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 105FEA0C47; Thu, 14 Oct 2021 13:25:27 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9B837411FE; Thu, 14 Oct 2021 13:25:26 +0200 (CEST) Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com [209.85.222.47]) by mails.dpdk.org (Postfix) with ESMTP id 3FD9D40041 for ; Thu, 14 Oct 2021 13:25:25 +0200 (CEST) Received: by mail-ua1-f47.google.com with SMTP id e7so10489894ual.11 for ; Thu, 14 Oct 2021 04:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=smartx-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GIN64vI5AGxMynviTukV3B60MAChrveXB+ys93bYCIE=; b=QHfkPu3kBiuPzEARJe+ZNTvxW6pIbB2Hi8evm9Gyn9yn08nE80InP7mu1FJH/VweKw Iq/cXyqhFx6DBHYPS3aAVuyy4aTeMyDETtVN3LwbFMJT0AiHJWWGh+wr0POd+eHXix1y I57kOvh62fIG5c8aCqJol6twGw4WSHk847xVfi7LaVyLj/X5mWt6iVU7bwAHXvXg0Gv8 nETBUn6CAeKVF+BapvqmDMQSkyfy66InSFYhZiFUYT67Kz8guKqY1bY4GGmFhaRBhr6K osBAhw7Q3nuBa3jecES0oCU2jIwq/h9xyYo0lZz7+zUogUrmUr/6pGiloMS/HZ0pgBFE ypQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GIN64vI5AGxMynviTukV3B60MAChrveXB+ys93bYCIE=; b=fFdMe7lPFeohf+U7koXaOHtrks6+Tq2OAbFdquV3Zh2Of8Itch7/wQQqTz7EKtgg0g GsO0qhHlF7cHXjhDxl1J8wjtTo9mx4wJjVeSEKKfPIVntlaeogso+Vu9U3uJmHFcEsku 4v5V9jcu9p11bdVLPA4jPpIr58Jt/29FtUM76c0uMFuDKlBIJrIXVucf3BEjVuB01maS OitQyvyGrnIOX4+kFhkz3PoF6Zqq1qajlYgyyMo7dWUiivI4najju8EiMOcUnj2YNL2X +gDADXw9MzD7K4thMjghO1XxExUdNQm7BD9wBR71d6vwSvWnxumWUwVURTqngiShUqNI e1EA== X-Gm-Message-State: AOAM5308hcN2MlMTXrW5dofhRRuaQIAb05gkPioFwsZBW2rS1/SyLIY5 /NDdkUOsyAsvPN7otTODaQWFdKSW3QVNRKq8oIeRaWNMqgyiiKpi X-Google-Smtp-Source: ABdhPJwl93rZOu7HlMmTC9pQM0fG59gOfc4OqylmubdrSuDfUYUFBGcMM3paFNiMxzaRQtmhb1/LfAD2bmJFdsu2mdg= X-Received: by 2002:a67:e28a:: with SMTP id g10mr5780013vsf.5.1634210724502; Thu, 14 Oct 2021 04:25:24 -0700 (PDT) MIME-Version: 1.0 References: <20210827051241.2448098-1-fengli@smartx.com> In-Reply-To: From: Li Feng Date: Thu, 14 Oct 2021 19:25:12 +0800 Message-ID: To: Maxime Coquelin Cc: Chenbo Xia , JinYu , dev Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v1] vhost: add sanity check for resubmiting reqs in split ring 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 Sender: "dev" Thank you for your response. On Thu, Oct 14, 2021 at 4:17 PM Maxime Coquelin wrote: > > Hi Li, > > Adding Jin Yu who introduced this function. > > On 8/27/21 07:12, Li Feng wrote: > > When getting reqs from the avail ring, the id may exceed inflight > > queue size. Then the dpdk will crash forever. > > You need to add Fixes tag and Cc stable@dpdk.org so that it can be > backported. OK, I will send the v2 version. > > > Signed-off-by: Li Feng > > --- > > lib/vhost/vhost_user.c | 10 ++++++++-- > > 1 file changed, 8 insertions(+), 2 deletions(-) > > > > diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c > > index 29a4c9af60..f09d0f6a48 100644 > > --- a/lib/vhost/vhost_user.c > > +++ b/lib/vhost/vhost_user.c > > @@ -1823,8 +1823,14 @@ vhost_check_queue_inflights_split(struct virtio_net *dev, > > last_io = inflight_split->last_inflight_io; > > > > if (inflight_split->used_idx != used->idx) { > > - inflight_split->desc[last_io].inflight = 0; > > - rte_atomic_thread_fence(__ATOMIC_SEQ_CST); > > + if (unlikely(last_io >= inflight_split->desc_num)) { > > + VHOST_LOG_CONFIG(ERR, "last_inflight_io '%"PRIu16"' exceeds inflight " > > + "queue size (%"PRIu16").\n", last_io, > > + inflight_split->desc_num); > > If such error happens, shouldn't we return RTE_VHOST_MSG_RESULT_ERR > instead of just logging an error? I think ignoring the error is ok. No one could handle this error correctly. At this time the guest virtio driver of this virtqueue may be in an incorrect state. > > > + } else { > > + inflight_split->desc[last_io].inflight = 0; > > + rte_atomic_thread_fence(__ATOMIC_SEQ_CST); > > + } > > inflight_split->used_idx = used->idx; > > } > > > > > > Regards, > Maxime >