linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: riel@redhat.com
Cc: linux-kernel@vger.kernel.org, bp@alien8.de,
	torvalds@linux-foundation.org, luto@kernel.org,
	dave.hansen@intel.linux.com, tglx@linutronix.de, hpa@zytor.com
Subject: Re: [PATCH RFC 0/3] x86/fpu: defer FPU state loading until return to userspace
Date: Tue, 18 Oct 2016 09:58:08 +0200	[thread overview]
Message-ID: <20161018075808.GA21544@gmail.com> (raw)
In-Reply-To: <1476734984-13839-1-git-send-email-riel@redhat.com>


* riel@redhat.com <riel@redhat.com> wrote:

> These patches defer FPU state loading until return to userspace.
> 
> This has the advantage of not clobbering the FPU state of one task
> with that of another, when that other task only stays in kernel mode.
> 
> It also allows us to skip the FPU restore in kernel_fpu_end(), which
> will help tasks that do multiple invokations of kernel_fpu_begin/end
> without returning to userspace, for example KVM VCPU tasks.
> 
> We could also skip the restore of the KVM VCPU guest FPU state at
> guest entry time, if it is still valid, but I have not implemented
> that yet.
> 
> The code that loads FPU context directly into registers from user
> space memory, or saves directly to user space memory, is wrapped
> in a retry loop, that ensures the FPU state is correctly set up
> at the start, and verifies that it is still valid at the end.
> 
> I have stress tested these patches with various FPU test programs,
> and things seem to survive.
> 
> However, I have not found any good test suites that mix FPU
> use and signal handlers. Close scrutiny of these patches would
> be appreciated.

BTW., for the next version it would be nice to also have a benchmark that shows 
the advantages (and proves that it's not causing measurable overhead elsewhere).

Either an FPU-aware extension to 'perf bench sched' or a separate 'perf bench fpu' 
suite would be nice.

Thanks,

	Ingo

      parent reply	other threads:[~2016-10-18  7:58 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 20:09 [PATCH RFC 0/3] x86/fpu: defer FPU state loading until return to userspace riel
2016-10-17 20:09 ` [PATCH RFC 1/3] fpu/x86: add make_fpregs_active(_newstate) helper functions riel
2016-10-17 20:57   ` Andy Lutomirski
2016-10-17 23:04     ` Yu-cheng Yu
2016-10-17 23:30       ` Andy Lutomirski
2016-10-17 23:45         ` Yu-cheng Yu
2016-10-18  1:23           ` Andy Lutomirski
2016-10-17 20:09 ` [PATCH RFC 2/3] x86/fpu: prepare misc FPU state handling code for lazy FPU loading riel
2016-10-17 20:09 ` [PATCH RFC 3/3] x86/fpu: defer FPU state load until return to userspace riel
2016-10-17 20:58   ` Andy Lutomirski
2016-10-18  0:06     ` Rik van Riel
2016-10-18  7:58 ` Ingo Molnar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161018075808.GA21544@gmail.com \
    --to=mingo@kernel.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.linux.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=riel@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).