Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1495177

Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch to userspace

From Rik van Riel <riel@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch to userspace
Date 2016-10-04 04:50 +0200
Message-ID <sonXQ-4PN-33@gated-at.bofh.it> (permalink)
References (4 earlier) <soivc-1li-7@gated-at.bofh.it> <soiY9-1K3-9@gated-at.bofh.it> <soj7P-1Ne-9@gated-at.bofh.it> <somIp-40M-5@gated-at.bofh.it> <sonuN-4Gn-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Mon, 2016-10-03 at 19:09 -0700, Andy Lutomirski wrote:

> > Having two separate status booleans for "registers valid"
> > and "memory valid" may make more sense.
> 
> I have no problem with the concept of "owner_ctx", and I think it's a
> perfectly reasonable data structure.  My problem with it is that it's
> subtle and knowledge of it is spread all over the place.  Just going
> with "registers valid" in a variable won't work, I think, because
> there's nowhere to put it.  We need to be able to delete a struct fpu
> while that struct fpu might have a valid copy in a different cpu's
> registers.
> 
> Anyway, feel free to tell me that I'm making this too difficult :)

How about we rename fpu_want_lazy_restore to
fpu_registers_valid()?  Problem solved :)

Then we can rename __cpu_disable_lazy_restore
to fpu_invalidate_registers(), and call that
before we modify any in-memory FPU state.

> > We can get rid of fpu.counter, since nobody uses it
> > any more.
> 
> We should definitely do this.
> 
> Maybe getting in some cleanups first (my lazy fpu deletion,
> fpu.counter removal, etc) first is the way to go.

Sounds good.  I will keep my patch 1/4 as part of the
cleanup series, and will not move on to the harder
stuff until after the cleanups.

Any other stuff I should clean up while we're there?

> > > > > 
> > You are right, read_pkru() and write_pkru() can only deal with
> > the pkru state being present in registers. Is this because of an
> > assumption in the code, or because of a hardware requirement?

read_pkru and write_pkru would be candidates for using
fpu_registers_valid, and potentially a fpu_make_registers_valid,
which restores the contents of the fpu registers from memory,
if fpu_registers_valid is not true.

Likewise, we can have an fpu_make_memory_valid to ensure the
in kernel memory copy of the FPU registers is valid, potentially
a _read and _write version that do exactly what the pstate code
wants today.

Would that make sense as an API?

-- 
All Rights Reversed.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch to userspace riel@redhat.com - 2016-10-01 23:00 +0200
  Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch  to userspace Andy Lutomirski <luto@amacapital.net> - 2016-10-02 01:50 +0200
    Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until  switch to userspace Rik van Riel <riel@redhat.com> - 2016-10-02 02:10 +0200
      Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch  to userspace Andy Lutomirski <luto@amacapital.net> - 2016-10-03 23:00 +0200
        Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until  switch to userspace Rik van Riel <riel@redhat.com> - 2016-10-03 23:30 +0200
          Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch  to userspace Andy Lutomirski <luto@amacapital.net> - 2016-10-03 23:40 +0200
            Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until  switch to userspace Rik van Riel <riel@redhat.com> - 2016-10-04 03:30 +0200
              Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch  to userspace Andy Lutomirski <luto@amacapital.net> - 2016-10-04 04:20 +0200
                Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until  switch to userspace Rik van Riel <riel@redhat.com> - 2016-10-04 04:50 +0200
                Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch  to userspace Andy Lutomirski <luto@amacapital.net> - 2016-10-04 05:10 +0200
                Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch  to userspace Ingo Molnar <mingo@kernel.org> - 2016-10-04 08:40 +0200
                Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until  switch to userspace Rik van Riel <riel@redhat.com> - 2016-10-04 14:50 +0200
            Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until  switch to userspace Rik van Riel <riel@redhat.com> - 2016-10-04 04:20 +0200
              Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch  to userspace Andy Lutomirski <luto@amacapital.net> - 2016-10-04 05:10 +0200
    Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until  switch to userspace Rik van Riel <riel@redhat.com> - 2016-10-02 02:50 +0200
      Re: [PATCH RFC 2/5] x86,fpu: delay FPU register loading until switch  to userspace Dave Hansen <dave.hansen@linux.intel.com> - 2016-10-03 18:30 +0200

csiph-web