[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87mu3pvly7.fsf@nanos.tec.linutronix.de>
Date: Fri, 24 Jul 2020 01:41:20 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Ira Weiny <ira.weiny@...el.com>
Cc: Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
Dan Williams <dan.j.williams@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Fenghua Yu <fenghua.yu@...el.com>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-nvdimm@...ts.01.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kselftest@...r.kernel.org
Subject: Re: [PATCH RFC V2 17/17] x86/entry: Preserve PKRS MSR across exceptions
Ira,
Ira Weiny <ira.weiny@...el.com> writes:
> On Thu, Jul 23, 2020 at 09:53:20PM +0200, Thomas Gleixner wrote:
> I think, after fixing my code (see below), using idtentry_state could still
> work. If the per-cpu cache and the MSR is updated in idtentry_exit() that
> should carry the state to the new cpu, correct?
I'm way too tired to think about that now. Will have a look tomorrow
with brain awake.
>> > It seems like we should start passing this by reference instead of
>> > value. But for now this works as an RFC. Comments?
>>
>> Works as in compiles, right?
>>
>> static void noinstr idt_save_pkrs(idtentry_state_t state)
>> {
>> state.foo = 1;
>> }
>>
>> How is that supposed to change the caller state? C programming basics.
>
> <sigh> I am so stupid. I was not looking at this particular case but you are
> 100% correct... I can't believe I did not see this.
>
> In the above statement I was only thinking about the extra overhead I was
> adding to idtentry_enter() and the callers of it.
Fun. That statement immediately caught my attention and made me look at
that function.
> "C programming basics" indeed... Once again sorry...
Don't worry.
One interesting design bug of the human brain is that it tricks you into
seeing what you expect to see no matter how hard you try not to fall for
that. You can spend days staring at the obvious without seeing it. The
saying 'you can't see the forest for the trees' exists for a reason.
Yes, I know it's embarrassing, but that happens and it happens to all of
us no matter how experienced we are. Just search the LKML archives for
'brown paperbag'. You'll find amazing things.
If you show your problem to people who are not involved in that at all
there is a high propability that it immediately snaps for one of
them. But there is no guarantee, just look at this mail thread and the
number of people who did not notice.
Move on and accept the fact that it will happen again :)
Thanks,
tglx
Powered by blists - more mailing lists