From: Jarkko Sakkinen <jarkko@kernel.org>
To: Thorsten Blum <thorsten.blum@linux.dev>
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
linux-sgx@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/sgx: Use goto to remove redundant if check in sgx_encl_init
Date: Sat, 13 Dec 2025 21:14:37 +0200 [thread overview]
Message-ID: <aT27Hc9gTo4wKcW1@kernel.org> (raw)
In-Reply-To: <aT26Vva7f9ZdVEn8@kernel.org>
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@linux.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
prev parent reply other threads:[~2025-12-13 19:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-10 13:00 [PATCH] x86/sgx: Use goto to remove redundant if check in sgx_encl_init Thorsten Blum
2025-12-10 15:32 ` Jarkko Sakkinen
2025-12-10 15:48 ` Thorsten Blum
2025-12-11 20:03 ` Jarkko Sakkinen
2025-12-11 20:15 ` Jarkko Sakkinen
2025-12-12 21:05 ` Thorsten Blum
2025-12-13 19:11 ` Jarkko Sakkinen
2025-12-13 19:14 ` Jarkko Sakkinen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aT27Hc9gTo4wKcW1@kernel.org \
--to=jarkko@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=thorsten.blum@linux.dev \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.