Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp354668rwr; Thu, 4 May 2023 20:52:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Jz7OEHhr68eu+heNM4Z9ROBasX1IT4VbMvnWDuGotiOk+Gxw7oVRyRM2I3pQIVIxyRu8y X-Received: by 2002:a05:6a21:1643:b0:ef:ef3d:6166 with SMTP id no3-20020a056a21164300b000efef3d6166mr84259pzb.32.1683258767078; Thu, 04 May 2023 20:52:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683258767; cv=none; d=google.com; s=arc-20160816; b=cazYTn/KbQgKiP1zUQ0nsn3F/y52kQsLnDVxTsxelNQB73QIOG+3r4iOHYiQAxWSrd Na1/ctJI/ozEB2y0pN+J1z/WYYTdH/Lbhbmi+7fRYvrXW6s+x9uf4kpi5E/5ThOg/0rQ c+19Hy5FANfeJyXYxy6P6YLT8mGRE3KxZzeA/B2rMILbFTlpmtTeOi9sxt0pf9C+FNXR tjJfOyL6EVmEG9YIj49vAfw4rvpVlbHbWmZD9t5vDRsm7rNtQ99ikhUVOprzISwmd6vv TqR1jK74AboOV/rKgzPR7sb+QVptCuqNJ05sEo2tC7m40q4Omt8GiJe2H+mhUWHRklPv Bf8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vtGTOV4w8H+HmedJBYfP7zUt+D2uJS6ykp/9DQHbib8=; b=dnwOP0KbS+LO/Iwo5ZSkvP4lWpMV7c7iVOwJHQMhBi7Jk5s8iwZQO6tobLiNSDubUd effm74rkYBamtotxmyIcOyz5wNFy8k3p9r/epcTDh0zabz6tUbR8bGU63wbqUd2mosDr LE+CleinY5GPJyKft1NkmniPj2mFTmSNxOSG6AjZp6Zy3FWvM4wxHu6s9NR3/6P6OaMF rr6cGU/KMhuLXLEGYRrCye9z/ie8VSpU6E0eSpD71N4XReaCIXnDFoGNuR5UjpceUykQ AXtKfo/1cVVLq5YFAqlnjLGznnrx7PF7IDTkcLeaPEFK8n5qGTGxxPA7/yjUWpXfk2Uc xNnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dryACXac; 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 t21-20020a63b255000000b00528bd891345si1041428pgo.111.2023.05.04.20.52.34; Thu, 04 May 2023 20:52:47 -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=dryACXac; 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 S230001AbjEED3a (ORCPT + 99 others); Thu, 4 May 2023 23:29:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbjEED32 (ORCPT ); Thu, 4 May 2023 23:29:28 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0FAD12082 for ; Thu, 4 May 2023 20:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683257320; 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=vtGTOV4w8H+HmedJBYfP7zUt+D2uJS6ykp/9DQHbib8=; b=dryACXacK7uRTKssh7c0+0kPyq98/16rMWUDDJN0uK544AaCTYl0xBMoaWwgq5+tgwdJg1 X1y3t0Nr2id7zbVmFH2bBCsFdYo1Yx5M3yAsUqvC9UEh5CvgWUWVeEk2UFEbVAqXI+rbiv niNCZjxuq4DAduFREy+zIzzRpuLQWdk= Received: from mail-lf1-f69.google.com (mail-lf1-f69.google.com [209.85.167.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-635-IC-gzcE2OP-rKPUZxRUE9Q-1; Thu, 04 May 2023 23:28:38 -0400 X-MC-Unique: IC-gzcE2OP-rKPUZxRUE9Q-1 Received: by mail-lf1-f69.google.com with SMTP id 2adb3069b0e04-4f12f45d113so696845e87.0 for ; Thu, 04 May 2023 20:28:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683257317; x=1685849317; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vtGTOV4w8H+HmedJBYfP7zUt+D2uJS6ykp/9DQHbib8=; b=W4Sn2GxuQI6iggCKCPDtqM0vVHDUHs3Adhv2J6KiLy4jNUbpPAYIDWuFS+xVpXeixC bv3JH3VMaB2azqpVQMhg8bWibV93htaieIQ7SjSPyQa7dYRjDt4zNp08aehRIMjRz3x1 Fpr+ETEq5WG9y/Ni3fzKt5oosxHU2IJEn7dZuoVaX2+v3emFZv4QubF8O4fj9ZyPOCPB PYKQpfDHdLpdt4Pk+HOZVBeS0CIYL7On9gPGYfsdR895cqlcgJ6NoD4rsIekAj+bGgA/ SGPylKX2mtwn550NAI82YROY221JiB1DnTGg74VeVJ2VoPUeVw6UeF4kb5ud0oEcIgxA znxA== X-Gm-Message-State: AC+VfDzL4CKalj4znDra3+PlU/ZgJdC3km8DTPWd/Fmn0m+uYblvZBUU 8EaYPF7aVj7OOoS2SThns+zaom7IdMPNcGEnAS6mjwa6Dz3lOP8Yn6uVGU0HS8cemkTMXzKkABk qg+WrIivp2FBc3jqBj+Jhb0vxTgaUA6rzvLIXhscw X-Received: by 2002:ac2:4d1a:0:b0:4ec:363a:5f24 with SMTP id r26-20020ac24d1a000000b004ec363a5f24mr132430lfi.23.1683257317336; Thu, 04 May 2023 20:28:37 -0700 (PDT) X-Received: by 2002:ac2:4d1a:0:b0:4ec:363a:5f24 with SMTP id r26-20020ac24d1a000000b004ec363a5f24mr132425lfi.23.1683257317049; Thu, 04 May 2023 20:28:37 -0700 (PDT) MIME-Version: 1.0 References: <1683167226-7012-1-git-send-email-wangwenliang.1995@bytedance.com> In-Reply-To: <1683167226-7012-1-git-send-email-wangwenliang.1995@bytedance.com> From: Jason Wang Date: Fri, 5 May 2023 11:28:25 +0800 Message-ID: Subject: Re: [PATCH v4] virtio_net: suppress cpu stall when free_unused_bufs To: Wenliang Wang Cc: mst@redhat.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, zhengqi.arch@bytedance.com, willemdebruijn.kernel@gmail.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, xuanzhuo@linux.alibaba.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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, May 4, 2023 at 10:27=E2=80=AFAM 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. > > Fixes: 986a4f4d452d ("virtio_net: multiqueue support") > Signed-off-by: Wenliang Wang > --- > v2: > -add need_resched check. > -apply same logic to sq. > v3: > -use cond_resched instead. > v4: > -add fixes tag > --- > drivers/net/virtio_net.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c > index 8d8038538fc4..a12ae26db0e2 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -3560,12 +3560,14 @@ static void free_unused_bufs(struct virtnet_info = *vi) > struct virtqueue *vq =3D vi->sq[i].vq; > while ((buf =3D virtqueue_detach_unused_buf(vq)) !=3D NUL= L) > virtnet_sq_free_unused_buf(vq, buf); > + cond_resched(); Does this really address the case when the virtqueue is very large? Thanks > } > > for (i =3D 0; i < vi->max_queue_pairs; i++) { > struct virtqueue *vq =3D vi->rq[i].vq; > while ((buf =3D virtqueue_detach_unused_buf(vq)) !=3D NUL= L) > virtnet_rq_free_unused_buf(vq, buf); > + cond_resched(); > } > } > > -- > 2.20.1 >