Received: by 10.223.176.5 with SMTP id f5csp376817wra; Fri, 9 Feb 2018 00:07:36 -0800 (PST) X-Google-Smtp-Source: AH8x227CLr01KN/2dkp6Ffsbfy1T1gUPznrY247xZ+IIKY0MB4d8DuG2FQbjWyUWpgLHbS1huP46 X-Received: by 10.99.113.7 with SMTP id m7mr1631940pgc.403.1518163656599; Fri, 09 Feb 2018 00:07:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518163656; cv=none; d=google.com; s=arc-20160816; b=jBxVC/lC490Bh5VeBXtw60+W2okSqA5M5RsCrC5P/ibst36TDUSYhyMAk4j/skEQsV PKwFUu/pkpPsJCkyHtRWHNc1opEzjecsZqTUfIBZBjXFJXGbg6GtHJr66Q5ZHqSyHgDG t45ZHXg6YKOWE1HrSOtbkfLDXnk5AF+yBEcBQNOJIfpSisdtt8VNWcJw9f/XCCBEsFHd vn0w2qwyT+zjj0qG5j0ucXDo6rBs8Wt9dCfzVxCfsnGsM+fuqPLzsG8x9esml2MxxpNg AdTIk/2bPDFi4v6WDydMIq5X6KBX7CTDBzAyAUBDNFT1ZEDfGNg28m57cJU+7oRWMymM uNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-disposition :mime-version:message-id:subject:cc:to:from:date :arc-authentication-results; bh=/r5pQuja5R9+m/cx2bv2MMYBfwgvCRhEMN1hx3PMyLE=; b=hFGmdIz24xKRFFZyh56gEuCgLBW0FxoWmUL3XGfDv9NxBCsWV6OzR7sz7K9CqRNpgP OEIW4pYNR9xujyQxGlc/J4TpQ3js9NT5Gbhk0RepD733iVqs7F1lyZY6Nr10zhQGQMCB HH8SV21DRQJJ6HmoWcBWP4j8eFteJqP0M8470sXazwpkjP5hZM1esmwroCpSKTYuXUSM mZcEq5cAiYut5AQAB24jxH1+4NQWqScwGlHd1S7vXQqRnvK60IQ+V/dk8lD+IrDXN3A1 eVdyHUFbL/k5HsLVjvCmDzjfvleIp9FT4yRrT7jNWLLOooGQ9lTML25V9LWJD9hHHggf y/yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c16si1057639pgv.741.2018.02.09.00.07.22; Fri, 09 Feb 2018 00:07:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751092AbeBIIGc (ORCPT + 99 others); Fri, 9 Feb 2018 03:06:32 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45706 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750886AbeBIIGb (ORCPT ); Fri, 9 Feb 2018 03:06:31 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C8B7F407604F; Fri, 9 Feb 2018 08:06:30 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-12-52.pek2.redhat.com [10.72.12.52]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E85392166BAE; Fri, 9 Feb 2018 08:06:27 +0000 (UTC) Date: Fri, 9 Feb 2018 16:06:24 +0800 From: Dave Young To: Steven Rostedt , Sergey Senozhatsky , Petr Mladek Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, Andi Kleen Subject: [PATCH] printk: move dump stack related code to lib/dump_stack.c Message-ID: <20180209080624.GA2607@dhcp-128-65.nay.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 09 Feb 2018 08:06:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Fri, 09 Feb 2018 08:06:30 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dyoung@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dump_stack related stuff should belong to lib/dump_stack.c thus move them there. Signed-off-by: Dave Young Suggested-by: Steven Rostedt Suggested-by: Sergey Senozhatsky --- Note: dump stack etc still share printk.h as before, I would keep it as is since a lot of files need it. This patch is based on printk for-4.17 branch kernel/printk/printk.c | 60 ------------------------------------------------- lib/dump_stack.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 60 deletions(-) --- linux-x86.orig/kernel/printk/printk.c +++ linux-x86/kernel/printk/printk.c @@ -42,13 +42,11 @@ #include #include #include -#include #include #include #include #include #include -#include #include #include @@ -3257,62 +3255,4 @@ void kmsg_dump_rewind(struct kmsg_dumper } EXPORT_SYMBOL_GPL(kmsg_dump_rewind); -static char dump_stack_arch_desc_str[128]; - -/** - * dump_stack_set_arch_desc - set arch-specific str to show with task dumps - * @fmt: printf-style format string - * @...: arguments for the format string - * - * The configured string will be printed right after utsname during task - * dumps. Usually used to add arch-specific system identifiers. If an - * arch wants to make use of such an ID string, it should initialize this - * as soon as possible during boot. - */ -void __init dump_stack_set_arch_desc(const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - vsnprintf(dump_stack_arch_desc_str, sizeof(dump_stack_arch_desc_str), - fmt, args); - va_end(args); -} - -/** - * dump_stack_print_info - print generic debug info for dump_stack() - * @log_lvl: log level - * - * Arch-specific dump_stack() implementations can use this function to - * print out the same debug information as the generic dump_stack(). - */ -void dump_stack_print_info(const char *log_lvl) -{ - printk("%sCPU: %d PID: %d Comm: %.20s %s%s %s %.*s\n", - log_lvl, raw_smp_processor_id(), current->pid, current->comm, - kexec_crash_loaded() ? "Kdump: loaded " : "", - print_tainted(), - init_utsname()->release, - (int)strcspn(init_utsname()->version, " "), - init_utsname()->version); - - if (dump_stack_arch_desc_str[0] != '\0') - printk("%sHardware name: %s\n", - log_lvl, dump_stack_arch_desc_str); - - print_worker_info(log_lvl, current); -} - -/** - * show_regs_print_info - print generic debug info for show_regs() - * @log_lvl: log level - * - * show_regs() implementations can use this function to print out generic - * debug information. - */ -void show_regs_print_info(const char *log_lvl) -{ - dump_stack_print_info(log_lvl); -} - #endif --- linux-x86.orig/lib/dump_stack.c +++ linux-x86/lib/dump_stack.c @@ -10,6 +10,66 @@ #include #include #include +#include +#include + +static char dump_stack_arch_desc_str[128]; + +/** + * dump_stack_set_arch_desc - set arch-specific str to show with task dumps + * @fmt: printf-style format string + * @...: arguments for the format string + * + * The configured string will be printed right after utsname during task + * dumps. Usually used to add arch-specific system identifiers. If an + * arch wants to make use of such an ID string, it should initialize this + * as soon as possible during boot. + */ +void __init dump_stack_set_arch_desc(const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vsnprintf(dump_stack_arch_desc_str, sizeof(dump_stack_arch_desc_str), + fmt, args); + va_end(args); +} + +/** + * dump_stack_print_info - print generic debug info for dump_stack() + * @log_lvl: log level + * + * Arch-specific dump_stack() implementations can use this function to + * print out the same debug information as the generic dump_stack(). + */ +void dump_stack_print_info(const char *log_lvl) +{ + printk("%sCPU: %d PID: %d Comm: %.20s %s%s %s %.*s\n", + log_lvl, raw_smp_processor_id(), current->pid, current->comm, + kexec_crash_loaded() ? "Kdump: loaded " : "", + print_tainted(), + init_utsname()->release, + (int)strcspn(init_utsname()->version, " "), + init_utsname()->version); + + if (dump_stack_arch_desc_str[0] != '\0') + printk("%sHardware name: %s\n", + log_lvl, dump_stack_arch_desc_str); + + print_worker_info(log_lvl, current); +} + +/** + * show_regs_print_info - print generic debug info for show_regs() + * @log_lvl: log level + * + * show_regs() implementations can use this function to print out generic + * debug information. + */ +void show_regs_print_info(const char *log_lvl) +{ + dump_stack_print_info(log_lvl); +} static void __dump_stack(void) {