Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3361389pxb; Mon, 17 Jan 2022 18:36:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJzOZ4n7yG4NamRKlx4owRUJ9v1L3EPXh3Bc+zuEeoiulJHj9yDD2BzT63BpXf15IQhtwR4K X-Received: by 2002:a17:90b:4f46:: with SMTP id pj6mr28334619pjb.166.1642473365304; Mon, 17 Jan 2022 18:36:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642473365; cv=none; d=google.com; s=arc-20160816; b=oiG9ByqKs4RG++TNU0OXQmeXleo4gZLhQkRL7qg9QuQb3u+YyR+8xuPI99TeWdC+HP wMNB88iNB/4fom8WKK9GCC7wWkSIA++3aiD7MzgPgOfQwVNBPTJs0mU3YRlNLQcM98sS WF0HIDHq8FLBQ8IYUflNmFOri4faFDDjH3tuUVTj/voTKMuA7XAu4agN4IYZzST0AAkA ouSoBAYhF/XGiKKSW2o6JK2KMiHYziGd1jYv5Qp29YgJKQa/M/tklIhWWd/2u/f6DOZ8 PC2KgfGuKlG7HwYO20D3ug0Iz6Xemu2hAcrcMKcETNBrFhjOG/FxC8HYUAHcmJRhmTbO CLxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=MNqHXv6MfG8R4sphIZpyKKqw2VDVKa0Hx9PMS38Jazc=; b=nCtqMYOK2LmcfNQNz54rh3TW6Kh/dGznNnWfKSPCESkRA1BJc+Lj7c3oEfg+4+OAXJ VsieJXrBD+1WeTL/MT+vqD1fLmixoF6yEACqmG0GY50PkwXEqyGMvBDPXg4taq4jGJfE jdHwQ2DCwbRfpeT7nmgfDtgJTpkSDbGqzBQnxhkw5rHainqZ5hQfhrOT5rBHECG/lM+i 1uW32J0q2m4rjl5pfkwptwPyysgo2q/H0oGxdgLAZw93xwgltcxS2wube4RRPxjK20P1 omPCCpcybvjObVY7FXSJAkwNxvB4BDbI1FhXWbH9RoBb6PwloF7x+1h3knHaAXYusnD0 xCrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zwQeY8ff; 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 84si10425694pgh.114.2022.01.17.18.35.53; Mon, 17 Jan 2022 18:36:05 -0800 (PST) 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=zwQeY8ff; 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 S240643AbiAQPu2 (ORCPT + 99 others); Mon, 17 Jan 2022 10:50:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237375AbiAQPu0 (ORCPT ); Mon, 17 Jan 2022 10:50:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 890B7C061574 for ; Mon, 17 Jan 2022 07:50:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 26A8860FAD for ; Mon, 17 Jan 2022 15:50:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEBA4C36AE7; Mon, 17 Jan 2022 15:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1642434624; bh=WsPNe1Hx43VHSCNBUeBEASSqX+3rnhsa2BPleFLd+SA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=zwQeY8ffSUVxeJ1jSp7KvX8e9gpuMLhmMwE0UlaHQLLQbzi8UEK8HN34VAGuQiXUr CPyq3cHx8ss9DodAu4BeYxD/TK8eeqhO2m/kY+oY0/O/reLtI4qn9E8hzomImjJElQ JoKsspK5XA1p7FCbYUP1xC01uanC+X15umso0GzM= Date: Mon, 17 Jan 2022 16:50:21 +0100 From: Greg Kroah-Hartman To: Changbin Du Cc: Jiri Slaby , Palmer Dabbelt , linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH] sysrq: do not omit current cpu when showing backtrace of all active CPUs Message-ID: References: <20220117154300.2808-1-changbin.du@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220117154300.2808-1-changbin.du@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 17, 2022 at 11:43:00PM +0800, Changbin Du wrote: > The backtrace of current CPU also should be printed as it is active. This > change add stack trace for current CPU and print a hint for idle CPU for > the generic workqueue based printing. (x86 already does this) How does x86 already do this? What processors do not currently do this? > Now it looks like below: > [ 279.401567] sysrq: Show backtrace of all active CPUs > [ 279.407234] sysrq: CPU5: > [ 279.407505] Call Trace: > [ 279.408789] [] dump_backtrace+0x2c/0x3a > [ 279.411698] [] show_stack+0x32/0x3e > [ 279.411809] [] sysrq_handle_showallcpus+0x4c/0xc6 > [ 279.411929] [] __handle_sysrq+0x106/0x26c > [ 279.412034] [] write_sysrq_trigger+0x64/0x74 > [ 279.412139] [] proc_reg_write+0x8e/0xe2 > [ 279.412252] [] vfs_write+0x90/0x2be > [ 279.412362] [] ksys_write+0xa6/0xce > [ 279.412467] [] sys_write+0x2a/0x38 > [ 279.412689] [] ret_from_syscall+0x0/0x2 > [ 279.417173] sysrq: CPU6: backtrace skipped as idling > [ 279.417185] sysrq: CPU4: backtrace skipped as idling > [ 279.417187] sysrq: CPU0: backtrace skipped as idling > [ 279.417181] sysrq: CPU7: backtrace skipped as idling > [ 279.417190] sysrq: CPU1: backtrace skipped as idling > [ 279.417193] sysrq: CPU3: backtrace skipped as idling > [ 279.417219] sysrq: CPU2: > [ 279.419179] Call Trace: > [ 279.419440] [] dump_backtrace+0x2c/0x3a > [ 279.419782] [] show_stack+0x32/0x3e > [ 279.420015] [] showacpu+0x5c/0x96 > [ 279.420317] [] flush_smp_call_function_queue+0xd6/0x218 > [ 279.420569] [] generic_smp_call_function_single_interrupt+0x14/0x1c > [ 279.420798] [] handle_IPI+0xaa/0x13a > [ 279.421024] [] riscv_intc_irq+0x56/0x70 > [ 279.421274] [] generic_handle_arch_irq+0x6a/0xfa > [ 279.421518] [] ret_from_exception+0x0/0x10 > [ 279.421750] [] rcu_idle_enter+0x16/0x1e > > Signed-off-by: Changbin Du > --- > drivers/tty/sysrq.c | 13 +++++++++---- > 1 file changed, 9 insertions(+), 4 deletions(-) > > diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c > index bbfd004449b5..34cfdda4aff5 100644 > --- a/drivers/tty/sysrq.c > +++ b/drivers/tty/sysrq.c > @@ -232,8 +232,10 @@ static void showacpu(void *dummy) > unsigned long flags; > > /* Idle CPUs have no interesting backtrace. */ > - if (idle_cpu(smp_processor_id())) > + if (idle_cpu(smp_processor_id())) { > + pr_info("CPU%d: backtrace skipped as idling\n", smp_processor_id()); > return; > + } Why do you need to see the skipped processor? Can't you just infer this from a lack of calltrace on the other cpus? What needs to see this information? > > raw_spin_lock_irqsave(&show_lock, flags); > pr_info("CPU%d:\n", smp_processor_id()); > @@ -260,10 +262,13 @@ static void sysrq_handle_showallcpus(int key) > > if (in_hardirq()) > regs = get_irq_regs(); > - if (regs) { > - pr_info("CPU%d:\n", smp_processor_id()); > + > + pr_info("CPU%d:\n", smp_processor_id()); > + if (regs) > show_regs(regs); > - } > + else > + show_stack(NULL, NULL, KERN_INFO); > + Why is this change needed as well? thanks, greg k-h