Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3814445rwi; Sun, 16 Oct 2022 19:12:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6uhDv/nUiDxMOD7hrbfl0UtGwl1OdZZWmdZ4p3I3gEaZ5ODd41pd4SgCeMye129y0icYFu X-Received: by 2002:a17:907:1b1f:b0:72f:56db:cce9 with SMTP id mp31-20020a1709071b1f00b0072f56dbcce9mr6625336ejc.605.1665972720986; Sun, 16 Oct 2022 19:12:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665972720; cv=none; d=google.com; s=arc-20160816; b=OAo3QgWmwqONBnm42lgYKgmik8AUE39Dz+5BlnrIPA2DdyUIEKc6aYPXC9GSASNII/ qTH320gnl0IUDdUtWWIf9TiI67o6BaZ0V99wWikq+eqaKpAvzkAeu+re18Mbi9K3SObP dHgcLMWkHqH7jmTeAWEURgD4qqQvEBNGePClQla/K8qw3e+2e5MjcUroqwKPcv+6wb0F 9xdbRT/cnlOSaSz8EN60Y005n/cnXUKLYRYLCWNjwyB61BBV2HPbcrjOtA8mt2DClzxo LicrsCfqFAZGuK/w6TEHCu2xUps9dz2nkz73U48XkD852+vrHJygNu1gY+KjRycympNF hi1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:cc:to:from:date:subject :message-id; bh=rWoTwrl5ZVeC5I7FW1n5wYUlhLf94PcANqd3NiTqQgQ=; b=uczlhKML7srXr/10ntOxeJ16vN8K8DCykARwFGNgIbTBXFI0ZEVIFEboYj3n/YH0/2 Me2zl/c8PtO67igJm5gd5LI5fvDvHc0oZoz8zYLucjZSOaNnApRVAm+lmhoEU/S2Zzfk 8Gxh5qmwCO2MZ+IOIDfdA/ZosU3Har0nTYVUdK16bZWFju8FHpHFQap958Xhz326pYHt TuwG1Vh7eeO5fZtoXsTasjRRiE8HJasC6dKsAjKfhGihgRss2NBIZx/gVsr8gCSPqKfP jf0D5N/ye6qUu0fkCR9zub3QcrkTjKxqpmhFkub8L/3uXQ4ihc+XC8ZOpLkVK6WX5lB2 /8kw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id co13-20020a0564020c0d00b00458bf560cbasi6890418edb.90.2022.10.16.19.11.24; Sun, 16 Oct 2022 19:12:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbiJQCBS (ORCPT + 99 others); Sun, 16 Oct 2022 22:01:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230179AbiJQCBC (ORCPT ); Sun, 16 Oct 2022 22:01:02 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E9A14456A; Sun, 16 Oct 2022 19:00:50 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R931e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046051;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VSG7X5M_1665972035; Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0VSG7X5M_1665972035) by smtp.aliyun-inc.com; Mon, 17 Oct 2022 10:00:37 +0800 Message-ID: <1665971921.4555926-1-xuanzhuo@linux.alibaba.com> Subject: Re: [PATCH V2 2/2] net: Fixup virtnet_set_affinity() cause cpumask warning Date: Mon, 17 Oct 2022 09:58:41 +0800 From: Xuan Zhuo To: guoren@kernel.org Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Guo Ren , Guo Ren , andriy.shevchenko@linux.intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux@rasmusvillemoes.dk, yury.norov@gmail.com, caraitto@google.com, willemb@google.com, jonolson@google.com, amritha.nambiar@intel.com References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-3-guoren@kernel.org> In-Reply-To: <20221014030459.3272206-3-guoren@kernel.org> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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, 13 Oct 2022 23:04:59 -0400, guoren@kernel.org wrote: > From: Guo Ren > > Don't pass nr_bits-1 as arg1 for cpumask_next_wrap, which would > cause warning now 78e5a3399421 ("cpumask: fix checking valid > cpu range"). > > ------------[ cut here ]------------ > WARNING: CPU: 0 PID: 1 at include/linux/cpumask.h:110 cpumask_next_wrap+0x5c/0x80 > Modules linked in: > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.0.0-11659-ge7e38f6cce55-dirty #328 > Hardware name: riscv-virtio,qemu (DT) > epc : cpumask_next_wrap+0x5c/0x80 > ra : virtnet_set_affinity+0x1ba/0x1fc > epc : ffffffff808992ca ra : ffffffff805d84ca sp : ff60000002327a50 > gp : ffffffff81602390 tp : ff600000023a0000 t0 : 5f74656e74726976 > t1 : 0000000000000000 t2 : 735f74656e747269 s0 : ff60000002327a90 > s1 : 0000000000000003 a0 : 0000000000000003 a1 : ffffffff816051c0 > a2 : 0000000000000004 a3 : 0000000000000000 a4 : 0000000000000000 > a5 : 0000000000000004 a6 : 0000000000000000 a7 : 0000000000000000 > s2 : 0000000000000000 s3 : ffffffff816051c0 s4 : ffffffff8160224c > s5 : 0000000000000004 s6 : 0000000000000004 s7 : 0000000000000000 > s8 : 0000000000000003 s9 : ffffffff810aa398 s10: ffffffff80e97d20 > s11: 0000000000000004 t3 : ffffffff819acc97 t4 : ffffffff819acc97 > t5 : ffffffff819acc98 t6 : ff60000002327878 > status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003 > [] virtnet_set_affinity+0x1ba/0x1fc > [] virtnet_probe+0x832/0xf1e > [] virtio_dev_probe+0x164/0x2de > [] really_probe+0x82/0x224 > [] __driver_probe_device+0x5a/0xaa > [] driver_probe_device+0x2c/0xb8 > [] __driver_attach+0x76/0x108 > [] bus_for_each_dev+0x52/0x9a > [] driver_attach+0x1a/0x28 > [] bus_add_driver+0x154/0x1c2 > [] driver_register+0x52/0x108 > [] register_virtio_driver+0x1c/0x2c > [] virtio_net_driver_init+0x7a/0xb0 > [] do_one_initcall+0x66/0x2e4 > [] kernel_init_freeable+0x28a/0x304 > [] kernel_init+0x1e/0x110 > [] ret_from_exception+0x0/0x10 > ---[ end trace 0000000000000000 ]--- > > Fixes: 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.") > Signed-off-by: Guo Ren > Signed-off-by: Guo Ren > --- > 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 7106932c6f88..e4b56523b2b5 100644 > --- a/drivers/net/virtio_net.c > +++ b/drivers/net/virtio_net.c > @@ -2300,6 +2300,8 @@ static void virtnet_set_affinity(struct virtnet_info *vi) > > for (j = 0; j < group_size; j++) { > cpumask_set_cpu(cpu, mask); > + if (cpu == (nr_cpu_ids - 1)) > + break; The problem seems to be a problem with cpumask_next_wrap(), I'm not particularly sure. But I think there is something wrong with your modification, which will cause subsequent queues to be bound to (nr_cpu_ids - 1). Thanks. > cpu = cpumask_next_wrap(cpu, cpu_online_mask, > nr_cpu_ids, false); > } > -- > 2.36.1 >