Generic Linux architectural discussions
 help / color / mirror / Atom feed
From: Rik van Riel <riel@surriel.com>
To: Andy Lutomirski <luto@amacapital.net>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	Andrew Lutomirski <luto@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Samuel Neves <sneves@dei.uc.pt>,
	linux-arch@vger.kernel.org
Subject: Re: [PATCH v2 01/17] asm: simd context helper API
Date: Sun, 26 Aug 2018 12:53:29 -0400	[thread overview]
Message-ID: <3983fcb4c663e8dc05f13cac32ff56ec15c3dac1.camel@surriel.com> (raw)
In-Reply-To: <2532E417-DDD2-4E2C-9F21-3B8D9B96370D@amacapital.net>

[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]

On Sun, 2018-08-26 at 07:18 -0700, Andy Lutomirski wrote:
> > On Aug 26, 2018, at 7:06 AM, Thomas Gleixner <tglx@linutronix.de>
> > wrote:
> > 
> > Jason,
> > 
> > > On Sun, 26 Aug 2018, Jason A. Donenfeld wrote:
> > > > On Sun, Aug 26, 2018 at 6:10 AM Thomas Gleixner <
> > > > tglx@linutronix.de> wrote:
> > > > I'm not too fond of this simply because it requires that
> > > > relax() step in
> > > > all code pathes. I'd rather make that completely transparent by
> > > > just
> > > > marking the task as FPU using and let the context switch code
> > > > deal with it
> > > > in case that it gets preempted. I'll let one of my engineers
> > > > look into
> > > > that next week.
> > > 
> > > Do you mean to say you intend to make kernel_fpu_end() and
> > > kernel_neon_end() only actually do something upon context switch,
> > > but
> > > not when it's actually called? So that multiple calls to
> > > kernel_fpu_begin() and kernel_neon_begin() can be made without
> > > penalty?
> > 
> > On context switch and exit to user. That allows to keep those code
> > pathes
> > fully preemptible. Still twisting my brain around the details.
> 
> I think you’ll have to treat exit to user and context switch as
> different things. For exit to user, we want to restore the *user*
> state, but, for context switch, we’ll need to restore *kernel* state.

For non-preemptible kernel_fpu_begin/end (which seems
like a good starting point since since it gets the
code halfway to where Thomas would like it to go), the
rules would be a little simpler:

- For exit to userspace, restore the user FPU state.
- At kernel_fpu_begin(), save the user FPU state (if still loaded).
- At context switch time, save the user FPU state (if still loaded).

> Do user first as its own patch set. It’ll be less painful that way.
> 
> And someone needs to rework PKRU for this to make sense. See previous
> threads.

I sent Thomas the patches I worked on in the past.

That series is likely incomplete, but should be a
reasonable starting point.

-- 
All Rights Reversed.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2018-08-26 16:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180824213849.23647-1-Jason@zx2c4.com>
2018-08-24 21:38 ` [PATCH v2 01/17] asm: simd context helper API Jason A. Donenfeld
2018-08-24 21:38   ` Jason A. Donenfeld
2018-08-26 12:10   ` Thomas Gleixner
2018-08-26 12:10     ` Thomas Gleixner
2018-08-26 13:45     ` Jason A. Donenfeld
2018-08-26 13:45       ` Jason A. Donenfeld
2018-08-26 14:06       ` Thomas Gleixner
2018-08-26 14:06         ` Thomas Gleixner
2018-08-26 14:18         ` Jason A. Donenfeld
2018-08-26 14:18           ` Jason A. Donenfeld
2018-08-26 14:25           ` Andy Lutomirski
2018-08-26 14:25             ` Andy Lutomirski
2018-08-26 14:18         ` Andy Lutomirski
2018-08-26 14:18           ` Andy Lutomirski
2018-08-26 16:53           ` Rik van Riel [this message]
2018-08-26 16:53             ` Rik van Riel
2018-09-01 20:19         ` Jason A. Donenfeld
2018-09-01 20:19           ` Jason A. Donenfeld
2018-09-01 20:32           ` Andy Lutomirski
2018-09-01 20:32             ` Andy Lutomirski
2018-09-01 20:34             ` Jason A. Donenfeld
2018-09-01 20:34               ` Jason A. Donenfeld
2018-09-06 13:42               ` Thomas Gleixner
2018-09-06 13:42                 ` Thomas Gleixner
2018-09-06 15:52                 ` Jason A. Donenfeld
2018-09-06 15:52                   ` Jason A. Donenfeld
2018-08-27 19:50   ` Palmer Dabbelt
2018-08-27 19:50     ` Palmer Dabbelt

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=3983fcb4c663e8dc05f13cac32ff56ec15c3dac1.camel@surriel.com \
    --to=riel@surriel.com \
    --cc=Jason@zx2c4.com \
    --cc=davem@davemloft.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sneves@dei.uc.pt \
    --cc=tglx@linutronix.de \
    /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