lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 18 Jul 2022 12:28:40 -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 12/16] time: optimize tick_check_percpu() tick_check_percpu() calls cpumask_equal() even if curdev->cpumask == cpumask_of(cpu). Fix it. Caught with CONFIG_DEBUG_BITMAP: [ 0.077622] Call trace: [ 0.077637] __bitmap_check_params+0x144/0x250 [ 0.077675] tick_check_replacement+0xac/0x320 [ 0.077716] tick_check_new_device+0x50/0x110 [ 0.077747] clockevents_register_device+0x74/0x1c0 [ 0.077779] dummy_timer_starting_cpu+0x6c/0x80 [ 0.077817] cpuhp_invoke_callback+0x104/0x20c [ 0.077856] cpuhp_invoke_callback_range+0x70/0xf0 [ 0.077890] notify_cpu_starting+0xac/0xcc [ 0.077921] secondary_start_kernel+0xe4/0x154 [ 0.077951] __secondary_switched+0xa0/0xa4 [ 0.077992] ---[ end trace 0000000000000000 ]--- [ 0.078021] b1: ffffbfec4703b890 [ 0.078031] b2: ffffbfec4703b890 [ 0.078043] b3: 0 [ 0.078052] nbits: 256 [ 0.078065] start: 0 [ 0.078075] off: 0 [ 0.078086] Bitmap: parameters check failed [ 0.078095] include/linux/bitmap.h [419]: bitmap_equal Signed-off-by: Yury Norov <yury.norov@...il.com> --- kernel/time/tick-common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index fdd5ae1a074b..7205f76f8d10 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -290,13 +290,15 @@ static bool tick_check_percpu(struct clock_event_device *curdev, { if (!cpumask_test_cpu(cpu, newdev->cpumask)) return false; - if (cpumask_equal(newdev->cpumask, cpumask_of(cpu))) + if (newdev->cpumask == cpumask_of(cpu) || + cpumask_equal(newdev->cpumask, cpumask_of(cpu))) return true; /* Check if irq affinity can be set */ if (newdev->irq >= 0 && !irq_can_set_affinity(newdev->irq)) return false; /* Prefer an existing cpu local device */ - if (curdev && cpumask_equal(curdev->cpumask, cpumask_of(cpu))) + if (curdev && (curdev->cpumask == cpumask_of(cpu) || + cpumask_equal(curdev->cpumask, cpumask_of(cpu)))) return false; return true; } -- 2.34.1
Powered by blists - more mailing lists