From patchwork Mon Feb 10 06:55:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864360 Received: from mo-csw.securemx.jp (mo-csw1802.securemx.jp [210.130.202.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C1101AC88B; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; cv=none; b=Z73E7odQbbfs8rB81RnuhVCwvzBqx4TyLA65tmQggRkILT+K1PadNfJQ0d4QEB1rWBOwosDAxv/JOvyAbKVU9OzBOh/DdGvizfQ+mWRcprJArTfGRMd7TEzn5y+n221wsLjHlSTEg1TcU3qQTLNfNcUx/t/IlsAVm/SZoPT5MO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; c=relaxed/simple; bh=iicbccpumPzfEtugq4KWFjKgGvcPopR7aKnNXGjxNaM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=grLDBYJ+ijK6p2xnmQQQRTclpuuDd0O/e/2sPhfQsuraHHZykJ6UyBr0SBtYB22fk0J+RzBRUBPoPUJdByAAbJa4GuNvJVDGA/LlQhPzUYo38YfXPfa/bD3kQBqJYQFiEnyOypYOtdwpAPXnvgcRFL85p3nSF3f+8DHMYB/sQgQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=cvLCK5SE; arc=none smtp.client-ip=210.130.202.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="cvLCK5SE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170570; x=1740380170; bh=iicbc cpumPzfEtugq4KWFjKgGvcPopR7aKnNXGjxNaM=; b=cvLCK5SEcKFcT2zmpcCOFiLW8YlO8Fg89xg ZJC+t51t22hZnqBNG1jW6+UTppHDggRJH10vC3i3cDqXLiHOe2OUJa0R1G4QGRILzZMKdgsRL/Ujt 6dCyfDwiwUsrgHFheHphRJx/JExLuMHkmBczMrfiOQC1Ci0tAr4wTom0n5Z/idKNVLGgXWmNT5Rri 5nOsdW6SlCh7fabP1DhzSDxLSFswt5wRmNHmzE3afZwzzIHx2FqfbIE1R3g22yHrIWePcSbkFnA3i SrZ/xmxXZPY7+CeVd1l8X4YAjC7v8YgSiGu/jenRcwSQqjDbAFvCUmDvvmxr+ujjZSMHxigvPzrA= =; Received: by mo-csw.securemx.jp (mx-mo-csw1802) id 51A6uAU93387600; Mon, 10 Feb 2025 15:56:10 +0900 X-Iguazu-Qid: 2yAbpfLvFIKSbpKASa X-Iguazu-QSIG: v=2; s=0; t=1739170568; q=2yAbpfLvFIKSbpKASa; m=gkZYdlsGvJB53wDsPFGToGjNwGtZeOMly87cM8gSnsc= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1803) id 51A6u6864036119 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:06 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 01/17] init: Pin init task to the boot CPU, initially Date: Mon, 10 Feb 2025 15:55:29 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-2-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit 8fb12156b8db61af3d49f3e5e104568494581d1f upstream. Some of the boot code in init_kernel_freeable() which runs before SMP bringup assumes (rightfully) that it runs on the boot CPU and therefore can use smp_processor_id() in preemptible context. That works so far because the smp_processor_id() check starts to be effective after smp bringup. That's just wrong. Starting with SMP bringup and the ability to move threads around, smp_processor_id() in preemptible context is broken. Aside of that it does not make sense to allow init to run on all CPUs before sched_smp_init() has been run. Pin the init to the boot CPU so the existing code can continue to use smp_processor_id() without triggering the checks when the enabling of those checks starts earlier. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/20170516184734.943149935@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- init/main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/init/main.c b/init/main.c index 9933fca3a5c8..6c745aff6669 100644 --- a/init/main.c +++ b/init/main.c @@ -386,6 +386,7 @@ static __initdata DECLARE_COMPLETION(kthreadd_done); static noinline void __init_refok rest_init(void) { + struct task_struct *tsk; int pid; rcu_scheduler_starting(); @@ -395,7 +396,17 @@ static noinline void __init_refok rest_init(void) * the init task will end up wanting to create kthreads, which, if * we schedule it before we create kthreadd, will OOPS. */ - kernel_thread(kernel_init, NULL, CLONE_FS); + pid = kernel_thread(kernel_init, NULL, CLONE_FS); + /* + * Pin init on the boot CPU. Task migration is not properly working + * until sched_init_smp() has been run. It will set the allowed + * CPUs for init to the non isolated CPUs. + */ + rcu_read_lock(); + tsk = find_task_by_pid_ns(pid, &init_pid_ns); + set_cpus_allowed_ptr(tsk, cpumask_of(smp_processor_id())); + rcu_read_unlock(); + numa_default_policy(); pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES); rcu_read_lock(); @@ -993,10 +1004,6 @@ static noinline void __init kernel_init_freeable(void) * init can allocate pages on any node */ set_mems_allowed(node_states[N_MEMORY]); - /* - * init can run on any cpu. - */ - set_cpus_allowed_ptr(current, cpu_all_mask); cad_pid = get_pid(task_pid(current)); From patchwork Mon Feb 10 06:55:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864362 Received: from mo-csw.securemx.jp (mo-csw1800.securemx.jp [210.130.202.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DEDD01A8F8A; Mon, 10 Feb 2025 06:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; cv=none; b=lqxNkt81t+979nUOrq6UE4au6A4hilBDBFvPzOz1Vio+CjUlTnGdzPc9undYXaKFo9DekinID3y3ns4GYcIoBpslHI5IclEhSyb6xa1zt0stS3QU6vmBR6UhjFyjDtHhgXEF05HYjTmpugDwNey7nASXrhFx/2ZFAPI0VVHcKG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; c=relaxed/simple; bh=LacjTpN6fdSgOV/NnhQm9cOx14rxFw1BSnWAXKHY99I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=gpC6gBNds22P3/L4uq/74xMYYUvxDj/IJK4Dme/TmY+dLzC8Lxz1gs2cVP67dhM35tnogzm5JvICowrVLoEHFqNmCbSUdcCHBCz0cziRDm5T1QR83w0jWA4Qjk1cCaQB0iIJ7Ppqotk7O8C/tQtNkx3kkPiUZLT1Rc6q6upqg8E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=PCDxFuqW; arc=none smtp.client-ip=210.130.202.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="PCDxFuqW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170571; x=1740380171; bh=LacjT pN6fdSgOV/NnhQm9cOx14rxFw1BSnWAXKHY99I=; b=PCDxFuqWCez+GJb9W3bm1Ld9MckiRtHX/n1 fa6oq339F+WSzPFy5sDQDE41zPod8eIh2LfYuTlqQxMu+GHqZxDmBkrVEoRxCcQMcv61DxZWR9ZL5 /IqWgcMF+JeZHWQ4+477b8/Y9f/ZIBQphYeZ68KCVPAhzxb5y47gPueGEWe6SLOWB4CNZ87a5ctO6 vSRAwSr0/SqdbhBg8sHD7UuhytHZrV9+L0T2PHewsyD/de0t+GtGoOPhokdGlIDvQ4VsO1aicGzXX og5SB8vlK0n+d2VVHZvo+QZqXIfAK1dVIw8PRD6Yk6NDjx9CjXDpxjwIJEbydacJan2DdhJS/n6w= =; Received: by mo-csw.securemx.jp (mx-mo-csw1800) id 51A6uA5C789405; Mon, 10 Feb 2025 15:56:10 +0900 X-Iguazu-Qid: 2yAbpfLvFIKSbpKASb X-Iguazu-QSIG: v=2; s=0; t=1739170568; q=2yAbpfLvFIKSbpKASb; m=Reug4TbvHHwhrFEIwyFoQhcztFgDCGfAzKkgoFM+1PQ= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1800) id 51A6u6OO977772 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:06 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 02/17] arm: Adjust system_state check Date: Mon, 10 Feb 2025 15:55:30 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-3-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit 5976a66913a8bf42465d96776fd37fb5631edc19 upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in ipi_cpu_stop() to handle the extra states. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Mark Rutland Cc: Peter Zijlstra Cc: Russell King Cc: Steven Rostedt Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20170516184735.020718977@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- arch/arm/kernel/smp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index ffa533a4ef57..7b32330185bc 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -587,8 +587,7 @@ static DEFINE_RAW_SPINLOCK(stop_lock); */ static void ipi_cpu_stop(unsigned int cpu) { - if (system_state == SYSTEM_BOOTING || - system_state == SYSTEM_RUNNING) { + if (system_state <= SYSTEM_RUNNING) { raw_spin_lock(&stop_lock); pr_crit("CPU%u: stopping\n", cpu); dump_stack(); From patchwork Mon Feb 10 06:55:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864354 Received: from mo-csw-fb.securemx.jp (mo-csw-fb1120.securemx.jp [210.130.202.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B68F62F2E; Mon, 10 Feb 2025 08:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.128 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739175392; cv=none; b=sf1dN4mNSH3YCVamo5L3oHf65MjI1gnItiAMZD9+dGuEyKaNzZ1vck++uuhl1yQJNN9fxSKR7k6Gm5xzpK0K4g0DfU10Zlz1LGAmY6hVie23T86pJkPxBS7R1Oz/aszGXSzTiYV0k1lxzlLtyHHyRroooEflgrzr/fYx4XuyXYU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739175392; c=relaxed/simple; bh=oeSTV1dI+T8GrwEAkCPvGHesDTdealGcRC8KdexYD5I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=as6Y5LJx1BpBaG6JHYe6yS2oGXsafSY1b9BqobQMtw5fYMagKT2+7B20n5xe97eaYHr8EDxmNvRYipd6/i+XGAUw5+1WT5eem1xEP3MrXrIDvZfRR1o0zpZ3vWPY25zc0ltD+zRjtBNP+FQV+AGU7LMnyAZPJhBfK/qkFwhIllA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=AnC3Hm5Y; arc=none smtp.client-ip=210.130.202.128 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="AnC3Hm5Y" Received: by mo-csw-fb.securemx.jp (mx-mo-csw-fb1120) id 51A6uotC216575; Mon, 10 Feb 2025 15:56:50 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170575; x=1740380175; bh=oeSTV 1dI+T8GrwEAkCPvGHesDTdealGcRC8KdexYD5I=; b=AnC3Hm5Y9xk8JXuJN1dIXHrxvS428YIDA5X HWM0a1+I4rouWYEJpr/xRVuiBjunane+Ja9ZOy+ytmw7+TxD4zJkVN/Z50cTkjbRJPDaBd29ysmyn CRRZLzuO1drzVvDKlRsM5AhX/RS/3S22xaF+wL90RfFL0IqCe9JQ4xPpvxB5coy/XFgOQmacv1qeg zVL2WA4GCXdc2h2n8aBT1/w0K9mOXhJK6BL1lTShMAzJAznbf+3y8/+psQaN7+icFG1x7KAD54RST DGrmdPrK0oyqKPp8/Y28QrtnJURMyRQPCYOQkfeCDfqJs3lQanb+Jx7qh0rjRtStkXCdS1wQm7bA= =; Received: by mo-csw.securemx.jp (mx-mo-csw1121) id 51A6uFb13832482; Mon, 10 Feb 2025 15:56:15 +0900 X-Iguazu-Qid: 2rWhSHZE3yt6r0xIbx X-Iguazu-QSIG: v=2; s=0; t=1739170569; q=2rWhSHZE3yt6r0xIbx; m=Y0hJNGDdcj4uKOoeojwG12+1jPvQ2I44K5L5a9Bg+kc= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1122) id 51A6u6tX182804 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 03/17] arm64: Adjust system_state check Date: Mon, 10 Feb 2025 15:55:31 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-4-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit ef284f5ca5f102bf855e599305c0c16d6e844635 upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in smp_send_stop() to handle the extra states. Conflicts: arch/arm64/kernel/smp.c 82611c14 moves per-CPU stop message from ipi_cpu_stop() to smp_send_stop(), but no change in checking system_state condition. Apply the change to ipi_cpu_stop() instead. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Acked-by: Mark Rutland Acked-by: Catalin Marinas Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Steven Rostedt Cc: Will Deacon Link: http://lkml.kernel.org/r/20170516184735.112589728@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- arch/arm64/kernel/smp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 36182dafd63c..9b21b6ccc3f1 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -685,8 +685,7 @@ static DEFINE_RAW_SPINLOCK(stop_lock); */ static void ipi_cpu_stop(unsigned int cpu) { - if (system_state == SYSTEM_BOOTING || - system_state == SYSTEM_RUNNING) { + if (system_state <= SYSTEM_RUNNING) { raw_spin_lock(&stop_lock); pr_crit("CPU%u: stopping\n", cpu); dump_stack(); From patchwork Mon Feb 10 06:55:32 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864017 Received: from mo-csw.securemx.jp (mo-csw1801.securemx.jp [210.130.202.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 848D11ADC68; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; cv=none; b=naEZMM8U5vRGq/+Scbda/76M2YmjugrOiOktYS9Crsy5t1spJ4PN/pOaJOhy9GhGkNY2JA33SLUYugOiC0Xqub28vwyFVUbH8BikFGpWsM4ATNwHO9SqZEepLrKltnvYzbkl9JihkAy4JVG2I9fpE38gN/Msyi3Qz4qZ+19z/xg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; c=relaxed/simple; bh=7ik5tU+aigkCH+DjxsodxVPjPp2fSYh7lpQZcnFBhMU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=IVb5dcYHGCGZtWSmMSWGu6TwtufwBdV5ogkM8vhcMahnv5R/Mn3dlsdTloD2ck4MzWJfuEhyNQN+tw90eou6jMj+dtdvqCwNoAX0oGOtGyo2gX7+NJDDUjmLyVGW/PKT7sCO0EdD2dhTgJsEzgn1HZF9DvRYrZy6ELk6SJtwL+w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=d3d2EDfY; arc=none smtp.client-ip=210.130.202.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="d3d2EDfY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170573; x=1740380173; bh=7ik5t U+aigkCH+DjxsodxVPjPp2fSYh7lpQZcnFBhMU=; b=d3d2EDfYsSuwE5qp9yxTdvbvKzIo3gp1Vvl X5vuJ54hVyogvK0mZOho/e4byR+tG67kmFazsnec9xhuo4DH/aJN6a32fpScULSAHJRyvgXTgNUjq kpL7jZ45W4YMyNnOjjp7lc4Zqp7wZKsNstLTOHnZd21HEJ8z4IdYTCj8xuTFapv8h/FTGh5Yjz/qQ /vhypP+lwWJAEbKcQccG1g8fjkA9OgtN7531DwRQC4bD8RlRtl17CRR42ur6Zoqq0KNwyiFDYqNAt H+FtnwrjFzq4i0OabTmcjt70/L4ApgK/at85cDmS65rfPhzFM5yX+EBMN+jBf1qFg8pmLg43y4VQ= =; Received: by mo-csw.securemx.jp (mx-mo-csw1801) id 51A6uDYW3258916; Mon, 10 Feb 2025 15:56:13 +0900 X-Iguazu-Qid: 2yAbAvUQLMDymhsI12 X-Iguazu-QSIG: v=2; s=0; t=1739170568; q=2yAbAvUQLMDymhsI12; m=z6ixCw7oMkuV8hIiY7pyEwGC8S/FFfZk875O/LRTkb0= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1803) id 51A6u6A24036125 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 04/17] x86/smp: Adjust system_state check Date: Mon, 10 Feb 2025 15:55:32 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-5-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit 719b3680d1f789c1e3054e3fcb26bfff07c3c623 upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in announce_cpu() to handle the extra states. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Steven Rostedt (VMware) Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Mark Rutland Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170516184735.191715856@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- arch/x86/kernel/smpboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 0512af683871..2a9ada6fa7d0 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -721,7 +721,7 @@ static void announce_cpu(int cpu, int apicid) if (cpu == 1) printk(KERN_INFO "x86: Booting SMP configuration:\n"); - if (system_state == SYSTEM_BOOTING) { + if (system_state < SYSTEM_RUNNING) { if (node != current_node) { if (current_node > (-1)) pr_cont("\n"); From patchwork Mon Feb 10 06:55:33 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864359 Received: from mo-csw.securemx.jp (mo-csw1120.securemx.jp [210.130.202.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D1681ACEAC; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; cv=none; b=QNjjY9IXgcsinr3mSeSqjKHI4xDJ3U5yYgKUwb2F4g4HuFBpKlytAdVen4z+HVTQyVhzNE7eOESec/QiGWMEx6zcKKqRDG09VPi5mucu/aossTcVMhwgkENhqUhPTC8k2rHE5wwcLihCdqda51bcIq5BIayEQbDckdtcaBPlVeA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; c=relaxed/simple; bh=tzD5UnyZwjInSLknlehUgMLUsGKRRIAWVDJzXwhh1Dc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=UPdLtvGoQNwNW9CbT4F92+IqAYMOCsC4zf9gB+5DktD256fk+7HB+JMLgMW5xgUZ9IaiAkTu+UcKmErPM9A91L6UEpxTAWvUZbtrlRwkd4Kgl/uAVBmeNMBxKkvcsRnrz+IGzw01DgP6/6wvfd/SIdXoaB2P1JPGmBGRR3Qb0PI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=aCX/vASB; arc=none smtp.client-ip=210.130.202.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="aCX/vASB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170576; x=1740380176; bh=tzD5U nyZwjInSLknlehUgMLUsGKRRIAWVDJzXwhh1Dc=; b=aCX/vASBJa9J7XHQjiqmCgQEmBa1/Mt3afV FetRNRM0/CdH6cNoiF9NHl6IGAFW73LaeReYLptonu6qfMQwBGcoLqJw8xd3AnAY+/2FW7nugcryo /AHnsR4p7IrwVv96rmGvtAx9ook1UeMMi2WfyjM1M0DCoepeNbyKf1oq3kKZi3+A/pJmuF/zzrpg/ 72ALg5QdbS5ake6ktMD638UENnUZfINf64PSc2JZrkvQp/F6I4M4gUJ1Q+4t/SkDhnEttr2+EbeMo RApCuQ6ZDsEx2VyxtFT1+Vnik4n7UH8uUVzoqJCVhGeCuj8c5EaMQ6rNDNjbBBduFdd9Ns824T5w= =; Received: by mo-csw.securemx.jp (mx-mo-csw1120) id 51A6uGw33587747; Mon, 10 Feb 2025 15:56:16 +0900 X-Iguazu-Qid: 2rWhWAeBjX3UYC8AJ6 X-Iguazu-QSIG: v=2; s=0; t=1739170569; q=2rWhWAeBjX3UYC8AJ6; m=YXkk/oYQcG59h4NUfNxnbqOT6lCvTE7NmT2B5wixTK0= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1120) id 51A6u7He859155 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 05/17] metag: Adjust system_state check Date: Mon, 10 Feb 2025 15:55:33 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-6-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit dcd2e4734b428709984e2fa35ebbd6cccc246d47 upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in stop_this_cpu() to handle the extra states. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Cc: Greg Kroah-Hartman Cc: James Hogan Cc: Linus Torvalds Cc: Mark Rutland Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/20170516184735.283420315@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- arch/metag/kernel/smp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c index c3c6f0864881..0bc03c257fe6 100644 --- a/arch/metag/kernel/smp.c +++ b/arch/metag/kernel/smp.c @@ -565,8 +565,7 @@ static void stop_this_cpu(void *data) { unsigned int cpu = smp_processor_id(); - if (system_state == SYSTEM_BOOTING || - system_state == SYSTEM_RUNNING) { + if (system_state <= SYSTEM_RUNNING) { spin_lock(&stop_lock); pr_crit("CPU%u: stopping\n", cpu); dump_stack(); From patchwork Mon Feb 10 06:55:34 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864355 Received: from mo-csw.securemx.jp (mo-csw1120.securemx.jp [210.130.202.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BD101ADC86; Mon, 10 Feb 2025 06:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170613; cv=none; b=q9gOd0arfkrLub6BtSQQVMoHtz2S+YjKOP3vAH1KnWuRUp+xZToaJkRpagqxC1685IHfpjVDZaUEVYkshBPwPnVoj2eqaL45EaH3pcNTQU7aMsCUAmAhc0YDHGWYnbeGb7WnNpBPAIq79pPh6gWJM3xwNXvPHM3YaJslsL3qckU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170613; c=relaxed/simple; bh=b8rrfMXIzh/6gB/7BIug22meGebSbUh7PWeoHodsWAI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=bacOQvYcM6srFrVBfFfpNcZKEBk0cEwpciwcBFb0cHw4SSv7VoUDhVEesowXvJS8YrjN+qXFrSnLcLFg6uqCvtJuMDoGuJtMjop6s19lPR1/liVTPC+NbDhv8MKWnLHL8qn2lnpOAT1ITfEEkjF9jLSC28/3XesOYAo0rRPr4g8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=br51Xz3i; arc=none smtp.client-ip=210.130.202.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="br51Xz3i" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170571; x=1740380171; bh=b8rrf MXIzh/6gB/7BIug22meGebSbUh7PWeoHodsWAI=; b=br51Xz3iZcURVQ7VFWDs/bRTbCF1f4cUVE5 gsxGtHiMrCFJ8ilSMmaUebb8+CmTyfo9gYdy3r58IB7by14ziMdByvmKE4qudPK8CeLBL3mUGXNaQ +OMfwCl90oK8kxOfcMjoTe5rGRUAB2OZj4wyaD5wpXRW0lT8S3HpOhsWXGae/2i/XgB1TjguY66o0 V22egeAr/zn1A36UFg24VVw9EwQvd/ul5I5KNbAOEiDKqwAmw5DsW0y/+0w2i+eeGL5fxXU1HigG5 hTkHwtv21XSJJzRA0E+AICusXOh7vccmGWyp3/rlDjcg/vQC2QjT02N1RKTy9jnOz0geTrf+U9fw= =; Received: by mo-csw.securemx.jp (mx-mo-csw1120) id 51A6uANx3587290; Mon, 10 Feb 2025 15:56:10 +0900 X-Iguazu-Qid: 2rWhqikycnTS8B6ZlK X-Iguazu-QSIG: v=2; s=0; t=1739170569; q=2rWhqikycnTS8B6ZlK; m=QJxngnsd5z1jHW2IqHw3hANCAKlwKNbBxxbFR6RYx9I= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1122) id 51A6u7Eb182827 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 06/17] powerpc: Adjust system_state check Date: Mon, 10 Feb 2025 15:55:34 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-7-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit a8fcfc1917681ba1ccc23a429543a67aad8bfd00 upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in smp_generic_cpu_bootable() to handle the extra states. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Acked-by: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Mark Rutland Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Steven Rostedt Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/20170516184735.359536998@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- arch/powerpc/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 19ba60ab1807..5dff1a750e49 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -94,7 +94,7 @@ int smp_generic_cpu_bootable(unsigned int nr) /* Special case - we inhibit secondary thread startup * during boot if the user requests it. */ - if (system_state == SYSTEM_BOOTING && cpu_has_feature(CPU_FTR_SMT)) { + if (system_state < SYSTEM_RUNNING && cpu_has_feature(CPU_FTR_SMT)) { if (!smt_enabled_at_boot && cpu_thread_in_core(nr) != 0) return 0; if (smt_enabled_at_boot From patchwork Mon Feb 10 06:55:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864014 Received: from mo-csw.securemx.jp (mo-csw1800.securemx.jp [210.130.202.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 81D571AD3F6; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; cv=none; b=gRMaQjaKphb+h0wftbH5u37V1uG6f2TUAsX0ef6skZSptIn4SOL4HtIJ1gjfAL3HZwJROsR/nM2YmIK/t2RZpz/fSVPgyyt4im1Kk3HItnI/sexrj1fmVLRQhh8nz0qgn5VhTA78R8P59mqNDmiZb5PSFhgzJE8BvuXMmvXZUKo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; c=relaxed/simple; bh=AmyIkv3DbnfgADTlpj58Tj6YoTuPHzz5Iun7nYljy4s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=fkU7WjYHO7fKKui77Xizgpp9vurnfuV7VI+jUYHGuzMVQQYDsQtYTjBS75/KZTvOkChUmUZu+mtqVA68+YZf6q39odX0dJDL7x8g4RWoqqNCKYkTgSuz4EbF1FRUBjYFy56D51iW6a1Id/kMbMP92YlQ1YNfG4Q6dvwLlDPpa+o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=TVzKufVx; arc=none smtp.client-ip=210.130.202.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="TVzKufVx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170570; x=1740380170; bh=AmyIk v3DbnfgADTlpj58Tj6YoTuPHzz5Iun7nYljy4s=; b=TVzKufVxTtWXFrq1Pn3E2sGu5Whj7fODdMv w9nlOPRLscz6hDXNDpI0aJzamzuu43loo8rH1Y93bA/xHQb/UcWci9DLyY7UXMRd+1vN5mJ1bOuuG Qdj2Av+uO+M63QXCx3zwl1YeM+ip/f2EI163ZwIxIENlhlY2UVcppTcRRe3Eem0DeS29ZVQ57iq3K x6Q+olH1Eodj23NSoDgDyiGWXRg47mwgBmZ6aC1RWLyEcCZYchU/rDHlxwva1jqZvJqHl38RuikWX yeaMhQH9hQBQmJHN9nXeX1ELW7DGghEOljqhXUzZKPZ/XYHk1/Qy8Bu4/pEyqlS7Z/ET4I3blRCg= =; Received: by mo-csw.securemx.jp (mx-mo-csw1800) id 51A6uAQ3789407; Mon, 10 Feb 2025 15:56:10 +0900 X-Iguazu-Qid: 2yAbuzQy0kRcL2Dr8m X-Iguazu-QSIG: v=2; s=0; t=1739170568; q=2yAbuzQy0kRcL2Dr8m; m=PWtZJNLikNyw9D52ik4dbAaTKCdwJGjcTITQQVEshYE= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1801) id 51A6u73m1015855 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 07/17] ACPI: Adjust system_state check Date: Mon, 10 Feb 2025 15:55:35 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-8-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit 9762b33dc31c67e34b36ba4e787e64084b3136ff upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Make the decision whether a pci root is hotplugged depend on SYSTEM_RUNNING instead of !SYSTEM_BOOTING. It makes no sense to cover states greater than SYSTEM_RUNNING as there are not hotplug events on reboot and poweroff. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Steven Rostedt (VMware) Cc: Greg Kroah-Hartman Cc: Len Brown Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Rafael J. Wysocki Link: http://lkml.kernel.org/r/20170516184735.446455652@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- drivers/acpi/pci_root.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 4031ec8024ce..5c5ae92710eb 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -526,7 +526,7 @@ static int acpi_pci_root_add(struct acpi_device *device, struct acpi_pci_root *root; acpi_handle handle = device->handle; int no_aspm = 0; - bool hotadd = system_state != SYSTEM_BOOTING; + bool hotadd = system_state == SYSTEM_RUNNING; root = kzalloc(sizeof(struct acpi_pci_root), GFP_KERNEL); if (!root) From patchwork Mon Feb 10 06:55:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864361 Received: from mo-csw.securemx.jp (mo-csw1800.securemx.jp [210.130.202.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7ED321AC892; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; cv=none; b=Xzy1yrQFv2qsR6UVMHYdWqOvcRW9Jpn5vjaG3z6HuwZhiTOgsz469/eZ5FbNcdP81tB3ghmjnatrmPBRgw0+kgeBgLE4GMBN2/MhxOmsWmljq3WR58S3AaRuPPc85A9gj16YVmo0K8rkAJ4+Ee/a6TBYDi3RYepuTIpJpbji844= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; c=relaxed/simple; bh=a5LTK8akCWYsmrwGmeEhr9jCA+rMnEe62GET8zmDZUQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=QDMcrlYFlUiDKwdZ+Ht/sQzU0tbGKf8dQyRF6q+x5yOb7IiRbC4cWEguOCmc2M5nLNn4FAj2gBE7GcjPHaX2D7xpq0wITHLFS1PYTUr/cSKOBRmbon+NQd/AjjzB/IXHUmt5qttwz3kGz/g2Pyxg/2c9ZJppA80dlDT1uFMBb38= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=T6wWCG0e; arc=none smtp.client-ip=210.130.202.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="T6wWCG0e" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170571; x=1740380171; bh=a5LTK 8akCWYsmrwGmeEhr9jCA+rMnEe62GET8zmDZUQ=; b=T6wWCG0ey9/a9lM5PjPb+yZ4PCB5xM6FDk1 pjOT/hNL852pjiNIuXe4P9cbYobZQ3Qngm4e+IOQnLuVPr6vUDIyuQVP0mz77/kBanR15/WdFOX+X loZ1Db0vWu193OqDNGszLpk4Csl5FeB+Ui4NX4q/HKZF4TKR4k3cz6LVcGnna6Ib/iRLXt2CuMLXB N7iUkVZbELVymTS0OJR0Rs3iT/hitTvEZCOiH9eayfylGFDx2xlLVjO5hHmsPxCb0JvkOyaY9XkdN i0XLGzyAcVOhx7eNFvSEvgl5itBwvqhEyR1qaojakC3nIbQZgYmv6aVGhBggKmVpa8PtwqKjpA6w= =; Received: by mo-csw.securemx.jp (mx-mo-csw1800) id 51A6uAe0789452; Mon, 10 Feb 2025 15:56:11 +0900 X-Iguazu-Qid: 2yAb5TJlesrnxmI0Tl X-Iguazu-QSIG: v=2; s=0; t=1739170568; q=2yAb5TJlesrnxmI0Tl; m=g4tZugCPP0TUusDejRGAYeM/h6LsbKB+8TWBGMjBPFA= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1801) id 51A6u7Cg1015852 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 08/17] mm: Adjust system_state check Date: Mon, 10 Feb 2025 15:55:36 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-9-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit 8cdde385c7a33afbe13fd71351da0968540fa566 upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. get_nid_for_pfn() checks for system_state == BOOTING to decide whether to use early_pfn_to_nid() when CONFIG_DEFERRED_STRUCT_PAGE_INIT=y. That check is dubious, because the switch to state RUNNING happes way after page_alloc_init_late() has been invoked. Change the check to less than RUNNING state so it covers the new intermediate states as well. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Acked-by: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Mark Rutland Cc: Mel Gorman Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/20170516184735.528279534@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- drivers/base/node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index 560751bad294..79d22c6aa401 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -366,7 +366,7 @@ static int __init_refok get_nid_for_pfn(unsigned long pfn) if (!pfn_valid_within(pfn)) return -1; #ifdef CONFIG_DEFERRED_STRUCT_PAGE_INIT - if (system_state == SYSTEM_BOOTING) + if (system_state < SYSTEM_RUNNING) return early_pfn_to_nid(pfn); #endif page = pfn_to_page(pfn); From patchwork Mon Feb 10 06:55:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864357 Received: from mo-csw.securemx.jp (mo-csw1802.securemx.jp [210.130.202.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C0BF1AA1DC; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; cv=none; b=VY43h073ZVMJLsCGefa5Y8BXcTNNoEOMYHM+nlpv5xxansKS0DJFyxH8ZdUElnHxIvyMLWFDHp6WXT3Puvl9RRo6N/AkplIiwl2S4xSxzui3EoxCIYAMMnDMd7nEWUnCQihv4do4wpihukWFayIWc1MUDPUVBdI3adz2Wn2JD0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; c=relaxed/simple; bh=FHAeIehSEre1DyNaE7gwBGK5RKji0Lu3Jnohnse04d4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=ZmPekKCr3kgt9Y/zq5CFKFLKGFXBRAvbXuTYBNUO4PtqnJ1T36EShMZtou5BAyZoISYxhSvZi6Wph0DdJLfgWoUbozFB7IRd1tRNT+eGKRO31iczJo1ON7J8sibVs8q+EhXvxNzMJRs4Dyt7+4EkO5AXSM9IWXpDboV7Qor2XVs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=OjGKWIam; arc=none smtp.client-ip=210.130.202.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="OjGKWIam" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170571; x=1740380171; bh=FHAeI ehSEre1DyNaE7gwBGK5RKji0Lu3Jnohnse04d4=; b=OjGKWIamTx8AI2I0z+dKYt6agyZemzXxTHc IbLR/XIpV5nJzs9czibVZGYJYpO06yJ2ysncCwA+k0TKr+4j328NdF2tJsLM8+wVH4ACqxvbA2v2d jKeT9m2zcIwOmRmso8RGuxdV/Kuufi9NME5HFRp/PC4YOC7hkhaCdfBELI+giDylQTb9svnG5xAvl R6uxd9fpRf4ks3+VuGHF9R/4jcn3JfTmPpS4YAfN9TCkIVp+/SIvQr80kgxi7OacjC1ftpyjASiJE vOz6gp/pyyjnHrdZOs2358QfVGvHe5cY0qYdjXLc3RCeDYTdA2F5gFjU0UprZMXuIh0HQ+eDanQA= =; Received: by mo-csw.securemx.jp (mx-mo-csw1802) id 51A6uBwN3387727; Mon, 10 Feb 2025 15:56:11 +0900 X-Iguazu-Qid: 2yAbaKzOfppzBY90eO X-Iguazu-QSIG: v=2; s=0; t=1739170569; q=2yAbaKzOfppzBY90eO; m=Od9Sd0ZYpAI44Mzn2nbC6uMQS4rc95151elHLMzEetg= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1801) id 51A6u7Wa1015859 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 09/17] cpufreq/pasemi: Adjust system_state check Date: Mon, 10 Feb 2025 15:55:37 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-10-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit d04e31a23c3c828456cb5613f391ce4ac4e5765f upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in pas_cpufreq_cpu_exit() to handle the extra states. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Acked-by: Viresh Kumar Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Mark Rutland Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Steven Rostedt Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/20170516184735.620023128@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- drivers/cpufreq/pasemi-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/pasemi-cpufreq.c b/drivers/cpufreq/pasemi-cpufreq.c index 991b6a3062c4..d1bdd8f62247 100644 --- a/drivers/cpufreq/pasemi-cpufreq.c +++ b/drivers/cpufreq/pasemi-cpufreq.c @@ -222,7 +222,7 @@ static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy) * We don't support CPU hotplug. Don't unmap after the system * has already made it to a running state. */ - if (system_state != SYSTEM_BOOTING) + if (system_state >= SYSTEM_RUNNING) return 0; if (sdcasr_mapbase) From patchwork Mon Feb 10 06:55:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864012 Received: from mo-csw.securemx.jp (mo-csw1122.securemx.jp [210.130.202.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A5B31ADC84; Mon, 10 Feb 2025 06:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170613; cv=none; b=hg0IIHw9Z3wrDbW95VDYXoSvlMtNGI2Vmiwl0bhhTZ9FVQnVjBpEmwifGWBTesB0Y6mwXMcnMPcp59ykxbBxPZh2a5GO4tlKm7r0QJlOnQVa+TM/XLUSkNn9XbKhiL7H1qGpRTzuWvfPhXGtzo3exMjSjg0t4bRRAvS/U21VNkU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170613; c=relaxed/simple; bh=5MfGl6e6Blv62gnNYU5ipLCi4CnP2QBHtpDPl+oXTF0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=m/8y/LsjUDZ38NG+xhM/nieeyf7P/0wFKc5neetWX2580MRsgk21j7AMkMlWn6pdjcDIlDtoOnxe/+QBh07nsSyh+KGf0If6gTxDvjk6flgFe5nZyLZZqcLR/YS9/07EhWE+ntxOSyHFpx2UbtGCNliZwSJjqGMWSvGCqhLnXd0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=DYQuxs3E; arc=none smtp.client-ip=210.130.202.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="DYQuxs3E" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170574; x=1740380174; bh=5MfGl 6e6Blv62gnNYU5ipLCi4CnP2QBHtpDPl+oXTF0=; b=DYQuxs3EEqvXXJ/ztGbr1tuSO9A80FHA+BY lDh9ciSj1K38wUG97jMcXu+ZqH5/jZbF5bXYq3xG+wyXKvtYzZ7gUzhaNzAFgz/HlKfIqEzNqizm6 6Dd2IPfLizDJxlsI5NGOMCVDrRM4O9LDiZSVuUkzUFrSiVrougRR2KcGMseqy3HvnzuX34Vg9zK/A 5xrDQkScj5/tPKW0ryMapv+PxM6HBclO7ZNS7WjD05HnxEZtuWpvG4F8p25gJd9zz2+IRZhfILpAk m2a4UWjc5PLpuxULKn8SnW4PXnK1r7Ynd5W7UYvqr0C7elEu2A6i46wIkkGSx9RJmua8VV3sDIYg= =; Received: by mo-csw.securemx.jp (mx-mo-csw1122) id 51A6uEr3605391; Mon, 10 Feb 2025 15:56:14 +0900 X-Iguazu-Qid: 2rWhg4sy0fhlZpldaO X-Iguazu-QSIG: v=2; s=0; t=1739170569; q=2rWhg4sy0fhlZpldaO; m=za6T2eJrO3RRQIGN4B5VThZHvkjZ0EevlFFIbYCfizE= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1122) id 51A6u7Gw182853 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:08 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 10/17] iommu/vt-d: Adjust system_state checks Date: Mon, 10 Feb 2025 15:55:38 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-11-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit b608fe356fe8328665445a26ec75dfac918c8c5d upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state checks in dmar_parse_one_atsr() and dmar_iommu_notify_scope_dev() to handle the extra states. Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Acked-by: Joerg Roedel Cc: David Woodhouse Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Mark Rutland Cc: Peter Zijlstra Cc: Steven Rostedt Cc: iommu@lists.linux-foundation.org Link: http://lkml.kernel.org/r/20170516184735.712365947@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- drivers/iommu/intel-iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index ed6cb3abf645..a8a221b9a3b5 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -4182,7 +4182,7 @@ int dmar_parse_one_atsr(struct acpi_dmar_header *hdr, void *arg) struct acpi_dmar_atsr *atsr; struct dmar_atsr_unit *atsru; - if (system_state != SYSTEM_BOOTING && !intel_iommu_enabled) + if (system_state >= SYSTEM_RUNNING && !intel_iommu_enabled) return 0; atsr = container_of(hdr, struct acpi_dmar_atsr, header); @@ -4431,7 +4431,7 @@ int dmar_iommu_notify_scope_dev(struct dmar_pci_notify_info *info) struct acpi_dmar_atsr *atsr; struct acpi_dmar_reserved_memory *rmrr; - if (!intel_iommu_enabled && system_state != SYSTEM_BOOTING) + if (!intel_iommu_enabled && system_state >= SYSTEM_RUNNING) return 0; list_for_each_entry(rmrru, &dmar_rmrr_units, list) { From patchwork Mon Feb 10 06:55:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864358 Received: from mo-csw.securemx.jp (mo-csw1802.securemx.jp [210.130.202.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C04F1A9B4E; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; cv=none; b=BVy4ELiRPmeke3/DoUTvyppfkDkyOFeBbexBAsFEtwvs1Quly52C1M5DEay89SoYsUE0IEzKOCOAOaptsCmqI6BnrvAo93yqUsCz28GUTTpYqlQ0G91H7pKd/mQYSGUZMiEsFYtfxvCA7sD/kL4ci69NgZ4T7SMukkt56hWfzVo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; c=relaxed/simple; bh=fdHkPnjzNI7ozIGMiEunkAyWiyl6YSEi1qVfY9DfIV8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=sUcCozSqt40NXavNohYzlCXmP0iXpcZGfw0QT03pzgVn4OLVwE9knIAJP/Y0HeQ4fjARgq8ttBGKkRAN43P0WfR4ZdLByOVbL16Tb0F6ILbP8QrH0dH/wITZMAHYeob2KO5C4WKET/2HYsugOnquTS75M9IGjVOqlXCOb6knpYY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=erlgJw0G; arc=none smtp.client-ip=210.130.202.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="erlgJw0G" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170571; x=1740380171; bh=fdHkP njzNI7ozIGMiEunkAyWiyl6YSEi1qVfY9DfIV8=; b=erlgJw0G1aUoinbqXGYQ/O+cmXFSoaDjP5G h/7kpBbdFR2VJA3pkW97qypVabN3NZ4BRxfaSEUyOnp75fIU7LW5LQlFUtd2hznWRb9Wy/SE2n6dT dC4vPNfwmMcqqdgtV//QYwFmiZLbaAUjYV0WfG2/x8YtPHG7WuuVhi0NMTue7wZIGJe4+TEtPpsh+ zOFQHMBMF46DVEjkfLikhXdtzkLrz5oGqh0zSSkAX7t1ATj8ifDzv0xbzIcqNr6k8xPcZuOTUGa7q rcMZfh1JNobtukvzSMlitgVBscr3DV7PWhu7ap0LpSJfhcCZTgTXIglUAjyFzoljsiuFW2TNU0xA= =; Received: by mo-csw.securemx.jp (mx-mo-csw1802) id 51A6uBo63387719; Mon, 10 Feb 2025 15:56:11 +0900 X-Iguazu-Qid: 2yAbyr8UnwGzlFQUfW X-Iguazu-QSIG: v=2; s=0; t=1739170568; q=2yAbyr8UnwGzlFQUfW; m=MaKdUf6dvxZzTTYqlF6U7FRj3iX0YihVW29YRSsydbo= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1801) id 51A6u7xg1015857 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 11/17] async: Adjust system_state checks Date: Mon, 10 Feb 2025 15:55:39 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-12-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit b4def42724594cd399cfee365221f5b38639711d upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in async_run_entry_fn() and async_synchronize_cookie_domain() to handle the extra states. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Acked-by: Arjan van de Ven Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/20170516184735.865155020@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- kernel/async.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/kernel/async.c b/kernel/async.c index f1fd155abff6..23cae44a6ae8 100644 --- a/kernel/async.c +++ b/kernel/async.c @@ -118,14 +118,14 @@ static void async_run_entry_fn(struct work_struct *work) ktime_t uninitialized_var(calltime), delta, rettime; /* 1) run (and print duration) */ - if (initcall_debug && system_state == SYSTEM_BOOTING) { + if (initcall_debug && system_state < SYSTEM_RUNNING) { pr_debug("calling %lli_%pF @ %i\n", (long long)entry->cookie, entry->func, task_pid_nr(current)); calltime = ktime_get(); } entry->func(entry->data, entry->cookie); - if (initcall_debug && system_state == SYSTEM_BOOTING) { + if (initcall_debug && system_state < SYSTEM_RUNNING) { rettime = ktime_get(); delta = ktime_sub(rettime, calltime); pr_debug("initcall %lli_%pF returned 0 after %lld usecs\n", @@ -288,14 +288,14 @@ void async_synchronize_cookie_domain(async_cookie_t cookie, struct async_domain { ktime_t uninitialized_var(starttime), delta, endtime; - if (initcall_debug && system_state == SYSTEM_BOOTING) { + if (initcall_debug && system_state < SYSTEM_RUNNING) { pr_debug("async_waiting @ %i\n", task_pid_nr(current)); starttime = ktime_get(); } wait_event(async_done, lowest_in_progress(domain) >= cookie); - if (initcall_debug && system_state == SYSTEM_BOOTING) { + if (initcall_debug && system_state < SYSTEM_RUNNING) { endtime = ktime_get(); delta = ktime_sub(endtime, starttime); From patchwork Mon Feb 10 06:55:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864018 Received: from mo-csw.securemx.jp (mo-csw1801.securemx.jp [210.130.202.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 833171ADC67; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; cv=none; b=G0NzgysGnH/Kd6IVN4LMfZeoFXMxcTC9Ge5mVB651TvAckscVRQleM6vDldX1isd88YNiDmfZPz6S8Rge2OqtyNB0gfdJUnN9JrveeST42q3xaPooMwkvkYeQiV6eHyssOL1zWrk3uTN57xKPYGR/sjLgWfOd1tYwTdrbL1Sjt4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; c=relaxed/simple; bh=4emG1fYMu+rWyyvKetgiXXHgCkawl0N1QUtTZSf9NIM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=BjcdKxJV04HmmUufMkt9DWOxrNw3mOWctGMb4c5IkTs2teltdZRAm8duX5t1d7nsxN9VP0gY8w9T2rmS/h5KNybGtvFwzNbwjjPCe646nXqCyDrc+ztUXv3tMrc7IHrnt/plym3jdMgzRQnciwnr7obMZCWG2TU9U9YsGX48vyQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=ddi2hDLy; arc=none smtp.client-ip=210.130.202.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="ddi2hDLy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170571; x=1740380171; bh=4emG1 fYMu+rWyyvKetgiXXHgCkawl0N1QUtTZSf9NIM=; b=ddi2hDLyj7AZI8SvUvj+zhVTU+wGxcZxNqA gt2GWybQDfOS1REWTI55qw0cbYacbXa8Hwkuv0GHM/Gou0GyScHtanpoq0OuMPJ0gVhoXi1gVSBAm LiIFleRfrA2F+ELG7adrJQ9ngWQ9Yzx/6hP6r9FrSHDCFcrZBvrmHUJDxbKzuX8YmwhWtx7hUz73K n6M9liIc6u6qUoIEMbkTulMwiUoojAdLHVVLE3D9bU7YqVKabGiF5JzStCeLMzciriiGsiBnNmnFI gpePV8kWlgbDHilNn1RBRjdz6GTCeUUoHhyjLDfMlFpNxe9Bg49JNU/B9FwFdqf6dft0IJvZ1rMg= =; Received: by mo-csw.securemx.jp (mx-mo-csw1801) id 51A6uBK33258823; Mon, 10 Feb 2025 15:56:11 +0900 X-Iguazu-Qid: 2yAbaKzOfppz6rTlSO X-Iguazu-QSIG: v=2; s=0; t=1739170568; q=2yAbaKzOfppz6rTlSO; m=boQJg9V3t8HvCwF8iFZ2EZNiBnK1BmEFkLAJHF9T+PQ= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1801) id 51A6u7401015860 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:07 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 12/17] extable: Adjust system_state checks Date: Mon, 10 Feb 2025 15:55:40 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-13-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit 0594729c24d846889408a07057b5cc9e8d931419 upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in core_kernel_text() to handle the extra states, i.e. to cover init text up to the point where the system switches to state RUNNING. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Steven Rostedt (VMware) Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170516184735.949992741@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- kernel/extable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/extable.c b/kernel/extable.c index 4f06fc34313f..83f9955735d9 100644 --- a/kernel/extable.c +++ b/kernel/extable.c @@ -72,7 +72,7 @@ int notrace core_kernel_text(unsigned long addr) addr < (unsigned long)_etext) return 1; - if (system_state == SYSTEM_BOOTING && + if (system_state < SYSTEM_RUNNING && init_kernel_text(addr)) return 1; return 0; From patchwork Mon Feb 10 06:55:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864363 Received: from mo-csw.securemx.jp (mo-csw1802.securemx.jp [210.130.202.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 585C3199FBA; Mon, 10 Feb 2025 06:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.152 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170610; cv=none; b=oWT83BAd+bXd4sydJtrfsN2WC7srtLt+b4D3g3Rg1Ez+clQbJ0kGtRvbXobhfwZA8gUD+yWYhNqZaXmYz1yRrjre31jtVWB+eLqEhTWn2S9eyxncSRkJB8XgB4fRuOrBVAy+8Jzx3p2XLj6C5HhbP9QFdPyBcAf6KEGsm9VADwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170610; c=relaxed/simple; bh=r2bGSQuW3OUidgcECmo0HgSV1D5FG/L2Ld2WCzZKiPg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=cei6V2HFAzMH+8dxTaWqqKEq+sBK21Yr9+SDp3wy6hcQhUcYu1nFHmmT7jwOFM04oxywU2pHjitdT1qpRA4Tlz7OLnVMQ1+Y5S8+jX4FnKBRSIoB3DB51G2BN3dc2drzQufMAg2O4FWb8W5zdf8i9kXF2yfVcrP5PpVk2P/uf+w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=knnD/rSR; arc=none smtp.client-ip=210.130.202.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="knnD/rSR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170573; x=1740380173; bh=r2bGS QuW3OUidgcECmo0HgSV1D5FG/L2Ld2WCzZKiPg=; b=knnD/rSRtEjokv4nwpdZLTt24aAMsPdzs30 OcZ6S48JJdY/JH8RrWYc+VapW96fUUfmO9pwBuSwy6Z81o9Bo7JuS7ovppPkUG+gTH/mlRg3+dBnl GDZM03E3lWJDfnU/rBAG6SmfvNQbrJIfDkF8+PUgC6r4RdQVl1fkmoe2OyAaAxohC1jU+GVinBcTU ilZt8iMKavIFJkjofP0PrO92gSlN0bILFlVMnOcMIt1XqmDAJCruup0n5Y3Sm5OTi74UG+73/mZcg uHlD7VTjpywQ0fFNnvcyGH4yr6wleFw74zKQGqQEMjUoxK/qaiXOSkwJ/5TP1Rhk7Ocg4HNahWww= =; Received: by mo-csw.securemx.jp (mx-mo-csw1802) id 51A6uDGN3387803; Mon, 10 Feb 2025 15:56:13 +0900 X-Iguazu-Qid: 2yAbAvUQLMDymhsI13 X-Iguazu-QSIG: v=2; s=0; t=1739170568; q=2yAbAvUQLMDymhsI13; m=cJHL28zEPBgbgE/lC5o0LDRLsvlwWkSeNef5Mf90hzM= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1803) id 51A6u8Qw4036156 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:08 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 13/17] printk: Adjust system_state checks Date: Mon, 10 Feb 2025 15:55:41 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-14-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit ff48cd26fc4889b9deb5f9333d3c61746e450b7f upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in boot_delay_msec() to handle the extra states. Conflicts: kernel/printk/printk.c cf775444 replace the third condition that boot_delay_msec() returns immediately with suppress_message_printing(). This does not affect system_state check. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Steven Rostedt (VMware) Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170516184736.027534895@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- kernel/printk/printk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index d8e0790f56cb..8d1e081bf9fc 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1077,7 +1077,7 @@ static void boot_delay_msec(int level) unsigned long long k; unsigned long timeout; - if ((boot_delay == 0 || system_state != SYSTEM_BOOTING) + if ((boot_delay == 0 || system_state >= SYSTEM_RUNNING) || (level >= console_loglevel && !ignore_loglevel)) { return; } From patchwork Mon Feb 10 06:55:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864013 Received: from mo-csw.securemx.jp (mo-csw1122.securemx.jp [210.130.202.158]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 985C01ADC79; Mon, 10 Feb 2025 06:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.158 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; cv=none; b=Pbu/aBi9e5vCr3osy+ljKcgkzfSGMS+BEs6SKOxYh8AKIlez2RXOBlD5yHPMobQp6zJTzpFQmAPS4eaAUIcblpbie/L0vYtfxSIrFdFDKDsIaT3kK5hK48PP+io1/i5acQWZ/1IkcYqNRDK69/nWW8VDEUyMuRCL9729kjdCm0U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; c=relaxed/simple; bh=oPbhdi6X+NHmZoY+32TmyHl/HKc+x2mok1HvpyiYhAw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=HRCJcrdoNL7UOaX5h0eRkvzH2UgIXeVXNVWmdOOYtCyMG1qj2BUOfUbqKADdWZbj+Xv7bXRLOyZbA+Hy0xnRdmZCmTJh5UQfc5uPhg9qRZ09gfcKylkzOQBt2RsmvEttbbT9y9DpagtVJOIEwBd2Cvk0Ba+34erOocaw1U0n7IA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=bSzuvNKV; arc=none smtp.client-ip=210.130.202.158 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="bSzuvNKV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170576; x=1740380176; bh=oPbhd i6X+NHmZoY+32TmyHl/HKc+x2mok1HvpyiYhAw=; b=bSzuvNKVpX/9glXGFuZlm9UjDKHJTsUZm45 XTfziGG7DzsMQ1QkYSjkSittyqoSxVE8iBraY0hPHfpyJ2W8k8ovYEx6GWz9xJHhl7lsnauTvsp7Y APC3lfhUIYPOVQgBsB8P18cHiQzs4FwxPw9m2gA5uAxXOstugM59eAvxIzjvTbGQl4bFo0ag8aHIh jWOj9PCsy7pzGRg0gFEnz+nUIy/pnt44kLsz/nxbr04l1z5bPmFomMx036s2ODMU99JFqDcsDD6x7 B+FdINI5uCkLCuyS0Kq+kKAWjwNfbiI2OFARra78tISlAeJb+90Gp/VTjtVJfUkdhS9y8cjujIzQ= =; Received: by mo-csw.securemx.jp (mx-mo-csw1122) id 51A6uGJ3605581; Mon, 10 Feb 2025 15:56:16 +0900 X-Iguazu-Qid: 2rWhWAeBjX3UcsnPV6 X-Iguazu-QSIG: v=2; s=0; t=1739170570; q=2rWhWAeBjX3UcsnPV6; m=PEpGbHJPdTb+kyLSpGQ0l6qlUAcFXU+N+Hi+UfiPIQo= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1121) id 51A6u73v4035346 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:08 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 14/17] mm/vmscan: Adjust system_state checks Date: Mon, 10 Feb 2025 15:55:42 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-15-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit c6202adf3a0969514299cf10ff07376a84ad09bb upstream. To enable smp_processor_id() and might_sleep() debug checks earlier, it's required to add system states between SYSTEM_BOOTING and SYSTEM_RUNNING. Adjust the system_state check in kswapd_run() to handle the extra states. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Steven Rostedt (VMware) Acked-by: Vlastimil Babka Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Johannes Weiner Cc: Linus Torvalds Cc: Mel Gorman Cc: Michal Hocko Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20170516184736.119158930@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- mm/vmscan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 76853088f66b..9cd702320375 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3620,7 +3620,7 @@ int kswapd_run(int nid) pgdat->kswapd = kthread_run(kswapd, pgdat, "kswapd%d", nid); if (IS_ERR(pgdat->kswapd)) { /* failure at boot is fatal */ - BUG_ON(system_state == SYSTEM_BOOTING); + BUG_ON(system_state < SYSTEM_RUNNING); pr_err("Failed to start kswapd on node %d\n", nid); ret = PTR_ERR(pgdat->kswapd); pgdat->kswapd = NULL; From patchwork Mon Feb 10 06:55:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864015 Received: from mo-csw.securemx.jp (mo-csw1801.securemx.jp [210.130.202.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EF871ADC6B; Mon, 10 Feb 2025 06:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; cv=none; b=cXeMX+wcwfyz+Yb6HUm8nCDwk1JBZFO59ntH73bOuNMJk2lxXdhIj/BJOFc7c8k7wjBas8Astt4RX2jZI6sdmPgjRxtyGjigwZZU/8OwWejH4V7ftHgca0Y7RnNv1zN7va5cMQP1sii8n1rO4Jag7JmCVQPLp66TTm6/DZ/48v8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170612; c=relaxed/simple; bh=+jRq6pBjTZA/g6J9T9NYXpzObiQLHmv8zugfNAxez44=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=R5tbDEKUu1k1ynT8A+jYs14zQ4AcVJjY87NDgkEkl1bYldkMzZj4tzgcDR6EvhbgwmdJ8fL/V7v3a0Kjnr30oUAVwNwL5/qk1Ssava4+d1vIuFRalBGluwzvCZZ1YhYQlLJjFn0onCMD/wggRR7/hUAeHPTDV3XeMHtfkpZKG2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=m1dhlpEF; arc=none smtp.client-ip=210.130.202.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="m1dhlpEF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170574; x=1740380174; bh=+jRq6 pBjTZA/g6J9T9NYXpzObiQLHmv8zugfNAxez44=; b=m1dhlpEFy6B42fF2cCw+w2kcj//WKiD+mkj o4XPUh2xy1aaRa7QTO/nuGiCALvDUTtc2SpSRIvRVqMu9hvUiFetozN1w7rZbGymt0GoVdUfNLO0D MDbnYVm8nRodTAFJHI5WuyIJ8v2DHhTSX1eenFMXBJ+x0q1VNcbPFeltgBBb4ZwW/ZiOPGz+6EjRM NxtKohjzL7i/d7uP7vH3gzCa9Ohz8Mfdl3Bb6OgJw/2XjXY8a4RO/CNtSdveWH3JOw2lGbAZzcPCV 0YvPK3VKWU5GANAqVBIvpTEpsDc3pxzpKTREi7KEdDXNHBWWFRKX0fISga7iNbh9EnzorpehBZCQ= =; Received: by mo-csw.securemx.jp (mx-mo-csw1801) id 51A6uDur3258935; Mon, 10 Feb 2025 15:56:14 +0900 X-Iguazu-Qid: 2yAbAvUQLMDymhsI16 X-Iguazu-QSIG: v=2; s=0; t=1739170569; q=2yAbAvUQLMDymhsI16; m=a3H3MO9Uo5vvHAlyEcveR+c2PIVSA+TssczIWnNiNTI= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1801) id 51A6u8nV1015867 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:08 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 15/17] init: Introduce SYSTEM_SCHEDULING state Date: Mon, 10 Feb 2025 15:55:43 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-16-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit 69a78ff226fe0241ab6cb9dd961667be477e3cf7 upstream. might_sleep() debugging and smp_processor_id() debugging should be active right after the scheduler starts working. The init task can invoke smp_processor_id() from preemptible context as it is pinned on the boot cpu until sched_smp_init() removes the pinning and lets it schedule on all non isolated cpus. Add a new state which allows to enable those checks earlier and add it to the xen do_poweroff() function. No functional change. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Boris Ostrovsky Acked-by: Mark Rutland Cc: Greg Kroah-Hartman Cc: Juergen Gross Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/20170516184736.196214622@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- drivers/xen/manage.c | 1 + include/linux/kernel.h | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index f494126aaecd..4f907fbda6c0 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c @@ -188,6 +188,7 @@ static void do_poweroff(void) { switch (system_state) { case SYSTEM_BOOTING: + case SYSTEM_SCHEDULING: orderly_poweroff(true); break; case SYSTEM_RUNNING: diff --git a/include/linux/kernel.h b/include/linux/kernel.h index d68f639f7330..d472456c6fcc 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -481,9 +481,13 @@ extern int root_mountflags; extern bool early_boot_irqs_disabled; -/* Values used for system_state */ +/* + * Values used for system_state. Ordering of the states must not be changed + * as code checks for <, <=, >, >= STATE. + */ extern enum system_states { SYSTEM_BOOTING, + SYSTEM_SCHEDULING, SYSTEM_RUNNING, SYSTEM_HALT, SYSTEM_POWER_OFF, From patchwork Mon Feb 10 06:55:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864356 Received: from mo-csw.securemx.jp (mo-csw1120.securemx.jp [210.130.202.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D8DA1ADC89; Mon, 10 Feb 2025 06:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170613; cv=none; b=VxHtG4Ihv9gLgGILVYfPMWCxO63Xk6visM4kRz0c2Kr1NT6m2k3lMROZ2B55dDVE8Rgbz+52KY3KYOFW2Z7vJSZORxM0u4KWsTn8qW9Q/tNpFaWDya04aBYtx9BFQd7pJb/Yw9C5qKbdZd9gaq5//WJ4qeZ9AiSoLpsGZbinjK8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170613; c=relaxed/simple; bh=SP2mNCJCWYP+Y8goXQCeNQj3FziYLaCpbQI4pkMOXBI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=Iz8rbLJT5nhTR+QxGUPkbjLRhswazOgZABTx4HVmBew1OWNMHEqlJjXjg+znIMYY6L9CO5jzsLpzT4qXq6k07a9ABU0qv6B7R1BWDu2I07LaAajOTQO6RmLXbgCg1ySVgCJjMdiuV2cOShEefojWAu7CdJ3+wKGlAzycarSKUBc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=FB4WGqTG; arc=none smtp.client-ip=210.130.202.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="FB4WGqTG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170571; x=1740380171; bh=SP2mN CJCWYP+Y8goXQCeNQj3FziYLaCpbQI4pkMOXBI=; b=FB4WGqTGxABJX41b7PK+dmsKpIBRvW+6Kzj 99ixaMXem2disaIHMGI9isPF5p9TwTCFV6TeqCFDwrV2hOY6ST0d8fkktEzL6LzmP24Nd0wv/1kTJ KS/Gq6o6uWP4b1kEjowRhhllOPtcNBMZ3IwHBU8lWWXA1avtrYr1jieMD2cnvW7HFCpV43+tV+1O8 ZZhSZKqNhnN1VVAzasqwhbBGlArKDE+TEHFFmLsGo/fSvPCimugl83pThVxhYLCvTFuocCju8O1KN 078Muj6az4Ed1UbZJKf7OusByAabtqPQDE7WendcBs/4qBJCRJFmDF2CQP5TQpoBN85ffo5UiZYw= =; Received: by mo-csw.securemx.jp (mx-mo-csw1120) id 51A6uAe23587313; Mon, 10 Feb 2025 15:56:10 +0900 X-Iguazu-Qid: 2rWhqikycnTS8B6ZlP X-Iguazu-QSIG: v=2; s=0; t=1739170569; q=2rWhqikycnTS8B6ZlP; m=Pln8YCdW3FRyGMFqByHrpv+NATtDA2H3XU8IdDMV1k0= Received: from imx2-a.toshiba.co.jp (imx2-a.toshiba.co.jp [106.186.93.35]) by relay.securemx.jp (mx-mr1120) id 51A6u8RL859203 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:08 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 16/17] sched/core: Enable might_sleep() and smp_processor_id() checks early Date: Mon, 10 Feb 2025 15:55:44 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-17-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: From: Thomas Gleixner commit 1c3c5eab171590f86edd8d31389d61dd1efe3037 upstream. might_sleep() and smp_processor_id() checks are enabled after the boot process is done. That hides bugs in the SMP bringup and driver initialization code. Enable it right when the scheduler starts working, i.e. when init task and kthreadd have been created and right before the idle task enables preemption. Tested-by: Mark Rutland Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Acked-by: Mark Rutland Cc: Greg Kroah-Hartman Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Steven Rostedt Link: http://lkml.kernel.org/r/20170516184736.272225698@linutronix.de Signed-off-by: Ingo Molnar Signed-off-by: Kazuhiro Hayashi --- init/main.c | 10 ++++++++++ kernel/sched/core.c | 4 +++- lib/smp_processor_id.c | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/init/main.c b/init/main.c index 6c745aff6669..0db97f4e2090 100644 --- a/init/main.c +++ b/init/main.c @@ -412,6 +412,16 @@ static noinline void __init_refok rest_init(void) rcu_read_lock(); kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns); rcu_read_unlock(); + + /* + * Enable might_sleep() and smp_processor_id() checks. + * They cannot be enabled earlier because with CONFIG_PRREMPT=y + * kernel_thread() would trigger might_sleep() splats. With + * CONFIG_PREEMPT_VOLUNTARY=y the init task might have scheduled + * already, but it's stuck on the kthreadd_done completion. + */ + system_state = SYSTEM_SCHEDULING; + complete(&kthreadd_done); /* diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c3e7d115d93d..d8dd1408943c 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -7966,8 +7966,10 @@ void ___might_sleep(const char *file, int line, int preempt_offset) rcu_sleep_check(); /* WARN_ON_ONCE() by default, no rate limit reqd. */ if ((preempt_count_equals(preempt_offset) && !irqs_disabled() && !is_idle_task(current)) || - system_state != SYSTEM_RUNNING || oops_in_progress) + system_state == SYSTEM_BOOTING || system_state > SYSTEM_RUNNING || + oops_in_progress) return; + if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy) return; prev_jiffy = jiffies; diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c index 11fa431046a8..3fc9a5b0ce48 100644 --- a/lib/smp_processor_id.c +++ b/lib/smp_processor_id.c @@ -28,7 +28,7 @@ notrace static unsigned int check_preemption_disabled(const char *what1, /* * It is valid to assume CPU-locality during early bootup: */ - if (system_state != SYSTEM_RUNNING) + if (system_state < SYSTEM_SCHEDULING) goto out; /* From patchwork Mon Feb 10 06:55:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kazuhiro Hayashi X-Patchwork-Id: 864019 Received: from mo-csw.securemx.jp (mo-csw1800.securemx.jp [210.130.202.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 305E2130E58; Mon, 10 Feb 2025 06:56:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.130.202.134 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; cv=none; b=XLrgyvN8+AgaRPuGWt/vUDOJEYBVwzkpWFJg0UFxO+2vKXmUYlK6Dg4Yt27aldgCwR0Q/zb7qOlzuhyd78K5C4+c/ZvuRR41xUolSrTPE5POznt1I0LTfq2Xzlr60gq6TkQoF/u+bdoVkOhNhlSGzatfpG+38C9/gAGNPitQPYs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739170611; c=relaxed/simple; bh=acPjB02nKz+0L18N0R0yI4XNLgXwOw2WtMq2MiY7VZo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=IqilnWXwpGB2MqWJC71hAtKrpZQR567FvjVhMreyjc4xBzikvsp1XV9q3VnhtOmWslfXoksRfhX/83uq2Lg0ZdPuX2HhvKxLOG/AR/V8zeEcGJ0qbg1WjjhC3+tZmoLKixOEFq/txCUeXdcTUOYF8Ghh8ymkyrd5q6pmCtsIkis= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp; spf=pass smtp.mailfrom=toshiba.co.jp; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b=oCh85SuA; arc=none smtp.client-ip=210.130.202.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=toshiba.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=toshiba.co.jp header.i=kazuhiro3.hayashi@toshiba.co.jp header.b="oCh85SuA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=toshiba.co.jp; h=From:To:Cc :Subject:Date:Message-Id:In-Reply-To:References;i= kazuhiro3.hayashi@toshiba.co.jp; s=key2.smx; t=1739170573; x=1740380173; bh=acPjB 02nKz+0L18N0R0yI4XNLgXwOw2WtMq2MiY7VZo=; b=oCh85SuAg7YVFGfhwBDQyajbrpY9Z052Zbz nC8RRvcCoEC8HPQTRbJGylco1CGX39SovF12k2wPQuHqlnHiTIcPt8EWA8oJ/DiKsATa+D8ls2ssz DU5d4yQtJAiPZ8TrPQnjtzssFmONlfjhPpXnI2OgXoK8rcghYTEwX8zCK0ic2OagRuXz4f76c5ieZ /FQ0GyGw11rhDkSRorOndM1rkbhMdH20sfItoMehwfv3gwWIVn8EATmSvwuS3BwHPvB0CIe38Y/Le eSr0D+F7f/9AqCuxe1wgTE7RhXwRGGZTs6w5OqljHfS+IpmLMGypaMmy9MjG3iB2oUU9D4ng+YNw= =; Received: by mo-csw.securemx.jp (mx-mo-csw1800) id 51A6uDV7789623; Mon, 10 Feb 2025 15:56:13 +0900 X-Iguazu-Qid: 2yAbAvUQLMDyrOXXCz X-Iguazu-QSIG: v=2; s=0; t=1739170569; q=2yAbAvUQLMDyrOXXCz; m=hT5YGyOoxk8Q0nj+TSNNp3ULzx5+5kOpNb8kwhatOo4= Received: from imx12-a.toshiba.co.jp ([38.106.60.135]) by relay.securemx.jp (mx-mr1802) id 51A6u8lC482935 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Mon, 10 Feb 2025 15:56:08 +0900 From: Kazuhiro Hayashi To: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, cip-dev@lists.cip-project.org Cc: bigeasy@linutronix.de, tglx@linutronix.de, rostedt@goodmis.org, linux-rt-users@vger.kernel.org, pavel@denx.de Subject: [PATCH 4.4 v1 17/17] mm: slub: allocate_slab() enables IRQ right after scheduler starts Date: Mon, 10 Feb 2025 15:55:45 +0900 X-TSB-HOP2: ON Message-Id: <1739170545-25011-18-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> References: <1739170545-25011-1-git-send-email-kazuhiro3.hayashi@toshiba.co.jp> Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This patch resolves problem in 4.4 (& 4.9) PREEMPT_RT kernels that the following WARNING happens repeatedly due to broken context caused by running slab allocation with IRQ disabled by mistake. WARNING: CPU: * PID: ** at */kernel/cpu.c:197 unpin_current_cpu+0x60/0x70() The system is almost unresponsive and the boot stalls once it occurs. This repeated WARNING only happens while kernel is booting (before reaches the userland) with a quite low reproducibility: Only one time in around 1,000 ~ 10,000 reboots. [Problem details] On PREEMPT_RT kernels < v4.14-rt, after __slab_alloc() disables IRQ with local_irq_save(), allocate_slab() is responsible for re-enabling IRQ only under the specific conditions: (1) gfpflags_allow_blocking(flags) OR (2) system_state == SYSTEM_RUNNING The problem happens when (1) is false AND system_state == SYSTEM_BOOTING, caused by the following scenario: 1. Some kernel codes invokes the allocator without __GFP_DIRECT_RECLAIM bit (i.e. blocking not allowed) while SYSTEM_BOOTING 2. allocate_slab() calls the following functions with IRQ disabled 3. buffered_rmqueue() invokes local_[spin_]lock_irqsave(pa_lock) which might call schedule() and enable IRQ, if it failed to get pa_lock 4. The migrate_disable counter, which is not intended to be updated with IRQs disabled, is accidentally updated after schedule() then migrate_enable() raises WARN_ON_ONCE(p->migrate_disable <= 0) 5. The unpin_current_cpu() WARNING is raised eventually because the refcount counter is linked to the migrate_disable counter The behavior 2-5 above has been obsereved[1] using ftrace. The condition (2) above intends to make the memory allocator fully preemptible on PREEMPT_RT kernels[2], so the lock function in the step 3 above should work if SYSTEM_RUNNING but not if SYSTEM_BOOTING. [How this is resolved in newer RT kernels] A patch series in the mainline (v4.13) introduces SYSTEM_SCHEDULING[3]. On top of this, v4.14-rt (6cec8467) changes the condition (2) above: - if (system_state == SYSTEM_RUNNING) + if (system_state > SYSTEM_BOOTING) This avoids the problem by enabling IRQ after SYSTEM_SCHEULDING. Thus, the conditions that allocate_slab() enables IRQ are like: (2)system_state v4.9-rt or before v4.14-rt or later SYSTEM_BOOTING (1)==true (1)==true : : : v SYSTEM_SCHEDULING : < Problem Always v < occurs here | SYSTEM_RUNNING Always | | | v v [How this patch works] The series[3] that introduces SYSTEM_SCHEULDING is already backported by the prior patches. Using the state, this patch applies the same fix as v4.14-rt (6cec8467) to system_state check in allocate_slab(). With those changes, the unpin_current_cpu() WARNING has not occured in more than 20,000 reboots on multiple environments[4]. As a side effect, all other codes which does not know SYSTEM_SCHEULDING yet needs to be adjusted like commits in the series[3]. [1] https://lore.kernel.org/all/TYCPR01MB11385E3CDF05544B63F7EF9C1E1622@TYCPR01MB11385.jpnprd01.prod.outlook.com/ [2] https://docs.kernel.org/locking/locktypes.html#raw-spinlock-t-on-rt [3] https://lore.kernel.org/all/20170516184231.564888231@linutronix.de/T/ [4] https://lore.kernel.org/all/TYCPR01MB1138579CA7612B568BB880652E1272@TYCPR01MB11385.jpnprd01.prod.outlook.com/ Signed-off-by: Kazuhiro Hayashi --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index fd23ff951395..3db76fd92861 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1412,7 +1412,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) if (gfpflags_allow_blocking(flags)) enableirqs = true; #ifdef CONFIG_PREEMPT_RT_FULL - if (system_state == SYSTEM_RUNNING) + if (system_state > SYSTEM_BOOTING) enableirqs = true; #endif if (enableirqs)