From: Ralf Baechle <ralf@linux-mips.org>
To: Nicolas Schichan <nschichan@freebox.fr>
Cc: linux-mips@linux-mips.org
Subject: Re: [patch] [RFC] Kexec on MIPS
Date: Wed, 18 Oct 2006 15:31:29 +0100 [thread overview]
Message-ID: <20061018143129.GB3498@linux-mips.org> (raw)
In-Reply-To: <200610181514.56081.nschichan@freebox.fr>
On Wed, Oct 18, 2006 at 03:14:55PM +0200, Nicolas Schichan wrote:
> I have implemented kexec support for the mips architecture, the code is
> available in the attached patch (for 2.6.18 kernel). This code works fine on
> the mips boards I use at work (one in big endian and one in little endian) and
> on qemu.
Cool!
> However it has not been tested on 64 bit mips and it may not work on
> those architectures.
Aside of a nit in a 32-bit specific comment the code is looking good. See
below.
> It may also not work on machines with more than 512 megabytes as the kexec
> generic code may fill the page list with adresses over the 512 megabytes
> limit (the mips boards I use only have 16mbytes and 32mbytes ram).
This is only an issue with 32-bit software anyway. On these you can solve
the problem by manually setting up TLB mappings. You may want to take a
look at kmap_coherent in arch/mips/mm/init.c for how to create such
temporary mappings.
> A tiny userland application loading the kernel and invoking kexec_load for
> mips is available here:
>
> http://chac.le-poulpe.net/~nico/kexec/kexec-2006-10-18.tar.gz
>
> Do not hesitate to comment on this patch,
Without having tested this, this actually looks quite fine for the first
cut. My nits are these:
+ /*
+ * The generic kexec code builds a page list with physical
+ * addresses. they are directly accessible through KSEG0,
+ * hence the pys_to_virt() call.
+ */
On a 64-bit system this could actually be either an XKPHY or CKSEG address,
depending on PAGE_OFFSET.
+ /*
+ * we do not want to be bothered.
+ */
+ local_irq_disable();
+
+ flush_icache_range(reboot_code_buffer,
+ reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
+
+ printk("Will call new kernel at %08x\n", image->start);
+ printk("Bye ...\n");
+ flush_cache_all();
+ ((void (*)(void))reboot_code_buffer)();
On SMP systems cache flushes may invoke smp_call_function which will barf
when called with interrupts disabled. So you may want to move the
local_irq_disable further down to somewhere after the last flush.
Your code does not try to deal with SMP at all. The strategy used by
Linux to get hold of processors 1 and up on bootup relies on the
firmware. Generally firmware breaks because Linux tramples over it and
even if it would survive that, it does not regain control over non-boot
processors, so starting of those processors would fail.
The solution I have in mind would be something like:
* The trampoline that transfers control between the old and new kernel
needs to be modified to keep all additional processors in some sort of
spinlock.
* A kernel needs a way to know if it has been executed via kexec or a
normal bootup. It uses this knowledge to release one non-boot
processor after another during SMP initialization.
Ralf
PS: If you have to send patches as attachments, then please as text/plain.
next prev parent reply other threads:[~2006-10-18 14:31 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-18 13:14 [patch] [RFC] Kexec on MIPS Nicolas Schichan
2006-10-18 14:31 ` Ralf Baechle [this message]
2006-10-18 21:21 ` Nicolas Schichan
2006-10-18 21:37 ` Nicolas Schichan
2006-10-18 22:38 ` Ralf Baechle
2006-10-19 14:16 ` Nicolas Schichan
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=20061018143129.GB3498@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=nschichan@freebox.fr \
/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 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.