[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190604114701.GM3402@hirez.programming.kicks-ass.net>
Date: Tue, 4 Jun 2019 13:47:01 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Christoph Hellwig <hch@....de>
Cc: x86@...nel.org, Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kernel@...r.kernel.org
Subject: Re: [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(¤t->thread.fpu);
> }
> __cpu_invalidate_fpregs_state();
> }
Powered by blists - more mailing lists