[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZmLxMaXd-qtLBoK2@gmail.com>
Date: Fri, 7 Jun 2024 13:38:25 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Brian Gerst <brgerst@...il.com>
Cc: linux-kernel@...r.kernel.org, Andy Lutomirski <luto@...capital.net>,
Andrew Morton <akpm@...ux-foundation.org>,
Dave Hansen <dave@...1.net>, Peter Zijlstra <peterz@...radead.org>,
Borislav Petkov <bp@...en8.de>, "H . Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Oleg Nesterov <oleg@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Uros Bizjak <ubizjak@...il.com>
Subject: Re: [PATCH] x86/fpu: Introduce the x86_task_fpu() helper method
* Brian Gerst <brgerst@...il.com> wrote:
> On Thu, Jun 6, 2024 at 5:06 AM Ingo Molnar <mingo@...nel.org> wrote:
> >
> >
> > * Brian Gerst <brgerst@...il.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@...nel.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@...nel.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
Powered by blists - more mailing lists