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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9867BC77B61 for ; Thu, 27 Apr 2023 07:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243043AbjD0HYh (ORCPT ); Thu, 27 Apr 2023 03:24:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243001AbjD0HY3 (ORCPT ); Thu, 27 Apr 2023 03:24:29 -0400 Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B8CB525A; Thu, 27 Apr 2023 00:24:03 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0Vh6Ouev_1682579912; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0Vh6Ouev_1682579912) by smtp.aliyun-inc.com; Thu, 27 Apr 2023 15:18:33 +0800 Message-ID: <1682579624.5395834-1-xuanzhuo@linux.alibaba.com> Subject: Re: [PATCH] virtio_net: suppress cpu stall when free_unused_bufs Date: Thu, 27 Apr 2023 15:13:44 +0800 From: Xuan Zhuo To: Wenliang Wang Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com References: <20230427043433.2594960-1-wangwenliang.1995@bytedance.com> <1682576442.2203932-1-xuanzhuo@linux.alibaba.com> <252ee222-f918-426e-68ef-b3710a60662e@bytedance.com> In-Reply-To: <252ee222-f918-426e-68ef-b3710a60662e@bytedance.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 27 Apr 2023 15:02:26 +0800, Wenliang Wang wrote: > > > On 4/27/23 2:20 PM, Xuan Zhuo wrote: > > On Thu, 27 Apr 2023 12:34:33 +0800, Wenliang Wang wrote: > >> For multi-queue and large rx-ring-size use case, the following error > > > > Cound you give we one number for example? > > 128 queues and 16K queue_size is typical. > > > > >> occurred when free_unused_bufs: > >> rcu: INFO: rcu_sched self-detected stall on CPU. > >> > >> Signed-off-by: Wenliang Wang > >> --- > >> drivers/net/virtio_net.c | 1 + > >> 1 file changed, 1 insertion(+) > >> > >> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > >> index ea1bd4bb326d..21d8382fd2c7 100644 > >> --- a/drivers/net/virtio_net.c > >> +++ b/drivers/net/virtio_net.c > >> @@ -3565,6 +3565,7 @@ static void free_unused_bufs(struct virtnet_info *vi) > >> struct virtqueue *vq = vi->rq[i].vq; > >> while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) > >> virtnet_rq_free_unused_buf(vq, buf); > >> + schedule(); > > > > Just for rq? > > > > Do we need to do the same thing for sq? > Rq buffers are pre-allocated, take seconds to free rq unused buffers. > > Sq unused buffers are much less, so do the same for sq is optional. I got. I think we should look for a way, compatible with the less queues or the smaller rings. Calling schedule() directly may be not a good way. Thanks. > > > > > Thanks. > > > > > >> } > >> } > >> > >> -- > >> 2.20.1 > >>