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:	Thu, 29 Jan 2015 22:21:23 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Rik van Riel <riel@...hat.com>
Cc:	"H. Peter Anvin" <hpa@...or.com>,
	Andy Lutomirski <luto@...capital.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Fenghua Yu <fenghua.yu@...el.com>,
	the arch/x86 maintainers <x86@...nel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC] x86,fpu: merge save_init_fpu & unlazy_fpu

On 01/29, Rik van Riel wrote:
>
> The functions save_init_fpu and unlazy_fpu do essentially the
> same thing:

Yes ;) Could you look at 1-3 I sent ?

> Callers of init_fpu do want __thread_fpu_end, so move the call to
> __thread_fpu_end into init_fpu.

I don't think so... Contrary, I think this __thread_fpu_end() is simply
wrong.

>  static inline void save_init_fpu(struct task_struct *tsk)
>  {
> -	WARN_ON_ONCE(!__thread_has_fpu(tsk));
> -
> -	if (use_eager_fpu()) {
> -		__save_fpu(tsk);
> -		return;
> -	}
> -
>  	preempt_disable();
> -	__save_init_fpu(tsk);
> -	__thread_fpu_end(tsk);
> +	if (__thread_has_fpu(tsk)) {
> +		if (use_eager_fpu())
> +			__save_fpu(tsk);
> +		else
> +			__save_init_fpu(tsk);

See the changelog in 2/3. I think we still need __thread_fpu_end() if
__save_init_fpu() returns 0. In this case (_I think_) the state of FPU
doesn't match the saved state. IOW, "save_init" == "save" + "init" (I guess),
and that "init" can (say) reset some control register to default value.


> +	} else if (!use_eager_fpu())
> +		tsk->thread.fpu_counter = 0;

See 1/3, I think this should be simply removed.

> @@ -245,8 +233,10 @@ int init_fpu(struct task_struct *tsk)
>  	int ret;
>  
>  	if (tsk_used_math(tsk)) {
> -		if (cpu_has_fpu && tsk == current)
> -			unlazy_fpu(tsk);
> +		if (cpu_has_fpu && tsk == current) {
> +			save_init_fpu(tsk);
> +			__thread_fpu_end(tsk);

See above.

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