[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YMh8PAomWPzHx3Nt@zn.tnic>
Date: Tue, 15 Jun 2021 12:09:00 +0200
From: Borislav Petkov <bp@...e.de>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Tony Luck <tony.luck@...el.com>,
Yu-cheng Yu <yu-cheng.yu@...el.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Kan Liang <kan.liang@...ux.intel.com>
Subject: Re: [patch 09/41] x86/kvm: Avoid looking up PKRU in XSAVE buffer
On Mon, Jun 14, 2021 at 12:34:31PM -0700, Dave Hansen wrote:
> I gave that a shot. Two wrinkles: The PKRU memcpy() needs 'offset' from
> cpuid_count() and the PKRU case also needs the 'valid -=' manipulation.
> The result is attached, and while it makes the diff look better, I
> don't think the resulting code is an improvement.
Bah, that was too much wishful and faulty thinking on my part, forget
what I said.
> I *think* these are already stored in xfeature_uncompacted_offset[]. It
> would be a pretty simple matter to export it. I just assumed that this
> is a slow enough path that the KVM folks don't care.
I guess. Yeah, let's cleanup the FPU mess first and then see what makes
sense or not.
> I'm happy to change it, but I usually like to separate declarations from
> pure code. Although, I guess that's a bit inconsistent in that file.
No, this is what I mean:
+ src = get_xsave_addr(xsave, xfeature_nr);
+ if (src)
+ memcpy(dest + offset, src, size);
vs
+ void *dest = get_xsave_addr(xsave, xfeature_nr);
+
+ if (dest)
memcpy(dest, src + offset, size);
both in your patch.
It is a lot easier when reading the code to have the error handling
glued together with the previous function call.
Thx.
--
Regards/Gruss,
Boris.
SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg
Powered by blists - more mailing lists