From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=DATE_IN_FUTURE_06_12, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15C89CA9EA0 for ; Fri, 25 Oct 2019 08:40:57 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id C86182070B for ; Fri, 25 Oct 2019 08:40:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C86182070B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1EBCC1C10B; Fri, 25 Oct 2019 10:40:56 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 167C21C0CD for ; Fri, 25 Oct 2019 10:40:53 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Oct 2019 01:40:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,228,1569308400"; d="scan'208";a="282199870" Received: from npg-dpdk-virtual-marvin-dev.sh.intel.com ([10.67.119.142]) by orsmga001.jf.intel.com with ESMTP; 25 Oct 2019 01:40:51 -0700 From: Marvin Liu To: maxime.coquelin@redhat.com, tiwei.bie@intel.com, zhihong.wang@intel.com, amorenoz@redhat.com Cc: dev@dpdk.org, Marvin Liu Date: Sat, 26 Oct 2019 00:20:42 +0800 Message-Id: <20191025162042.71687-1-yong.liu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [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" Log feature is disabled in vhost user, so that log address was invalid when checking. Add feature bit check can skip useless address check. 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); + 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; -- 2.17.1