All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] printk: Add dummy routine for when CONFIG_PRINTK=n
@ 2015-01-20 23:51 Pranith Kumar
  2015-01-20 23:51 ` [PATCH 2/2] powerpc/powernv: Skip registering log region " Pranith Kumar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pranith Kumar @ 2015-01-20 23:51 UTC (permalink / raw)
  To: Andrew Morton, Steven Rostedt (Red Hat),
	Petr Mladek, Joe Perches, John Stultz, Dan Streetman,
	Simon Kågström, Borislav Petkov, Andy Shevchenko,
	open list
  Cc: Michael Ellerman

There are missing dummy routines for log_buf_addr_get() and log_buf_len_get()
for when CONFIG_PRINTK is not set causing build failures.

This patch adds these dummy routines at the appropriate location.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
CC: Michael Ellerman <mpe@ellerman.id.au>
---
 include/linux/printk.h | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/include/linux/printk.h b/include/linux/printk.h
index aeb9d7f..f52f02b 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -10,9 +10,6 @@
 extern const char linux_banner[];
 extern const char linux_proc_banner[];
 
-extern char *log_buf_addr_get(void);
-extern u32 log_buf_len_get(void);
-
 static inline int printk_get_level(const char *buffer)
 {
 	if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
@@ -168,6 +165,8 @@ void __init setup_log_buf(int early);
 void dump_stack_set_arch_desc(const char *fmt, ...);
 void dump_stack_print_info(const char *log_lvl);
 void show_regs_print_info(const char *log_lvl);
+char *log_buf_addr_get(void);
+u32 log_buf_len_get(void);
 #else
 static inline __printf(1, 0)
 int vprintk(const char *s, va_list args)
@@ -217,6 +216,16 @@ static inline void dump_stack_print_info(const char *log_lvl)
 static inline void show_regs_print_info(const char *log_lvl)
 {
 }
+
+static inline char *log_buf_addr_get(void)
+{
+	return NULL;
+}
+
+static linline u32 log_buf_len_get(void)
+{
+	return 0;
+}
 #endif
 
 extern asmlinkage void dump_stack(void) __cold;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] powerpc/powernv: Skip registering log region when CONFIG_PRINTK=n
  2015-01-20 23:51 [PATCH 1/2] printk: Add dummy routine for when CONFIG_PRINTK=n Pranith Kumar
@ 2015-01-20 23:51 ` Pranith Kumar
  2015-01-21  4:28   ` Stewart Smith
  2015-01-21  7:30 ` [PATCH 1/2] printk: Add dummy routine for " Michael Ellerman
  2015-01-21 12:58 ` Petr Mladek
  2 siblings, 1 reply; 6+ messages in thread
From: Pranith Kumar @ 2015-01-20 23:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Mahesh Salgaonkar, Anton Blanchard, Neelesh Gupta, Joel Stanley,
	Vasant Hegde, Rob Herring, open list:LINUX FOR POWERPC...,
	open list

When CONFIG_PRINTK=n, log_buf_addr_get() returns NULL and log_buf_len_get()
return 0. Check for these return values and skip registering the dump buffer.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
CC: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/platforms/powernv/opal.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index f10b9ec..1db119f0 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -667,7 +667,13 @@ static void __init opal_dump_region_init(void)
 
 	/* Register kernel log buffer */
 	addr = log_buf_addr_get();
+	if (addr == NULL)
+		return;
+
 	size = log_buf_len_get();
+	if (size == 0)
+		return;
+
 	rc = opal_register_dump_region(OPAL_DUMP_REGION_LOG_BUF,
 				       __pa(addr), size);
 	/* Don't warn if this is just an older OPAL that doesn't
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] powerpc/powernv: Skip registering log region when CONFIG_PRINTK=n
  2015-01-20 23:51 ` [PATCH 2/2] powerpc/powernv: Skip registering log region " Pranith Kumar
