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 D9A79A0C43; Tue, 16 Nov 2021 10:36:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4379C41161; Tue, 16 Nov 2021 10:36:27 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 4D2B24115F for ; Tue, 16 Nov 2021 10:36:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637055385; 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=38aTjsuJjDcNDezMFIm+JuQt6RSmOsH5/6V06UMEGzo=; b=hkpLUGd28tqRtIm9Ch2szAEvENDAX+3r6Tp6/gf5/ui2LoseGknewHououBHq1Rvvg9Gsq C2djg2lM2v5qQotN+/WvrCwh37gThGAu2PpTS2wwMUupSbYrim8dYOej4ljR6II/t5N7Bz xn0rwQo2MJupP2+u5fuHbl3WvJJpLqc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-126-ehplxdKbP9-GlHfIlKhv-A-1; Tue, 16 Nov 2021 04:36:24 -0500 X-MC-Unique: ehplxdKbP9-GlHfIlKhv-A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EF6A87D542; Tue, 16 Nov 2021 09:36:23 +0000 (UTC) Received: from [10.39.208.9] (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4820F57CAD; Tue, 16 Nov 2021 09:36:22 +0000 (UTC) Message-ID: <3b828df5-d2ee-44dd-0347-3ef975e2dd21@redhat.com> Date: Tue, 16 Nov 2021 10:36:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH v1] net/vhost: add queue status check From: Maxime Coquelin To: Miao Li , dev@dpdk.org Cc: chenbo.xia@intel.com References: <20211116164446.149453-1-miao.li@intel.com> <3076b24c-0347-c0cf-3384-aecf4f76773b@redhat.com> In-Reply-To: <3076b24c-0347-c0cf-3384-aecf4f76773b@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 On 11/16/21 10:34, Maxime Coquelin wrote: > > > On 11/16/21 17:44, Miao Li wrote: >> This patch adds queue status check to make sure that vhost monitor >> address will not be got until the link between backend and frontend > s/got/gone/? >> up and the packets are allowed to be queued. > > It needs a fixes tag. > >> Signed-off-by: Miao Li >> --- >>   drivers/net/vhost/rte_eth_vhost.c | 2 ++ >>   1 file changed, 2 insertions(+) >> >> diff --git a/drivers/net/vhost/rte_eth_vhost.c >> b/drivers/net/vhost/rte_eth_vhost.c >> index 070f0e6dfd..9d600054d8 100644 >> --- a/drivers/net/vhost/rte_eth_vhost.c >> +++ b/drivers/net/vhost/rte_eth_vhost.c >> @@ -1415,6 +1415,8 @@ vhost_get_monitor_addr(void *rx_queue, struct >> rte_power_monitor_cond *pmc) >>       int ret; >>       if (vq == NULL) >>           return -EINVAL; >> +    if (unlikely(rte_atomic32_read(&vq->allow_queuing) == 0)) >> +        return -EINVAL; Also, EINVAL might not be the right return value here. > How does it help? > What does prevent allow_queuing to become zero between the check and the > call to rte_vhost_get_monitor_addr? > > I think you need to implement the same logic as in eth_vhost_rx(), i.e. > check allow_queueing, set while_queueing, check allow_queueing, do your > stuff and clear while_queuing. > >>       ret = rte_vhost_get_monitor_addr(vq->vid, vq->virtqueue_id, >>               &vhost_pmc); >>       if (ret < 0) >> > > Maxime