From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 121DFC433FE for ; Mon, 11 Apr 2022 15:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347840AbiDKPZA (ORCPT ); Mon, 11 Apr 2022 11:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240245AbiDKPY5 (ORCPT ); Mon, 11 Apr 2022 11:24:57 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 66FDC2314E for ; Mon, 11 Apr 2022 08:22:43 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 195A91570; Mon, 11 Apr 2022 08:22:43 -0700 (PDT) Received: from e122027.arm.com (unknown [10.57.40.227]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 65FC23F73B; Mon, 11 Apr 2022 08:22:41 -0700 (PDT) From: Steven Price To: Thomas Gleixner , Vincent Donnefort , Peter Zijlstra Cc: Steven Price , linux-kernel@vger.kernel.org, Baokun Li , Dongli Zhang , Randy Dunlap , Valentin Schneider , Yuan ZhaoXiong , YueHaibing , Dietmar Eggemann Subject: [PATCH v3 0/2] cpu/hotplug: Fix cpuhp_cpu_state used before init Date: Mon, 11 Apr 2022 16:22:31 +0100 Message-Id: <20220411152233.474129-1-steven.price@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently it's possible to trigger a case where the cpuhp_cpu_state::cpu member is used before it has been initialised. This can cause CPU 0 to be erroneously marked as dying and trigger a scheduler panic (full details in v1[1]). The two patches here fix the root cause by removing the 'cpu' member altogether and to prevent similar confusion in the future ensure that the cpuhp_cpu_state structures are initialised before any hotplugging occurs. Changes since v2[2]: * Remove the cpu member altogether (first patch) * Move the initialisation of cpuhp_cpu_state as suggested by tglx (second patch) [1] https://lore.kernel.org/all/20220225134918.105796-1-steven.price@arm.com/ [2] https://lore.kernel.org/all/20220316153637.288199-1-steven.price@arm.com/ Steven Price (2): cpu/hotplug: Remove the 'cpu' member of cpuhp_cpu_state cpu/hotplug: Initialise all cpuhp_cpu_state structs earlier kernel/cpu.c | 58 ++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 27 deletions(-) -- 2.25.1