@ 2015-01-21  4:28   ` Stewart Smith
  0 siblings, 0 replies; 6+ messages in thread
From: Stewart Smith @ 2015-01-21  4:28 UTC (permalink / raw)
  To: Pranith Kumar, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Mahesh Salgaonkar, Anton Blanchard,
	Neelesh Gupta, Joel Stanley, Vasant Hegde, Rob Herring,
	open list:LINUX FOR POWERPC...,
	open list

Pranith Kumar <bobby.prani@gmail.com> writes:
> When CONFIG_PRINTK=n, log_buf_addr_get() returns NULL and log_buf_len_get()
> return 0. Check for these return values and skip registering the dump buffer.
>
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> CC: Michael Ellerman <mpe@ellerman.id.au>

(investigating what would occur on systems with current firmware..)

Looking at hw/fsp/fsp-mdst-table.c in skiboot it appears that we'd end
up logging an error log about being passed the size 0 and return
OPAL_PARAMETER back to Linux.

While harmless, this is, naturally, not awesome to log an error about
being unable to grab kernel log on crash every time you boot.

Reviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com>

> ---
>  arch/powerpc/platforms/powernv/opal.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index f10b9ec..1db119f0 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -667,7 +667,13 @@ static void __init opal_dump_region_init(void)
>  
>  	/* Register kernel log buffer */
>  	addr = log_buf_addr_get();
> +	if (addr == NULL)
> +		return;
> +
>  	size = log_buf_len_get();
> +	if (size == 0)
> +		return;
> +
>  	rc = opal_register_dump_region(OPAL_DUMP_REGION_LOG_BUF,
>  				       __pa(addr), size);
>  	/* Don't warn if this is just an older OPAL that doesn't
> -- 
> 1.9.1
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] printk: Add dummy routine for when CONFIG_PRINTK=n
  2015-01-20 23:51 [PATCH 1/2] printk: Add dummy routine for when CONFIG_PRINTK=n Pranith Kumar
  2015-01-20 23:51 ` [PATCH 2/2] powerpc/powernv: Skip registering log region " Pranith Kumar
@ 2015-01-21  7:30 ` Michael Ellerman
  2015-01-21 12:58 ` Petr Mladek
  2 siblings, 0 replies; 6+ messages in thread
From: Michael Ellerman @ 2015-01-21  7:30 UTC (permalink / raw)
  To: Pranith Kumar
  Cc: Andrew Morton, Steven Rostedt (Red Hat),
	Petr Mladek, Joe Perches, John Stultz, Dan Streetman,
	Simon Kågström, Borislav Petkov, Andy Shevchenko,
	open list

On Tue, 2015-01-20 at 18:51 -0500, Pranith Kumar wrote:
> There are missing dummy routines for log_buf_addr_get() and log_buf_len_get()
> for when CONFIG_PRINTK is not set causing build failures.
> 
> This patch adds these dummy routines at the appropriate location.
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> CC: Michael Ellerman <mpe@ellerman.id.au>

Are folks on CC happy if we take this via the powerpc tree?

Apologies for not getting it right the first time.

cheers



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] printk: Add dummy routine for when CONFIG_PRINTK=n
  2015-01-20 23:51 [PATCH 1/2] printk: Add dummy routine for when CONFIG_PRINTK=n Pranith Kumar
  2015-01-20 23:51 ` [PATCH 2/2] powerpc/powernv: Skip registering log region " Pranith Kumar
  2015-01-21  7:30 ` [PATCH 1/2] printk: Add dummy routine for " Michael Ellerman
@ 2015-01-21 12:58 ` Petr Mladek
  2015-01-22  2:12   ` Pranith Kumar
  2 siblings, 1 reply; 6+ messages in thread
From: Petr Mladek @ 2015-01-21 12:58 UTC (permalink / raw)
  To: Pranith Kumar
  Cc: Andrew Morton, Steven Rostedt (Red Hat),
	Joe Perches, John Stultz, Dan Streetman,
	Simon Kågström, Borislav Petkov, Andy Shevchenko,
	open list, Michael Ellerman

