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 3483EA0C43; Tue, 16 Nov 2021 10:34:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1A17641143; Tue, 16 Nov 2021 10:34:15 +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 7882E410EA for ; Tue, 16 Nov 2021 10:34:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637055253; 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=ML+zGteGhSQ44kkAJC7LkKEcvvtyJtGjMfIxMbjmiDg=; b=g/zqzQmm43Ht0UNF7edOM4FdHoA3jb/up6rQVPJndoKCYjjIAGn+icBXs8b5iYz7dep07u J5bT8n3HWVzCD6jElgwn6ZOPM6RkrC+WepxKmuQlBse38EPEHRCpNA9BS0xK4XxNwLmymf /L6NaHZ/IhST7SnVBMvySDcM2Wnwnec= 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-486-fAV_m55XPHq_TgDpdgAWSA-1; Tue, 16 Nov 2021 04:34:09 -0500 X-MC-Unique: fAV_m55XPHq_TgDpdgAWSA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8D51610247A8; Tue, 16 Nov 2021 09:34:08 +0000 (UTC) Received: from [10.39.208.9] (unknown [10.39.208.9]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C8C5C77E26; Tue, 16 Nov 2021 09:34:07 +0000 (UTC) Message-ID: <3076b24c-0347-c0cf-3384-aecf4f76773b@redhat.com> Date: Tue, 16 Nov 2021 10:34:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 To: Miao Li , dev@dpdk.org Cc: chenbo.xia@intel.com References: <20211116164446.149453-1-miao.li@intel.com> From: Maxime Coquelin Subject: Re: [PATCH v1] net/vhost: add queue status check In-Reply-To: <20211116164446.149453-1-miao.li@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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: 7bit 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 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; 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