From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755560AbcHXSnq (ORCPT ); Wed, 24 Aug 2016 14:43:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52088 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754139AbcHXSno (ORCPT ); Wed, 24 Aug 2016 14:43:44 -0400 Date: Wed, 24 Aug 2016 13:43:27 -0500 From: Josh Poimboeuf To: Joe Perches Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Andy Lutomirski , Linus Torvalds , Steven Rostedt , Brian Gerst , Kees Cook , Peter Zijlstra , Frederic Weisbecker , Byungchul Park , Nilay Vaish Subject: Re: [PATCH 3/6] x86/dumpstack: make printk_stack_address() more generally useful Message-ID: <20160824184327.ta3u3dckjmmc7dkx@treble> References: <9fbe0db05bacf66d337c162edbf61450d0cff1e2.1472057064.git.jpoimboe@redhat.com> <1472059718.3746.154.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1472059718.3746.154.camel@perches.com> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 24 Aug 2016 18:43:30 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 24, 2016 at 10:28:38AM -0700, Joe Perches wrote: > On Wed, 2016-08-24 at 11:50 -0500, Josh Poimboeuf wrote: > > Change printk_stack_address() to be useful when called by an unwinder > > outside the context of dump_trace(). > > > > Specifically: > > > > - printk_stack_address()'s 'data' argument is always used as the log > >   level string.  Make that explicit. > > If this is true, and I'm not sure it is as I believe > there are static strings emitted like EOE and IRQ, > shouldn't this bubble up through the calling tree? > > > - Call touch_nmi_watchdog(). > [] > > diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c > [] > > @@ -26,10 +26,11 @@ int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE; > >  static int die_counter; > >   > >  static void printk_stack_address(unsigned long address, int reliable, > > - void *data) > > +  char *log_lvl) > >  { > > + touch_nmi_watchdog(); > >   printk("%s [<%p>] %s%pB\n", > > - (char *)data, (void *)address, reliable ? "" : "? ", > > + log_lvl, (void *)address, reliable ? "" : "? ", > >   (void *)address); > >  } > >   > > @@ -148,7 +149,6 @@ static int print_trace_stack(void *data, char *name) > >   */ > >  static int print_trace_address(void *data, unsigned long addr, int reliable) > >  { > > - touch_nmi_watchdog(); > >   printk_stack_address(addr, reliable, data); > >   return 0; > >  } > > like for data here? This function needs to keep its 'void *data' argument because it's a callback for stacktrace_ops, so it has to conform to the callback interface. 'data' is used for passing a pointer to an opaque data structure to the callback. Also this is the only caller of printk_stack_address(), so there's nowhere else to bubble it up to. -- Josh