linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* arm64: pstore: printk causing hang during boot in __memcpy_toio with pstore enabled
@ 2018-08-01 12:35 Ivid Suvarna
  2018-08-01 13:19 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Ivid Suvarna @ 2018-08-01 12:35 UTC (permalink / raw)
  To: Kees Cook, Arnd Bergmann, Guenter Roeck, Greg Kroah-Hartman,
	Linus Torvalds, Jason Baron
  Cc: Kernel development list, Joe Perches, linux-arm-msm

Hi,

When pstore is enabled and a *pr_info(any printk) in
__memcpy_toio(arch/arm64/kernel/io.c)* is added, kernel wont boot and
just hangs.

The path where __memcpy_toio is called is below:

->persistent_ram_update
  -> memcpy_toio
    -> __memcpy_toio

I tried with trace_printk and kernel boots fine. I understand that
printk has overhead, but is this expected when we use some printk
statement in __memcpy_toio?

Or is it some kind of bug? Tested on db410c.

Please let me know your opinion.

Thanks,

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

* Re: arm64: pstore: printk causing hang during boot in __memcpy_toio with pstore enabled
  2018-08-01 12:35 arm64: pstore: printk causing hang during boot in __memcpy_toio with pstore enabled Ivid Suvarna
@ 2018-08-01 13:19 ` Guenter Roeck
  2018-08-01 17:16   ` Ivid Suvarna
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2018-08-01 13:19 UTC (permalink / raw)
  To: Ivid Suvarna, Kees Cook, Arnd Bergmann, Greg Kroah-Hartman,
	Linus Torvalds, Jason Baron
  Cc: Kernel development list, Joe Perches, linux-arm-msm

On 08/01/2018 05:35 AM, Ivid Suvarna wrote:
> Hi,
> 
> When pstore is enabled and a *pr_info(any printk) in
> __memcpy_toio(arch/arm64/kernel/io.c)* is added, kernel wont boot and
> just hangs.
> 
> The path where __memcpy_toio is called is below:
> 
> ->persistent_ram_update
>    -> memcpy_toio
>      -> __memcpy_toio
> 
> I tried with trace_printk and kernel boots fine. I understand that
> printk has overhead, but is this expected when we use some printk
> statement in __memcpy_toio?
> 

I think the problem may be that the printk() output is copied to pstore.
Since pstore calls memcpy_toio(), you get a nice recursion if you add a
printk() call to it.

Guenter

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

* Re: arm64: pstore: printk causing hang during boot in __memcpy_toio with pstore enabled
  2018-08-01 13:19 ` Guenter Roeck
@ 2018-08-01 17:16   ` Ivid Suvarna
  2018-08-01 17:25     ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Ivid Suvarna @ 2018-08-01 17:16 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, Linus Torvalds,
	Jason Baron, Kernel development list, Joe Perches, linux-arm-msm

On Wed, Aug 1, 2018 at 6:49 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On 08/01/2018 05:35 AM, Ivid Suvarna wrote:
>>
>> Hi,
>>
>> When pstore is enabled and a *pr_info(any printk) in
>> __memcpy_toio(arch/arm64/kernel/io.c)* is added, kernel wont boot and
>> just hangs.
>>
>> The path where __memcpy_toio is called is below:
>>
>> ->persistent_ram_update
>>    -> memcpy_toio
>>      -> __memcpy_toio
>>
>> I tried with trace_printk and kernel boots fine. I understand that
>> printk has overhead, but is this expected when we use some printk
>> statement in __memcpy_toio?
>>
>
> I think the problem may be that the printk() output is copied to pstore.
> Since pstore calls memcpy_toio(), you get a nice recursion if you add a
> printk() call to it.
>

Is there any solution to this other than not adding printk :p

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

