[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJvTdK=DKWrLSpmrxEc6JDT=dHrHxXNOuj-iQVW_FvFxBcfPAQ@mail.gmail.com>
Date: Tue, 24 Nov 2020 13:35:07 -0500
From: Len Brown <lenb@...nel.org>
To: Andy Lutomirski <luto@...nel.org>
Cc: "Chang S. Bae" <chang.seok.bae@...el.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...e.de>,
X86 ML <x86@...nel.org>, Len Brown <len.brown@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
"Liu, Jing2" <jing2.liu@...el.com>,
"Ravi V. Shankar" <ravi.v.shankar@...el.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 14/22] x86/fpu/xstate: Inherit dynamic user state when
used in the parent
On Fri, Nov 20, 2020 at 12:08 AM Andy Lutomirski <luto@...nel.org> wrote:
>
> On Thu, Nov 19, 2020 at 3:37 PM Chang S. Bae <chang.seok.bae@...el.com> wrote:
> >
> > When a new task is created, the kernel copies all the states from the
> > parent. If the parent already has any dynamic user state in use, the new
> > task has to expand the XSAVE buffer to save them. Also, disable the
> > associated first-use fault.
>
> This seems like a mistake. If init uses AMX for some misguided
> reason, ever task on the whole system will end up with AMX state
> allocated.
Andy, you are right -- the child can (and should) start with the
un-expanded context switch buffer, and as a result XFD should be armed
to fire on the child's first access to TMM hardware.
TMM registers are scratchpad, they will never be used to pass globals,
say, from parent to child thread.
Further, they are volatile and caller saved. The callee can assume
they are empty -- so even by virtue of being in a fork system call,
that state is already gone.
thanks,
Len Brown, Intel Open Source Technology Center
Powered by blists - more mailing lists