[PATCH 1/2] arm64: Move handling of erratum 1418040 into C code

Catalin Marinas catalin.marinas at arm.com
Wed Jul 29 13:12:04 EDT 2020


On Tue, Jul 28, 2020 at 10:21:11AM +0100, Marc Zyngier wrote:
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index 6089638c7d43..87c33f7c536b 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -515,6 +515,34 @@ static void entry_task_switch(struct task_struct *next)
>  	__this_cpu_write(__entry_task, next);
>  }
>  
> +static void erratum_1418040_thread_switch(struct task_struct *prev,
> +					  struct task_struct *next)
> +{
> +	bool prev32, next32;
> +	u64 val;
> +
> +	if (!(IS_ENABLED(CONFIG_ARM64_ERRATUM_1418040) &&
> +	      cpus_have_const_cap(ARM64_WORKAROUND_1418040)))
> +		return;
> +
> +	prev32 = (!(prev->flags & PF_KTHREAD) &&
> +		  is_compat_thread(task_thread_info(prev)));
> +	next32 = (!(next->flags & PF_KTHREAD) &&
> +		  is_compat_thread(task_thread_info(next)));

I don't think we need to test PF_KTHREAD. is_compat_thread() checks for
TIF_32BIT and we never set this on kernel threads (they are cloned from
kthreadd).

-- 
Catalin



More information about the linux-arm-kernel mailing list