From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "oleg@redhat.com" <oleg@redhat.com>
Cc: "debug@rivosinc.com" <debug@rivosinc.com>,
"mingo@kernel.org" <mingo@kernel.org>,
"bp@alien8.de" <bp@alien8.de>,
"broonie@kernel.org" <broonie@kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"hpa@zytor.com" <hpa@zytor.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"Mehta, Sohil" <sohil.mehta@intel.com>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH v2 0/5] x86/fpu: don't abuse x86_task_fpu(PF_USER_WORKER) in .regset_get() paths
Date: Thu, 28 Aug 2025 21:48:03 +0000 [thread overview]
Message-ID: <4249e18ffed68e8038624021aa3a6f06b64eeb85.camel@intel.com> (raw)
In-Reply-To: <20250827145159.GA9844@redhat.com>
On Wed, 2025-08-27 at 16:51 +0200, Oleg Nesterov wrote:
> >
> > I guess I question whether it really makes sense to add a special case for
> > PF_USER_WORKER, including the existing logic. But I'm still trying to piece
> > together a clearly stated benefit.
>
> Again, I don't understand... To me, currently arch/x86/kernel/fpu/regset.c
> adds a special case for PF_USER_WORKER, this series tries to remove it (but
> we need a bit more of simple changes).
That commit I dug up? It didn't have a super strong justification either. Can
you say what your intended benefit is?
>
> > > That said... Could you explain why do you dislike 4/5 ?
> >
> > As I said, shstk_alloc_thread_stack() shouldn't clear ARCH_SHSTK_SHSTK
> > because
> > the function is about shadow stack allocation.
>
> OK, then how/where we can clear this flag if we avoid the pointless shadow
> stack allocation for PF_USER_WORKER?
*If* we want to worry about an extra shadow stack allocation (which Dave seems
to doubt), we don't need to clear ARCH_SHSTK_SHSTK to avoid allocations. Other
thread types already avoid it (vfork, etc). So just add to the existing logic
that skips shadow stack allocation. Make it do that for user workers too, and
leave ARCH_SHSTK_SHSTK alone.
>
> > It also doesn't make sense to clear ARCH_SHSTK_SHSTK for user workers.
>
> Why?
Because ARCH_SHSTK_SHSTK is supposed to be inherited by children. It adds a
special case for no reason.
>
> > I think Dave also questioned whether a rare extra shadow stack is really a
> > problem.
>
> Sure, it is not really a problem. In that it is not a bug. But why we can't
> avoid the pointless shadow stack / ARCH_SHSTK_SHSTK for user workers ? 4/5
> doesn't complicate this code.
>
> Plus, again, the current code is not consistent. fpu_clone() won't do
> update_fpu_shstk() in this case. Not a bug too, but imo deserves a cleanup.
I thought we discussed that the user worker logic already wipes the whole FPU
state though, so we don't need to call update_fpu_shstk(). Did I get that wrong?
next prev parent reply other threads:[~2025-08-28 21:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 15:36 [PATCH v2 0/5] x86/fpu: don't abuse x86_task_fpu(PF_USER_WORKER) in .regset_get() paths Oleg Nesterov
2025-08-22 15:36 ` [PATCH v2 1/5] x86/fpu: don't use x86_task_fpu() in copy_xstate_to_uabi_buf() Oleg Nesterov
2025-08-22 15:36 ` [PATCH v2 2/5] x86/fpu: regset: introduce get_fpstate() helper Oleg Nesterov
2025-08-22 15:36 ` [PATCH v2 3/5] x86/fpu: fold sync_fpstate() into get_fpstate() Oleg Nesterov
2025-08-22 15:37 ` [PATCH v2 4/5] x86/shstk: don't create the shadow stack for PF_USER_WORKERs Oleg Nesterov
2025-08-22 15:37 ` [PATCH v2 5/5] x86/fpu: change get_fpstate() to return &init_fpstate if PF_USER_WORKER Oleg Nesterov
2025-08-22 16:32 ` [PATCH v2 0/5] x86/fpu: don't abuse x86_task_fpu(PF_USER_WORKER) in .regset_get() paths Edgecombe, Rick P
2025-08-22 19:21 ` Oleg Nesterov
2025-08-22 20:01 ` Edgecombe, Rick P
2025-08-25 13:47 ` Oleg Nesterov
2025-08-27 14:12 ` Edgecombe, Rick P
2025-08-27 14:51 ` Oleg Nesterov
2025-08-28 21:48 ` Edgecombe, Rick P [this message]
2025-08-29 15:06 ` Oleg Nesterov
2025-09-02 20:37 ` Edgecombe, Rick P
2025-09-03 9:54 ` Oleg Nesterov
2025-09-03 15:46 ` Edgecombe, Rick P
2025-09-04 13:44 ` Oleg Nesterov
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=4249e18ffed68e8038624021aa3a6f06b64eeb85.camel@intel.com \
--to=rick.p.edgecombe@intel.com \
--cc=bp@alien8.de \
--cc=broonie@kernel.org \
--cc=dave.hansen@linux.intel.com \
--cc=debug@rivosinc.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=sohil.mehta@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;
as well as URLs for NNTP newsgroup(s).