From: David Laight <david.laight.linux@gmail.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: ubizjak@gmail.com, bp@alien8.de, dave.hansen@linux.intel.com,
hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
mingo@kernel.org, pbonzini@redhat.com, seanjc@google.com,
tglx@kernel.org, x86@kernel.org
Subject: Re: [PATCH 1/2] KVM: VMX: Drop obsolete branch hint prefixes from inline asm
Date: Wed, 11 Feb 2026 13:43:42 +0000 [thread overview]
Message-ID: <20260211134342.45b7e19e@pumpkin> (raw)
In-Reply-To: <2af5e3a8-f520-40fd-96a5-28555c3e4a5e@citrix.com>
On Wed, 11 Feb 2026 10:57:31 +0000
Andrew Cooper <andrew.cooper3@citrix.com> wrote:
> > Remove explicit branch hint prefixes (.byte 0x2e / 0x3e) from VMX
> > inline assembly sequences.
> >
> > These prefixes (CS/DS segment overrides used as branch hints on
> > very old x86 CPUs) have been ignored by modern processors for a
> > long time. Keeping them provides no measurable benefit and only
> > enlarges the generated code.
>
> It's actually worse than this.
>
> The branch-taken hint has new meaning in Lion Cove cores and later,
> along with a warning saying "performance penalty for misuse".
>
> i.e. "only insert this prefix after profiling".
Don't they really have much the same meaning as before?
Perhaps the branch prediction logic is ignored (which would make
getting then wrong very bad).
But here (and a few other places) the branch really is 'never taken',
so perhaps the branch hints should have been removed 20 years ago
and now is the time to add them back?
Of course, the branch-hint can only have an effect when the branch
prediction logic gets to see the branch.
The initial instruction prefetch (etc) is done without regard to
the contents of the memory being read - so initially all branches
are effectively predicted 'not-taken'.
(I got the impression that some AMD cpu 'attached' some of the branch
prediction info to the cache-line - and would use it when the cache
line was re-used for an entirely different address. Hence the issues
where non-branch instructions would be predicted as branches.)
David
>
> ~Andrew
>
next prev parent reply other threads:[~2026-02-11 13:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 10:28 [PATCH 1/2] KVM: VMX: Drop obsolete branch hint prefixes from inline asm Uros Bizjak
2026-02-11 10:28 ` [PATCH 2/2] KVM: VMX: Use ASM_INPUT_RM in __vmcs_writel Uros Bizjak
2026-02-25 19:02 ` Nathan Chancellor
2026-02-11 10:57 ` [PATCH 1/2] KVM: VMX: Drop obsolete branch hint prefixes from inline asm Andrew Cooper
2026-02-11 13:36 ` Sean Christopherson
2026-02-11 13:43 ` David Laight [this message]
2026-02-11 13:55 ` Andrew Cooper
2026-02-11 15:44 ` Sean Christopherson
2026-02-11 16:11 ` Andrew Cooper
2026-02-11 16:17 ` Sean Christopherson
2026-02-11 16:46 ` Andrew Cooper
2026-02-11 16:49 ` Sean Christopherson
2026-02-11 21:35 ` David Laight
2026-03-05 17:08 ` Sean Christopherson
-- strict thread matches above, loose matches on Subject: below --
2026-02-12 5:33 Christian Ludloff
2026-02-12 16:18 ` Andrew Cooper
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=20260211134342.45b7e19e@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@kernel.org \
--cc=ubizjak@gmail.com \
--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