Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2715146pxv; Sun, 11 Jul 2021 23:36:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7mBq3s8nkzog3TZMaq69g9IPMU+1jmTfiLKAU7dj50M3XTJ8lApymClkH8mXwNeZBvqJw X-Received: by 2002:a05:6402:40cf:: with SMTP id z15mr51190040edb.175.1626071804279; Sun, 11 Jul 2021 23:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626071804; cv=none; d=google.com; s=arc-20160816; b=0fvNy5P1kIqWaMMEENFNW0dTUHbS1QWQcqNe0uijiqzG2LbBLK6lDCBoFtvpS83CtW Y49nDHFf76dH1mJHXHvlSU+4X9/Kp6ZkgED18NooUmZ+RVEXgKU2jclQsAcJt7pHSjyk 4r+III6srsLHO3oz6v/3fP1Au+IH9sQX5as8+VtSQQ1ErotzcdiiIzXI3Ugkyp2JIfiA 8IGE4ysOoAI8gwemjfS+c6ESeLJ3XDg8JODYUIncHVmVRieTXT8rZDAl4NsI/haHCF54 KfTmwemd2Sz9v+unWS+hL8myR8u1oasYt7DzZzd6YgCK4GIXsWuXFKemyq9rpo4HsdM/ aSRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4RQzu8XxUo3Zj+imghvOe+Chenl2sftWfGnLZ0eCgMg=; b=ytF5v0vp6EMvjpxs6rw9LM75GeG+LZMeCqJWmfyDIcfF0zje4N6m5FXSWBwyXVJeU0 WXLy6SYeyNnAp3ulq7yyd/K4WGyjoF15Y9xfNsyAUN3JQjyJJtZcYHVaXA/4bkBeY4eL 5Hd5gdX8zztgFFJNbIcb6hWngSHBc7MA8EoMfR2G5FIfiAhW8DFlEKySnbzuv/MGxslB XsMIwZ87OHxHoy8rq1bLzau+czPmdAfmvHR7cZIQ6P6fat/mqqVSYl78UFnC6tMvPBb7 uX3cMBPla5kpmNh1pLhp6s2onYJj+264o3QwhUFOFbyM4mIdJDtfi0YwYUgC5adNO9SQ O+bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=arfLOGMk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u15si17452208edt.211.2021.07.11.23.36.21; Sun, 11 Jul 2021 23:36:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=arfLOGMk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236332AbhGLGhO (ORCPT + 99 others); Mon, 12 Jul 2021 02:37:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:52360 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236456AbhGLGaM (ORCPT ); Mon, 12 Jul 2021 02:30:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3BABA60234; Mon, 12 Jul 2021 06:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626071244; bh=pb/+uHrhCpg4Ze3Y2BbtY7us8v88mbrC5hq3KglQBUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=arfLOGMkftz2nSVHaFWYNh3YlZ9PxLFFXu33Sr6R1VhdbzVDRKT3D81k7M7efL41N 5JOQkE4iQY4L8/ScLZ+mAW2cIToNuUuauarEVyZCWzm6GrdZPFUUavSjlPoe1ftPuq tred2ozV7vbMBDLpzLjj+/EL7GCxEsdfaC3doksw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 335/348] powerpc: Offline CPU in stop_this_cpu() Date: Mon, 12 Jul 2021 08:11:59 +0200 Message-Id: <20210712060748.574141528@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060659.886176320@linuxfoundation.org> References: <20210712060659.886176320@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Piggin [ Upstream commit bab26238bbd44d5a4687c0a64fd2c7f2755ea937 ] printk_safe_flush_on_panic() has special lock breaking code for the case where we panic()ed with the console lock held. It relies on panic IPI causing other CPUs to mark themselves offline. Do as most other architectures do. This effectively reverts commit de6e5d38417e ("powerpc: smp_send_stop do not offline stopped CPUs"), unfortunately it may result in some false positive warnings, but the alternative is more situations where we can crash without getting messages out. Fixes: de6e5d38417e ("powerpc: smp_send_stop do not offline stopped CPUs") Signed-off-by: Nicholas Piggin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20210623041245.865134-1-npiggin@gmail.com Signed-off-by: Sasha Levin --- arch/powerpc/kernel/smp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index b24d860bbab9..c06cac543f18 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -588,6 +588,8 @@ static void nmi_stop_this_cpu(struct pt_regs *regs) /* * IRQs are already hard disabled by the smp_handle_nmi_ipi. */ + set_cpu_online(smp_processor_id(), false); + spin_begin(); while (1) spin_cpu_relax(); @@ -603,6 +605,15 @@ void smp_send_stop(void) static void stop_this_cpu(void *dummy) { hard_irq_disable(); + + /* + * Offlining CPUs in stop_this_cpu can result in scheduler warnings, + * (see commit de6e5d38417e), but printk_safe_flush_on_panic() wants + * to know other CPUs are offline before it breaks locks to flush + * printk buffers, in case we panic()ed while holding the lock. + */ + set_cpu_online(smp_processor_id(), false); + spin_begin(); while (1) spin_cpu_relax(); -- 2.30.2