public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Brian Gerst <brgerst@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Andy Lutomirski <luto@amacapital.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Hansen <dave@sr71.net>,
	Peter Zijlstra <peterz@infradead.org>,
	Borislav Petkov <bp@alien8.de>, "H . Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Uros Bizjak <ubizjak@gmail.com>
Subject: Re: [PATCH] x86/fpu: Introduce the x86_task_fpu() helper method
Date: Fri, 7 Jun 2024 13:38:25 +0200	[thread overview]
Message-ID: <ZmLxMaXd-qtLBoK2@gmail.com> (raw)
In-Reply-To: <CAMzpN2gL04UbRUP5HDkz9hxdyxXVkFcXBrDc+hGmvR0rxt2Onw@mail.gmail.com>


* Brian Gerst <brgerst@gmail.com> wrote:

> On Thu, Jun 6, 2024 at 5:06 AM Ingo Molnar <mingo@kernel.org> wrote:
> >
> >
> > * Brian Gerst <brgerst@gmail.com> wrote:
> >
> > > >  17 files changed, 104 insertions(+), 107 deletions(-)
> > >
> > > This series would be better if you added the x86_task_fpu() helper in
> > > an initial patch without any other changes.  That would make the
> > > actual changes more visible with less code churn.
> >
> > Makes sense - I've split out the patch below and adjusted the rest of the
> > series. Is this what you had in mind?
> >
> > Note that I also robustified the macro a bit:
> >
> >  -# define x86_task_fpu(task) ((struct fpu *)((void *)task + sizeof(*task)))
> >  +# define x86_task_fpu(task) ((struct fpu *)((void *)(task) + sizeof(*(task))))
> >
> > Thanks,
> >
> >         Ingo
> >
> > ========================>
> > From: Ingo Molnar <mingo@kernel.org>
> > Date: Thu, 6 Jun 2024 11:01:14 +0200
> > Subject: [PATCH] x86/fpu: Introduce the x86_task_fpu() helper method
> >
> > The per-task FPU context/save area is allocated right
> > next to task_struct() - introduce the x86_task_fpu()
> > helper that calculates this explicitly from the
> > task pointer.
> >
> > Signed-off-by: Ingo Molnar <mingo@kernel.org>
> > ---
> >  arch/x86/include/asm/processor.h | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
> > index 920b0beebd11..fb6f030f0692 100644
> > --- a/arch/x86/include/asm/processor.h
> > +++ b/arch/x86/include/asm/processor.h
> > @@ -507,6 +507,8 @@ struct thread_struct {
> >         struct fpu              *fpu;
> >  };
> >
> > +#define x86_task_fpu(task) ((struct fpu *)((void *)(task) + sizeof(*(task))))
> > +
> >  /*
> >   * X86 doesn't need any embedded-FPU-struct quirks:
> >   */
> 
> Since this should be the first patch in the series, It would be:
> 
> #define #define x86_task_fpu(task) (&(task)->thread.fpu)
> 
> along with converting the existing accesses to task->thread.fpu in one
> patch with no other functional changes. Then you could change how the
> fpu struct is allocated without touching every access site again.

Yeah, you are right of course - I've restructured the series accordingly, 
it's now indeed a lot easier to review internally now, but has the same end 
result. Will post it later today.

Thanks,

	Ingo

      reply	other threads:[~2024-06-07 11:38 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  8:35 [PATCH 0/3, v3] x86/fpu: Remove the thread::fpu pointer Ingo Molnar
2024-06-05  8:35 ` [PATCH 1/3] x86/fpu: Make task_struct::thread constant size Ingo Molnar
2024-06-05 19:04   ` Chang S. Bae
2024-06-06  9:30     ` [PATCH] x86/fpu: Fix stale comment in ex_handler_fprestore() Ingo Molnar
2024-06-06 15:55       ` Chang S. Bae
2024-06-05  8:35 ` [PATCH 2/3] x86/fpu: Remove the thread::fpu pointer Ingo Molnar
2024-06-05 13:38   ` Oleg Nesterov
2024-06-06  8:53     ` Ingo Molnar
2024-06-08  6:55       ` Ingo Molnar
2024-06-08  7:26         ` Ingo Molnar
2024-06-08 10:10           ` Oleg Nesterov
2024-06-25  5:26   ` Edgecombe, Rick P
2024-06-25 13:45     ` Edgecombe, Rick P
2024-06-05  8:35 ` [PATCH 3/3] x86/fpu: Remove init_task FPU state dependencies, add debugging warning Ingo Molnar
2024-06-05 14:17   ` Oleg Nesterov
2024-06-05 16:08     ` Linus Torvalds
2024-06-05 16:26       ` Oleg Nesterov
2024-06-05 17:28         ` Linus Torvalds
2024-06-06  8:30           ` [PATCH 3/3, v4] x86/fpu: Remove init_task FPU state dependencies, add debugging warning for PF_KTHREAD tasks Ingo Molnar
2024-06-06  8:46             ` [PATCH 4/3] x86/fpu: Push 'fpu' pointer calculation into the fpu__drop() call Ingo Molnar
2024-06-06  8:47             ` [PATCH 5/3] x86/fpu: Make sure x86_task_fpu() doesn't get called for PF_KTHREAD tasks during exit Ingo Molnar
2024-06-06  8:48             ` [PATCH 3/3, v4] x86/fpu: Remove init_task FPU state dependencies, add debugging warning for PF_KTHREAD tasks Ingo Molnar
2024-06-06 12:00             ` Oleg Nesterov
2024-06-07 10:56               ` Ingo Molnar
2024-06-24  6:47   ` [PATCH 3/3] x86/fpu: Remove init_task FPU state dependencies, add debugging warning Ning, Hongyu
2024-06-27  3:50     ` Ning, Hongyu
2024-06-05 21:21 ` [PATCH 0/3, v3] x86/fpu: Remove the thread::fpu pointer Brian Gerst
2024-06-06  9:06   ` [PATCH] x86/fpu: Introduce the x86_task_fpu() helper method Ingo Molnar
2024-06-06 15:35     ` Brian Gerst
2024-06-07 11:38       ` Ingo Molnar [this message]

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=ZmLxMaXd-qtLBoK2@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=dave@sr71.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=ubizjak@gmail.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