[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aT27Hc9gTo4wKcW1@kernel.org>
Date: Sat, 13 Dec 2025 21:14:37 +0200
From: Jarkko Sakkinen <jarkko@...nel.org>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
linux-sgx@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/sgx: Use goto to remove redundant if check in
sgx_encl_init
On Sat, Dec 13, 2025 at 09:11:23PM +0200, Jarkko Sakkinen wrote:
> On Fri, Dec 12, 2025 at 10:05:00PM +0100, Thorsten Blum wrote:
> > On 11. Dec 2025, at 21:15, Jarkko Sakkinen wrote:
> > > On Thu, Dec 11, 2025 at 10:03:56PM +0200, Jarkko Sakkinen wrote:
> > >> On Wed, Dec 10, 2025 at 04:48:08PM +0100, Thorsten Blum wrote:
> > >>> On 10. Dec 2025, at 16:32, Jarkko Sakkinen wrote:
> > >>>> On Wed, Dec 10, 2025 at 02:00:35PM +0100, Thorsten Blum wrote:
> > >>>>> Immediately break out of both loops when 'ret != SGX_UNMASKED_EVENT'
> > >>>>> instead of checking for the same condition again in the outer loop.
> > >>>>>
> > >>>>> Signed-off-by: Thorsten Blum <thorsten.blum@...ux.dev>
> > >>>>> ---
> > >>>>> [...]
> > >>>>
> > >>>> I don't think moving code around is very useful.
> > >>>
> > >>> The patch doesn't actually move any code around, but it removes up to 50
> > >>> (SGX_EINIT_SLEEP_COUNT) duplicate and therefore unnecessary if checks in
> > >>> the outer for loop.
> > >>
> > >> Temporary change for generating disassembly:
> > >> [...]
> > >
> > > It pretty much does what I said i.e., shuffles a new location for a code block.
> >
> > GCC emits a much larger diff; however, discussing the patch based solely
> > on the disassembled code probably isn't very meaningful.
>
> It does close the "does nothing useful" claim. It really does nothing
> useful.
So it's a debate whether saving a single check with more convoluted
branching is a better or worse idea. I don't know. Thus, I cannot
accept this patch.
BR, Jarkko
Powered by blists - more mailing lists