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>] [day] [month] [year] [list]
Date:	Thu, 02 May 2013 18:19:19 -0400
From:	Rik van Riel <riel@...riel.com>
To:	Suresh Siddha <suresh.b.siddha@...el.com>
CC:	"H. Peter Anvin" <hpa@...or.com>, Andi Kleen <andi@...stfloor.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: question about lazy FPU restore

Hi Suresh,

I have a question about the lazy fpu restore code in
switch_fpu_prepare.  Specifically, about the case where
the old task did not use the FPU, and the new task's
FPU state is still in the cpu.

         } else {
                 old->fpu_counter = 0;
                 old->thread.fpu.last_cpu = ~0;
                 if (fpu.preload) {
                         new->fpu_counter++;
                         if (!use_eager_fpu() && fpu_lazy_restore(new, cpu))
                                 fpu.preload = 0;
                         else
                                 prefetch(new->thread.fpu.state);
                         __thread_fpu_begin(new);
                 }
         }

In this branch, we call fpu_lazy_restore, which
confirms that the CPU still has the new task's state
in it.

However, if we are in eager fpu mode, we still end up
calling restore_fpu_checking from switch_fpu_finish,
even if the new task's FPU state is still resident in
the CPU.

Is there a particular reason we do this?

Would it be possible to always set fpu.preload = 0,
call clts, and __thread_set_has_fpu if fpu_lazy_restore
returns true?

That would allow us to skip the loading of FPU state
when re-entering a process that went briefly idle, before
getting something else to do, a common occurrance in
message passing workloads.
--
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