On Tue 2015-01-20 18:51:49, Pranith Kumar wrote:
> There are missing dummy routines for log_buf_addr_get() and log_buf_len_get()
> for when CONFIG_PRINTK is not set causing build failures.
> 
> This patch adds these dummy routines at the appropriate location.
> 
> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
> CC: Michael Ellerman <mpe@ellerman.id.au>
> ---
>  include/linux/printk.h | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index aeb9d7f..f52f02b 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -10,9 +10,6 @@
>  extern const char linux_banner[];
>  extern const char linux_proc_banner[];
>  
> -extern char *log_buf_addr_get(void);
> -extern u32 log_buf_len_get(void);
> -
>  static inline int printk_get_level(const char *buffer)
>  {
>  	if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
> @@ -168,6 +165,8 @@ void __init setup_log_buf(int early);
>  void dump_stack_set_arch_desc(const char *fmt, ...);
>  void dump_stack_print_info(const char *log_lvl);
>  void show_regs_print_info(const char *log_lvl);
> +char *log_buf_addr_get(void);
> +u32 log_buf_len_get(void);
>  #else
>  static inline __printf(1, 0)
>  int vprintk(const char *s, va_list args)
> @@ -217,6 +216,16 @@ static inline void dump_stack_print_info(const char *log_lvl)
>  static inline void show_regs_print_info(const char *log_lvl)
>  {
>  }
> +
> +static inline char *log_buf_addr_get(void)
> +{
> +	return NULL;
> +}
> +
> +static linline u32 log_buf_len_get(void)
          ^
	  typo: linline -> inline

Otherwise, it looks fine to me.

Well, If you send v2, I would move this above log_buf_kexec_setup() in
both #ifdef branches. So that all four log_buf()-related functions
declared/defined together.

Best Regards,
Petr

> +{
> +	return 0;
> +}
>  #endif
>  
>  extern asmlinkage void dump_stack(void) __cold;
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] printk: Add dummy routine for when CONFIG_PRINTK=n
  2015-01-21 12:58 ` Petr Mladek
@ 2015-01-22  2:12   ` Pranith Kumar
  0 siblings, 0 replies; 6+ messages in thread
From: Pranith Kumar @ 2015-01-22  2:12 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Andrew Morton, Steven Rostedt (Red Hat),
	Joe Perches, John Stultz, Dan Streetman,
	Simon Kågström, Borislav Petkov, Andy Shevchenko,
	open list, Michael Ellerman

On Wed, Jan 21, 2015 at 7:58 AM, Petr Mladek <pmladek@suse.cz> wrote:
> On Tue 2015-01-20 18:51:49, Pranith Kumar wrote:
>> There are missing dummy routines for log_buf_addr_get() and log_buf_len_get()
>> for when CONFIG_PRINTK is not set causing build failures.
>>
>> This patch adds these dummy routines at the appropriate location.
>>
>> Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
>> CC: Michael Ellerman <mpe@ellerman.id.au>
>> ---
>>  include/linux/printk.h | 15 ++++++++++++---
>>  1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/linux/printk.h b/include/linux/printk.h
>> index aeb9d7f..f52f02b 100644
>> --- a/include/linux/printk.h
>> +++ b/include/linux/printk.h
>> @@ -10,9 +10,6 @@
>>  extern const char linux_banner[];
>>  extern const char linux_proc_banner[];
>>
>> -extern char *log_buf_addr_get(void);
>> -extern u32 log_buf_len_get(void);
>> -
>>  static inline int printk_get_level(const char *buffer)
>>  {
>>       if (buffer[0] == KERN_SOH_ASCII && buffer[1]) {
>> @@ -168,6 +165,8 @@ void __init setup_log_buf(int early);
>>  void dump_stack_set_arch_desc(const char *fmt, ...);
>>  void dump_stack_print_info(const char *log_lvl);
>>  void show_regs_print_info(const char *log_lvl);
>> +char *log_buf_addr_get(void);
>> +u32 log_buf_len_get(void);
>>  #else
>>  static inline __printf(1, 0)
>>  int vprintk(const char *s, va_list args)
>> @@ -217,6 +216,16 @@ static inline void dump_stack_print_info(const char *log_lvl)
>>  static inline void show_regs_print_info(const char *log_lvl)
>>  {
>>  }
>> +
>> +static inline char *log_buf_addr_get(void)
>> +{
>> +     return NULL;
>> +}
>> +
>> +static linline u32 log_buf_len_get(void)
>           ^
>           typo: linline -> inline

Argh, shows why we should always atleast build test before sending a
patch, no matter how trivial it is.

>
> Otherwise, it looks fine to me.
>
> Well, If you send v2, I would move this above log_buf_kexec_setup() in
> both #ifdef branches. So that all four log_buf()-related functions
> declared/defined together.

I will update as you said in v2.

Thanks!
-- 
Pranith

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-01-22  2:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-20 23:51 [PATCH 1/2] printk: Add dummy routine for when CONFIG_PRINTK=n Pranith Kumar
2015-01-20 23:51 ` [PATCH 2/2] powerpc/powernv: Skip registering log region " Pranith Kumar
2015-01-21  4:28   ` Stewart Smith
2015-01-21  7:30 ` [PATCH 1/2] printk: Add dummy routine for " Michael Ellerman
2015-01-21 12:58 ` Petr Mladek
2015-01-22  2:12   ` Pranith Kumar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.