From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 355C62E718B for ; Tue, 7 Jul 2026 18:12:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783447978; cv=none; b=bqsQpwCFRoEfr+J8OLxY9vPLySua6xzEUCA1h/NvU4onG3nfsA5vn6HUGp8ROfNnOJOilPyNbYWaS3dshxHZi8cptqEZGkL3Z9N4UDNB2eJd787pKt7MfpkGWV/KKgIx074PDRK4vZFZ/ImjQu65up8cuaQmXD7migOJBc6iGyw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783447978; c=relaxed/simple; bh=xMJV42mVpmiwY4TA5GnEJucrtbjHI+VXMbZtWbbuabI=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=XXUfDlMwzeQxXMQju6cavxbE/d9r36qT10E+nXiMsKD3066nLHYZ2VQyIWQX2t+mohRC8Z/6AeZ+WnzMKz3jmSvYdSsLAyDRV0t0S2OuHEjvK19/d2NUYxbfqRTBI6e8TAwPCdz+L6JxsH7J2Kpw++GjS98kW1iXwucARy3zxAE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=JpE1Pfq1; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="JpE1Pfq1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9065B1F000E9; Tue, 7 Jul 2026 18:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1783447976; bh=p8F82tAypMzt6T1wWF/TyXfPJ3vy3euhrjnqJ3QLegE=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=JpE1Pfq1JUtt1WQUAijOYWM3sArqfsYOq2tL3kcWsOm0XJWWCe9sd72WjKsv+kN6V 9SZqUDErrXhldBYE6ZKPOyAtbJjedklltWzgVjGtrr4sxDo1jE2nLIw0+Pu5dqihfm LNqmJkYjG72KSTC0eC/sSYF4x2jKRAnXLvqAlKhA= Date: Tue, 7 Jul 2026 11:12:56 -0700 From: Andrew Morton To: Bradley Morgan Cc: pmladek@suse.com, feng.tang@linux.alibaba.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] panic: stop CPUs that lose the panic_redirect_cpu race Message-Id: <20260707111256.d16cd0fba685c7fa1c1663df@linux-foundation.org> In-Reply-To: <20260707172252.4842-1-include@grrlz.net> References: <20260707172252.4842-1-include@grrlz.net> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 7 Jul 2026 17:22:52 +0000 Bradley Morgan wrote: > Loser of the redirect cmpxchg must stop, not fall through to > panic_try_start(). > > This issue was found by sashiko [1]. > > [1] https://sashiko.dev/#/patchset/20260705164123.18746-1-include%40grrlz.net > > ... > > --- a/kernel/panic.c > +++ b/kernel/panic.c > @@ -400,12 +400,9 @@ static bool panic_try_force_cpu(const char *fmt, va_list args) > if (panic_in_progress()) > return false; > > - /* > - * Only one CPU can do the redirect. Use atomic cmpxchg to ensure > - * we don't race with another CPU also trying to redirect. > - */ > + /* Only one CPU redirects, the loser stops and lets it finish. */ > if (!atomic_try_cmpxchg(&panic_redirect_cpu, &old_cpu, this_cpu)) > - return false; > + return true; > > /* > * Use dynamically allocated buffer if available, otherwise Sashiko is at it again: https://sashiko.dev/#/patchset/20260707172252.4842-1-include@grrlz.net