From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77894C433DF for ; Tue, 9 Jun 2020 04:30:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F1C3207F9 for ; Tue, 9 Jun 2020 04:30:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="AwDFUS9v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F1C3207F9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D3C2C6B002D; Tue, 9 Jun 2020 00:30:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D115B6B002F; Tue, 9 Jun 2020 00:30:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C28BA6B002E; Tue, 9 Jun 2020 00:30:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id AABBC6B002C for ; Tue, 9 Jun 2020 00:30:55 -0400 (EDT) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6811180485E8 for ; Tue, 9 Jun 2020 04:30:55 +0000 (UTC) X-FDA: 76908398070.19.cord61_12094bd26dbf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 3DAF61FC56 for ; Tue, 9 Jun 2020 04:30:55 +0000 (UTC) X-HE-Tag: cord61_12094bd26dbf X-Filterd-Recvd-Size: 5143 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Jun 2020 04:30:54 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C078120801; Tue, 9 Jun 2020 04:30:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591677054; bh=pD46/82IwoblyyKUnpF3TpLZa3Lv699I0qv+0bRsIkU=; h=Date:From:To:Subject:In-Reply-To:From; b=AwDFUS9vcvvI+GpW3sJU9yb6hFpJLTmmOnKfvPGlw69bd5YiPrGNTHMgZv7xNBL/2 GB2mRDI+xQJz2CMPzOqcGO4/J7c8I4g2rKr9T+ZFTj0k9ljdoS1qbBM6V1IgcMI5Ju NDZHdIKmlcdMsJElVqxTFUz1FHgzL4gKL+cLxONE= Date: Mon, 08 Jun 2020 21:30:53 -0700 From: Andrew Morton To: akpm@linux-foundation.org, dima@arista.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, monstr@monstr.eu, torvalds@linux-foundation.org Subject: [patch 19/93] microblaze: add loglvl to microblaze_unwind() Message-ID: <20200609043053.MuEy3p4G9%akpm@linux-foundation.org> In-Reply-To: <20200608212922.5b7fa74ca3f4e2444441b7f9@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: 3DAF61FC56 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Dmitry Safonov Subject: microblaze: add loglvl to microblaze_unwind() Currently, the log-level of show_stack() depends on a platform realization. It creates situations where the headers are printed with lower log level or higher than the stacktrace (depending on a platform or user). Furthermore, it forces the logic decision from user to an architecture side. In result, some users as sysrq/kdb/etc are doing tricks with temporary rising console_loglevel while printing their messages. And in result it not only may print unwanted messages from other CPUs, but also omit printing at all in the unlucky case where the printk() was deferred. Introducing log-level parameter and KERN_UNSUPPRESSED [1] seems an easier approach than introducing more printk buffers. Also, it will consolidate printings with headers. Add log level parameter to microblaze_unwind() as a preparation to add show_stack_loglvl(). [1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@arista.com/T/#u Link: http://lkml.kernel.org/r/20200418201944.482088-20-dima@arista.com Signed-off-by: Dmitry Safonov Cc: Michal Simek Signed-off-by: Andrew Morton --- arch/microblaze/include/asm/unwind.h | 3 ++- arch/microblaze/kernel/stacktrace.c | 4 ++-- arch/microblaze/kernel/traps.c | 2 +- arch/microblaze/kernel/unwind.c | 6 +++--- 4 files changed, 8 insertions(+), 7 deletions(-) --- a/arch/microblaze/include/asm/unwind.h~microblaze-add-loglvl-to-microblaze_unwind +++ a/arch/microblaze/include/asm/unwind.h @@ -20,7 +20,8 @@ extern struct trap_handler_info microbla extern const char _hw_exception_handler; extern const char ex_handler_unhandled; -void microblaze_unwind(struct task_struct *task, struct stack_trace *trace); +void microblaze_unwind(struct task_struct *task, struct stack_trace *trace, + const char *loglvl); #endif /* __MICROBLAZE_UNWIND_H */ --- a/arch/microblaze/kernel/stacktrace.c~microblaze-add-loglvl-to-microblaze_unwind +++ a/arch/microblaze/kernel/stacktrace.c @@ -20,12 +20,12 @@ void save_stack_trace(struct stack_trace { /* Exclude our helper functions from the trace*/ trace->skip += 2; - microblaze_unwind(NULL, trace); + microblaze_unwind(NULL, trace, ""); } EXPORT_SYMBOL_GPL(save_stack_trace); void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) { - microblaze_unwind(tsk, trace); + microblaze_unwind(tsk, trace, ""); } EXPORT_SYMBOL_GPL(save_stack_trace_tsk); --- a/arch/microblaze/kernel/traps.c~microblaze-add-loglvl-to-microblaze_unwind +++ a/arch/microblaze/kernel/traps.c @@ -68,7 +68,7 @@ void show_stack(struct task_struct *task print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 32, 4, (void *)fp, words_to_show << 2, 0); pr_info("\n\nCall Trace:\n"); - microblaze_unwind(task, NULL); + microblaze_unwind(task, NULL, KERN_INFO); pr_info("\n"); if (!task) --- a/arch/microblaze/kernel/unwind.c~microblaze-add-loglvl-to-microblaze_unwind +++ a/arch/microblaze/kernel/unwind.c @@ -287,11 +287,11 @@ static void microblaze_unwind_inner(stru * @task : Task whose stack we are to unwind (NULL == current) * @trace : Where to store stack backtrace (PC values). * NULL == print backtrace to kernel log + * @loglvl : Used for printk log level if (trace == NULL). */ -void microblaze_unwind(struct task_struct *task, struct stack_trace *trace) +void microblaze_unwind(struct task_struct *task, struct stack_trace *trace, + const char *loglvl) { - const char *loglvl = KERN_INFO; - if (task) { if (task == current) { const struct pt_regs *regs = task_pt_regs(task); _