Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp323342rdb; Thu, 1 Feb 2024 09:25:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IExHxCX8Ql3ioh8S9AWBRtiDCMCpzeqQrq7N5laIMBYNNk3PTCtborPJJyZ3ZXdarfyNtu7 X-Received: by 2002:a17:90a:a617:b0:296:c0c:98f5 with SMTP id c23-20020a17090aa61700b002960c0c98f5mr2746495pjq.40.1706808332767; Thu, 01 Feb 2024 09:25:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706808332; cv=pass; d=google.com; s=arc-20160816; b=Wa/f/+/dfiociOPnuFB5bXO8kFOGLaCFjpcYUzknmvnMBZEYN56YLyKcyslOY18qZN Rdb7gOHgjokdzCWtD+yrnV9OQqVfE+r3mq/GSlZlRXuNpJAisqiXeb6LdULwkLGCwd4K 2kFohq9AQ7TCX4B8lue6CKNI6tPazPsyN3p5I1X7SvJDFzJYGWtnMLPxfa+VRtQlapuE jFfxhKjjWQSLtVOGJHbeSLEzjYqgr17jqRJC381gFeOFvF75rL6FshqJijiZjBpOJlx1 NJMZmBZhjYP5k8KkcmHmLeHyfWMleadaPjpSfWe2+24A2Ecrsl/3MxgeNbhchFGohFGV qC4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=7MquBRSp8M5XSTS7JrS9IGiTmm1hSPD8OPV9NUrrkqk=; fh=FuK4rGoxj+rUxmiQQTJoWlBoeJf7Xb7GZVAcnoF9Ulc=; b=pqQGKusmgb5pkQGu1aKpA7MlOsVDFWtdC/fkQcBu5RzTxKAnDskAGt6gjDwSzGdfP2 WTK95BKCdzmI9AuJ8hI5FnmO5lBm92mVb3BNhbkwcw4r7AawNyQrWOmUFd4jloYFAHQX kZRNFE7mggnPBiwV2CC9QSDTATKKUOoRLdiWAVWCzDrXqbGqj/6Ra7kGoJynY0IFtkP2 Rib83+qriVqAXuzMGclm9CAUJkvmI8oGZmEhgZgkDNTJtXsMEJMSLqDy96wSfNz7jheC 5lDyrQRdJvgPOhOl2Z/1zBw8yZjFHY4wzRqi//m4GR/7iQaV2l2MichUaL22nllRaSp9 M9Jw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=SAl3WAKb; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-48544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de X-Forwarded-Encrypted: i=1; AJvYcCWceg1o457uXWvxE+XEvGDhmif2vhTuxyl4f+IvnydRC1mBJA0pIpJHfDStITJX0Dghv0XnAa+ELjrb/d1AQLYrP102FOb+pM3ggtbb7A== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id bo8-20020a17090b090800b00296168c7cdasi1780152pjb.165.2024.02.01.09.25.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 09:25:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=SAl3WAKb; arc=pass (i=1 spf=pass spfdomain=gmx.de dkim=pass dkdomain=gmx.de dmarc=pass fromdomain=gmx.de); spf=pass (google.com: domain of linux-kernel+bounces-48544-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48544-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 58DBBB35A6B for ; Thu, 1 Feb 2024 16:41:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EFBE5CBE; Thu, 1 Feb 2024 16:41:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmx.de header.i=deller@gmx.de header.b="SAl3WAKb" Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E40F94A2A; Thu, 1 Feb 2024 16:41:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=212.227.15.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706805681; cv=none; b=buXzPv/VOGzflfizBRd/5WuDmuPZsvPfurwRq7vPRDJYblol1dY3cp8OefZYwjW82dulpvq7cBGPtTWIF7UXVZ+XwYTZlnc3L/DJHLeLBWmCPAmLE8DA6eF+JoQnMJ/YJQEZVdgzvCPzWOAOp7tUO0ucqbMXlEw9By0kLePqdqk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706805681; c=relaxed/simple; bh=8jHu6yHt8uCA3Dy1yFe+TlZEoJuvBfuOFfiYAURRHCs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pYX/rRVPCye3zkRCmC6o7RumioViTjEe3+skk7frHn2YtxNCn9nSEY+D7oJttt7HBpWkrxvVvXqRxZgkRK3DpHtW4ydO9TWFdToYbbUYprCMgmEiF0fqup4GTNklm1mu4awRwrJhowmRSqZSlnM7Z1XGOy0vfa5Y0IdlBkEw9D8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de; spf=pass smtp.mailfrom=gmx.de; dkim=pass (2048-bit key) header.d=gmx.de header.i=deller@gmx.de header.b=SAl3WAKb; arc=none smtp.client-ip=212.227.15.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1706805671; x=1707410471; i=deller@gmx.de; bh=8jHu6yHt8uCA3Dy1yFe+TlZEoJuvBfuOFfiYAURRHCs=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From: In-Reply-To; b=SAl3WAKbdxre9ty8GQzr5DFP6GnJxkvhM1Y02PyPuM1JKXNoFrgKxhkcvJG5mz+I SSzogr/NtTUOkoEMkcKHcxQDY+1n9HmH0jPFwwI7j3bcO+tiVuCgWZaTOAsgW/+qA +3RTsGyv783p7DmJ6eINYIVOvPL7IBWHPf68ZJvtMYYOfAAUsPXUOLeXTI49fvmXo ZRxDR1qR7bsGHXlGB+tIIK8cS4x6kE6Fsoc66SvaIBoXc+DFpblz9ehhJ8Dxx0L72 nESEx12jWq+p91kk/NuHtrMgUti373sUdv803MGiL3WxJpA5O2nkG2hV7NK/9OTsH UjEyyWFSebPVBznyPA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.8.0.6] ([78.94.87.245]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MrQEn-1qjNWy2XHb-00oUnh; Thu, 01 Feb 2024 17:41:11 +0100 Message-ID: <8a266076-b3dc-4a39-aac4-089e2ef77da3@gmx.de> Date: Thu, 1 Feb 2024 17:41:10 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH][RFC] workqueue: Fix kernel panic on CPU hot-unplug Content-Language: en-US To: Tejun Heo , Helge Deller Cc: Lai Jiangshan , linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org References: From: Helge Deller Autocrypt: addr=deller@gmx.de; keydata= xsFNBF3Ia3MBEAD3nmWzMgQByYAWnb9cNqspnkb2GLVKzhoH2QD4eRpyDLA/3smlClbeKkWT HLnjgkbPFDmcmCz5V0Wv1mKYRClAHPCIBIJgyICqqUZo2qGmKstUx3pFAiztlXBANpRECgwJ r+8w6mkccOM9GhoPU0vMaD/UVJcJQzvrxVHO8EHS36aUkjKd6cOpdVbCt3qx8cEhCmaFEO6u CL+k5AZQoABbFQEBocZE1/lSYzaHkcHrjn4cQjc3CffXnUVYwlo8EYOtAHgMDC39s9a7S90L 69l6G73lYBD/Br5lnDPlG6dKfGFZZpQ1h8/x+Qz366Ojfq9MuuRJg7ZQpe6foiOtqwKym/zV dVvSdOOc5sHSpfwu5+BVAAyBd6hw4NddlAQUjHSRs3zJ9OfrEx2d3mIfXZ7+pMhZ7qX0Axlq Lq+B5cfLpzkPAgKn11tfXFxP+hcPHIts0bnDz4EEp+HraW+oRCH2m57Y9zhcJTOJaLw4YpTY GRUlF076vZ2Hz/xMEvIJddRGId7UXZgH9a32NDf+BUjWEZvFt1wFSW1r7zb7oGCwZMy2LI/G aHQv/N0NeFMd28z+deyxd0k1CGefHJuJcOJDVtcE1rGQ43aDhWSpXvXKDj42vFD2We6uIo9D 1VNre2+uAxFzqqf026H6cH8hin9Vnx7p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KEkSHHOm8jHwvQWvPP73pvuPBEPtKGLzbgd7OOcGZWtq2hNC6cRtsRdDx 4TAGMCz4j238m+2mdbdhRh3iBnWT5yPFfnv/2IjFAk+sdix1Mrr+LIDF++kiekeq0yUpDdc4 ExBy2xf6dd+tuFFBp3/VDN4U0UfG4QJ2fg19zE5Z8dS4jGIbLg== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:w57UWtdmFRiBnq3mv+oAtnI+elf1uGycDr/a5vvBaJMTS5EJxWv VFTxYtvVmZSEuMR14iL3OhDbozIc6twHyRc4V75fbfSmvf7WptcmHexISs0t4Y0ooW9Uxcc XhdcNRsaF+EfJDfRS/qzsAl1sKEmVqyYj4wFXLOVuitYh1KdpG50VGc3dvpb6S7VLkvY553 kbHU3UdfajzWlNP70sXyg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:Yrl6l4XB8O8=;OrePRDiSVj9iLyFebIj8eIkuU7o 5BMDumthG0S+bLzwzwC6Kh3YSAN2cssz8UR1tfrMJoW/yelx+/MldarMr9ZW8YBixsYKjzU1k 6mb1li51AdjC+w1ZA5bi8NvbYvyJ7+76UduOSt5ZgdTH5x9AgqCJFtfTqzWII3joLxTzQhKgq ugzTf0u97mG4+MDhauGEJuZSNaDfPcdscPcAATHn58QMUnxOOEB9HiZMVPMLufri/xNhqb6hK uvqCrGJNORzrgJyOjd/JSsU92335z3q6uaaA5GeFu6C6ww/LGRRWP/QnJNXpEswdVha+yzB6J +AJF+EYK5ExLu0K4/cby/9g7yBug7vlZwVGjDySVYSAEQdpV1ja9YqtWAujihCLBYO1UK+pHO KIxBCyomD/1P1lprP76o6Bi96LtSTC8PgAlagDwR/ItMhgvV+CRtOTR7fKk0rdt14Xjyrr/S9 DcVkosdUwh7MlM6Wu8VBY7nJGDeGVrxirwgapdnPxM7BioReVtwLdKMM7qz70FW4u8IIIULv8 Sd30UIH5f7CxBrHqyBJFvPYzy1H3f0/e0O7dMatD2GxCWYeSa1bPHFus/flVzzNmwS4Fg3Vfm XSYD2k+kl3R6uvzjeMVzmywysL2FP8SJEW27qfY0Uo/VUg0TPG0AoIFQh/8T/0dF+k/+ki7NS l53P1DZSYPU5q8V+CVG3G82oOLBkP8VPLxYlm0BwC8TOdmH8BU9rlSUSVeyugByLi0abcrT60 OBNf3B2pd5LUNY8HIn49BOH7zTkBSOZ2z75E5DJUs45xY3TccWLrqjlOd0kpxFpV7N6IAMswe VEH5NbJc14kIVvgjszGgySmEPzSXOiH2OXsck2MfqnhxQ= On 1/31/24 23:28, Tejun Heo wrote: > On Wed, Jan 31, 2024 at 08:27:45PM +0100, Helge Deller wrote: >> When hot-unplugging a 32-bit CPU on the parisc platform with >> "chcpu -d 1", I get the following kernel panic. Adding a check >> for !pwq prevents the panic. >> >> Kernel Fault: Code=3D26 (Data memory access rights trap) at addr 0000= 0000 >> CPU: 1 PID: 21 Comm: cpuhp/1 Not tainted 6.8.0-rc1-32bit+ #1291 >> Hardware name: 9000/778/B160L >> >> IASQ: 00000000 00000000 IAOQ: 10446db4 10446db8 >> IIR: 0f80109c ISR: 00000000 IOR: 00000000 >> CPU: 1 CR30: 11dd1710 CR31: 00000000 >> IAOQ[0]: wq_update_pod+0x98/0x14c >> IAOQ[1]: wq_update_pod+0x9c/0x14c >> RP(r2): wq_update_pod+0x80/0x14c >> Backtrace: >> [<10448744>] workqueue_offline_cpu+0x1d4/0x1dc >> [<10429db4>] cpuhp_invoke_callback+0xf8/0x200 >> [<1042a1d0>] cpuhp_thread_fun+0xb8/0x164 >> [<10452970>] smpboot_thread_fn+0x284/0x288 >> [<1044d8f4>] kthread+0x12c/0x13c >> [<1040201c>] ret_from_kernel_thread+0x1c/0x24 >> Kernel panic - not syncing: Kernel Fault >> >> Signed-off-by: Helge Deller >> >> --- >> >> diff --git a/kernel/workqueue.c b/kernel/workqueue.c >> index 76e60faed892..dfeee7b7322c 100644 >> --- a/kernel/workqueue.c >> +++ b/kernel/workqueue.c >> @@ -4521,6 +4521,8 @@ static void wq_update_pod(struct workqueue_struct= *wq, int cpu, >> wq_calc_pod_cpumask(target_attrs, cpu, off_cpu); >> pwq =3D rcu_dereference_protected(*per_cpu_ptr(wq->cpu_pwq, cpu), >> lockdep_is_held(&wq_pool_mutex)); >> + if (!pwq) >> + return; > > Hmm... I have a hard time imagining a scenario where some CPUs don't hav= e > pwq installed on wq->cpu_pwq. Can you please run `drgn > tools/workqueue/wq_dump.py` before triggering the hotplug event and past= e > the output along with full dmesg? I'm not sure if parisc is already fully supported with that tool, or if I'm doing something wrong: root@debian:~# uname -a Linux debian 6.8.0-rc1-32bit+ #1292 SMP PREEMPT Thu Feb 1 11:31:38 CET 20= 24 parisc GNU/Linux root@debian:~# drgn --main-symbols -s ./vmlinux ./wq_dump.py Traceback (most recent call last): File "/usr/bin/drgn", line 33, in sys.exit(load_entry_point('drgn=3D=3D0.0.25', 'console_scripts', 'drg= n')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^ File "/usr/lib/python3/dist-packages/drgn/cli.py", line 301, in _main runpy.run_path(script, init_globals=3D{"prog": prog}, run_name=3D"__m= ain__") File "", line 291, in run_path File "", line 98, in _run_module_code File "", line 88, in _run_code File "./wq_dump.py", line 78, in worker_pool_idr =3D prog['worker_pool_idr'] ~~~~^^^^^^^^^^^^^^^^^^^ KeyError: 'worker_pool_idr' Maybe you have an idea? I'll check further, but otherwise it's probably easier for me to add some printk() to the kernel function wq_update_pod() and send that info? Helge