From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756945AbdKGWS0 (ORCPT ); Tue, 7 Nov 2017 17:18:26 -0500 Received: from mx0b-00190b01.pphosted.com ([67.231.157.127]:41272 "EHLO mx0b-00190b01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755935AbdKGWSY (ORCPT ); Tue, 7 Nov 2017 17:18:24 -0500 Subject: Re: [jump_label_test] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:761 jump_label_test+0x63/0xab To: Fengguang Wu , linux-kernel@vger.kernel.org Cc: Linus Torvalds , Peter Zijlstra , Ingo Molnar , Marc Zyngier , Paolo Bonzini , Thomas Gleixner References: <20171107092756.5gh7zpml7qz2bevb@wfg-t540p.sh.intel.com> From: Jason Baron Message-ID: Date: Tue, 7 Nov 2017 17:17:38 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171107092756.5gh7zpml7qz2bevb@wfg-t540p.sh.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-07_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711070291 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-11-07_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1711070292 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/07/2017 04:27 AM, Fengguang Wu wrote: > Hello, > > FYI this happens in v4.14-rc8 -- it's not necessarily a new bug. > Hi, So this looks like the branches aren't getting updated because the WARN_ON()s are all from the second half of the test loop (where we actually change the branch direction). I ran a kernel with a very similar .config on qemu-kvm/i386 as well, and was not able to trigger the WARN_ON(). Do you know if it happens on every boot or if there is some boot timing involved? You could try the patch below, to start to narrow down if this is a problem with jump table setup or with the update process. Thanks, -Jason diff --git a/kernel/jump_label.c b/kernel/jump_label.c index 0bf2e8f5..433cc94 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c @@ -364,8 +364,13 @@ static void __jump_label_update(struct static_key *key, * kernel_text_address() verifies we are not in core kernel * init code, see jump_label_invalidate_module_init(). */ - if (entry->code && kernel_text_address(entry->code)) + if (entry->code && kernel_text_address(entry->code)) { + printk("%s: key: 0x%lx, code: 0x%lx, target: 0x%lx\n", + __func__, (unsigned long)jump_entry_key(entry), + (unsigned long)entry->code, + (unsigned long)entry->target); arch_jump_label_transform(entry, jump_label_type(entry)); + } } } @@ -752,7 +757,9 @@ static __init int jump_label_test(void) WARN_ON(static_branch_likely(&sk_false)); WARN_ON(static_branch_unlikely(&sk_false)); + printk("jump_label: disable sk_true: %p\n", &sk_true); static_branch_disable(&sk_true); + printk("jump_label: enable sk_false: %p\n", &sk_false); static_branch_enable(&sk_false); WARN_ON(static_key_enabled(&sk_true.key) == true); @@ -763,7 +770,9 @@ static __init int jump_label_test(void) WARN_ON(!static_branch_likely(&sk_false)); WARN_ON(!static_branch_unlikely(&sk_false)); + printk("jump_label: enable sk_true: %p\n", &sk_true); static_branch_enable(&sk_true); + printk("jump_label: disable sk_false: %p\n", &sk_false); static_branch_disable(&sk_false); } > [ 15.214834] IRQ15 -> 0:15 > [ 15.214834] .................................... done. > [ 15.214834] Using IPI Shortcut mode > [ 15.214834] sched_clock: Marking stable (15210834346, 0)->(15797181340, -586346994) > [ 17.667168] ------------[ cut here ]------------ > [ 17.668895] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:761 jump_label_test+0x63/0xab > [ 17.672346] Modules linked in: > [ 17.673475] CPU: 0 PID: 1 Comm: swapper Not tainted 4.14.0-rc8 #29 > [ 17.675724] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > [ 17.678755] task: c0020d00 task.stack: c0022000 > [ 17.680423] EIP: jump_label_test+0x63/0xab > [ 17.681912] EFLAGS: 00210202 CPU: 0 > [ 17.683206] EAX: 00000001 EBX: 00000002 ECX: 00000004 EDX: 00000000 > [ 17.685501] ESI: c9918db6 EDI: 00000000 EBP: 00000000 ESP: c0023f40 > [ 17.687787] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > [ 17.689748] CR0: 80050033 CR2: 00000000 CR3: 09991000 CR4: 000006b0 > [ 17.692019] Call Trace: > [ 17.692938] ? do_one_initcall+0x2c/0x13a > [ 17.694398] ? parse_args+0x1af/0x300 > [ 17.695740] ? kernel_init_freeable+0xce/0x161 > [ 17.697370] ? kernel_init_freeable+0xee/0x161 > [ 17.698986] ? rest_init+0xb0/0xb0 > [ 17.700236] ? kernel_init+0x5/0xe0 > [ 17.701513] ? ret_from_fork+0x19/0x30 > [ 17.702876] Code: c9 e8 3c 59 7b ff b8 5c cf 08 ca e8 a2 58 7b ff a1 60 bc 8a c9 85 c0 74 02 0f ff a1 5c cf 08 ca 85 c0 75 02 0f ff 3e 8d 74 26 00 <0f> ff e9 35 00 00 00 e9 34 00 00 00 3e 8d 74 26 00 0f ff b8 60 > [ 17.709721] ---[ end trace f18711bfa2b1114e ]--- > [ 17.711418] ------------[ cut here ]------------ > [ 17.711418] ------------[ cut here ]------------ > [ 17.713092] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:762 jump_label_test+0x9f/0xab > [ 17.716534] Modules linked in: > [ 17.717665] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.14.0-rc8 #29 > [ 17.720349] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > [ 17.723362] task: c0020d00 task.stack: c0022000 > [ 17.725004] EIP: jump_label_test+0x9f/0xab > [ 17.726516] EFLAGS: 00210202 CPU: 0 > [ 17.727785] EAX: 00000001 EBX: 00000002 ECX: 00000004 EDX: 00000000 > [ 17.730058] ESI: c9918db6 EDI: 00000000 EBP: 00000000 ESP: c0023f40 > [ 17.732341] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > [ 17.734300] CR0: 80050033 CR2: 00000000 CR3: 09991000 CR4: 000006b0 > [ 17.736560] Call Trace: > [ 17.737476] ? do_one_initcall+0x2c/0x13a > [ 17.738943] ? parse_args+0x1af/0x300 > [ 17.740326] ? kernel_init_freeable+0xce/0x161 > [ 17.741943] ? kernel_init_freeable+0xee/0x161 > [ 17.743571] ? rest_init+0xb0/0xb0 > [ 17.744820] ? kernel_init+0x5/0xe0 > [ 17.746095] ? ret_from_fork+0x19/0x30 > [ 17.747474] Code: 0f ff b8 60 bc 8a c9 e8 6a 58 7b ff b8 5c cf 08 ca e8 f0 58 7b ff 4b 74 1a bb 01 00 00 00 e9 6f ff ff ff 0f ff eb 86 0f ff eb 95 <0f> ff eb c7 0f ff eb c8 31 c0 5b c3 b8 68 bc 8a c9 e9 25 d4 77 > [ 17.754356] ---[ end trace f18711bfa2b1114f ]--- > [ 17.755649] ------------[ cut here ]------------ > [ 17.755649] ------------[ cut here ]------------ > [ 17.756863] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:763 jump_label_test+0xa3/0xab > [ 17.759289] Modules linked in: > [ 17.760082] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.14.0-rc8 #29 > [ 17.761983] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > [ 17.764723] task: c0020d00 task.stack: c0022000 > [ 17.766378] EIP: jump_label_test+0xa3/0xab > [ 17.767470] EFLAGS: 00210202 CPU: 0 > [ 17.769223] EAX: 00000001 EBX: 00000002 ECX: 00000004 EDX: 00000000 > [ 17.771188] ESI: c9918db6 EDI: 00000000 EBP: 00000000 ESP: c0023f40 > [ 17.773495] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > [ 17.774916] CR0: 80050033 CR2: 00000000 CR3: 09991000 CR4: 000006b0 > [ 17.776576] Call Trace: > [ 17.777249] ? do_one_initcall+0x2c/0x13a > [ 17.778318] ? parse_args+0x1af/0x300 > [ 17.779292] ? kernel_init_freeable+0xce/0x161 > [ 17.780443] ? kernel_init_freeable+0xee/0x161 > [ 17.781558] ? rest_init+0xb0/0xb0 > [ 17.782463] ? kernel_init+0x5/0xe0 > [ 17.783394] ? ret_from_fork+0x19/0x30 > [ 17.784376] Code: bc 8a c9 e8 6a 58 7b ff b8 5c cf 08 ca e8 f0 58 7b ff 4b 74 1a bb 01 00 00 00 e9 6f ff ff ff 0f ff eb 86 0f ff eb 95 0f ff eb c7 <0f> ff eb c8 31 c0 5b c3 b8 68 bc 8a c9 e9 25 d4 77 ff 80 3d a0 > [ 17.789290] ---[ end trace f18711bfa2b11150 ]--- > [ 17.790487] ------------[ cut here ]------------ > [ 17.790487] ------------[ cut here ]------------ > [ 17.792555] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:764 jump_label_test+0x74/0xab > [ 17.796930] Modules linked in: > [ 17.798391] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.14.0-rc8 #29 > [ 17.801754] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > [ 17.805496] task: c0020d00 task.stack: c0022000 > [ 17.806702] EIP: jump_label_test+0x74/0xab > [ 17.807786] EFLAGS: 00210202 CPU: 0 > [ 17.808726] EAX: 00000001 EBX: 00000002 ECX: 00000004 EDX: 00000000 > [ 17.810368] ESI: c9918db6 EDI: 00000000 EBP: 00000000 ESP: c0023f40 > [ 17.811994] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > [ 17.813424] CR0: 80050033 CR2: 00000000 CR3: 09991000 CR4: 000006b0 > [ 17.815063] Call Trace: > [ 17.815748] ? do_one_initcall+0x2c/0x13a > [ 17.816822] ? parse_args+0x1af/0x300 > [ 17.817812] ? kernel_init_freeable+0xce/0x161 > [ 17.818986] ? kernel_init_freeable+0xee/0x161 > [ 17.820172] ? rest_init+0xb0/0xb0 > [ 17.821081] ? kernel_init+0x5/0xe0 > [ 17.822033] ? ret_from_fork+0x19/0x30 > [ 17.823051] Code: 60 bc 8a c9 85 c0 74 02 0f ff a1 5c cf 08 ca 85 c0 75 02 0f ff 3e 8d 74 26 00 0f ff e9 35 00 00 00 e9 34 00 00 00 3e 8d 74 26 00 <0f> ff b8 60 bc 8a c9 e8 6a 58 7b ff b8 5c cf 08 ca e8 f0 58 7b > [ 17.828103] ---[ end trace f18711bfa2b11151 ]--- > [ 17.829379] ------------[ cut here ]------------ > [ 17.829379] ------------[ cut here ]------------ > [ 17.830622] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:761 jump_label_test+0x63/0xab > [ 17.833131] Modules linked in: > [ 17.833973] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.14.0-rc8 #29 > [ 17.835923] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > [ 17.838126] task: c0020d00 task.stack: c0022000 > [ 17.839355] EIP: jump_label_test+0x63/0xab > [ 17.840447] EFLAGS: 00210202 CPU: 0 > [ 17.841384] EAX: 00000001 EBX: 00000001 ECX: 00000004 EDX: 00000000 > [ 17.843034] ESI: c9918db6 EDI: 00000000 EBP: 00000000 ESP: c0023f40 > [ 17.844698] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > [ 17.846127] CR0: 80050033 CR2: 00000000 CR3: 09991000 CR4: 000006b0 > [ 17.847794] Call Trace: > [ 17.848472] ? do_one_initcall+0x2c/0x13a > [ 17.849547] ? parse_args+0x1af/0x300 > [ 17.850590] ? kernel_init_freeable+0xce/0x161 > [ 17.851783] ? kernel_init_freeable+0xee/0x161 > [ 17.852977] ? rest_init+0xb0/0xb0 > [ 17.854277] ? kernel_init+0x5/0xe0 > [ 17.855571] ? ret_from_fork+0x19/0x30 > [ 17.856955] Code: c9 e8 3c 59 7b ff b8 5c cf 08 ca e8 a2 58 7b ff a1 60 bc 8a c9 85 c0 74 02 0f ff a1 5c cf 08 ca 85 c0 75 02 0f ff 3e 8d 74 26 00 <0f> ff e9 35 00 00 00 e9 34 00 00 00 3e 8d 74 26 00 0f ff b8 60 > [ 17.863904] ---[ end trace f18711bfa2b11152 ]--- > [ 17.865629] ------------[ cut here ]------------ > [ 17.865629] ------------[ cut here ]------------ > [ 17.867438] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:762 jump_label_test+0x9f/0xab > [ 17.871148] Modules linked in: > [ 17.872450] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.14.0-rc8 #29 > [ 17.875124] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > [ 17.878364] task: c0020d00 task.stack: c0022000 > [ 17.880027] EIP: jump_label_test+0x9f/0xab > [ 17.881544] EFLAGS: 00210202 CPU: 0 > [ 17.882901] EAX: 00000001 EBX: 00000001 ECX: 00000004 EDX: 00000000 > [ 17.885473] ESI: c9918db6 EDI: 00000000 EBP: 00000000 ESP: c0023f40 > [ 17.887934] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > [ 17.890009] CR0: 80050033 CR2: 00000000 CR3: 09991000 CR4: 000006b0 > [ 17.892339] Call Trace: > [ 17.893316] ? do_one_initcall+0x2c/0x13a > [ 17.894822] ? parse_args+0x1af/0x300 > [ 17.896911] ? kernel_init_freeable+0xce/0x161 > [ 17.899626] ? kernel_init_freeable+0xee/0x161 > [ 17.902732] ? rest_init+0xb0/0xb0 > [ 17.904894] ? kernel_init+0x5/0xe0 > [ 17.907031] ? ret_from_fork+0x19/0x30 > [ 17.909383] Code: 0f ff b8 60 bc 8a c9 e8 6a 58 7b ff b8 5c cf 08 ca e8 f0 58 7b ff 4b 74 1a bb 01 00 00 00 e9 6f ff ff ff 0f ff eb 86 0f ff eb 95 <0f> ff eb c7 0f ff eb c8 31 c0 5b c3 b8 68 bc 8a c9 e9 25 d4 77 > [ 17.928301] ---[ end trace f18711bfa2b11153 ]--- > [ 17.931515] ------------[ cut here ]------------ > [ 17.931515] ------------[ cut here ]------------ > [ 17.943868] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:763 jump_label_test+0xa3/0xab > [ 17.950147] Modules linked in: > [ 17.952135] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.14.0-rc8 #29 > [ 17.956297] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > [ 17.964556] task: c0020d00 task.stack: c0022000 > [ 17.985804] EIP: jump_label_test+0xa3/0xab > [ 17.988269] EFLAGS: 00210202 CPU: 0 > [ 17.990407] EAX: 00000001 EBX: 00000001 ECX: 00000004 EDX: 00000000 > [ 17.996820] ESI: c9918db6 EDI: 00000000 EBP: 00000000 ESP: c0023f40 > [ 18.000174] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > [ 18.003505] CR0: 80050033 CR2: 00000000 CR3: 09991000 CR4: 000006b0 > [ 18.007251] Call Trace: > [ 18.008897] ? do_one_initcall+0x2c/0x13a > [ 18.016611] ? parse_args+0x1af/0x300 > [ 18.018854] ? kernel_init_freeable+0xce/0x161 > [ 18.021573] ? kernel_init_freeable+0xee/0x161 > [ 18.024418] ? rest_init+0xb0/0xb0 > [ 18.026326] ? kernel_init+0x5/0xe0 > [ 18.028418] ? ret_from_fork+0x19/0x30 > [ 18.031569] Code: bc 8a c9 e8 6a 58 7b ff b8 5c cf 08 ca e8 f0 58 7b ff 4b 74 1a bb 01 00 00 00 e9 6f ff ff ff 0f ff eb 86 0f ff eb 95 0f ff eb c7 <0f> ff eb c8 31 c0 5b c3 b8 68 bc 8a c9 e9 25 d4 77 ff 80 3d a0 > [ 18.050687] ---[ end trace f18711bfa2b11154 ]--- > [ 18.060661] ------------[ cut here ]------------ > [ 18.060661] ------------[ cut here ]------------ > [ 18.064196] WARNING: CPU: 0 PID: 1 at kernel/jump_label.c:764 jump_label_test+0x74/0xab > [ 18.076475] Modules linked in: > [ 18.083657] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.14.0-rc8 #29 > [ 18.101662] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014 > [ 18.109794] task: c0020d00 task.stack: c0022000 > [ 18.112995] EIP: jump_label_test+0x74/0xab > [ 18.115714] EFLAGS: 00210202 CPU: 0 > [ 18.118265] EAX: 00000001 EBX: 00000001 ECX: 00000004 EDX: 00000000 > [ 18.125065] ESI: c9918db6 EDI: 00000000 EBP: 00000000 ESP: c0023f40 > [ 18.128653] DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068 > [ 18.130955] CR0: 80050033 CR2: 00000000 CR3: 09991000 CR4: 000006b0 > [ 18.136512] Call Trace: > [ 18.137684] ? do_one_initcall+0x2c/0x13a > [ 18.141253] ? parse_args+0x1af/0x300 > [ 18.143612] ? kernel_init_freeable+0xce/0x161 > [ 18.146407] ? kernel_init_freeable+0xee/0x161 > [ 18.149921] ? rest_init+0xb0/0xb0 > [ 18.151599] ? kernel_init+0x5/0xe0 > [ 18.153257] ? ret_from_fork+0x19/0x30 > [ 18.155487] Code: 60 bc 8a c9 85 c0 74 02 0f ff a1 5c cf 08 ca 85 c0 75 02 0f ff 3e 8d 74 26 00 0f ff e9 35 00 00 00 e9 34 00 00 00 3e 8d 74 26 00 <0f> ff b8 60 bc 8a c9 e8 6a 58 7b ff b8 5c cf 08 ca e8 f0 58 7b > [ 18.167223] ---[ end trace f18711bfa2b11155 ]--- > > Attached the full dmesg and kconfig. > > Thanks, > Fengguang >