public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sohil Mehta <sohil.mehta@intel.com>
To: Rick Edgecombe <rick.p.edgecombe@intel.com>, <tglx@linutronix.de>,
	<mingo@redhat.com>, <bp@alien8.de>, <x86@kernel.org>,
	<hpa@zytor.com>, <dave.hansen@linux.intel.com>, <luto@kernel.org>,
	<peterz@infradead.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86: Use __fpu_invalidate_fpregs_state() in exec
Date: Fri, 18 Aug 2023 16:35:23 -0700	[thread overview]
Message-ID: <86e0203d-d4f4-3502-da85-6626eecfac99@intel.com> (raw)
In-Reply-To: <20230818170305.502891-1-rick.p.edgecombe@intel.com>

Hi Rick,

On 8/18/2023 10:03 AM, Rick Edgecombe wrote:
> So the root cause is that exec() is doing the wrong kind of invalidate. It
> should reset fpu->last_cpu via __fpu_invalidate_fpregs_state(). Further,
> fpu__drop() doesn't really seem appropriate as the task (and FPU) are not
> going away, they are just getting reset as part of an exec. So switch to
> __fpu_invalidate_fpregs_state().
> 

I went through the scenario you described and it seems plausible. Since
the task is being reset (and the CPU is unaffected) it makes sense to
use __fpu_invalidate_fpregs_state() during exec().

> Also, delete the misleading comment that says that either kind of
> invalidate will be enough, because it’s not always the case.
> 

I think it would be helpful to expand the comment specifying exactly
when __fpu_invalidate_fpregs_state() should be used vs
__cpu_invalidate_fpregs_state(). I'll try to audit the usages and come
up with something reasonable if possible.

Sohil

  parent reply	other threads:[~2023-08-18 23:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 17:03 [PATCH] x86: Use __fpu_invalidate_fpregs_state() in exec Rick Edgecombe
2023-08-18 19:35 ` Lijun Pan
2023-08-18 21:56   ` Sohil Mehta
2023-08-24  0:04   ` Lijun Pan
2023-08-18 23:35 ` Sohil Mehta [this message]
2023-08-22 20:10 ` Sohil Mehta
2023-08-24  9:11 ` [tip: x86/urgent] x86/fpu: Invalidate FPU state correctly on exec() tip-bot2 for Rick Edgecombe
2023-08-24 15:22   ` Edgecombe, Rick P

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=86e0203d-d4f4-3502-da85-6626eecfac99@intel.com \
    --to=sohil.mehta@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rick.p.edgecombe@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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