From: Uros Bizjak <ubizjak@gmail.com>
To: Borislav Petkov <bp@alien8.de>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86/asm: Use asm_inline() instead of asm() in __untagged_addr()
Date: Fri, 14 Mar 2025 14:22:45 +0100 [thread overview]
Message-ID: <CAFULd4bwsZENN5eVLXDDizt6+EcdwgnFBaS4b7YjjqzR-Rmjjw@mail.gmail.com> (raw)
In-Reply-To: <20250314112504.GBZ9QSEL1hgjp376ey@fat_crate.local>
On Fri, Mar 14, 2025 at 12:25 PM Borislav Petkov <bp@alien8.de> wrote:
>
> On Fri, Mar 14, 2025 at 10:30:55AM +0100, Uros Bizjak wrote:
> > Use asm_inline() to instruct the compiler that the size of asm()
> > is the minimum size of one instruction, ignoring how many instructions
> > the compiler thinks it is. ALTERNATIVE macro that expands to several
> > pseudo directives causes instruction length estimate to count
> > more than 20 instructions.
> >
> > bloat-o-meter reports minimal code size increase
>
> If you see an increase and *no* *other* *palpable* improvement, you don't send
> it. It is that simple.
Do you see the removed functions? These are now fully inlined and
optimized in their inlined places. The program does not have to set up
a function call, invoke call/ret insn and create a frame in the called
function. The well tuned compiler heuristics make trade offs between
performance and code growth and it chose it that way. The heuristics
are as good as the data the programmer provides, and choking the
compiler with incorrect data, as provided by asm() interface,
certainly does no good. The asm() code in the patch declares *one*
instruction, not 23. Please count it.
Code size is not the right metric with -O2. It is that simple.
BR,
Uros.
next prev parent reply other threads:[~2025-03-14 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 9:30 Uros Bizjak
2025-03-14 11:25 ` Borislav Petkov
2025-03-14 13:22 ` Uros Bizjak [this message]
2025-03-14 13:34 ` Borislav Petkov
2025-03-17 9:01 ` Ingo Molnar
2025-03-17 9:28 ` Ingo Molnar
2025-03-17 18:34 ` H. Peter Anvin
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=CAFULd4bwsZENN5eVLXDDizt6+EcdwgnFBaS4b7YjjqzR-Rmjjw@mail.gmail.com \
--to=ubizjak@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®