Re: [PATCH 2/2] MIPS: c-r4k: Do not SMP function call during kexec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxx>

 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 +




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux