From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 AC2DCC433FE
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 03:05:35 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229493AbiJNDF3 (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Thu, 13 Oct 2022 23:05:29 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60584 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229540AbiJNDFV (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Thu, 13 Oct 2022 23:05:21 -0400
Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9815250B94;
        Thu, 13 Oct 2022 20:05:15 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by dfw.source.kernel.org (Postfix) with ESMTPS id 6CFF861950;
        Fri, 14 Oct 2022 03:05:15 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 589B1C433C1;
        Fri, 14 Oct 2022 03:05:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665716714;
        bh=8ZkOpKNVxr4UPbjHuNQIfezV4h/BZySFsoWb9a9aUu4=;
        h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
        b=ul+bewFbEjXzIvKzavEZOsA5STj/hvv0RYN90VZjOdc8xaHk/TGWx6VO9aAXmAtCT
         7az8Y09YrE9vIfRX4tgOMo0BlWGrqUJSsb25mC2ju2ohVYwFhWEJUe+2eZXR4rQjZF
         dKiP6PaoNx6T+1wQC56iD/y9XfjZrOVmmqEmS8f66eDhihSSUmE1KQK7bV5QVOPQhK
         XApWvWVQr6dM8V1z5cIOwpiW8Kyioema0X9EC4GNQvqtGqXr7sJLa0sF2TqhKKQO1d
         oQXz+hMq8NYTtetp5y9k3ucv6sE09TPaGyGoeGo0rWYE7d/QwXdtPcgojqpw9/egzE
         1IobgkrbyrmIA==
From:   guoren@kernel.org
To:     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
Cc:     linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>, Guo Ren <guoren@kernel.org>
Subject: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
Date:   Thu, 13 Oct 2022 23:04:58 -0400
Message-Id: <20221014030459.3272206-2-guoren@kernel.org>
X-Mailer: git-send-email 2.36.1
In-Reply-To: <20221014030459.3272206-1-guoren@kernel.org>
References: <20221014030459.3272206-1-guoren@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

From: Guo Ren <guoren@linux.alibaba.com>

Don't pass nr_bits as arg1, cpu_max_bits_warn would cause warning
now 854701ba4c39 ("net: fix cpu_max_bits_warn() usage in
netif_attrmask_next{,_and}").

------------[ cut here ]------------
WARNING: CPU: 2 PID: 1 at include/linux/cpumask.h:110 __netif_set_xps_queue+0x14e/0x770
Modules linked in:
CPU: 2 PID: 1 Comm: swapper/0 Not tainted 6.0.0-rc4-00018-g854701ba4c39 #324
Hardware name: riscv-virtio,qemu (DT)
epc : __netif_set_xps_queue+0x14e/0x770
 ra : __netif_set_xps_queue+0x552/0x770
epc : ffffffff806fe448 ra : ffffffff806fe84c sp : ff600000023279d0
 gp : ffffffff815fff88 tp : ff600000023a0000 t0 : ff6000000308ab40
 t1 : 0000000000000003 t2 : 0000000000000000 s0 : ff60000002327a90
 s1 : 0000000000000000 a0 : ff6000000308ab00 a1 : ff6000000308ab00
 a2 : ff6000000308a8e8 a3 : 0000000000000004 a4 : 0000000000000000
 a5 : 0000000000000000 a6 : 0000000000000000 a7 : 0000000000000000
 s2 : 0000000000000000 s3 : 0000000000000000 s4 : ff60000002327aa0
 s5 : ffffffff816031c8 s6 : 0000000000000000 s7 : 0000000000000001
 s8 : 0000000000000000 s9 : 0000000000000004 s10: ff6000000308a8c0
 s11: 0000000000000004 t3 : 0000000000000000 t4 : 0000000000000014
 t5 : 0000000000000000 t6 : 0000000000000000
status: 0000000200000120 badaddr: 0000000000000000 cause: 0000000000000003
[<ffffffff805e5824>] virtnet_set_affinity+0x14a/0x1c0
[<ffffffff805e7b04>] virtnet_probe+0x7fc/0xee2
[<ffffffff8050e120>] virtio_dev_probe+0x164/0x2de
[<ffffffff8055b69e>] really_probe+0x82/0x224
[<ffffffff8055b89a>] __driver_probe_device+0x5a/0xaa
[<ffffffff8055b916>] driver_probe_device+0x2c/0xb8
[<ffffffff8055bf34>] __driver_attach+0x76/0x108
[<ffffffff805597c0>] bus_for_each_dev+0x4a/0x8e
[<ffffffff8055b072>] driver_attach+0x1a/0x28
[<ffffffff8055ab8c>] bus_add_driver+0x13c/0x1a6
[<ffffffff8055c722>] driver_register+0x4a/0xfc
[<ffffffff8050dc34>] register_virtio_driver+0x1c/0x2c
[<ffffffff80a2bae4>] virtio_net_driver_init+0x7a/0xb0
[<ffffffff80002840>] do_one_initcall+0x66/0x2e4
[<ffffffff80a01212>] kernel_init_freeable+0x28a/0x304
[<ffffffff808b21e2>] kernel_init+0x1e/0x110
[<ffffffff80003c46>] ret_from_exception+0x0/0x10
---[ end trace 0000000000000000 ]---

Fixes: 80d19669ecd3 ("net: Refactor XPS for CPUs and Rx queues")
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
---
 net/core/dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index fa53830d0683..9ec8b10ae329 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2589,8 +2589,8 @@ int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask,
 		copy = true;
 
 	/* allocate memory for queue storage */
-	for (j = -1; j = netif_attrmask_next_and(j, online_mask, mask, nr_ids),
-	     j < nr_ids;) {
+	for (j = -1; j < nr_ids;
+	     j = netif_attrmask_next_and(j, online_mask, mask, nr_ids)) {
 		if (!new_dev_maps) {
 			new_dev_maps = kzalloc(maps_sz, GFP_KERNEL);
 			if (!new_dev_maps) {
-- 
2.36.1


From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 46C47C4332F
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 03:05:53 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229700AbiJNDFu (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Thu, 13 Oct 2022 23:05:50 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60676 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229662AbiJNDFW (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Thu, 13 Oct 2022 23:05:22 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 768DB4D263;
        Thu, 13 Oct 2022 20:05:13 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 16485B821B3;
        Fri, 14 Oct 2022 03:05:11 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A928C433D6;
        Fri, 14 Oct 2022 03:05:05 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665716709;
        bh=ldowPF7sFqLiViXUTA/fAMmO4R830NHCzYAbu57HVXA=;
        h=From:To:Cc:Subject:Date:From;
        b=AuU4ynnnStqadUaXN9zHktRKYJfqFZauBtmPaTMnSe3bJHDC8TWgrBgTWQRbvR/Ka
         mRcQtf4gs2h76hMIroTt5zVGkFtwVLGJ3ewbbkPQBxv8W882/zNo8bzVG0xurOCSCD
         mG24ZDPeAssJonhlvIKe8FRyytOVIblGCUDY4sgdUJ+pNP3YAVxJurFF2K8aj5fCiT
         ygy/mB99fFIqgI+rh9I/2Fsxy834HitnrOkFAO+nOk/T+CCMkPLZCO/T2YyPDtCarG
         dzoe3h4f8wfwaGgh4csMD8EQx/caCOHVbTy/i82O5mK1anDv+DrJlyCi63w6BKudtv
         ExuZppoDS6qdA==
From:   guoren@kernel.org
To:     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
Cc:     linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Subject: [PATCH V2 0/2] net: Fixup cpu_mask usage
Date:   Thu, 13 Oct 2022 23:04:57 -0400
Message-Id: <20221014030459.3272206-1-guoren@kernel.org>
X-Mailer: git-send-email 2.36.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

From: Guo Ren <guoren@linux.alibaba.com>

Yury Norov repaired cpumask_check() in [1], which eveals the
problem in other code. The series fixup them one by one clearly.

[1] https://lore.kernel.org/all/20220919210559.1509179-1-yury.norov@gmail.com/

Changes:
v2:
 - Fixup fixes tag in commit log with Yury Norov advice.

v1:
https://lore.kernel.org/all/20221013163857.3086718-1-guoren@kernel.org/
https://lore.kernel.org/all/20221013171434.3132854-1-guoren@kernel.org/

Guo Ren (2):
  net: Fixup netif_attrmask_next_and warning
  net: Fixup virtnet_set_affinity() cause cpumask warning

 drivers/net/virtio_net.c | 2 ++
 net/core/dev.c           | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

-- 
2.36.1


From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 66AF7C4332F
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 03:05:59 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229513AbiJNDF4 (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Thu, 13 Oct 2022 23:05:56 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60432 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229646AbiJNDFZ (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Thu, 13 Oct 2022 23:05:25 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD9525A2DC;
        Thu, 13 Oct 2022 20:05:22 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 49C04B821BD;
        Fri, 14 Oct 2022 03:05:21 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78680C433B5;
        Fri, 14 Oct 2022 03:05:15 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665716720;
        bh=jcOAb17nQhKMFlp6op1wJtpKh/mTJQ4vvofAV6VMd94=;
        h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
        b=t2J+6Xx5wHV528SmBxs5wwM2mexweWFCybwkvdBWoe3BcegNnCR1dG2MKYdTFVi7D
         kpkhRlgO9TXORLB+4+mBlPT5buUKoj9O0w+wr+IhOm0rivq52uVt6Xsr0BpMd7UEro
         aXffKvQRoHEmlA0n/klCENDl72XtdZZygyWRwmpexI6tcCIhiOqO7UOFnNBAOYVhcI
         ZYe3VHrkG4f7bqkxH4O4Kk55Y0IrgSvStPY8n9xhjmcxqGQlonF2iEJZaxjD7tFU+d
         +tvgz503VWdFXB9MMjPLQJ7yuWnaEgIX7o9i3YynM57ONyNw5SzmBD7IXbXBNf3OfI
         OkyEptjElzFBw==
From:   guoren@kernel.org
To:     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
Cc:     linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>, Guo Ren <guoren@kernel.org>
Subject: [PATCH V2 2/2] net: Fixup virtnet_set_affinity() cause cpumask warning
Date:   Thu, 13 Oct 2022 23:04:59 -0400
Message-Id: <20221014030459.3272206-3-guoren@kernel.org>
X-Mailer: git-send-email 2.36.1
In-Reply-To: <20221014030459.3272206-1-guoren@kernel.org>
References: <20221014030459.3272206-1-guoren@kernel.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

From: Guo Ren <guoren@linux.alibaba.com>

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
[<ffffffff805d84ca>] virtnet_set_affinity+0x1ba/0x1fc
[<ffffffff805da7ac>] virtnet_probe+0x832/0xf1e
[<ffffffff804fe61c>] virtio_dev_probe+0x164/0x2de
[<ffffffff8054c4c4>] really_probe+0x82/0x224
[<ffffffff8054c6c0>] __driver_probe_device+0x5a/0xaa
[<ffffffff8054c73c>] driver_probe_device+0x2c/0xb8
[<ffffffff8054cd66>] __driver_attach+0x76/0x108
[<ffffffff8054a482>] bus_for_each_dev+0x52/0x9a
[<ffffffff8054be8c>] driver_attach+0x1a/0x28
[<ffffffff8054b996>] bus_add_driver+0x154/0x1c2
[<ffffffff8054d592>] driver_register+0x52/0x108
[<ffffffff804fe120>] register_virtio_driver+0x1c/0x2c
[<ffffffff80a29142>] virtio_net_driver_init+0x7a/0xb0
[<ffffffff80002854>] do_one_initcall+0x66/0x2e4
[<ffffffff80a01222>] kernel_init_freeable+0x28a/0x304
[<ffffffff808cb1be>] kernel_init+0x1e/0x110
[<ffffffff80003c4e>] ret_from_exception+0x0/0x10
---[ end trace 0000000000000000 ]---

Fixes: 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@kernel.org>
---
 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;
 			cpu = cpumask_next_wrap(cpu, cpu_online_mask,
 						nr_cpu_ids, false);
 		}
-- 
2.36.1


From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 CCEB0C433FE
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 03:35:57 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229600AbiJNDfz (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Thu, 13 Oct 2022 23:35:55 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60264 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229496AbiJNDfs (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Thu, 13 Oct 2022 23:35:48 -0400
Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68059B1DDB;
        Thu, 13 Oct 2022 20:35:47 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by dfw.source.kernel.org (Postfix) with ESMTPS id F19A7619D0;
        Fri, 14 Oct 2022 03:35:46 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE140C433D6;
        Fri, 14 Oct 2022 03:35:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665718546;
        bh=e8NS7e8GjJLV43eHbx04zHu5yOOzyVWxuItjDNonERs=;
        h=Date:From:To:Cc:Subject:In-Reply-To:References:From;
        b=ifB5hUO6VFr4oTdSvyyX/fyRNocEJsrYDOR6p2ZjjIYQWGwSooeTIwQffaQikBtpx
         yuLQRio8jUNWiwz/v2SVhlycdPMi1jGp8NJw5dZda41qxB8L0y4HK/fcFlo3qaGvV6
         IZqbNt++TsglJtCBfHbbY80/QHspC3a75yICoZde5PhIF2aSP2+ovB9mI1VZ/0Xu2+
         /UTI+PBAoNoIEbjgz+G2YPL4A4Difg2+8LnFnFJO9910WUFquODq4arNJKu4FyOOyD
         JFfDlAZVMUalOrjRS5umQ/aDFpVng8eayhsmtW3ZnLAJmWmOJ+3fDucRYW+PFM+fEl
         ct6wwZi7VS9YQ==
Date:   Thu, 13 Oct 2022 20:35:44 -0700
From:   Jakub Kicinski <kuba@kernel.org>
To:     guoren@kernel.org
Cc:     andriy.shevchenko@linux.intel.com, davem@davemloft.net,
        edumazet@google.com, pabeni@redhat.com, linux@rasmusvillemoes.dk,
        yury.norov@gmail.com, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
Message-ID: <20221013203544.110a143c@kernel.org>
In-Reply-To: <20221014030459.3272206-2-guoren@kernel.org>
References: <20221014030459.3272206-1-guoren@kernel.org>
        <20221014030459.3272206-2-guoren@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, 13 Oct 2022 23:04:58 -0400 guoren@kernel.org wrote:
> -	for (j = -1; j = netif_attrmask_next_and(j, online_mask, mask, nr_ids),
> -	     j < nr_ids;) {
> +	for (j = -1; j < nr_ids;
> +	     j = netif_attrmask_next_and(j, online_mask, mask, nr_ids)) {

This does not look equivalent, have you tested it?

nr_ids is unsigned, doesn't it mean we'll never enter the loop?

Can we instead revert 854701ba4c and take the larger rework Yury 
has posted a week ago into net-next?

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 EFB1BC433FE
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 03:39:22 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229688AbiJNDjV (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Thu, 13 Oct 2022 23:39:21 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35446 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229598AbiJNDjQ (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Thu, 13 Oct 2022 23:39:16 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42B419298C;
        Thu, 13 Oct 2022 20:39:15 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 9A9FCB820BC;
        Fri, 14 Oct 2022 03:39:14 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEEA2C43140;
        Fri, 14 Oct 2022 03:39:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665718753;
        bh=KYozkUymmljAF7Z/zt5tiXLnn4emqzGDDUi4SNebNHs=;
        h=Date:From:To:Cc:Subject:In-Reply-To:References:From;
        b=fSWV20IrHlHHTBupoOxrTKAFOTl5k4jmN9qMWeOoqZFIL9zNZV8B8jnK/Zb9LfUtY
         oxgXhpbsUYqjvRhgYhMBBcDzQ1mvAt9fqEHi1v78yA5z0fVpZV0OSMr6z4bHCjlvqH
         KZInPjXyiOLVBuaHE7JlyDk902S5uIRswWCDr9x0ryCoq4piHT5fyrUsaj77OWdH8z
         deaf7WTgrJGR0czgTt0oTrfCdGEQxHw4UCgZW+6N5S+G7dBXMz3KKtcHRF72HzkARc
         lfGR51awdOa68d3M7aJ5tZY0Ne9Fgu3vT/XElrffSvXzwFBadxmm+L7heeSWKTl8TE
         buOVnj1viUuow==
Date:   Thu, 13 Oct 2022 20:39:11 -0700
From:   Jakub Kicinski <kuba@kernel.org>
To:     guoren@kernel.org
Cc:     andriy.shevchenko@linux.intel.com, davem@davemloft.net,
        edumazet@google.com, pabeni@redhat.com, linux@rasmusvillemoes.dk,
        yury.norov@gmail.com, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
Message-ID: <20221013203911.2705eccc@kernel.org>
In-Reply-To: <20221013203544.110a143c@kernel.org>
References: <20221014030459.3272206-1-guoren@kernel.org>
        <20221014030459.3272206-2-guoren@kernel.org>
        <20221013203544.110a143c@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, 13 Oct 2022 20:35:44 -0700 Jakub Kicinski wrote:
> Can we instead revert 854701ba4c and take the larger rework Yury 
> has posted a week ago into net-next?

Oh, it was reposted today:

https://lore.kernel.org/all/20221013234349.1165689-2-yury.norov@gmail.com/

But we need a revert of 854701ba4c as well to cover the issue back up
for 6.1, AFAIU.

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 6BCD9C4332F
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 04:43:16 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229507AbiJNEnO (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 00:43:14 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37838 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229548AbiJNEnI (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 00:43:08 -0400
Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB67718F246;
        Thu, 13 Oct 2022 21:42:47 -0700 (PDT)
Received: by mail-qv1-xf2a.google.com with SMTP id f14so2605262qvo.3;
        Thu, 13 Oct 2022 21:42:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20210112;
        h=in-reply-to:content-disposition:mime-version:references:message-id
         :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to;
        bh=xDtHrOYP4APIibnIFGeB3Yw3zgEryhyhvr48A52nfvo=;
        b=Ro7TzmXcPOJdpoVECzcFljxgM8dhXLxteFJY68WpVligO/yeqNeWMB5o+6aRph7B9Q
         dAE6NZx4KGimtxPGnL1kLXCOPIHNmRiyDU4POvLb4mwvAq2zas3X8vQPpH8nWhVfvuOH
         VKOvzSZ4X2MYO6ae/Ll6gSN01EnDLyEwsz8dVJvdGZBALt0abPyLqHfYvX/kVw1NMl+E
         uK0Hydtuk5ORtoODQfl9Q5Jld/FwG725CxnP8+PKX5I+ZSQz96XVzdsmWVuIbuGv1vUE
         1JEXLVsKNOSlk5/9/JWdr5w88V3W35K/zh6crAdTSFhum0DhClXlyHT+sre8H/yIb7rR
         wPuQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20210112;
        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=xDtHrOYP4APIibnIFGeB3Yw3zgEryhyhvr48A52nfvo=;
        b=7xcVlvcI+9b+yyUMTGFNbPOFy+jWywlTo50KjN8sWeDVNPO2WPpmuuayDiaN8E/cyR
         tI0DBaMPs+2QKdreoDlP/Tu3IjyKbjIGMxC5V+rsDo4cx9RncT7ME7HOpM56a+YeAanw
         HDpdG66jg8/+wPYhXUjx/fRuVLf/CmerOi9E41pRfOcBG4zqxnLwVGS3o4seiitfxKto
         bgubke4ZDZ9ICYpru5YUZVQErcVw1GY3gu11WazY61Aqh7ors81GtLrdLLhnCpythdl+
         xnguuNgRy80arZSdHkv4rsVMdTZyOCZlqY3DCn+XN6GGMlJ6/GiqC64Ca+WMCxlP6LNE
         Ym0Q==
X-Gm-Message-State: ACrzQf0V4/lu+E57xE5oDO6qgjvExHeVfU38n0Zo0MY7U7cx3zdStkvn
        2/m+TPsSby9N4upDplvJRBWFSZAausI=
X-Google-Smtp-Source: AMsMyM6qhS54c16AjFMowoyApUDec+Ds+Np3mRIhBzyLU7P3dUyWXlfLYyYzI3M8wpklAAgbBYkHoA==
X-Received: by 2002:a05:6214:29ee:b0:4b1:c1d2:6635 with SMTP id jv14-20020a05621429ee00b004b1c1d26635mr2821399qvb.82.1665722563289;
        Thu, 13 Oct 2022 21:42:43 -0700 (PDT)
Received: from localhost ([2601:4c1:c100:2270:a669:acbb:c756:5d9a])
        by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b006bbb07ebd83sm1498758qkb.108.2022.10.13.21.42.42
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Thu, 13 Oct 2022 21:42:42 -0700 (PDT)
Date:   Thu, 13 Oct 2022 21:42:41 -0700
From:   Yury Norov <yury.norov@gmail.com>
To:     Jakub Kicinski <kuba@kernel.org>
Cc:     guoren@kernel.org, andriy.shevchenko@linux.intel.com,
        davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
        linux@rasmusvillemoes.dk, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
Message-ID: <Y0jowX4zIZMMVc0H@yury-laptop>
References: <20221014030459.3272206-1-guoren@kernel.org>
 <20221014030459.3272206-2-guoren@kernel.org>
 <20221013203544.110a143c@kernel.org>
 <20221013203911.2705eccc@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20221013203911.2705eccc@kernel.org>
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, Oct 13, 2022 at 08:39:11PM -0700, Jakub Kicinski wrote:
> On Thu, 13 Oct 2022 20:35:44 -0700 Jakub Kicinski wrote:
> > Can we instead revert 854701ba4c and take the larger rework Yury 
> > has posted a week ago into net-next?
> 
> Oh, it was reposted today:
> 
> https://lore.kernel.org/all/20221013234349.1165689-2-yury.norov@gmail.com/
> 
> But we need a revert of 854701ba4c as well to cover the issue back up
> for 6.1, AFAIU.

The patch 854701ba4c is technically correct. I fixed most of warnings in
advance, but nobody can foresee everything, right? I expected some noise,
and now we have just a few things to fix. This is what for -rc releases
exist, didn't they?

I suggest to keep the patch, because this is the only way to make
cpumask_check()-related issues visible to people. If things will go as
they go now, I expect that -rc3 will be clean from cpumask_check()
warnings.

Thanks,
Yury

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 315B4C433FE
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 06:39:19 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229798AbiJNGjQ (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 02:39:16 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57514 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229769AbiJNGjN (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 02:39:13 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4013181C89;
        Thu, 13 Oct 2022 23:39:11 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 7613CB82211;
        Fri, 14 Oct 2022 06:39:10 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A83AC43146;
        Fri, 14 Oct 2022 06:39:09 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665729549;
        bh=B3adAPBXbT2V2JKZDZY+UOzG01zwsYFzTn663zAW2/c=;
        h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
        b=DcMwh4/DtW84kXki/xT2Ua7MBUnFd5D79x+NoR9upYaaEVBOnO8JJ0Jyv5FFRqCOf
         BJX9K34GABc6c3EAJX7lh9HWdcS9SbiodA5xccjf1cNoPRjgb3gCyrGXjE+MsAqZnI
         Ct01LdBKBfWx4x1G1Y6R08dmqvfX2tnbO6Y95x1kPu+ypzZEJ8lfEankp1/sjwqgAG
         lpupQ65U1D1vFIJggOkkNMFKcb2gaW4VYzo3jvOg64I7G2AFoFjShplBS65IW4Wvj3
         FrG0uRV/QGXqH6aTNAoHkVX54TwicDuyaygOljcJb0W/YGrGDm6Qvpn55l507Rw4Lt
         Y9cgaA9lq+vHQ==
Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-132b8f6f1b2so4835931fac.11;
        Thu, 13 Oct 2022 23:39:09 -0700 (PDT)
X-Gm-Message-State: ACrzQf0qFaNO3J1BwH+Dr/ebI5TutVotmDqsC4Tp+S5bCwz8iw1kwmmU
        qzbi0DDSc5iYxkkMjpyzpiKxJC/KKB+ReR1KJ6M=
X-Google-Smtp-Source: AMsMyM5u69ZKJiI9Ovoyien4/E0vCbsStcgbvRcUXPgWkTBdnh704VkjV8u5JqcFXDy7+52Iqa0EbUK9eabBEG1K1lk=
X-Received: by 2002:a05:6870:4413:b0:136:66cc:6af8 with SMTP id
 u19-20020a056870441300b0013666cc6af8mr7732235oah.112.1665729548233; Thu, 13
 Oct 2022 23:39:08 -0700 (PDT)
MIME-Version: 1.0
References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-2-guoren@kernel.org>
 <20221013203544.110a143c@kernel.org>
In-Reply-To: <20221013203544.110a143c@kernel.org>
From:   Guo Ren <guoren@kernel.org>
Date:   Fri, 14 Oct 2022 14:38:56 +0800
X-Gmail-Original-Message-ID: <CAJF2gTQyMHNHLizeU-gvUdA5hRLUWxvHXuVVqSoPg3M_WxPPdw@mail.gmail.com>
Message-ID: <CAJF2gTQyMHNHLizeU-gvUdA5hRLUWxvHXuVVqSoPg3M_WxPPdw@mail.gmail.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
To:     Jakub Kicinski <kuba@kernel.org>
Cc:     andriy.shevchenko@linux.intel.com, davem@davemloft.net,
        edumazet@google.com, pabeni@redhat.com, linux@rasmusvillemoes.dk,
        yury.norov@gmail.com, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Content-Type: text/plain; charset="UTF-8"
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Fri, Oct 14, 2022 at 11:35 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 13 Oct 2022 23:04:58 -0400 guoren@kernel.org wrote:
> > -     for (j = -1; j = netif_attrmask_next_and(j, online_mask, mask, nr_ids),
> > -          j < nr_ids;) {
> > +     for (j = -1; j < nr_ids;
> > +          j = netif_attrmask_next_and(j, online_mask, mask, nr_ids)) {
>
> This does not look equivalent, have you tested it?
>
> nr_ids is unsigned, doesn't it mean we'll never enter the loop?
Yes, you are right. Any unsigned int would break the result.
(gdb) p (int)-1 < (int)2
$1 = 1
(gdb) p (int)-1 < (unsigned int)2
$2 = 0
(gdb) p (unsigned int)-1 < (int)2
$4 = 0

So it should be:
 -     for (j = -1; j = netif_attrmask_next_and(j, online_mask, mask, nr_ids),
 -          j < nr_ids;) {
 +     for (j = -1; j < (int)nr_ids;
 +          j = netif_attrmask_next_and(j, online_mask, mask, nr_ids)) {

Right? Of cause, nr_ids couldn't be 0xffffffff (-1).

>
> Can we instead revert 854701ba4c and take the larger rework Yury
> has posted a week ago into net-next?



-- 
Best Regards
 Guo Ren

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 F076FC433FE
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 06:42:48 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229863AbiJNGmp (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 02:42:45 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44222 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229649AbiJNGml (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 02:42:41 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ABB11946EB;
        Thu, 13 Oct 2022 23:42:39 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 3413FB82218;
        Fri, 14 Oct 2022 06:42:38 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9891C433B5;
        Fri, 14 Oct 2022 06:42:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665729756;
        bh=eW2HUck35u1qifMCTu3OfQoHmFkJZtQcrSUIJ/PJ4hA=;
        h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
        b=hWbN1sm0QIwlff2tnplfIkJy+t70pfa9ted2ZMRnpcjQ7hcGYzGnQ9aRb/4BUxa6i
         7H+VP+nfm8yektekF1YHpqNuomGRUXvGVwYeG0ezwFA05O9YaM0818nqynh6P6khqQ
         7PKdLI+0iAieMc0K+7hp035CPURlKXbjVrAB4yo3RRHzrfM45GME/3ggSpkEV30uWn
         AVv1jB2dK9YRWm5tAM/D0IShvT50zZwOLFim9LxcW+uzsBCUgFJlmKbx1kd4MIdQ6z
         F6SfJ/hMTJ4EGwpKFBMnyK9WBESAdaAWlmEP3xI+MJJBINApl8qZ0tBDJF0KSaBjag
         W30bFcRpNiDlQ==
Received: by mail-oi1-f182.google.com with SMTP id w196so4131790oiw.8;
        Thu, 13 Oct 2022 23:42:36 -0700 (PDT)
X-Gm-Message-State: ACrzQf0aTldYF5FzKTyZjVU5aIV0VfUjXp/cj69yG+fTPXjwfsUuIA5T
        kHimie3uz0b5/NuQagzfbgDJMLQCac3COCNL0eI=
X-Google-Smtp-Source: AMsMyM666LQOO+rKhPSl0IyxA5zLp4Y0JaqfwQSUvyyUCZnEvSpPaTAz+nEGLq7ZXtTLJFnaSmS32QySgegFg+9FZQ4=
X-Received: by 2002:a05:6808:10c3:b0:354:db1e:c4a8 with SMTP id
 s3-20020a05680810c300b00354db1ec4a8mr5884742ois.112.1665729756010; Thu, 13
 Oct 2022 23:42:36 -0700 (PDT)
MIME-Version: 1.0
References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-2-guoren@kernel.org>
 <20221013203544.110a143c@kernel.org> <20221013203911.2705eccc@kernel.org> <Y0jowX4zIZMMVc0H@yury-laptop>
In-Reply-To: <Y0jowX4zIZMMVc0H@yury-laptop>
From:   Guo Ren <guoren@kernel.org>
Date:   Fri, 14 Oct 2022 14:42:24 +0800
X-Gmail-Original-Message-ID: <CAJF2gTR6BJMvoz+QhVDbG3Ho1xvMAwNLkmTCOByZxpymZfZJnQ@mail.gmail.com>
Message-ID: <CAJF2gTR6BJMvoz+QhVDbG3Ho1xvMAwNLkmTCOByZxpymZfZJnQ@mail.gmail.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
To:     Yury Norov <yury.norov@gmail.com>
Cc:     Jakub Kicinski <kuba@kernel.org>,
        andriy.shevchenko@linux.intel.com, davem@davemloft.net,
        edumazet@google.com, pabeni@redhat.com, linux@rasmusvillemoes.dk,
        caraitto@google.com, willemb@google.com, jonolson@google.com,
        amritha.nambiar@intel.com, linux-kernel@vger.kernel.org,
        netdev@vger.kernel.org, Guo Ren <guoren@linux.alibaba.com>
Content-Type: text/plain; charset="UTF-8"
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Fri, Oct 14, 2022 at 12:42 PM Yury Norov <yury.norov@gmail.com> wrote:
>
> On Thu, Oct 13, 2022 at 08:39:11PM -0700, Jakub Kicinski wrote:
> > On Thu, 13 Oct 2022 20:35:44 -0700 Jakub Kicinski wrote:
> > > Can we instead revert 854701ba4c and take the larger rework Yury
> > > has posted a week ago into net-next?
> >
> > Oh, it was reposted today:
> >
> > https://lore.kernel.org/all/20221013234349.1165689-2-yury.norov@gmail.com/
> >
> > But we need a revert of 854701ba4c as well to cover the issue back up
> > for 6.1, AFAIU.
>
> The patch 854701ba4c is technically correct. I fixed most of warnings in
> advance, but nobody can foresee everything, right? I expected some noise,
> and now we have just a few things to fix. This is what for -rc releases
> exist, didn't they?
Your job is great, I just want to help with some fixes. Fixes them in
-rc would be a good point.

>
> I suggest to keep the patch, because this is the only way to make
> cpumask_check()-related issues visible to people. If things will go as
> they go now, I expect that -rc3 will be clean from cpumask_check()
> warnings.
>
> Thanks,
> Yury



-- 
Best Regards
 Guo Ren

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 390FAC433FE
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 10:00:31 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229961AbiJNKA2 (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 06:00:28 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48940 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229554AbiJNKAY (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 06:00:24 -0400
Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5634D63F3F;
        Fri, 14 Oct 2022 03:00:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
  t=1665741623; x=1697277623;
  h=date:from:to:cc:subject:message-id:references:
   mime-version:in-reply-to;
  bh=yU691PK0LSDKQcnMRYmi3y8VrAcQvxQtXyiByydYRCI=;
  b=fnDX6KhJdiEHlqb54CTo5z/5p2CbzeTN91APcjAIThrkfvrlqwSSvWKk
   ITnQ0HxdzmcJgBQUEmuGrRrC+aovXewu9W1J2Cmra7KJbUoEgJ/hfMToG
   fvTAQ52eHGrNFMpB5CTdWuAyf2fBbgxZ1JaA/l7dme8TUmVgYGlWigaqi
   0Q4pUlwzW0bGORD01AaugeCDc2hJ/mpfyteX+DSXcyGEldVwkBxKp/l5E
   15grekbzCXT7V1nmSqA5/eLwBCubAFdGHu2A10oQBG9VCvfXxUP5HObr7
   bKy3FWXa7TxIF3AMY4AoIiO/R4zEY8FFs4Lh7FGpRBOSf2Rngi6kENCUv
   w==;
X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="367360304"
X-IronPort-AV: E=Sophos;i="5.95,184,1661842800"; 
   d="scan'208";a="367360304"
Received: from fmsmga004.fm.intel.com ([10.253.24.48])
  by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2022 03:00:22 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="696251825"
X-IronPort-AV: E=Sophos;i="5.95,184,1661842800"; 
   d="scan'208";a="696251825"
Received: from smile.fi.intel.com ([10.237.72.54])
  by fmsmga004.fm.intel.com with ESMTP; 14 Oct 2022 03:00:13 -0700
Received: from andy by smile.fi.intel.com with local (Exim 4.96)
        (envelope-from <andriy.shevchenko@linux.intel.com>)
        id 1ojHUB-006sKC-0e;
        Fri, 14 Oct 2022 13:00:11 +0300
Date:   Fri, 14 Oct 2022 13:00:10 +0300
From:   Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To:     guoren@kernel.org
Cc:     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, linux-kernel@vger.kernel.org,
        netdev@vger.kernel.org, Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH V2 2/2] net: Fixup virtnet_set_affinity() cause cpumask
 warning
Message-ID: <Y0kzKgHO51LlqGkY@smile.fi.intel.com>
References: <20221014030459.3272206-1-guoren@kernel.org>
 <20221014030459.3272206-3-guoren@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20221014030459.3272206-3-guoren@kernel.org>
Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, Oct 13, 2022 at 11:04:59PM -0400, guoren@kernel.org wrote:
> From: Guo Ren <guoren@linux.alibaba.com>
> 
> 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:

Submitting Patches document suggests to cut this huge warning to only what
makes sense to see in the report.

-- 
With Best Regards,
Andy Shevchenko



From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 89A97C4332F
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 10:01:15 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229959AbiJNKBN (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 06:01:13 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53178 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S230011AbiJNKBI (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 06:01:08 -0400
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E2D69F741;
        Fri, 14 Oct 2022 03:01:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
  d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
  t=1665741664; x=1697277664;
  h=date:from:to:cc:subject:message-id:references:
   mime-version:in-reply-to;
  bh=P/LSpeZ4rqXERhvqeByUhgiXrNe//GKUtdTAL6L6Qi0=;
  b=JJA6w3Du8u/X1imOMeaVUvpNg9zdN77YLlHslLTm7HmC0SjvRjV0bJC/
   pOUk/lUzYkibWn6+YM017dgcElCh61Gda+DvzwCgqDw4vt6dD+sWgCh0x
   Gs9uPSPxoVepvKEmRmaXf7CAEd8Z9zobVQOdq/R6KxCzZVUG9uLX0NzH7
   Ksm615gtIzaQWoPaVY9kbfjg1+6cfE74q4JIo7lzIbzBpHVoqaLNgtlor
   3cJkoU9YZviR63YB11sNPbsjfINM3LUTE8Gd1Isq++lpMFD4JYMdbj6Al
   IS/RKXavduPQerKAIw7WWd1VTezu4uX6YFwQwgR91eVO6hruIu6kKckcB
   Q==;
X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="306989649"
X-IronPort-AV: E=Sophos;i="5.95,184,1661842800"; 
   d="scan'208";a="306989649"
Received: from fmsmga002.fm.intel.com ([10.253.24.26])
  by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2022 03:01:03 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=McAfee;i="6500,9779,10499"; a="732246731"
X-IronPort-AV: E=Sophos;i="5.95,184,1661842800"; 
   d="scan'208";a="732246731"
Received: from smile.fi.intel.com ([10.237.72.54])
  by fmsmga002.fm.intel.com with ESMTP; 14 Oct 2022 03:00:59 -0700
Received: from andy by smile.fi.intel.com with local (Exim 4.96)
        (envelope-from <andriy.shevchenko@linux.intel.com>)
        id 1ojHUv-006sKo-2K;
        Fri, 14 Oct 2022 13:00:57 +0300
Date:   Fri, 14 Oct 2022 13:00:57 +0300
From:   Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To:     guoren@kernel.org
Cc:     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, linux-kernel@vger.kernel.org,
        netdev@vger.kernel.org, Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
Message-ID: <Y0kzWQZSdCR93s/y@smile.fi.intel.com>
References: <20221014030459.3272206-1-guoren@kernel.org>
 <20221014030459.3272206-2-guoren@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20221014030459.3272206-2-guoren@kernel.org>
Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, Oct 13, 2022 at 11:04:58PM -0400, guoren@kernel.org wrote:
> From: Guo Ren <guoren@linux.alibaba.com>
> 
> Don't pass nr_bits as arg1, cpu_max_bits_warn would cause warning
> now 854701ba4c39 ("net: fix cpu_max_bits_warn() usage in
> netif_attrmask_next{,_and}").
> 
> ------------[ cut here ]------------
> WARNING: CPU: 2 PID: 1 at include/linux/cpumask.h:110 __netif_set_xps_queue+0x14e/0x770
> Modules linked in:

Submitting Patches documentation suggests to cut this to only what makes sense
for the report.

-- 
With Best Regards,
Andy Shevchenko



From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 C4332C4332F
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 10:04:54 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229618AbiJNKEw (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 06:04:52 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57844 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229613AbiJNKEt (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 06:04:49 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D1B027FD9;
        Fri, 14 Oct 2022 03:04:48 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 3DFA7B82295;
        Fri, 14 Oct 2022 10:04:47 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0815C43140;
        Fri, 14 Oct 2022 10:04:45 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665741885;
        bh=M1RHVhrd9CvGHsDLVTPIYyBQZd2boaXvVLczC8V1agw=;
        h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
        b=cSjc0snQFw9N7np+xcZVe0pdiaXuGmgKZOfsbXqeSyQZyVnMhWevQh789ZMC/I480
         xuGynoflF8jZyym9WKjQXXpCHCsTlv7+akgvg3EnUy3KvsEkKyc9PCNf+9CiS1Vcol
         Zh+a206ZeF+2HQ2yhBQ6MQsAHCELN2YmyWnCm9LSCX8RGHptjM3SJakv4x9wXTrsmT
         qo+xjzSd7D82sa8ppvZhOzcFxBbeuSKWQ29Bh0mJ2TyaiKzAyGvmyKUq0EBdHbNbaw
         HDNlX7hfPNP7PxHDqVSEqzs/MRyKMtufQFA9foX/t53n1+xFXCMSHg+fIkVThHu9LE
         Ej28w10WEDNtw==
Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-1370acb6588so5268272fac.9;
        Fri, 14 Oct 2022 03:04:45 -0700 (PDT)
X-Gm-Message-State: ACrzQf2RM1B9q1gSoeQrHX1cpBZ1gUcoYwJyBzILOHJJlcUk0/S/40EC
        e37RHDAbhvLpUeafDsErSU5arpIPdeKKOIfpuik=
X-Google-Smtp-Source: AMsMyM4AanB6DEc0QtQUMx97yjyTLDFYTwR7kLa4ZXZSkz9p6XoOhM8wnzzmCv9StC9733eUpY6ZLuCUTKfyFf7Xkuw=
X-Received: by 2002:a05:6870:4413:b0:136:66cc:6af8 with SMTP id
 u19-20020a056870441300b0013666cc6af8mr8049193oah.112.1665741884871; Fri, 14
 Oct 2022 03:04:44 -0700 (PDT)
MIME-Version: 1.0
References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-2-guoren@kernel.org>
 <Y0kzWQZSdCR93s/y@smile.fi.intel.com>
In-Reply-To: <Y0kzWQZSdCR93s/y@smile.fi.intel.com>
From:   Guo Ren <guoren@kernel.org>
Date:   Fri, 14 Oct 2022 18:04:32 +0800
X-Gmail-Original-Message-ID: <CAJF2gTReV1JhfP2SN-3P3g4v6Mpgaq4CMb5COAiGCwo=onaAgQ@mail.gmail.com>
Message-ID: <CAJF2gTReV1JhfP2SN-3P3g4v6Mpgaq4CMb5COAiGCwo=onaAgQ@mail.gmail.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
To:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc:     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, linux-kernel@vger.kernel.org,
        netdev@vger.kernel.org, Guo Ren <guoren@linux.alibaba.com>
Content-Type: text/plain; charset="UTF-8"
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Fri, Oct 14, 2022 at 6:01 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Oct 13, 2022 at 11:04:58PM -0400, guoren@kernel.org wrote:
> > From: Guo Ren <guoren@linux.alibaba.com>
> >
> > Don't pass nr_bits as arg1, cpu_max_bits_warn would cause warning
> > now 854701ba4c39 ("net: fix cpu_max_bits_warn() usage in
> > netif_attrmask_next{,_and}").
> >
> > ------------[ cut here ]------------
> > WARNING: CPU: 2 PID: 1 at include/linux/cpumask.h:110 __netif_set_xps_queue+0x14e/0x770
> > Modules linked in:
>
> Submitting Patches documentation suggests to cut this to only what makes sense
> for the report.
Right, thx for mentioning.

>
> --
> With Best Regards,
> Andy Shevchenko
>
>


-- 
Best Regards
 Guo Ren

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 69FB0C433FE
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 10:05:22 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229955AbiJNKFU (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 06:05:20 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60304 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229722AbiJNKFQ (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 06:05:16 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79CFD4DF13;
        Fri, 14 Oct 2022 03:05:15 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id E6E37B82214;
        Fri, 14 Oct 2022 10:05:13 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 977DBC4347C;
        Fri, 14 Oct 2022 10:05:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665741912;
        bh=kQ6GsrFoYb1xxcIqX5jvTD5g30h+H0/nMu6gMa3iuhQ=;
        h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
        b=bFVraoR+KBZlJMiW6OJVjKdA0qNbVdmvSKet627k8vi7WE3zkwz9rEzsWlwYCyLRP
         Vmzo9KzbyzclaeFyD9TjL2pJDFziWCr3G85oYE++ednWJZbakyDB4mZ8aPvv81ABAL
         iXw7ZMOon0ucQgdC4hwFkMGInljPH6jJatptCt3H4UvbHQlbrUo16g+iIIXH8A+ufs
         juNx8mE7h6CwGRQUEG8KFDpCdBqHfqyVy6dyO98N5104xOVjNAiNc/KTWP6uoSPDQi
         TvxmwTQ7jAbzwhmn+WfiyBPyPDsMX4ehQEnk178w0tTzDqll3TUAW2YNXfJsRx/xkh
         TBeKfB/RWB8Pg==
Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-1370acb6588so5269316fac.9;
        Fri, 14 Oct 2022 03:05:12 -0700 (PDT)
X-Gm-Message-State: ACrzQf1tmrkcmE02EbHA0iUh8OglZLgcY2uEGFqD1mQuU6bnJh558yuA
        zPMoMGdaX5PB5Mx7eG8A7YIMQspBorTCC8nZDkY=
X-Google-Smtp-Source: AMsMyM6Z7SSf4AbBTLY7ienWTYZ/Glj67u/8CDcrGsvcrY5qq68jT2V5WDTo+MO4GNhF5+M7o7yeUe0ycoBROkcKZ5E=
X-Received: by 2002:a05:6870:4413:b0:136:66cc:6af8 with SMTP id
 u19-20020a056870441300b0013666cc6af8mr8050336oah.112.1665741911827; Fri, 14
 Oct 2022 03:05:11 -0700 (PDT)
MIME-Version: 1.0
References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-3-guoren@kernel.org>
 <Y0kzKgHO51LlqGkY@smile.fi.intel.com>
In-Reply-To: <Y0kzKgHO51LlqGkY@smile.fi.intel.com>
From:   Guo Ren <guoren@kernel.org>
Date:   Fri, 14 Oct 2022 18:04:58 +0800
X-Gmail-Original-Message-ID: <CAJF2gTTuPmd8MPK5vwWfKTLv+unjr=+Q8KOTzCmq5LHipKX62Q@mail.gmail.com>
Message-ID: <CAJF2gTTuPmd8MPK5vwWfKTLv+unjr=+Q8KOTzCmq5LHipKX62Q@mail.gmail.com>
Subject: Re: [PATCH V2 2/2] net: Fixup virtnet_set_affinity() cause cpumask warning
To:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc:     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, linux-kernel@vger.kernel.org,
        netdev@vger.kernel.org, Guo Ren <guoren@linux.alibaba.com>
Content-Type: text/plain; charset="UTF-8"
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Fri, Oct 14, 2022 at 6:00 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Thu, Oct 13, 2022 at 11:04:59PM -0400, guoren@kernel.org wrote:
> > From: Guo Ren <guoren@linux.alibaba.com>
> >
> > 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:
>
> Submitting Patches document suggests to cut this huge warning to only what
> makes sense to see in the report.
Okay
>
> --
> With Best Regards,
> Andy Shevchenko
>
>


-- 
Best Regards
 Guo Ren

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 B871BC4332F
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 15:52:30 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S231171AbiJNPw2 (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 11:52:28 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36246 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S230512AbiJNPwY (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 11:52:24 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC65D1C6BE4;
        Fri, 14 Oct 2022 08:52:23 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 85821B82367;
        Fri, 14 Oct 2022 15:52:22 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8E3BC433C1;
        Fri, 14 Oct 2022 15:52:20 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665762741;
        bh=KB5yV/ErkZcjUTijfeVO4kmN9+d0J7rzX42NU+CHSZQ=;
        h=Date:From:To:Cc:Subject:In-Reply-To:References:From;
        b=hxizLyBqwBpsL+YmB2RwdnEZTjpyezWCDbKR7q1KII+P8VEY9GFyFVLvV++i2CF+q
         Oa5C36dTpZBS7h88v1RfNl1iWDGwnd+LOmBn+Lv/ZDhnW8+/B+p/+sK23MNerq72kn
         UhVXXzkJVLk9+bvkF2W6jf8K0vKUP4fzSMohPgi3jHs7POU1+xdaMKuBliqmejsk/g
         6JADOjOW9/4mtTLfy6gYtAR/BI/XImxUzyiJBTLhIg63feU5IhvROUn61T+y/yahuY
         y39pJhVt+iIVjfCkAJIUPhe8YNQ6jDhxQ7AmVay7V7GexMTx9CCHqZy1UVU6c8fxV+
         16FViRMPq8F5Q==
Date:   Fri, 14 Oct 2022 08:52:19 -0700
From:   Jakub Kicinski <kuba@kernel.org>
To:     Guo Ren <guoren@kernel.org>
Cc:     andriy.shevchenko@linux.intel.com, davem@davemloft.net,
        edumazet@google.com, pabeni@redhat.com, linux@rasmusvillemoes.dk,
        yury.norov@gmail.com, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
Message-ID: <20221014085219.635d25cd@kernel.org>
In-Reply-To: <CAJF2gTQyMHNHLizeU-gvUdA5hRLUWxvHXuVVqSoPg3M_WxPPdw@mail.gmail.com>
References: <20221014030459.3272206-1-guoren@kernel.org>
        <20221014030459.3272206-2-guoren@kernel.org>
        <20221013203544.110a143c@kernel.org>
        <CAJF2gTQyMHNHLizeU-gvUdA5hRLUWxvHXuVVqSoPg3M_WxPPdw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Fri, 14 Oct 2022 14:38:56 +0800 Guo Ren wrote:
> > This does not look equivalent, have you tested it?
> >
> > nr_ids is unsigned, doesn't it mean we'll never enter the loop?  
> 
> Yes, you are right. Any unsigned int would break the result.
> (gdb) p (int)-1 < (int)2
> $1 = 1
> (gdb) p (int)-1 < (unsigned int)2
> $2 = 0
> (gdb) p (unsigned int)-1 < (int)2
> $4 = 0
> 
> So it should be:
>  -     for (j = -1; j = netif_attrmask_next_and(j, online_mask, mask, nr_ids),
>  -          j < nr_ids;) {
>  +     for (j = -1; j < (int)nr_ids;
>  +          j = netif_attrmask_next_and(j, online_mask, mask, nr_ids)) {
> 
> Right? Of cause, nr_ids couldn't be 0xffffffff (-1).

No. You can't enter the loop with -1 as the iterator either. 
Let's move on.

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 8CBACC4332F
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 16:03:21 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S230353AbiJNQDS (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 12:03:18 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40898 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229862AbiJNQDP (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 12:03:15 -0400
Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AD7B17D861;
        Fri, 14 Oct 2022 09:03:14 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by dfw.source.kernel.org (Postfix) with ESMTPS id DAD4961B98;
        Fri, 14 Oct 2022 16:03:13 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5040C433C1;
        Fri, 14 Oct 2022 16:03:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665763393;
        bh=GhT+2uwoWbVxlknQK8yOBQWtY4Zr0UcbQ0bqCKmzgRQ=;
        h=Date:From:To:Cc:Subject:In-Reply-To:References:From;
        b=SWLx2h2KdSCGExSD13RuEN268mxxtVyyTXF/CzGYRAL6LqxDjBLAuPIqEykXEeABL
         XpgTuQfurIDRJCPFkjLTTGs6xc4uLWscsCMw7Cs97oZp5QmmjDd00lF+2ws+z7iegK
         43k9VBPV2NPjeHwHVN3hwYDtZVu46DOdLi/Cee8sJLjk211jXjn9o/pGYhyMWQvaUL
         iSoYEHSU2QMARIIoPZiPCdGh/ECNJal7LfIUmTl+d74662HL3E3XMDZZC6ClYbu5bZ
         LiX+1ZmFB7eTiIiEf+KzQu3ES/d2tLAjBsRFQ5i+RqfXF7vwF5LLBqAP8v2aCsraAX
         uDRDBuhMlUing==
Date:   Fri, 14 Oct 2022 09:03:11 -0700
From:   Jakub Kicinski <kuba@kernel.org>
To:     Yury Norov <yury.norov@gmail.com>
Cc:     guoren@kernel.org, andriy.shevchenko@linux.intel.com,
        davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
        linux@rasmusvillemoes.dk, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
Message-ID: <20221014090311.392e0546@kernel.org>
In-Reply-To: <Y0jowX4zIZMMVc0H@yury-laptop>
References: <20221014030459.3272206-1-guoren@kernel.org>
        <20221014030459.3272206-2-guoren@kernel.org>
        <20221013203544.110a143c@kernel.org>
        <20221013203911.2705eccc@kernel.org>
        <Y0jowX4zIZMMVc0H@yury-laptop>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, 13 Oct 2022 21:42:41 -0700 Yury Norov wrote:
> > Oh, it was reposted today:
> >=20
> > https://lore.kernel.org/all/20221013234349.1165689-2-yury.norov@gmail.c=
om/
> >=20
> > But we need a revert of 854701ba4c as well to cover the issue back up
> > for 6.1, AFAIU. =20
>=20
> The patch 854701ba4c is technically correct. I fixed most of warnings in
> advance, but nobody can foresee everything, right? I expected some noise,
> and now we have just a few things to fix.

I got 6 warnings booting my machine after pulling back from Linus
(which included your patches in net for the first time).
And that's not including the XPS and the virtio warning.

> This is what for -rc releases exist, didn't they?
>=20
> I suggest to keep the patch, because this is the only way to make
> cpumask_check()-related issues visible to people. If things will go as
> they go now, I expect that -rc3 will be clean from cpumask_check()
> warnings.

This sounds too close to saying that "it's okay for -rc1 to be broken".
Why were your changes not in linux-next for a month before the merge
window? :(

We will not be merging a refactoring series into net to silence an
arguably over-eager warning. We need a minimal fix, Guo Ren's patches
seem to miss the mark so I reckon the best use of everyone's time is=20
to just drop the exposing patch and retry in -next =F0=9F=A4=B7

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 CEEDAC433FE
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 16:16:20 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229849AbiJNQQS (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 12:16:18 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50766 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229673AbiJNQQP (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 12:16:15 -0400
Received: from mail-vs1-xe33.google.com (mail-vs1-xe33.google.com [IPv6:2607:f8b0:4864:20::e33])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D85F1CFF20;
        Fri, 14 Oct 2022 09:16:13 -0700 (PDT)
Received: by mail-vs1-xe33.google.com with SMTP id d187so5383140vsd.6;
        Fri, 14 Oct 2022 09:16:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20210112;
        h=content-transfer-encoding:cc:to:subject:message-id:date:from
         :in-reply-to:references:mime-version:from:to:cc:subject:date
         :message-id:reply-to;
        bh=m6c6o3U74O8R1F/6os/hJFkTL6GUlIrhNrBHLOkzRho=;
        b=a1Xom2666YZzwvYjRzZQ+kEK+YDG0h0s9soYrxe7wBsMNxv/0NtJKHsL/LNQOQAor1
         3geUZZj4zV1XCiWCo5qHG59cer4+VhWCcrS+MnMn6pH2MsK6Zx3ZU6mLVNZbSWWBRhQO
         kSR4uHCWLJ+6NNy7nQxmofK0ZXB0FemeV3mDu5WdYXh99XxE8T3KvLn/h1OujuViL3P9
         cS2sD0fn4ikRkuDGP3WyWGnUAl192XdK2mzRPGnzbyflJZHCEKI0yyUA0tsVPrlVMbXe
         gO11GF8013mAxYCmrLx/yg1iWc6r6kp4LaX8V+NXMr1Dcw+hb1qLGLMEIDTdHT2aUTaK
         xr1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20210112;
        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=m6c6o3U74O8R1F/6os/hJFkTL6GUlIrhNrBHLOkzRho=;
        b=7L58M9CDUhSDVdvabkmINcx4PjkYSlGiXY3tieguixEAy7fVwsS7pwQAMjPcpN1e0+
         rakYTOVXcX/1dW4+zAV6FOOgLQsEPoaRqVLd73lk6uLFab6DSJ5NkugmQCCrjvS6icPS
         0KbEX5ZcqPHY6a5lHZBKsaq2YDsqHr9ZI+uPsRy1WMI7SmbD6e7uMKcC2i8je1AySNTl
         DtbqrB7Y/BNCL3aBwi969HzRtXg5g23XO2H+IS93ZE059T9FJ0mNf8NuESoVpp7yY7TD
         cfhNN1wq+/xi8Pib9D6/htlq0lA8iSqdsucZe2Us0izMJdjDUZG9myHgMUynJr0wy5TR
         d8NA==
X-Gm-Message-State: ACrzQf0hO0zU4AUqF+Ok2+pAIOQEKYs081egde7fPp3kRschNaLGzbNQ
        YE7+u1HlcyjNd8rKHiJFSR3u79Eo2ILLHHDWeC4=
X-Google-Smtp-Source: AMsMyM5hEA7tW9pMEtbRo5bhn4Xm3tML2GQzMEVHCvBZ5LyqmeuhjpOc7breuy8Y/4NjTe//zzTRWCkal8B75MK7BRk=
X-Received: by 2002:a05:6102:31b6:b0:3a6:eeec:a566 with SMTP id
 d22-20020a05610231b600b003a6eeeca566mr3501741vsh.28.1665764172140; Fri, 14
 Oct 2022 09:16:12 -0700 (PDT)
MIME-Version: 1.0
References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-2-guoren@kernel.org>
 <20221013203544.110a143c@kernel.org> <20221013203911.2705eccc@kernel.org>
 <Y0jowX4zIZMMVc0H@yury-laptop> <20221014090311.392e0546@kernel.org>
In-Reply-To: <20221014090311.392e0546@kernel.org>
From:   Yury Norov <yury.norov@gmail.com>
Date:   Fri, 14 Oct 2022 09:16:01 -0700
Message-ID: <CAAH8bW_6uT7M_y7GEZSrzo1WJZfZ2j=UeZreXX9yHCEFqXNJzQ@mail.gmail.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
To:     Jakub Kicinski <kuba@kernel.org>
Cc:     guoren@kernel.org, andriy.shevchenko@linux.intel.com,
        davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
        linux@rasmusvillemoes.dk, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Fri, Oct 14, 2022 at 9:03 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 13 Oct 2022 21:42:41 -0700 Yury Norov wrote:
> > > Oh, it was reposted today:
> > >
> > > https://lore.kernel.org/all/20221013234349.1165689-2-yury.norov@gmail=
.com/
> > >
> > > But we need a revert of 854701ba4c as well to cover the issue back up
> > > for 6.1, AFAIU.
> >
> > The patch 854701ba4c is technically correct. I fixed most of warnings i=
n
> > advance, but nobody can foresee everything, right? I expected some nois=
e,
> > and now we have just a few things to fix.
>
> I got 6 warnings booting my machine after pulling back from Linus
> (which included your patches in net for the first time).
> And that's not including the XPS and the virtio warning.
>
> > This is what for -rc releases exist, didn't they?
> >
> > I suggest to keep the patch, because this is the only way to make
> > cpumask_check()-related issues visible to people. If things will go as
> > they go now, I expect that -rc3 will be clean from cpumask_check()
> > warnings.
>
> This sounds too close to saying that "it's okay for -rc1 to be broken".
> Why were your changes not in linux-next for a month before the merge
> window? :(

They spent about a month in -next. Nobody cared.

> We will not be merging a refactoring series into net to silence an
> arguably over-eager warning. We need a minimal fix, Guo Ren's patches
> seem to miss the mark so I reckon the best use of everyone's time is
> to just drop the exposing patch and retry in -next =F0=9F=A4=B7

If you prefer treating symptoms rather than the disease - I have nothing
to add.

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 D9FC5C43219
	for <linux-kernel@archiver.kernel.org>; Fri, 14 Oct 2022 18:03:45 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229460AbiJNSDo (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 14:03:44 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53580 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S230255AbiJNSDg (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 14:03:36 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A96561B6C96;
        Fri, 14 Oct 2022 11:03:34 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 5267AB82356;
        Fri, 14 Oct 2022 18:03:33 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B209C433C1;
        Fri, 14 Oct 2022 18:03:31 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665770612;
        bh=161vf/MZ9Uq3Rm1iKnGWQxZPlYkzch68bDKn9ElqWek=;
        h=Date:From:To:Cc:Subject:In-Reply-To:References:From;
        b=dEJO7TBTXFVb84YJq4B8bg3pcBpDmPFaxL0rYF/0KgkmFCZBuC4Gc3hRO7qGu27Gn
         W5JOn0WbEzkrTeyQsaLUKUOBmkO9kOVhdj9DGaQ/i5QsAw3Uh2qW9B/a3cA2+1nGLK
         hKJgyv3Pcy2WTFs255fuRKk8132aBj2VOXerxamlWtB6MftmjBvYACjnqDkL0QwkJG
         tmZuUkKHtQKVgi3wBu+MiSL5JGCgevOvnlEzIZSWjT/mJ1pU4LzJWpQOAtZu7xGqo2
         s/mh38esWmQGxSYEjMkUeOCJ1ciuEpUJrr1SXF6TpCl8mLcFsS2dDxaqaA7HOR7yQF
         zIKyw3oCmOz4Q==
Date:   Fri, 14 Oct 2022 11:03:30 -0700
From:   Jakub Kicinski <kuba@kernel.org>
To:     Yury Norov <yury.norov@gmail.com>
Cc:     guoren@kernel.org, andriy.shevchenko@linux.intel.com,
        davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
        linux@rasmusvillemoes.dk, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
Message-ID: <20221014110330.044bbbf4@kernel.org>
In-Reply-To: <CAAH8bW_6uT7M_y7GEZSrzo1WJZfZ2j=UeZreXX9yHCEFqXNJzQ@mail.gmail.com>
References: <20221014030459.3272206-1-guoren@kernel.org>
        <20221014030459.3272206-2-guoren@kernel.org>
        <20221013203544.110a143c@kernel.org>
        <20221013203911.2705eccc@kernel.org>
        <Y0jowX4zIZMMVc0H@yury-laptop>
        <20221014090311.392e0546@kernel.org>
        <CAAH8bW_6uT7M_y7GEZSrzo1WJZfZ2j=UeZreXX9yHCEFqXNJzQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Fri, 14 Oct 2022 09:16:01 -0700 Yury Norov wrote:
> > We will not be merging a refactoring series into net to silence an
> > arguably over-eager warning. We need a minimal fix, Guo Ren's patches
> > seem to miss the mark so I reckon the best use of everyone's time is
> > to just drop the exposing patch and retry in -next =F0=9F=A4=B7 =20
>=20
> If you prefer treating symptoms rather than the disease - I have nothing
> to add.

I don't, but we may consider different things to be "the disease".
Please do not insinuate that I don't care about fixing bugs.

What I can grok from the history and your commit messages is that=20
you want to catch people who pass what you consider invalid inputs=20
to the helpers, but nothing will crash/OOB access here, because=20
the helper double checks that the input is < nr_bits.

So it's a nice cleanup and refactoring, sure, but not an urgent fix
that needs to go to Linus ASAP.

If that's not what you're fixing please explain, I believe I already
asked you to clarify before. And the commit message aren't exactly
informative either.

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 2D63BC4332F
	for <linux-kernel@archiver.kernel.org>; Sat, 15 Oct 2022 01:38:44 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229648AbiJOBim (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 21:38:42 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50946 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229609AbiJOBik (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 21:38:40 -0400
Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86C0A895DA;
        Fri, 14 Oct 2022 18:38:39 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by ams.source.kernel.org (Postfix) with ESMTPS id 43C87B82486;
        Sat, 15 Oct 2022 01:38:38 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id EEE41C43143;
        Sat, 15 Oct 2022 01:38:36 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665797917;
        bh=ZjS+xMNSlpvu1zyJXPazkr7R5rfqNNFR9uxlQHaxDsE=;
        h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
        b=sZJXGp6SrjJIO9l34zTRNWzM4kTD44QTn543wLrAPYqL01z6JXWE1hWUY6q2duH6e
         aS9b69bxyIrjDzXKV1Jkm7vL7UOGcW7zvspQ0LXz0E5YdTU8dKkbWYriiawbB9uYMS
         24GoryYcJSo9pfQJVo56E0luIiVyd7v00Z5ph63iDvKopZwypRALTPcCEsIOr/9sOD
         VF+zGeqkS3wtO+y64krgLfXrJSaI0AH/OALGXN5S3GkcGmh/NLWc90x4afTlX/hIgf
         +N+X+S0Ee4hUcoXv8sxtbVkoYZLndQP13LhX8N5YhQnwnTqu77/XZv67kal9FOrb4d
         5agliUqM2N3PA==
Received: by mail-oi1-f170.google.com with SMTP id g130so6796708oia.13;
        Fri, 14 Oct 2022 18:38:36 -0700 (PDT)
X-Gm-Message-State: ACrzQf2Gd6zH1hdDCncMhQCxZZJ27YDZuJ/MN5+/9N4QreZVaoiLCFb2
        l3Pm7zt6C/K8GfPiLGh91j5spI/DL5JXI5eiN+0=
X-Google-Smtp-Source: AMsMyM6B/sjQViEnCU0rQQ1CtugSua/MQXf19M8zrTaSx6fTy6/clBFPhm0KZ8eepVAFQut0I40wcPZpDsuV9XPCvL8=
X-Received: by 2002:a05:6808:10c3:b0:354:db1e:c4a8 with SMTP id
 s3-20020a05680810c300b00354db1ec4a8mr7945001ois.112.1665797916031; Fri, 14
 Oct 2022 18:38:36 -0700 (PDT)
MIME-Version: 1.0
References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-2-guoren@kernel.org>
 <20221013203544.110a143c@kernel.org> <CAJF2gTQyMHNHLizeU-gvUdA5hRLUWxvHXuVVqSoPg3M_WxPPdw@mail.gmail.com>
 <20221014085219.635d25cd@kernel.org>
In-Reply-To: <20221014085219.635d25cd@kernel.org>
From:   Guo Ren <guoren@kernel.org>
Date:   Sat, 15 Oct 2022 09:38:24 +0800
X-Gmail-Original-Message-ID: <CAJF2gTQtZOHgN7eJ-nhwF3RMUzJUC=ZjOnRzoR11Fso2b3z3gQ@mail.gmail.com>
Message-ID: <CAJF2gTQtZOHgN7eJ-nhwF3RMUzJUC=ZjOnRzoR11Fso2b3z3gQ@mail.gmail.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
To:     Jakub Kicinski <kuba@kernel.org>
Cc:     andriy.shevchenko@linux.intel.com, davem@davemloft.net,
        edumazet@google.com, pabeni@redhat.com, linux@rasmusvillemoes.dk,
        yury.norov@gmail.com, caraitto@google.com, willemb@google.com,
        jonolson@google.com, amritha.nambiar@intel.com,
        linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>
Content-Type: text/plain; charset="UTF-8"
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Fri, Oct 14, 2022 at 11:52 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 14 Oct 2022 14:38:56 +0800 Guo Ren wrote:
> > > This does not look equivalent, have you tested it?
> > >
> > > nr_ids is unsigned, doesn't it mean we'll never enter the loop?
> >
> > Yes, you are right. Any unsigned int would break the result.
> > (gdb) p (int)-1 < (int)2
> > $1 = 1
> > (gdb) p (int)-1 < (unsigned int)2
> > $2 = 0
> > (gdb) p (unsigned int)-1 < (int)2
> > $4 = 0
> >
> > So it should be:
> >  -     for (j = -1; j = netif_attrmask_next_and(j, online_mask, mask, nr_ids),
> >  -          j < nr_ids;) {
> >  +     for (j = -1; j < (int)nr_ids;
> >  +          j = netif_attrmask_next_and(j, online_mask, mask, nr_ids)) {
> >
> > Right? Of cause, nr_ids couldn't be 0xffffffff (-1).
>
> No. You can't enter the loop with -1 as the iterator either.
> Let's move on.
Oops, how about the below:
     for (j = netif_attrmask_next_and(-1, online_mask, mask, nr_ids);
j < (int)nr_ids;
          j = netif_attrmask_next_and(j, online_mask, mask, nr_ids)) {


-- 
Best Regards
 Guo Ren

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 AF4CAC4332F
	for <linux-kernel@archiver.kernel.org>; Sat, 15 Oct 2022 01:41:29 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S229665AbiJOBl1 (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Fri, 14 Oct 2022 21:41:27 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59170 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S229602AbiJOBlY (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Fri, 14 Oct 2022 21:41:24 -0400
Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545A592CDA;
        Fri, 14 Oct 2022 18:41:23 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by dfw.source.kernel.org (Postfix) with ESMTPS id E622C61CEE;
        Sat, 15 Oct 2022 01:41:22 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 538A8C4347C;
        Sat, 15 Oct 2022 01:41:22 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665798082;
        bh=wKhQf1jqlDwn101ASuQdn4i1qM4vzK+c1GxsBmywSQE=;
        h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
        b=G7EP7ym7Xq40DSKKFk1FnlCqWb0kWyOonZjQwcrLxsSebr0hWQlSrXTiJIlc4rLiY
         wtLZQXubG00pUCZxw/3VdZsZF20feD8oOMmcVrgTnfZRY2A1CXb4Kp81Qo533K1xfE
         ZVWIt/TZU2VivgMENujtqrGWLfngOyA4BBzpRkk5apvtI+9619fDtu/iH+1qWwDVWT
         FxoIdFOQ4Ugot94sKDQdOToiEBSRWqBXkC1Yr/RVxtre3O3qJ4wNjIBmyU9tIfWqfs
         eb4AFh7oZdXwpminI3b60Vk3hV+Ez1Tl2w+w30/nCZ5avaQHhBpJ4de2yqfPZapBv2
         LqYUQMkbtKL3A==
Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-132af5e5543so7820511fac.8;
        Fri, 14 Oct 2022 18:41:22 -0700 (PDT)
X-Gm-Message-State: ACrzQf39f/0K61B4XZR+eU0LZrfTOKEKVJ0PZg9hVwjLrmnLxPNopFoR
        qSc2OkJ8eiltTyftFLyar6dYrka+E6RRC4D6cS0=
X-Google-Smtp-Source: AMsMyM4X/8fOrngND6837Iu7qJtRPT17SJfoi8d7p/Zi7lOb6CQClanTVDO2W4a/68EOGJB1oXZitLhLUCHPN74oDB8=
X-Received: by 2002:a05:6870:4413:b0:136:66cc:6af8 with SMTP id
 u19-20020a056870441300b0013666cc6af8mr10179246oah.112.1665798081415; Fri, 14
 Oct 2022 18:41:21 -0700 (PDT)
MIME-Version: 1.0
References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-2-guoren@kernel.org>
 <20221013203544.110a143c@kernel.org> <20221013203911.2705eccc@kernel.org>
 <Y0jowX4zIZMMVc0H@yury-laptop> <20221014090311.392e0546@kernel.org>
In-Reply-To: <20221014090311.392e0546@kernel.org>
From:   Guo Ren <guoren@kernel.org>
Date:   Sat, 15 Oct 2022 09:41:09 +0800
X-Gmail-Original-Message-ID: <CAJF2gTSQ++HkY8=vhgN7+sqETjvbxNTuKLb_wLU=U90mUmUHFg@mail.gmail.com>
Message-ID: <CAJF2gTSQ++HkY8=vhgN7+sqETjvbxNTuKLb_wLU=U90mUmUHFg@mail.gmail.com>
Subject: Re: [PATCH V2 1/2] net: Fixup netif_attrmask_next_and warning
To:     Jakub Kicinski <kuba@kernel.org>
Cc:     Yury Norov <yury.norov@gmail.com>,
        andriy.shevchenko@linux.intel.com, davem@davemloft.net,
        edumazet@google.com, pabeni@redhat.com, linux@rasmusvillemoes.dk,
        caraitto@google.com, willemb@google.com, jonolson@google.com,
        amritha.nambiar@intel.com, linux-kernel@vger.kernel.org,
        netdev@vger.kernel.org, Guo Ren <guoren@linux.alibaba.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Sat, Oct 15, 2022 at 12:03 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Thu, 13 Oct 2022 21:42:41 -0700 Yury Norov wrote:
> > > Oh, it was reposted today:
> > >
> > > https://lore.kernel.org/all/20221013234349.1165689-2-yury.norov@gmail=
.com/
> > >
> > > But we need a revert of 854701ba4c as well to cover the issue back up
> > > for 6.1, AFAIU.
> >
> > The patch 854701ba4c is technically correct. I fixed most of warnings i=
n
> > advance, but nobody can foresee everything, right? I expected some nois=
e,
> > and now we have just a few things to fix.
>
> I got 6 warnings booting my machine after pulling back from Linus
> (which included your patches in net for the first time).
> And that's not including the XPS and the virtio warning.
Oh, that's a wide effect than we thought.

>
> > This is what for -rc releases exist, didn't they?
> >
> > I suggest to keep the patch, because this is the only way to make
> > cpumask_check()-related issues visible to people. If things will go as
> > they go now, I expect that -rc3 will be clean from cpumask_check()
> > warnings.
>
> This sounds too close to saying that "it's okay for -rc1 to be broken".
> Why were your changes not in linux-next for a month before the merge
> window? :(
>
> We will not be merging a refactoring series into net to silence an
> arguably over-eager warning. We need a minimal fix, Guo Ren's patches
> seem to miss the mark so I reckon the best use of everyone's time is
> to just drop the exposing patch and retry in -next =F0=9F=A4=B7



--=20
Best Regards
 Guo Ren

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 2BC02C4332F
	for <linux-kernel@archiver.kernel.org>; Mon, 17 Oct 2022 02:01:22 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S230185AbiJQCBT (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Sun, 16 Oct 2022 22:01:19 -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
        <rfc822;linux-kernel@vger.kernel.org>);
        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 <xuanzhuo@linux.alibaba.com>
To:     guoren@kernel.org
Cc:     linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>,
        Guo Ren <guoren@kernel.org>, 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>
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, 13 Oct 2022 23:04:59 -0400, guoren@kernel.org wrote:
> From: Guo Ren <guoren@linux.alibaba.com>
>
> 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
> [<ffffffff805d84ca>] virtnet_set_affinity+0x1ba/0x1fc
> [<ffffffff805da7ac>] virtnet_probe+0x832/0xf1e
> [<ffffffff804fe61c>] virtio_dev_probe+0x164/0x2de
> [<ffffffff8054c4c4>] really_probe+0x82/0x224
> [<ffffffff8054c6c0>] __driver_probe_device+0x5a/0xaa
> [<ffffffff8054c73c>] driver_probe_device+0x2c/0xb8
> [<ffffffff8054cd66>] __driver_attach+0x76/0x108
> [<ffffffff8054a482>] bus_for_each_dev+0x52/0x9a
> [<ffffffff8054be8c>] driver_attach+0x1a/0x28
> [<ffffffff8054b996>] bus_add_driver+0x154/0x1c2
> [<ffffffff8054d592>] driver_register+0x52/0x108
> [<ffffffff804fe120>] register_virtio_driver+0x1c/0x2c
> [<ffffffff80a29142>] virtio_net_driver_init+0x7a/0xb0
> [<ffffffff80002854>] do_one_initcall+0x66/0x2e4
> [<ffffffff80a01222>] kernel_init_freeable+0x28a/0x304
> [<ffffffff808cb1be>] kernel_init+0x1e/0x110
> [<ffffffff80003c4e>] ret_from_exception+0x0/0x10
> ---[ end trace 0000000000000000 ]---
>
> Fixes: 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
> Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> Signed-off-by: Guo Ren <guoren@kernel.org>
> ---
>  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
>

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 604B0C433FE
	for <linux-kernel@archiver.kernel.org>; Mon, 17 Oct 2022 02:47:20 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S231348AbiJQCrR (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Sun, 16 Oct 2022 22:47:17 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41972 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S231340AbiJQCrO (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Sun, 16 Oct 2022 22:47:14 -0400
Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F2BB32A94;
        Sun, 16 Oct 2022 19:47:13 -0700 (PDT)
Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140])
        (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
        (No client certificate requested)
        by dfw.source.kernel.org (Postfix) with ESMTPS id DFF1160EDE;
        Mon, 17 Oct 2022 02:47:12 +0000 (UTC)
Received: by smtp.kernel.org (Postfix) with ESMTPSA id 510B6C43470;
        Mon, 17 Oct 2022 02:47:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;
        s=k20201202; t=1665974832;
        bh=ypxAg+O7mH3i+8DecFdqTk3eEFBZSUQm3ax++cEOL0E=;
        h=References:In-Reply-To:From:Date:Subject:To:Cc:From;
        b=tmm11IuPP58CR7OL26Hyokf7S84NTRiNl0pnLEhhqgmr/wGVgFhjomA5tMMyinAOU
         ujpgsaISg6xw6eu/k+lPaV0hH8wYlE6ikX9/1MZyN/mf+EsfVQlwg1+wMd8jBK2tD3
         Rice8JnCXfJRUrFr3zvmgIbc2q3pOXxUSooMhMY06D01DgiOP3xRs5cX0EoMY2DiIc
         siei2OxjIoD+L9LmoNy5pkTVnxhnaJV8OAm0p+5fU8VTPXfAalfdUlYkTKfe1ylCAk
         cFU6PQeNrFwPIuKSYZX2mWwWSS4o5UcABIWOb+AJvT7F3TGpDPYT0DHwzO1BSix1CC
         zu51YLFbLV8hw==
Received: by mail-oo1-f54.google.com with SMTP id s1-20020a4a81c1000000b0047d5e28cdc0so2449187oog.12;
        Sun, 16 Oct 2022 19:47:12 -0700 (PDT)
X-Gm-Message-State: ACrzQf048yk+diViANch2y8ldg0qyZ0SgE/+oKWpe8F+y8ZQDXbRvsXU
        xldBPYE4DEhV+kkRzXvRD68jVHN7BLl0kKKYTlU=
X-Google-Smtp-Source: AMsMyM6aQL75voyyFEOZLq0dR0mBGdU9SmCnFtAbjZZiZP+F39r9LHAElMex+yP1f02AG56czAYtz0wa7y1cVzvPeDw=
X-Received: by 2002:a4a:4f84:0:b0:480:8515:ff8d with SMTP id
 c126-20020a4a4f84000000b004808515ff8dmr3375599oob.31.1665974831458; Sun, 16
 Oct 2022 19:47:11 -0700 (PDT)
MIME-Version: 1.0
References: <20221014030459.3272206-1-guoren@kernel.org> <20221014030459.3272206-3-guoren@kernel.org>
 <1665971921.4555926-1-xuanzhuo@linux.alibaba.com>
In-Reply-To: <1665971921.4555926-1-xuanzhuo@linux.alibaba.com>
From:   Guo Ren <guoren@kernel.org>
Date:   Mon, 17 Oct 2022 10:46:59 +0800
X-Gmail-Original-Message-ID: <CAJF2gTRYr4XyaHR14_h5tmHpdpnh5j75MeP2V6Au1p3qpABnDQ@mail.gmail.com>
Message-ID: <CAJF2gTRYr4XyaHR14_h5tmHpdpnh5j75MeP2V6Au1p3qpABnDQ@mail.gmail.com>
Subject: Re: [PATCH V2 2/2] net: Fixup virtnet_set_affinity() cause cpumask warning
To:     Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Cc:     linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>,
        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
Content-Type: text/plain; charset="UTF-8"
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Mon, Oct 17, 2022 at 10:00 AM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
>
> On Thu, 13 Oct 2022 23:04:59 -0400, guoren@kernel.org wrote:
> > From: Guo Ren <guoren@linux.alibaba.com>
> >
> > 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
> > [<ffffffff805d84ca>] virtnet_set_affinity+0x1ba/0x1fc
> > [<ffffffff805da7ac>] virtnet_probe+0x832/0xf1e
> > [<ffffffff804fe61c>] virtio_dev_probe+0x164/0x2de
> > [<ffffffff8054c4c4>] really_probe+0x82/0x224
> > [<ffffffff8054c6c0>] __driver_probe_device+0x5a/0xaa
> > [<ffffffff8054c73c>] driver_probe_device+0x2c/0xb8
> > [<ffffffff8054cd66>] __driver_attach+0x76/0x108
> > [<ffffffff8054a482>] bus_for_each_dev+0x52/0x9a
> > [<ffffffff8054be8c>] driver_attach+0x1a/0x28
> > [<ffffffff8054b996>] bus_add_driver+0x154/0x1c2
> > [<ffffffff8054d592>] driver_register+0x52/0x108
> > [<ffffffff804fe120>] register_virtio_driver+0x1c/0x2c
> > [<ffffffff80a29142>] virtio_net_driver_init+0x7a/0xb0
> > [<ffffffff80002854>] do_one_initcall+0x66/0x2e4
> > [<ffffffff80a01222>] kernel_init_freeable+0x28a/0x304
> > [<ffffffff808cb1be>] kernel_init+0x1e/0x110
> > [<ffffffff80003c4e>] ret_from_exception+0x0/0x10
> > ---[ end trace 0000000000000000 ]---
> >
> > Fixes: 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
> > Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> > Signed-off-by: Guo Ren <guoren@kernel.org>
> > ---
> >  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).
Yes, it would lose cpu[nr_cpu_ids - 1]. We've moved to reverting the
patch to fix problem:
https://lore.kernel.org/all/20221015130548.3634468-1-guoren@kernel.org/


>
> Thanks.
>
>
> >                       cpu = cpumask_next_wrap(cpu, cpu_online_mask,
> >                                               nr_cpu_ids, false);
> >               }
> > --
> > 2.36.1
> >



-- 
Best Regards
 Guo Ren

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@kernel.org>
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 886F4C433FE
	for <linux-kernel@archiver.kernel.org>; Mon, 17 Oct 2022 02:58:31 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
        id S231637AbiJQC62 (ORCPT <rfc822;linux-kernel@archiver.kernel.org>);
        Sun, 16 Oct 2022 22:58:28 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35142 "EHLO
        lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
        with ESMTP id S231624AbiJQC60 (ORCPT
        <rfc822;linux-kernel@vger.kernel.org>);
        Sun, 16 Oct 2022 22:58:26 -0400
Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131])
        by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D21C848E85;
        Sun, 16 Oct 2022 19:58:24 -0700 (PDT)
X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=xuanzhuo@linux.alibaba.com;NM=1;PH=DS;RN=15;SR=0;TI=SMTPD_---0VSGBvZK_1665975500;
Received: from localhost(mailfrom:xuanzhuo@linux.alibaba.com fp:SMTPD_---0VSGBvZK_1665975500)
          by smtp.aliyun-inc.com;
          Mon, 17 Oct 2022 10:58:21 +0800
Message-ID: <1665975482.5061383-1-xuanzhuo@linux.alibaba.com>
Subject: Re: [PATCH V2 2/2] net: Fixup virtnet_set_affinity() cause cpumask warning
Date:   Mon, 17 Oct 2022 10:58:02 +0800
From:   Xuan Zhuo <xuanzhuo@linux.alibaba.com>
To:     Guo Ren <guoren@kernel.org>
Cc:     linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
        Guo Ren <guoren@linux.alibaba.com>,
        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>
 <1665971921.4555926-1-xuanzhuo@linux.alibaba.com>
 <CAJF2gTRYr4XyaHR14_h5tmHpdpnh5j75MeP2V6Au1p3qpABnDQ@mail.gmail.com>
In-Reply-To: <CAJF2gTRYr4XyaHR14_h5tmHpdpnh5j75MeP2V6Au1p3qpABnDQ@mail.gmail.com>
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Mon, 17 Oct 2022 10:46:59 +0800, Guo Ren <guoren@kernel.org> wrote:
> On Mon, Oct 17, 2022 at 10:00 AM Xuan Zhuo <xuanzhuo@linux.alibaba.com> wrote:
> >
> > On Thu, 13 Oct 2022 23:04:59 -0400, guoren@kernel.org wrote:
> > > From: Guo Ren <guoren@linux.alibaba.com>
> > >
> > > 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
> > > [<ffffffff805d84ca>] virtnet_set_affinity+0x1ba/0x1fc
> > > [<ffffffff805da7ac>] virtnet_probe+0x832/0xf1e
> > > [<ffffffff804fe61c>] virtio_dev_probe+0x164/0x2de
> > > [<ffffffff8054c4c4>] really_probe+0x82/0x224
> > > [<ffffffff8054c6c0>] __driver_probe_device+0x5a/0xaa
> > > [<ffffffff8054c73c>] driver_probe_device+0x2c/0xb8
> > > [<ffffffff8054cd66>] __driver_attach+0x76/0x108
> > > [<ffffffff8054a482>] bus_for_each_dev+0x52/0x9a
> > > [<ffffffff8054be8c>] driver_attach+0x1a/0x28
> > > [<ffffffff8054b996>] bus_add_driver+0x154/0x1c2
> > > [<ffffffff8054d592>] driver_register+0x52/0x108
> > > [<ffffffff804fe120>] register_virtio_driver+0x1c/0x2c
> > > [<ffffffff80a29142>] virtio_net_driver_init+0x7a/0xb0
> > > [<ffffffff80002854>] do_one_initcall+0x66/0x2e4
> > > [<ffffffff80a01222>] kernel_init_freeable+0x28a/0x304
> > > [<ffffffff808cb1be>] kernel_init+0x1e/0x110
> > > [<ffffffff80003c4e>] ret_from_exception+0x0/0x10
> > > ---[ end trace 0000000000000000 ]---
> > >
> > > Fixes: 2ca653d607ce ("virtio_net: Stripe queue affinities across cores.")
> > > Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
> > > Signed-off-by: Guo Ren <guoren@kernel.org>
> > > ---
> > >  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).
> Yes, it would lose cpu[nr_cpu_ids - 1]. We've moved to reverting the
> patch to fix problem:
> https://lore.kernel.org/all/20221015130548.3634468-1-guoren@kernel.org/

Great!!

Thanks.


>
>
> >
> > Thanks.
> >
> >
> > >                       cpu = cpumask_next_wrap(cpu, cpu_online_mask,
> > >                                               nr_cpu_ids, false);
> > >               }
> > > --
> > > 2.36.1
> > >
>
>
>
> --
> Best Regards
>  Guo Ren

