Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1434685rwr; Thu, 27 Apr 2023 18:23:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ70rOrp/fMYiwNtJQkvVPKOUvQv3PampG8CM9T+GFJV5Fp0YqfnCtojxgZQCn24xP3wkRqT X-Received: by 2002:a17:902:c791:b0:1a6:d2a9:3fd9 with SMTP id w17-20020a170902c79100b001a6d2a93fd9mr2958190pla.60.1682644991302; Thu, 27 Apr 2023 18:23:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682644991; cv=none; d=google.com; s=arc-20160816; b=y9WD922ZJ/pl2H4p3BRXq3fenHSvsWHV2Zs/nWCOTFEDlruQtVyicjt82mabyv7aF1 GWhuv/2ShzSpLi8gdCnhCcaZTeBN2qcaMANjmtCWoOsZAqZuYheThmkr+yFKrlT9pA9D D4k/E0U+aceE5/Dt7a5xGY5bqw6EpTKdRa8Mh6AylXOE/ti+B39atFF7CEiL4ojFNnk7 vzpk5iQ55FvK1sqqmlC5vm7BmsTD9myryKEZbur8N8Op77nT1UzuNj7gpi1wK1bLRSQ6 nXlja6odJlcK4boV6VaoL/LeOPq8BTNUKF/KH2ITnbriZ9fgUg/i00olINpW/PnqOxcW arwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vDlMjQQs9oNd1rM1Ie1hZYk7Gu1+pdqFqGgkpF/yxbI=; b=bCl6MbtrOq4jHt2U6dlX3fvYdFyHBq02b+FYzi0rhXkz2eD8uRrGq64LJTAG12JJex 6vAPhQjSSGz3Gr2TVlxr4Ez3p8e/k4qf48yVrjyIjbBR2F83d5tx58ghKOEtc1sMvi2Y YBcEr1oxVbTI6fAIqN3urdEUyCPQ9taMCOku1wSTI+KwTWEVouIK9iYeb7yws7n2JFcx yegWrjT1ivlBAkvO+Qor+rPjNf02ubh6iJuTLFYGFM6oRpnTfOpI5x8nnUVhhzGuukdS ruCIcUIMqOcZutK44tjjoC1yo1X5vBPnYQvjECgkjHKWg3Du2NmJpaD2bQsJQ/oo1tjK 7QYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DZXSTqNJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z18-20020a17090ad79200b0024b55721075si18954001pju.176.2023.04.27.18.22.57; Thu, 27 Apr 2023 18:23:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DZXSTqNJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344711AbjD1BKR (ORCPT + 99 others); Thu, 27 Apr 2023 21:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344467AbjD1BKP (ORCPT ); Thu, 27 Apr 2023 21:10:15 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2407E30F7 for ; Thu, 27 Apr 2023 18:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682644167; 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: in-reply-to:in-reply-to:references:references; bh=vDlMjQQs9oNd1rM1Ie1hZYk7Gu1+pdqFqGgkpF/yxbI=; b=DZXSTqNJUsv5wdNWTswQJp8aSfoleaQ1eesrm+5RhO88YzlGH42G8Kp14HtdLvdlwYzbGH 8z61Fy+1GcXpw/KVjBCg64rgRhMKypuT0No7DL/6GB0oUA7BLpMeQCpD5gVjv+0w0nnjQ8 JZ45FkegG6wMxTCKWCAv8njwKrFK/i0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-FmNALPFqNSOUrtYOdIie7g-1; Thu, 27 Apr 2023 21:09:25 -0400 X-MC-Unique: FmNALPFqNSOUrtYOdIie7g-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-2f831f6e175so5174382f8f.2 for ; Thu, 27 Apr 2023 18:09:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682644164; x=1685236164; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=vDlMjQQs9oNd1rM1Ie1hZYk7Gu1+pdqFqGgkpF/yxbI=; b=BO+d1ACkBGELhJ9TJpnjzMqNrP6Oo1BfLOMPwYe15Jwd9PyVRLbEwfp/djTbTEfbJx cU8nL9MFvFjyYFyuBJkesCW3e8/2jopkl20cpn1QGBqwrryPvEBxPNKupYRMYTguIpQC XPTDoN0ypHmRw3ky3q2WSpMP8eex8pKGiS9chSvkv/2tbrpHYIJcBqFimQXBtrrZAH1U cYV12bJMh8WmcOvTpHHclXf5AnzfHmaaN2B/UkTlfMISOU38wgtRHIlRk09RmoQAD8WX SwhFE6n7WjHkK2jEyjO8sLm7RCJY3ZVo0ysJslz2RHyD5ZfxudSwaKZNc9GXfUpHtzdv 4I7w== X-Gm-Message-State: AC+VfDw0PKl7EMX4/ocOqyUrDyjzTHKtWAZhtS35mgMwPoLIqYC89wA5 GwLd1FU0ILJjbXGOo5S+3Eln7t0VVGcbWp+5RabpHT+cfYmXkhOIRrpdMRL2uJiCj6IUGAH1gCy 6+QX7ZZXcDdPILEy9ArbcbPGV X-Received: by 2002:adf:dd90:0:b0:304:b967:956f with SMTP id x16-20020adfdd90000000b00304b967956fmr706844wrl.8.1682644164583; Thu, 27 Apr 2023 18:09:24 -0700 (PDT) X-Received: by 2002:adf:dd90:0:b0:304:b967:956f with SMTP id x16-20020adfdd90000000b00304b967956fmr706834wrl.8.1682644164304; Thu, 27 Apr 2023 18:09:24 -0700 (PDT) Received: from redhat.com ([2.52.19.183]) by smtp.gmail.com with ESMTPSA id e22-20020a5d5956000000b003012030a0c6sm19719410wri.18.2023.04.27.18.09.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Apr 2023 18:09:23 -0700 (PDT) Date: Thu, 27 Apr 2023 21:09:20 -0400 From: "Michael S. Tsirkin" To: Wenliang Wang Cc: jasowang@redhat.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] virtio_net: suppress cpu stall when free_unused_bufs Message-ID: <20230427210851-mutt-send-email-mst@kernel.org> References: <1682585517.595783-3-xuanzhuo@linux.alibaba.com> <20230427104618.3297348-1-wangwenliang.1995@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230427104618.3297348-1-wangwenliang.1995@bytedance.com> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 27, 2023 at 06:46:18PM +0800, Wenliang Wang wrote: > For multi-queue and large ring-size use case, the following error > occurred when free_unused_bufs: > rcu: INFO: rcu_sched self-detected stall on CPU. > > Signed-off-by: Wenliang Wang pls send vN+1 as a new thread not as a reply in existing thread of vN. > --- > v2: > -add need_resched check. > -apply same logic to sq. > --- > drivers/net/virtio_net.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index ea1bd4bb326d..573558b69a60 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -3559,12 +3559,16 @@ static void free_unused_bufs(struct virtnet_info *vi) > struct virtqueue *vq = vi->sq[i].vq; > while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) > virtnet_sq_free_unused_buf(vq, buf); > + if (need_resched()) > + schedule(); > } > > for (i = 0; i < vi->max_queue_pairs; i++) { > struct virtqueue *vq = vi->rq[i].vq; > while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) > virtnet_rq_free_unused_buf(vq, buf); > + if (need_resched()) > + schedule(); > } > } > > -- > 2.20.1