From: Phileas Fogg <phileas-fogg@mail.ru>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Subject: Re: PS3: Strange issue with kexec and FreeBSD loader
Date: Sat, 23 Feb 2013 00:53:16 +0100 [thread overview]
Message-ID: <512804EC.6050407@mail.ru> (raw)
In-Reply-To: <1361573108.15017.39.camel@pasglop>
Benjamin Herrenschmidt wrote:
> On Sat, 2013-02-23 at 00:41 +0100, Phileas Fogg wrote:
>> Benjamin Herrenschmidt wrote:
>>> On Fri, 2013-02-22 at 21:49 +0100, Phileas Fogg wrote:
>>>> i wanted to let you know that i tested your advice. And let me say, it's was a
>>>> damn good advice :) I can boot FreeBSD loader on Linux 3.8 now, no SHA256
>>>> checksum failures. And no panics with FreeBSD LiveCD anymore too.
>>>>
>>>> I just inserted hard_irq_disable() after each local_irq_disable() in
>>>> arch/powerpc/kernel/machine_kexec_64.c
>>>
>>> Awesome ! :-)
>>>
>>> Care to send a patch with a Signed-off-by: ?
>>
>> No problem, but as i said it was your idea how to fix the issue with kexec.
>> Anyways here is the patch which i tested on my PS3 console with Linux 3.8.
>> After applying this patch i can boot any Linux kernel starting with 2.6,
>> FreeBSD loader, FreeBSD LiveCD and my own tiny ELF kernels too.
>> Even OpenBSD bootloader starts now too :)
>> And i don't see any failed SHA256 checksums in the purgatory code.
>
> Thanks, but I still need the Signed-off-by: line before i can apply
> it :-) (legal...)
>
> Cheers,
> Ben.
>
>> regards
>>
>> From c17cdf38dfe180b4a571827bb547aaf9b678cf29 Mon Sep 17 00:00:00 2001
>> From: Phileas Fogg <phileas-fogg@mail.ru>
>> Date: Sat, 23 Feb 2013 00:32:19 +0100
>> Subject: [PATCH] kexec: disable hard IRQ before kexec
>>
>> Disable hard IRQ before kexec a new kernel image.
>> Not doing it can result in corrupted data in the memory segments
>> reserved for the new kernel.
>> ---
>> arch/powerpc/kernel/machine_kexec_64.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/powerpc/kernel/machine_kexec_64.c
>> b/arch/powerpc/kernel/machine_kexec_64.c
>> index 7206701..e08b9d0 100644
>> --- a/arch/powerpc/kernel/machine_kexec_64.c
>> +++ b/arch/powerpc/kernel/machine_kexec_64.c
>> @@ -162,6 +162,7 @@ static int kexec_all_irq_disabled = 0;
>> static void kexec_smp_down(void *arg)
>> {
>> local_irq_disable();
>> + hard_irq_disable();
>> mb(); /* make sure our irqs are disabled before we say they are */
>> get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
>> while(kexec_all_irq_disabled == 0)
>> @@ -244,6 +245,7 @@ static void kexec_prepare_cpus(void)
>> wake_offline_cpus();
>> smp_call_function(kexec_smp_down, NULL, /* wait */0);
>> local_irq_disable();
>> + hard_irq_disable();
>> mb(); /* make sure IRQs are disabled before we say they are */
>> get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
>>
>> @@ -281,6 +283,7 @@ static void kexec_prepare_cpus(void)
>> if (ppc_md.kexec_cpu_down)
>> ppc_md.kexec_cpu_down(0, 0);
>> local_irq_disable();
>> + hard_irq_disable();
>> }
>>
>> #endif /* SMP */
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
Next attempt.
Signed-off-by: Phileas Fogg <phileas-fogg@mail.ru>
---
From c17cdf38dfe180b4a571827bb547aaf9b678cf29 Mon Sep 17 00:00:00 2001
From: Phileas Fogg <phileas-fogg@mail.ru>
Date: Sat, 23 Feb 2013 00:32:19 +0100
Subject: [PATCH] kexec: disable hard IRQ before kexec
Disable hard IRQ before kexec a new kernel image.
Not doing it can result in corrupted data in the memory segments
reserved for the new kernel.
---
arch/powerpc/kernel/machine_kexec_64.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/powerpc/kernel/machine_kexec_64.c
b/arch/powerpc/kernel/machine_kexec_64.c
index 7206701..e08b9d0 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -162,6 +162,7 @@ static int kexec_all_irq_disabled = 0;
static void kexec_smp_down(void *arg)
{
local_irq_disable();
+ hard_irq_disable();
mb(); /* make sure our irqs are disabled before we say they are */
get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
while(kexec_all_irq_disabled == 0)
@@ -244,6 +245,7 @@ static void kexec_prepare_cpus(void)
wake_offline_cpus();
smp_call_function(kexec_smp_down, NULL, /* wait */0);
local_irq_disable();
+ hard_irq_disable();
mb(); /* make sure IRQs are disabled before we say they are */
get_paca()->kexec_state = KEXEC_STATE_IRQS_OFF;
@@ -281,6 +283,7 @@ static void kexec_prepare_cpus(void)
if (ppc_md.kexec_cpu_down)
ppc_md.kexec_cpu_down(0, 0);
local_irq_disable();
+ hard_irq_disable();
}
#endif /* SMP */
--
1.8.1.4
next prev parent reply other threads:[~2013-02-22 22:53 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 23:10 PS3: Strange issue with kexec and FreeBSD loader Phileas Fogg
2013-02-16 10:53 ` Phileas Fogg
2013-02-16 22:14 ` Phileas Fogg
2013-02-16 23:12 ` Phileas Fogg
2013-02-17 8:53 ` Geert Uytterhoeven
2013-02-17 12:40 ` Phileas Fogg
2013-02-21 0:14 ` Geoff Levand
2013-02-16 18:51 ` Phileas Fogg
2013-02-19 18:40 ` Phileas Fogg
2013-02-19 19:54 ` Phileas Fogg
2013-02-20 20:43 ` Phileas Fogg
2013-02-21 0:32 ` Benjamin Herrenschmidt
2013-02-21 20:38 ` Phileas Fogg
2013-02-21 20:35 ` Benjamin Herrenschmidt
2013-02-21 21:44 ` Phileas Fogg
2013-02-21 23:46 ` Benjamin Herrenschmidt
2013-02-22 20:49 ` Phileas Fogg
2013-02-22 19:52 ` Benjamin Herrenschmidt
2013-02-22 23:41 ` Phileas Fogg
2013-02-22 22:45 ` Benjamin Herrenschmidt
2013-02-22 23:53 ` Phileas Fogg [this message]
2013-02-21 22:06 ` Phileas Fogg
2013-02-21 23:47 ` Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=512804EC.6050407@mail.ru \
--to=phileas-fogg@mail.ru \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).