lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 2 Feb 2015 20:21:39 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	riel@...hat.com
Cc:	dave.hansen@...ux.intel.com, sbsiddha@...il.com,
	luto@...capital.net, tglx@...utronix.de, mingo@...hat.com,
	hpa@...or.com, fenghua.yu@...el.com, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/6] x86,fpu: use disable_task_lazy_fpu_restore helper

I'll try to read this patch tomorrow. Too late for me.

I think it is fine, but

On 02/02, riel@...hat.com wrote:
>
> This also fixes the lazy FPU restore disabling in drop_fpu, which
> only really works when !use_eager_fpu().
> ...
>
> --- a/arch/x86/include/asm/fpu-internal.h
> +++ b/arch/x86/include/asm/fpu-internal.h
> @@ -396,7 +396,7 @@ static inline void drop_fpu(struct task_struct *tsk)
>  	 * Forget coprocessor state..
>  	 */
>  	preempt_disable();
> -	tsk->thread.fpu_counter = 0;
> +	task_disable_lazy_fpu_restore(tsk);
>  	__drop_fpu(tsk);
>  	clear_used_math();

perhaps this makes sense anyway, but I am not sure if the changelog is right.

Note that we clear PF_USED_MATH, last_fpu/has_fpu have no effect after this.

>  	preempt_enable();
> @@ -440,7 +440,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
>  					     new->thread.fpu_counter > 5);
>  	if (__thread_has_fpu(old)) {
>  		if (!__save_init_fpu(old))
> -			old->thread.fpu.last_cpu = ~0;
> +			task_disable_lazy_fpu_restore(old);
>  		else
>  			old->thread.fpu.last_cpu = cpu;
>  		old->thread.fpu.has_fpu = 0;	/* But leave fpu_owner_task! */
> @@ -454,7 +454,7 @@ static inline fpu_switch_t switch_fpu_prepare(struct task_struct *old, struct ta
>  			stts();
>  	} else {
>  		old->thread.fpu_counter = 0;
> -		old->thread.fpu.last_cpu = ~0;
> +		task_disable_lazy_fpu_restore(old);

I am also wondering if we can remove this task_disable_lazy_fpu_restore...
I mean, perhaps we should shift this into __thread_fpu_end() path. But this
is almost off-topic and in any case this patch should not do this.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