From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 68B39A0A02; Thu, 13 May 2021 16:39:02 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9E1F4067E; Thu, 13 May 2021 16:39:01 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id BAD2D4003F for ; Thu, 13 May 2021 16:38:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620916738; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EPCanT9yyw82XYK0VDB+pMEjea/oN1e0iqFjPMfcgOE=; b=ZqLKK2YLDeu59BNvP85xGVTpkj1kmndSeKMjve+w6/BG/9p8VBAZwyOkQniSed118jX6vX fmg2RN1SWtT+iL2aoutIXgFcnTHZv9Mwp33tOUpXLiEtSr/3eeg/geZrgiE90EpogfE6L3 P7W6AmcHNRsbW2H0swmRqRXYyUW5vWw= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-601-cuxwdglsPIG-AeKB2G1qFg-1; Thu, 13 May 2021 10:38:57 -0400 X-MC-Unique: cuxwdglsPIG-AeKB2G1qFg-1 Received: by mail-wr1-f70.google.com with SMTP id i102-20020adf90ef0000b029010dfcfc46c0so11637277wri.1 for ; Thu, 13 May 2021 07:38:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=EPCanT9yyw82XYK0VDB+pMEjea/oN1e0iqFjPMfcgOE=; b=eGKh2U4U0QDuGhBrNikLklPf0bsgUQr9WgC2bY/WWxjycOZtsSYrDjRqH5u3rkf5+y yk8FSQQQ/DP2BYwoJzxcR89tuz3nvG9cjshPm2Tdm3TmCtWzRfyTl3i8rSPgjhvCwLa4 4ySrT7EFmFD16O04NXYwkwRjT40hGLa1E3vQYHup94yxS8kz1+G61X5uUTHz0i/UQVBe RWJfiBIOZggFg03sWoOq9RvL7QTaeElPmajVTujnguYhv3pExTsibK1EPpQ0Xsmz4Ops 5JFSYbGZD+dYGRwsl3d89mO9ye/wbtXKnO67AmCgPMx9bbM7fAt2BlACOxR9r7ch1v00 /Vmw== X-Gm-Message-State: AOAM531eDVS6hT9rR3aSd+L+r3hHhgUDyJ+fdnxWAYH3PToGvWuH0vFe 4GEGiwpHuVP75RT6/q4dTH8lqPNxlW1u+r9H5dDaxNLZx5ijFsLfQsrKZdDMfwWScg5lzoC8TVU xEGs= X-Received: by 2002:a7b:c0cb:: with SMTP id s11mr44512825wmh.146.1620916735915; Thu, 13 May 2021 07:38:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQVz8VpSkOZOaY/+w+PfvQWPgIEyySDhENQ7fVa5Zs7ZwXmJ5q5aeRGe1PsQEHXS0L4k4BfA== X-Received: by 2002:a7b:c0cb:: with SMTP id s11mr44512807wmh.146.1620916735707; Thu, 13 May 2021 07:38:55 -0700 (PDT) Received: from [192.168.0.36] ([78.18.27.43]) by smtp.gmail.com with ESMTPSA id c8sm2963657wrx.4.2021.05.13.07.38.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 May 2021 07:38:55 -0700 (PDT) To: David Marchand , Chenbo Xia , Maxime Coquelin Cc: dev , Pei Zhang , "Yigit, Ferruh" , Thomas Monjalon References: <20210513122826.49910-1-chenbo.xia@intel.com> From: Kevin Traynor Message-ID: Date: Thu, 13 May 2021 15:38:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] vhost: fix wrong IOTLB initialization X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 13/05/2021 15:11, David Marchand wrote: > On Thu, May 13, 2021 at 2:38 PM Chenbo Xia wrote: >> >> This patch fixes an issue of application crash because of vhost iotlb >> not initialized when virtio has multiqueue enabled. >> >> iotlb messages will be sent when some queues are not enabled. If we >> initialize iotlb in vhost_user_set_vring_num, it could happen that >> iotlb update comes when iotlb pool of disabled queues are not >> initialized. > > This makes the problem I reproduced disappear at init, but I noticed > the segfault after restarting testpmd once. > And a little bit after this, my vm crashed. > > This is not systematic, so I guess there is some condition with how > the virtio device is initialised in the vm. > Ok, no point in Red Hat QA testing RC3 yet, if it is still faulty. fyi - if you want to fix with a new patch it will likely delay Red Hat QA testing RC3 (maybe others?) and probably they will only have cycles for one RC3 test run. If you choose to revert, we can ask Red Hat QA to test RC3 without further delay. Please let us know when you consider the options. > > One question below. > > > Bugzilla ID: 703 > >> Fixes: 968bbc7e2e50 ("vhost: avoid IOTLB mempool allocation while IOMMU disabled") >> > > Reported-by: Pei Zhang > >> Signed-off-by: Chenbo Xia >> --- >> lib/vhost/vhost_user.c | 13 +++++++++---- >> 1 file changed, 9 insertions(+), 4 deletions(-) >> >> diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c >> index 611ff209e3..ae4df8eb69 100644 >> --- a/lib/vhost/vhost_user.c >> +++ b/lib/vhost/vhost_user.c >> @@ -311,6 +311,7 @@ vhost_user_set_features(struct virtio_net **pdev, struct VhostUserMsg *msg, >> uint64_t features = msg->payload.u64; >> uint64_t vhost_features = 0; >> struct rte_vdpa_device *vdpa_dev; >> + uint32_t i; >> >> if (validate_msg_fds(msg, 0) != 0) >> return RTE_VHOST_MSG_RESULT_ERR; >> @@ -389,6 +390,14 @@ vhost_user_set_features(struct virtio_net **pdev, struct VhostUserMsg *msg, >> vdpa_dev->ops->set_features(dev->vid); >> >> dev->flags &= ~VIRTIO_DEV_FEATURES_FAILED; >> + >> + if (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM)) { >> + for (i = 0; i < dev->nr_vring; i++) { > > I don't know the vhost-user protocol. > At this point of the device init/life, are we sure nr_vring is set to > the max number of vring? > The logs I have tend to say it is the case, but is there a guarantee > in the protocol? > > > Another way to fix would be to allocate on the first > VHOST_USER_IOTLB_MSG message received for a vring. > > >> + if (vhost_user_iotlb_init(dev, i)) >> + return RTE_VHOST_MSG_RESULT_ERR; >> + } >> + } >> + >> return RTE_VHOST_MSG_RESULT_OK; >> } >> > >