lkml.org 
[lkml]   [2019]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] x86/fpu: Simplify kernel_fpu_begin
On Tue, Jun 04, 2019 at 09:15:23AM +0200, Christoph Hellwig wrote:
> +void kernel_fpu_begin(void)
> {
> + preempt_disable();
>
> WARN_ON_FPU(!irq_fpu_usable());
> + WARN_ON_FPU(this_cpu_read(in_kernel_fpu));
>
> + this_cpu_write(in_kernel_fpu, true);
>
> + if (current->mm && !test_thread_flag(TIF_NEED_FPU_LOAD)) {

Did that want to be: !(current->flags & PF_KTHREAD), instead?

Because I'm thinking that kernel_fpu_begin() on a kthread that has
use_mm() employed shouldn't be doing this..

> + set_thread_flag(TIF_NEED_FPU_LOAD);
> + /*
> + * Ignore return value -- we don't care if reg state
> + * is clobbered.
> + */
> + copy_fpregs_to_fpstate(&current->thread.fpu);
> }
> __cpu_invalidate_fpregs_state();
> }

\
 
 \ /
  Last update: 2019-06-04 13:47    [W:0.076 / U:2.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site