* Re: arm64: pstore: printk causing hang during boot in __memcpy_toio with pstore enabled
  2018-08-01 17:16   ` Ivid Suvarna
@ 2018-08-01 17:25     ` Guenter Roeck
  2018-08-01 17:51       ` Ivid Suvarna
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2018-08-01 17:25 UTC (permalink / raw)
  To: Ivid Suvarna
  Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, Linus Torvalds,
	Jason Baron, Kernel development list, Joe Perches, linux-arm-msm

On Wed, Aug 01, 2018 at 10:46:06PM +0530, Ivid Suvarna wrote:
> On Wed, Aug 1, 2018 at 6:49 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> > On 08/01/2018 05:35 AM, Ivid Suvarna wrote:
> >>
> >> Hi,
> >>
> >> When pstore is enabled and a *pr_info(any printk) in
> >> __memcpy_toio(arch/arm64/kernel/io.c)* is added, kernel wont boot and
> >> just hangs.
> >>
> >> The path where __memcpy_toio is called is below:
> >>
> >> ->persistent_ram_update
> >>    -> memcpy_toio
> >>      -> __memcpy_toio
> >>
> >> I tried with trace_printk and kernel boots fine. I understand that
> >> printk has overhead, but is this expected when we use some printk
> >> statement in __memcpy_toio?
> >>
> >
> > I think the problem may be that the printk() output is copied to pstore.
> > Since pstore calls memcpy_toio(), you get a nice recursion if you add a
> > printk() call to it.
> >
> 
> Is there any solution to this other than not adding printk :p

Well, disabling pstore would help. You could also use a trace function,
as you already found out, or you could use gdb for debugging. Since
this is obviously a debug image, you should be willing to accept some
limitations/restrictions.

Guenter

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

* Re: arm64: pstore: printk causing hang during boot in __memcpy_toio with pstore enabled
  2018-08-01 17:25     ` Guenter Roeck
@ 2018-08-01 17:51       ` Ivid Suvarna
  0 siblings, 0 replies; 5+ messages in thread
From: Ivid Suvarna @ 2018-08-01 17:51 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, Linus Torvalds,
	Jason Baron, Kernel development list, Joe Perches, linux-arm-msm

On Wed, Aug 1, 2018 at 10:55 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> On Wed, Aug 01, 2018 at 10:46:06PM +0530, Ivid Suvarna wrote:
>> On Wed, Aug 1, 2018 at 6:49 PM, Guenter Roeck <linux@roeck-us.net> wrote:
>> > On 08/01/2018 05:35 AM, Ivid Suvarna wrote:
>> >>
>> >> Hi,
>> >>
>> >> When pstore is enabled and a *pr_info(any printk) in
>> >> __memcpy_toio(arch/arm64/kernel/io.c)* is added, kernel wont boot and
>> >> just hangs.
>> >>
>> >> The path where __memcpy_toio is called is below:
>> >>
>> >> ->persistent_ram_update
>> >>    -> memcpy_toio
>> >>      -> __memcpy_toio
>> >>
>> >> I tried with trace_printk and kernel boots fine. I understand that
>> >> printk has overhead, but is this expected when we use some printk
>> >> statement in __memcpy_toio?
>> >>
>> >
>> > I think the problem may be that the printk() output is copied to pstore.
>> > Since pstore calls memcpy_toio(), you get a nice recursion if you add a
>> > printk() call to it.
>> >
>>
>> Is there any solution to this other than not adding printk :p
>
> Well, disabling pstore would help. You could also use a trace function,
> as you already found out, or you could use gdb for debugging. Since
> this is obviously a debug image, you should be willing to accept some
> limitations/restrictions.
>

Ok. But trace_printk output is available only after boot, so to debug
any boot issues,
it may not be helpful. And gdb for kernel debugging? Maybe u meant kgdb?

Let me check if this issue is only for pstore path or not.

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

end of thread, other threads:[~2018-08-01 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 12:35 arm64: pstore: printk causing hang during boot in __memcpy_toio with pstore enabled Ivid Suvarna
2018-08-01 13:19 ` Guenter Roeck
2018-08-01 17:16   ` Ivid Suvarna
2018-08-01 17:25     ` Guenter Roeck
2018-08-01 17:51       ` Ivid Suvarna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).