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 63D60A0353; Mon, 31 Jan 2022 09:36:32 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F077F4114E; Mon, 31 Jan 2022 09:36:30 +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 B29BB40E25 for ; Mon, 31 Jan 2022 09:36:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643618189; 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=xPCfoIy2jZrTU5etAR+2DxAuigh6KT32CFKXJHFHlIc=; b=Ry/8aKuGxmEW0Yrp6JePbl/bbBb4OMqWSCz29VKjO8mfPc230McIG31/yOTDPHyGaCh+tc YhT3dwZLLDkCpqs8Xe0zuTAVYxQv1W+5or7gyRsDJfmfItP8Nob4ewxCMHdmx48AQ+rXCz aRmzmY7DDd77kEn9Gbe6RT92lcSPv+k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-386-XO2HypmjPE6k8U4uT8YgQA-1; Mon, 31 Jan 2022 03:36:23 -0500 X-MC-Unique: XO2HypmjPE6k8U4uT8YgQA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4B19A8144E1; Mon, 31 Jan 2022 08:36:22 +0000 (UTC) Received: from [10.39.208.24] (unknown [10.39.208.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C6AF1F42A; Mon, 31 Jan 2022 08:36:21 +0000 (UTC) Message-ID: <27f25ca9-0c52-5398-d34d-139bbee3f221@redhat.com> Date: Mon, 31 Jan 2022 09:36:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v1] net/vhost: add queue status check To: "Li, Miao" , "dev@dpdk.org" Cc: "Xia, Chenbo" References: <20211116164446.149453-1-miao.li@intel.com> <3076b24c-0347-c0cf-3384-aecf4f76773b@redhat.com> <3b828df5-d2ee-44dd-0347-3ef975e2dd21@redhat.com> From: Maxime Coquelin In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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/19/21 07:30, Li, Miao wrote: > Hi > >> -----Original Message----- >> From: Maxime Coquelin >> Sent: Tuesday, November 16, 2021 5:36 PM >> To: Li, Miao ; dev@dpdk.org >> Cc: Xia, Chenbo >> Subject: Re: [PATCH v1] net/vhost: add queue status check >> >> >> >> 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. > > If we don't add this check, rte_vhost_get_monitor_addr will return -EINVAL when check if dev is null. But before return, get_device() will be called and print error log "device not found". So we want to add this check and return -EINVAL before call rte_vhost_get_monitor_addr. If we don't add this check, the vhost monitor address will also not be got but vhost will print error log continuously. It have no function impact, so I think it is not a fix. > >>> >>>> 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. > > I don't know which return value will be better. Do you have any suggestions? Thanks! > >> >>> How does it help? >>> What does prevent allow_queuing to become zero between the check and the >>> call to rte_vhost_get_monitor_addr? > > This check will prevent vhost to print error log continuously. You mean, it will prevent it most of the time, as there is still a window where it can happen, if allow_queueing is set between is 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. > > I think the while_queuing is unnecessary because we only read the value in vq and this API will only be called as a callback of RX. > > Thanks, > Miao > >>> >>>>       ret = rte_vhost_get_monitor_addr(vq->vid, vq->virtqueue_id, >>>>               &vhost_pmc); >>>>       if (ret < 0) >>>> >>> >>> Maxime >