From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtprelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41hXDj3VvSzF2D8 for ; Fri, 3 Aug 2018 13:13:24 +1000 (AEST) Received: from smtprelay.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by smtpgrave03.hostedemail.com (Postfix) with ESMTP id B9A0718002057 for ; Fri, 3 Aug 2018 01:23:34 +0000 (UTC) Message-ID: Subject: Re: [PATCH v4 5/6] powerpc: Add show_user_instructions() From: Joe Perches To: Murilo Opsfelder Araujo , Christophe LEROY Cc: linux-kernel@vger.kernel.org, Alastair D'Silva , Andrew Donnellan , Balbir Singh , Benjamin Herrenschmidt , Cyril Bur , "Eric W . Biederman" , Michael Ellerman , Michael Neuling , Nicholas Piggin , Paul Mackerras , Simon Guo , Sukadev Bhattiprolu , "Tobin C . Harding" , linuxppc-dev@lists.ozlabs.org, Segher Boessenkool Date: Thu, 02 Aug 2018 18:22:29 -0700 In-Reply-To: <20180803004201.GA5891@kermit-br-ibm-com> References: <20180801213320.11203-1-muriloo@linux.ibm.com> <20180801213320.11203-6-muriloo@linux.ibm.com> <7209fa95-8d40-14ca-f27a-ce3edb64191e@c-s.fr> <20180803004201.GA5891@kermit-br-ibm-com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu, 2018-08-02 at 21:42 -0300, Murilo Opsfelder Araujo wrote: > > > diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c [] > > > @@ -1299,6 +1299,46 @@ static void show_instructions(struct pt_regs *regs) > > > pr_cont("\n"); > > > } > > > +void show_user_instructions(struct pt_regs *regs) > > > +{ > > > + int i; > > > + const char *prefix = KERN_INFO "%s[%d]: code: "; > > > + unsigned long pc = regs->nip - (instructions_to_print * 3 / 4 * > > > + sizeof(int)); > > > + > > > + printk(prefix, current->comm, current->pid); > > > > Why not use pr_info() and remove KERN_INFO from *prefix ? > > Because it doesn't compile: > > arch/powerpc/kernel/process.c:1317:10: error: expected ‘)’ before ‘prefix’ > pr_info(prefix, current->comm, current->pid); > ^ > ./include/linux/printk.h:288:21: note: in definition of macro ‘pr_fmt’ > #define pr_fmt(fmt) fmt > ^ What being suggested is using: pr_info("%s[%d]: code: ", current->comm, current->pid);