Re: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-12-03 Thread Borislav Petkov
On Thu, Dec 03, 2015 at 11:29:21AM +, 河合英宏 / KAWAI,HIDEHIRO wrote: > I was arguing about the case of oops_end --> crash_kexec > --> return from crash_kexec because of !kexec_crash_image --> > panic. Aha. > In the case of panic --> __crash_kexec, __crash_kexec is called > only once, so we don'

RE: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-12-03 Thread 河合英宏 / KAWAI,HIDEHIRO
> On Thu, Dec 03, 2015 at 02:01:38AM +, 河合英宏 / KAWAI,HIDEHIRO wrote: > > > On Wed, Dec 02, 2015 at 11:57:38AM +, 河合英宏 / KAWAI,HIDEHIRO wrote: > > > > We can do so, but I think resetting panic_cpu always would be > > > > simpler and safer. > > > > I'll state in detail. > > > > When we call c

Re: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-12-03 Thread Borislav Petkov
On Thu, Dec 03, 2015 at 02:01:38AM +, 河合英宏 / KAWAI,HIDEHIRO wrote: > > On Wed, Dec 02, 2015 at 11:57:38AM +, 河合英宏 / KAWAI,HIDEHIRO wrote: > > > We can do so, but I think resetting panic_cpu always would be > > > simpler and safer. > > I'll state in detail. > > When we call crash_kexec() w

RE: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-12-02 Thread 河合英宏 / KAWAI,HIDEHIRO
> On Wed, Dec 02, 2015 at 11:57:38AM +, 河合英宏 / KAWAI,HIDEHIRO wrote: > > We can do so, but I think resetting panic_cpu always would be > > simpler and safer. I'll state in detail. When we call crash_kexec() without entering panic() and return from it, panic() should be called eventually. But

Re: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-12-02 Thread Borislav Petkov
On Wed, Dec 02, 2015 at 11:57:38AM +, 河合英宏 / KAWAI,HIDEHIRO wrote: > We can do so, but I think resetting panic_cpu always would be > simpler and safer. Well, I think executing code needlessly *especially* at panic time is not all that rosy either. Besides something like this: static

RE: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-12-02 Thread 河合英宏 / KAWAI,HIDEHIRO
Hello Borislav, Sorry, I haven't replied to this mail yet. > On Fri, Nov 20, 2015 at 06:36:48PM +0900, Hidehiro Kawai wrote: ... > > +void crash_kexec(struct pt_regs *regs) > > +{ > > + int old_cpu, this_cpu; > > + > > + /* > > +* Only one CPU is allowed to execute the crash_kexec() code

Re: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-11-25 Thread Borislav Petkov
On Fri, Nov 20, 2015 at 06:36:48PM +0900, Hidehiro Kawai wrote: > Currently, panic() and crash_kexec() can be called at the same time. > For example (x86 case): > > CPU 0: > oops_end() > crash_kexec() > mutex_trylock() // acquired > nmi_shootdown_cpus() // stop other cpus > >

RE: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-11-24 Thread 河合英宏 / KAWAI,HIDEHIRO
> On Fri, Nov 20, 2015 at 06:36:48PM +0900, Hidehiro Kawai wrote: > > Currently, panic() and crash_kexec() can be called at the same time. > > For example (x86 case): > > > > CPU 0: > > oops_end() > > crash_kexec() > > mutex_trylock() // acquired > > nmi_shootdown_cpus() // stop

Re: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-11-24 Thread Steven Rostedt
On Fri, Nov 20, 2015 at 06:36:48PM +0900, Hidehiro Kawai wrote: > Currently, panic() and crash_kexec() can be called at the same time. > For example (x86 case): > > CPU 0: > oops_end() > crash_kexec() > mutex_trylock() // acquired > nmi_shootdown_cpus() // stop other cpus > >

Re: [V5 PATCH 3/4] kexec: Fix race between panic() and crash_kexec() called directly

2015-11-24 Thread Michal Hocko
On Fri 20-11-15 18:36:48, Hidehiro Kawai wrote: > Currently, panic() and crash_kexec() can be called at the same time. > For example (x86 case): > > CPU 0: > oops_end() > crash_kexec() > mutex_trylock() // acquired > nmi_shootdown_cpus() // stop other cpus > > CPU 1: > panic