From: Ralf Baechle <ralf@linux-mips.org>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-mips@linux-mips.org, james.hogan@imgtec.com,
paul.burton@imgtec.com, marcin.nowakowski@imgtec.com,
justinpopo6@gmail.com, bcm-kernel-feedback-list@broadcom.com
Subject: Re: [PATCH 2/2] MIPS: c-r4k: Do not SMP function call during kexec
Date: Fri, 10 Mar 2017 11:31:52 +0100 [thread overview]
Message-ID: <20170310103152.GA22089@linux-mips.org> (raw)
In-Reply-To: <20170308014641.16267-3-f.fainelli@gmail.com>
On Tue, Mar 07, 2017 at 05:46:41PM -0800, Florian Fainelli wrote:
> On SMP r4k cache style systems, we cannot issue a
> smp_function_call_many() like what __flush_cache_all() does *after* we
> have disabled interrupts for the calling CPU. Add a special check, and
> do a local cache operation instead.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> arch/mips/mm/c-r4k.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
> index e7f798d55fbc..ea2998f1f5c5 100644
> --- a/arch/mips/mm/c-r4k.c
> +++ b/arch/mips/mm/c-r4k.c
> @@ -19,6 +19,7 @@
> #include <linux/mm.h>
> #include <linux/export.h>
> #include <linux/bitops.h>
> +#include <linux/kexec.h>
>
> #include <asm/bcache.h>
> #include <asm/bootinfo.h>
> @@ -494,7 +495,10 @@ static inline void local_r4k___flush_cache_all(void * args)
>
> static void r4k___flush_cache_all(void)
> {
> - r4k_on_each_cpu(R4K_INDEX, local_r4k___flush_cache_all, NULL);
> + if (!kexec_in_progress)
> + r4k_on_each_cpu(R4K_INDEX, local_r4k___flush_cache_all, NULL);
> + else
> + local_r4k___flush_cache_all(NULL);
> }
The cache management code shouldn't know about kexec. And if the problem
is calling __flush_cache_all with interrupts disabled, then why not
calling it with interrupts enabled which can be trivially done by moving
the call by a few lines?
Suggested by untested patch below, so testing would be appreciated.
Ralf
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/kernel/machine_kexec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c
index 8b574bc..d6a6abe 100644
--- a/arch/mips/kernel/machine_kexec.c
+++ b/arch/mips/kernel/machine_kexec.c
@@ -117,6 +117,7 @@ machine_kexec(struct kimage *image)
*ptr & IND_DESTINATION)
*ptr = (unsigned long) phys_to_virt(*ptr);
}
+ __flush_cache_all();
/*
* we do not want to be bothered.
@@ -125,7 +126,6 @@ machine_kexec(struct kimage *image)
printk("Will call new kernel at %08lx\n", image->start);
printk("Bye ...\n");
- __flush_cache_all();
#ifdef CONFIG_SMP
/* All secondary cpus now may jump to kexec_wait cycle */
relocated_kexec_smp_wait = reboot_code_buffer +
prev parent reply other threads:[~2017-03-10 10:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-08 1:46 [PATCH 0/2] MIPS: Couple kexec related fixes Florian Fainelli
2017-03-08 1:46 ` [PATCH 1/2] MIPS: kexec: Provide bootloader arguments by default Florian Fainelli
2017-03-10 12:16 ` Ralf Baechle
2017-03-08 1:46 ` [PATCH 2/2] MIPS: c-r4k: Do not SMP function call during kexec Florian Fainelli
2017-03-10 10:31 ` Ralf Baechle [this message]
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=20170310103152.GA22089@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=f.fainelli@gmail.com \
--cc=james.hogan@imgtec.com \
--cc=justinpopo6@gmail.com \
--cc=linux-mips@linux-mips.org \
--cc=marcin.nowakowski@imgtec.com \
--cc=paul.burton@imgtec.com \
/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