From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guenter Roeck Subject: Re: arm64: pstore: printk causing hang during boot in __memcpy_toio with pstore enabled Date: Wed, 1 Aug 2018 10:25:49 -0700 Message-ID: <20180801172549.GA16774@roeck-us.net> References: <8ab731b4-2929-e92e-6536-35096ee66baa@roeck-us.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Ivid Suvarna Cc: Kees Cook , Arnd Bergmann , Greg Kroah-Hartman , Linus Torvalds , Jason Baron , Kernel development list , Joe Perches , linux-arm-msm@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org On Wed, Aug 01, 2018 at 10:46:06PM +0530, Ivid Suvarna wrote: > On Wed, Aug 1, 2018 at 6:49 PM, Guenter Roeck 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