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 8F07517B43F for ; Thu, 21 May 2026 22:37:17 +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=1779403038; cv=none; b=F7a5xtCwb+7mBl4g+9Iv0FuxkkUvm9BEMAHXULY5/bVkwmb++4a++Vmr1dvuZ2s4awHGJf98onbsEwstSaaqLWLxb7llDN6ygzQ7ayW+CmH/pWfHK7+nAjCDhzf3+ag+E8JfovTmzxaBfgExDaJbH9BDXVVuC46gcRIWVCQvlPg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779403038; c=relaxed/simple; bh=NKxM+6Bbv8vvCLgXi+kzsPXsTJXf8eafpvQw0ZQUVc8=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=IWicEegFt0G9KnX92LZAH0TfvsyZLU8x64FDz9b22xKVzMMgW6YUh2QWyPE/8NIJMSnAOgzZHr0fUvYrQNi/XhEthe6MXDQHvHsbGr1H7hc1+8GB88LeVHDK7gEek3DGbP+KbMXEVKFIwq8dP2EfN28UQcP/XE8ARQfyyjwGeEE= 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=IjXziiAT; 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="IjXziiAT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EFD61F000E9; Thu, 21 May 2026 22:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1779403037; bh=7R/uk7YcVBtiWPdNVrKy8CZ7cLGZw7MTdc3Amgg9pWk=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=IjXziiATh7KpFtyTQ7vTS7mo+2O2O611vv9PQGLeQYGjEOFeXf/i11H2yIXJRoxXU OmeslbBIxik2RqN8sXkatFe1imqrEkVemynW2YbAvvnChZESjhe1doVBJAVimn7G5q yyspiGvLhYZpvqnFRQDuOLXBrAMHjqmzkF+cvrG4= Date: Thu, 21 May 2026 15:37:16 -0700 From: Andrew Morton To: Feng Tang Cc: paulmck@kernel.org, Petr Mladek , linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib/nmi_backtrace: print out the CPUs which fail to respond to NMI Message-Id: <20260521153716.0e6da8366d3e2004e9e7cf97@linux-foundation.org> In-Reply-To: <20260521030336.92172-1-feng.tang@linux.alibaba.com> References: <20260521030336.92172-1-feng.tang@linux.alibaba.com> 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 Thu, 21 May 2026 11:03:36 +0800 Feng Tang wrote: > When debugging RCU stall cases, usually all CPUs will respond to the > NMI and print out the backtrace. But in some nasty or hardware related > cases, some CPUs may fail to respond in 10 seconds, and very likely > this is sign of severe issues. > > Paul E. McKenney has implemented the NMI backtrace stall check for x86, > and for other architectures, it should be also helpful to at least > print out those CPUs which failed to repond to the NMI, so that users > can get an early heads-up for possible CPU hard stall. That must be one messed up machine. Is this something you've encountered in real life? > --- a/lib/nmi_backtrace.c > +++ b/lib/nmi_backtrace.c > @@ -75,7 +75,13 @@ void nmi_trigger_cpumask_backtrace(const cpumask_t *mask, > mdelay(1); > touch_softlockup_watchdog(); > } > - nmi_backtrace_stall_check(to_cpumask(backtrace_mask)); > + > + if (!cpumask_empty(to_cpumask(backtrace_mask))) { > + pr_warn("After 10 seconds, these CPUS still haven't responded to the NMI: %*pbl\n", > + cpumask_pr_args(to_cpumask(backtrace_mask))); > + > + nmi_backtrace_stall_check(to_cpumask(backtrace_mask)); > + } It's a nitpick, but : /* Wait for up to 10 seconds for all CPUs to do the backtrace */ : for (i = 0; i < 10 * 1000; i++) { : if (cpumask_empty(to_cpumask(backtrace_mask))) : break; : mdelay(1); : touch_softlockup_watchdog(); : } : : if (!cpumask_empty(to_cpumask(backtrace_mask))) { : pr_warn("After 10 seconds, these CPUS still haven't responded to the NMI: %*pbl\n", Here we're hard-coding "10" in two places and in a comment. It would be nicer to do #define FOO_TIMEOUT 10 then use that throughout. (bonus points for figuring out how to paste that "10" into the pr_warn() control string rather than using %d!)