linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@linux.intel.com>
To: riel@redhat.com, linux-kernel@vger.kernel.org
Cc: hpa@zytor.com, mingo@kernel.org, bp@alien8.de, luto@kernel.org,
	oleg@redhat.com
Subject: Re: [PATCH 2/2] x86/fpu: split old & new fpu handling into separate functions
Date: Fri, 14 Oct 2016 10:14:00 -0700	[thread overview]
Message-ID: <58011258.5000202@linux.intel.com> (raw)
In-Reply-To: <1476447331-21566-3-git-send-email-riel@redhat.com>

On 10/14/2016 05:15 AM, riel@redhat.com wrote:
> From: Rik van Riel <riel@redhat.com>
> 
> By moving all of the new fpu state handling into switch_fpu_finish,
> the code can be simplified some more. This does get rid of the
> prefetch, but given the size of the fpu register state on modern
> CPUs, and the amount of work done by __switch_to in-between both
> functions, the value of a single cache line prefetch seems somewhat
> dubious anyway.
...
> -
> -	if (fpu.preload) {
> -		if (fpregs_state_valid(new_fpu, cpu))
> -			fpu.preload = 0;
> -		else
> -			prefetch(&new_fpu->state);
> -		fpregs_activate(new_fpu);
> -	}
> -
> -	return fpu;
>  }

Yeah, that prefetch is highly dubious.  XRSTOR might not even be
_reading_ that cacheline if the state isn't present (xstate->xfeatures
bit is 0).  If we had to pick *a* cacheline to prefetch for XRSTOR, it
would be the XSAVE header, *not* the FPU state.

I actually did some attempts to optimize the PKRU handling by touching
and prefetching the state before calling XRSTOR.  It actually made
things overall _worse_ when I touched it before the XRSTOR.

It would be ideal to have some data on whether this actually _does_
anything, but I can't imagine it being a real delta in either direction.

Acked-by: Dave Hansen <dave.hansen@intel.com>

  reply	other threads:[~2016-10-14 17:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-14 12:15 [PATCH 0/2] x86/fpu: two more FPU cleanups riel
2016-10-14 12:15 ` [PATCH 1/2] x86/fpu: remove cpu argument to __cpu_invalidate_fpregs_state riel
2016-10-14 16:53   ` Dave Hansen
2016-10-16 11:25   ` [tip:x86/fpu] x86/fpu: Remove 'cpu' argument from __cpu_invalidate_fpregs_state() tip-bot for Rik van Riel
2016-10-14 12:15 ` [PATCH 2/2] x86/fpu: split old & new fpu handling into separate functions riel
2016-10-14 17:14   ` Dave Hansen [this message]
2016-10-16 11:25   ` [tip:x86/fpu] x86/fpu: Split old_fpu & new_fpu " tip-bot for Rik van Riel
2017-01-24 12:13     ` you have a new message from... c92Y Izuchukwu Francis
2017-02-10 13:52       ` Izuchukwu Francis

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=58011258.5000202@linux.intel.com \
    --to=dave.hansen@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=riel@redhat.com \
    /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).