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 29920A04A4; Mon, 4 Nov 2019 09:47:17 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 861C4493D; Mon, 4 Nov 2019 09:47:16 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 919A737B7 for ; Mon, 4 Nov 2019 09:47:14 +0100 (CET) Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.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 B381887640 for ; Mon, 4 Nov 2019 08:47:13 +0000 (UTC) Received: by mail-wm1-f72.google.com with SMTP id y14so3448888wmj.9 for ; Mon, 04 Nov 2019 00:47:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=avO6Mt27Fsl/QQQI6bggya0Qo8EdV3bynDeQrNwad6U=; b=LmOS1SQDmtqoL3sXEwGcsRD5XAop8IXzoH++vF2ndoJKknVX5k/M6Sy05/a8b1pzCo 1UiA3EKu34v5ovY8GCEPhrZYPjzuF6gNNuUZ7nnvWsmfN3vH/1rNNYMQ3Q4BiIcsc0UE LjTtbpmO4Hemnvmv3x6PHFAG/IErGkhFMbTvEp5/SYpYThLphpTVO6QyjfD5sGiBJ4Ih Pa6e4aeC/nSRnPgGdvhNTcoq3fjBpcMZQvgo9HILcPAfGcoV+VTtvC4FDNkUYhEKXHnu qeYxIF/BZbsJj+cvL1X7p+ds3NRn1vfDaJs4BHYCK5u6/xGLhiDgCVoDNaOd/a0Pml/C QTrw== X-Gm-Message-State: APjAAAV56E6ynKty9X1Qrg+QQ79Afexp7nISoHqU/+ltljDWo2j4INHz xj2nbTn1SGOZnzRRXCIYQzGPQQEPYWLaoAjHUWI6ELPO2mcJtEIr5cna0a9zb83leYNfFPU+syo SslQ= X-Received: by 2002:adf:b199:: with SMTP id q25mr23489376wra.320.1572857232072; Mon, 04 Nov 2019 00:47:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzSeOEDVn3NjejLaKsPVECmLJ6lvL+KiAJgypUGPprTGVyONkGf0lAAq+g20otFMu906R1QPQ== X-Received: by 2002:adf:b199:: with SMTP id q25mr23489361wra.320.1572857231922; Mon, 04 Nov 2019 00:47:11 -0800 (PST) Received: from amorenoz.users.ipa.redhat.com ([81.0.4.169]) by smtp.gmail.com with ESMTPSA id t134sm19346130wmt.24.2019.11.04.00.47.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Nov 2019 00:47:10 -0800 (PST) To: Marvin Liu , maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com Cc: dev@dpdk.org References: <20191030145602.1948-1-yong.liu@intel.com> <20191104101322.53017-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 AAG0I0FkcmlhbiBNb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4CdFwQIoAMMslhFA7G+teeOKBq36E+1+zrybI6Xy1UBSlpDK9j4CtTnMQejjuSQb Qhle+l8VroaUHq869wjAhRHHhqmtJKggI+OvzgQpDIwfHIDypb1BuKydi2W6cVYEALUYyCLS dTBDhzj8zR5tPCsga8J7+TclQzkWOiI2C6ZtiWrMsL/Uym3uXk5nsoc7lSj7yLd/MrBRhYfP JQ== Message-ID: Date: Mon, 4 Nov 2019 09:47:10 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191104101322.53017-1-yong.liu@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v4] vhost: fix vhost user virtqueue not accessible 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" On 11/4/19 11:13 AM, Marvin Liu wrote: > Log feature is disabled in vhost user, so that log address was invalid > when checking. Check whether log address is valid can work around it. > Log address should also be translated in packed ring virtqueue. > > Fixes: 04cfc7fdbfca ("vhost: translate incoming log address to gpa") > > Signed-off-by: Marvin Liu > --- > lib/librte_vhost/vhost_user.c | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > > diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c > index 61ef699ac..09e241305 100644 > --- a/lib/librte_vhost/vhost_user.c > +++ b/lib/librte_vhost/vhost_user.c > @@ -641,11 +641,21 @@ translate_ring_addresses(struct virtio_net *dev, int vq_index) > struct vhost_vring_addr *addr = &vq->ring_addrs; > uint64_t len, expected_len; > > + if (addr->flags & (1 << VHOST_VRING_F_LOG)) { > + 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 (vq_is_packed(dev)) { > len = sizeof(struct vring_packed_desc) * vq->size; > vq->desc_packed = (struct vring_packed_desc *)(uintptr_t) > ring_addr_to_vva(dev, vq, addr->desc_user_addr, &len); > - vq->log_guest_addr = 0; > if (vq->desc_packed == NULL || > len != sizeof(struct vring_packed_desc) * > vq->size) { > @@ -741,14 +751,6 @@ 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; > - } > vq->access_ok = 1; > > VHOST_LOG_DEBUG(VHOST_CONFIG, "(%d) mapped address desc: %p\n", > Reviewed-by: Adrian Moreno