From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 41266A32A3 for ; Fri, 25 Oct 2019 14:20:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 224131BFE2; Fri, 25 Oct 2019 14:20:46 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 921F91BFCB for ; Fri, 25 Oct 2019 14:20:44 +0200 (CEST) Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A6ABF3D94D for ; Fri, 25 Oct 2019 12:20:43 +0000 (UTC) Received: by mail-wr1-f72.google.com with SMTP id q14so1031285wrw.4 for ; Fri, 25 Oct 2019 05:20:43 -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:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=uPIuej558M5i84syEU7bUmtZSRofFRse81BLxOS4nmM=; b=FPX7ZnDRFZyCH3JhPUUtr/BH//U7q0VJRsj0DhWUbbXd4SN82GJfNMQG8HbzcXpGqq kghVTz1NuJhxzE/f71DdO0611O/wcb/IFWEo2BhbKzJEGrpnIsZHVKyvQjedzslqBLq6 KEXZELfBussdrtKY2JGRFfn3BQFGz8xGl9scv6O2BM81V6dR5bIbXaBrN4nmrcevcgWl Zc4IVlVzFG52Kl2bed6mgZDZfu5MhzGLQ3ID/mUl64cfCUUpLVzgwEcWkkH66c9tRPno ixR0Nf0HyxcPMiqO7BzqZhoiqUQGs4YDyrl8viaYUynfRosVd+7/2JsPlLn0EJcLFU39 ovMg== X-Gm-Message-State: APjAAAXro8UohRfwqlN8h6+rkogBmo1NuSb/G0rMD+P6vltlEDLmSx+A 9hBjQJFdv7sG4lyeXtX4c5CZ9lqU+W+JwuQf5rGzliIp8SvPAiZSjz8SsmlxQ2W69GxH5IVEqql qCPE= X-Received: by 2002:adf:c105:: with SMTP id r5mr2781068wre.125.1572006041862; Fri, 25 Oct 2019 05:20:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFharBzHByncxE3uAERIUyoGVtwm+OsLhancfryO+ziVX/EzJpEQCGcSpnu5qTf/6kqcUjww== X-Received: by 2002:adf:c105:: with SMTP id r5mr2781047wre.125.1572006041645; Fri, 25 Oct 2019 05:20:41 -0700 (PDT) Received: from amorenoz.users.ipa.redhat.com ([81.0.26.174]) by smtp.gmail.com with ESMTPSA id c15sm194667wmb.45.2019.10.25.05.20.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2019 05:20:41 -0700 (PDT) To: Marvin Liu , maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org References: <20191025162042.71687-1-yong.liu@intel.com> From: Adrian Moreno Autocrypt: addr=amorenoz@redhat.com; prefer-encrypt=mutual; keydata= mQENBF1syNUBCADQ9dk3fDMxOZ/+OQpmbanpodYxEv8IRtDz8PXw8YX7UyGfozOpLjQ8Fftj ZxuubYNbt2QVbSgviFilFdNWu2eTnN/JaGtfhmTOLPVoakkPHZF8lbgImMoch7L0fH8wN2IM KPxQyPNlX+K9FD5brHsV1lfe1TwAxmhcvLW8yNrVq+9eDIDykxc7tH4exIqXgZroahGxMHKy c8Ti2kJka/t6pDfRaY0J+6J7I1nrn6GXXSMNA45EH8+0N/QlcXhP3rfftnoPeVmpjswzvJqY FNjf/Q5VPLx7RX0Qx+y8mMB2JcChV5Bl7D7x5EUbItj6+Sy7QfOgCtPegk9HSrBCNYaLABEB AAG0I0FkcmlhbiBNb3Jlbm8gPGFtb3Jlbm96QHJlZ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E+1+zrybI6Xy1UBSlpDK9j4CtTnMQejjuSQb Qhle+l8VroaUHq869wjAhRHHhqmtJKggI+OvzgQpDIwfHIDypb1BuKydi2W6cVYEALUYyCLS dTBDhzj8zR5tPCsga8J7+TclQzkWOiI2C6ZtiWrMsL/Uym3uXk5nsoc7lSj7yLd/MrBRhYfP JQ== Message-ID: <66e350e2-4d34-7a17-afa2-d87eea47a37e@redhat.com> Date: Fri, 25 Oct 2019 14:20:40 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 In-Reply-To: <20191025162042.71687-1-yong.liu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH] vhost: fix vhost user virtqueue not accessable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Hi Marvin, On 10/25/19 6:20 PM, Marvin Liu wrote: > Log feature is disabled in vhost user, so that log address was invalid > when checking. Add feature bit check can skip useless address check. > Just so I understand, what conditions is the log address invalid? > Fixes: 04cfc7fdbfca ("vhost: translate incoming log address to gpa") > > Signed-off-by: Marvin Liu > --- > lib/librte_vhost/vhost_user.c | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > index 61ef699ac..0407fdc29 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -741,13 +741,15 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) > vq->last_avail_idx = vq->used->idx; > } > > - vq->log_guest_addr = > - translate_log_addr(dev, vq, addr->log_guest_addr); > - if (vq->log_guest_addr == 0) { > - RTE_LOG(DEBUG, VHOST_CONFIG, > - "(%d) failed to map log_guest_addr .\n", > - dev->vid); > - return dev; > + if (dev->features & (1ULL << VHOST_F_LOG_ALL)) { > + vq->log_guest_addr = > + translate_log_addr(dev, vq, addr->log_guest_addr); VHOST_F_LOG_ALL is only negotiated once the migration has started (at least from qemu's perspective). That means that we will postponing the translation of the log address to the vhost_user_set_vring_addr() call that follows the VHOST_F_LOG_ALL enabling. In that call there are (at least) two things that could go wrong and lead to a migration failure: - If VHOST_USER_F_PROTOCOL_FEATURES is not enabled, the address won't be translated: vhost_user:795 if ((vq->enabled && (dev->features & (1ULL << VHOST_USER_F_PROTOCOL_FEATURES))) || access_ok) { dev = translate_ring_addresses(dev, msg->payload.addr.index); if (!dev) return RTE_VHOST_MSG_RESULT_ERR; *pdev = dev; } - If the IOMMU is enabled and there's a miss, we would have to wait for the IOTLB_UPDATE and during that time, there would be failed accesses to the (still untranslated) log address. > + if (vq->log_guest_addr == 0) { > + RTE_LOG(DEBUG, VHOST_CONFIG, > + "(%d) failed to map log_guest_addr .\n", > + dev->vid); > + return dev; > + } > } > vq->access_ok = 1; > > Thanks, Adrian