[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220718192844.1805158-10-yury.norov@gmail.com>
Date: Mon, 18 Jul 2022 12:28:37 -0700
From: Yury Norov <yury.norov@...il.com>
To: linux-kernel@...r.kernel.org,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Alexei Starovoitov <ast@...nel.org>,
Alexey Klimov <aklimov@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Andrii Nakryiko <andrii@...nel.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Ben Segall <bsegall@...gle.com>,
Christoph Lameter <cl@...ux.com>,
Dan Williams <dan.j.williams@...el.com>,
Daniel Borkmann <daniel@...earbox.net>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Dennis Zhou <dennis@...nel.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Eric Dumazet <edumazet@...gle.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Guenter Roeck <linux@...ck-us.net>,
Ingo Molnar <mingo@...hat.com>,
Isabella Basso <isabbasso@...eup.net>,
John Fastabend <john.fastabend@...il.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Juergen Gross <jgross@...e.com>,
Juri Lelli <juri.lelli@...hat.com>,
KP Singh <kpsingh@...nel.org>,
Kees Cook <keescook@...omium.org>,
Martin KaFai Lau <kafai@...com>,
Mel Gorman <mgorman@...e.de>, Miroslav Benes <mbenes@...e.cz>,
Nathan Chancellor <nathan@...nel.org>,
"Paul E . McKenney" <paulmck@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Song Liu <songliubraving@...com>,
Steven Rostedt <rostedt@...dmis.org>,
Tejun Heo <tj@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Valentin Schneider <vschneid@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Vlastimil Babka <vbabka@...e.cz>, Yonghong Song <yhs@...com>,
Yury Norov <yury.norov@...il.com>, linux-mm@...ck.org,
netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: [PATCH 09/16] irq: don't copy cpu affinity mask if source is equal to destination
irq_do_set_affinity() may be called with
mask == irq_data_to_desc()->irq_common_data.affinity
Copying in that case is useless.
Caught with CONFIG_DEBUG_BITMAP:
[ 1.089177] __bitmap_check_params+0x144/0x250
[ 1.089238] irq_do_set_affinity+0x120/0x470
[ 1.089298] irq_startup+0x140/0x16c
[ 1.089350] __setup_irq+0x668/0x760
[ 1.089402] request_threaded_irq+0xe8/0x1b0
[ 1.089474] vp_find_vqs_msix+0x270/0x410
[ 1.089532] vp_find_vqs+0x48/0x1b4
[ 1.089584] vp_modern_find_vqs+0x1c/0x70
[ 1.089641] init_vq+0x2dc/0x34c
[ 1.089690] virtblk_probe+0xdc/0x710
[ 1.089745] virtio_dev_probe+0x19c/0x270
[ 1.089802] really_probe.part.0+0x9c/0x2ac
[ 1.089863] __driver_probe_device+0x98/0x144
[ 1.089923] driver_probe_device+0xac/0x140
[ 1.089985] __driver_attach+0xf8/0x1a0
[ 1.090047] bus_for_each_dev+0x70/0xd0
[ 1.090101] driver_attach+0x24/0x30
[ 1.090153] bus_add_driver+0x150/0x200
[ 1.090208] driver_register+0x78/0x130
[ 1.090266] register_virtio_driver+0x28/0x40
[ 1.090329] virtio_blk_init+0x68/0xa4
[ 1.090400] do_one_initcall+0x50/0x1c0
[ 1.090471] kernel_init_freeable+0x208/0x28c
[ 1.090538] kernel_init+0x28/0x13c
[ 1.090590] ret_from_fork+0x10/0x20
[ 1.090642] ---[ end trace 0000000000000000 ]---
[ 1.090705] b1: ffff2ec742b85e18
[ 1.090710] b2: ffff2ec742b85e18
[ 1.090715] b3: 0
[ 1.090719] nbits: 256
[ 1.090723] start: 0
[ 1.090727] off: 0
Signed-off-by: Yury Norov <yury.norov@...il.com>
---
kernel/irq/manage.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 8c396319d5ac..f9c1b21584ec 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -284,7 +284,8 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
switch (ret) {
case IRQ_SET_MASK_OK:
case IRQ_SET_MASK_OK_DONE:
- cpumask_copy(desc->irq_common_data.affinity, mask);
+ if (desc->irq_common_data.affinity != mask)
+ cpumask_copy(desc->irq_common_data.affinity, mask);
fallthrough;
case IRQ_SET_MASK_OK_NOCOPY:
irq_validate_effective_affinity(data);
--
2.34.1
Powered by blists - more mailing lists