Skip to content

[26.04_linux-nvidia] Backport removal of extra ISBs when using msr_hcr_el2 - #535

Closed
esot0 wants to merge 1 commit into
NVIDIA:26.04_linux-nvidiafrom
esot0:26.04_linux-nvidia-isb
Closed

[26.04_linux-nvidia] Backport removal of extra ISBs when using msr_hcr_el2#535
esot0 wants to merge 1 commit into
NVIDIA:26.04_linux-nvidiafrom
esot0:26.04_linux-nvidia-isb

Conversation

@esot0

@esot0 esot0 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Backport of 54a3cc145456272b10c1452fe89e1dcf933d5c39, which removes redundant ISBs after msr_hcr_el2, so HCR_EL2 writes do one barrier instead of two and run a bit faster. Verified that patch is present in kernel using check-hcr-isb.sh.

Script output:

kernel  : 7.0.12+  (running: 7.0.12+)
image   : /boot/vmlinuz-7.0.12+
symbols : /boot/System.map-7.0.12+
erratum : CONFIG_AMPERE_ERRATUM_AC04_CPU_23=y
note    : commit landed in v7.1-rc1; no Cc: stable, so no -stable backport

zstd: /*stdin*\: unsupported format 
image format: compressed Image  (73728000 bytes flat)
_text       : 0xffff800080000000

=== sites generated by the msr_hcr_el2 assembly macro (what the patch touches) ===
vaddr              symbol                                     prev      instr            next      next+1      pattern
--------------------------------------------------------------------------------------------------------------------------------------
0xffff800081a40be0 __kvm_nvhe____kvm_hyp_init+0x18            dsb nsh   msr hcr_el2,x1   isb       0xd2c00082  single-isb
0xffff800081a40cd0 __kvm_nvhe___kvm_hyp_init_cpu+0x40         dsb nsh   msr hcr_el2,x0   isb       0xd2800021  single-isb
0xffff800081a40d04 __kvm_nvhe___kvm_hyp_init_cpu+0x74         dsb nsh   msr hcr_el2,x0   isb       0x97fffead  single-isb
0xffff800081a41ad8 __finalise_el2+0x278                       dsb nsh   msr hcr_el2,x0   isb       0xd53c4100  single-isb
0xffff800082e111a4 init_el2+0x58                              dsb nsh   msr hcr_el2,x0   isb       0xd2800021  single-isb
0xffff800082e111d8 init_el2+0x8c                              dsb nsh   msr hcr_el2,x0   isb       0xd2a00000  single-isb

=== other HCR_EL2 writes: C write_sysreg_hcr(), NOT touched by this patch ===
38 sites (5 of them double-isb) -- expected noise, ignore for the verdict

======================================================================================================================================
CONFIG_AMPERE_ERRATUM_AC04_CPU_23=y -> signature is the double ISB
RESULT: commit 54a3cc145456 IS PRESENT (0/6 macro sites have back-to-back ISBs)
======================================================================================================================================

Launchpad: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia-bos/+bug/2163052

@nirmoy nirmoy added the help wanted Extra attention is needed label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

PR Validation Report

Patchscan ✅ No Missing Fixes

All cherry-picked commits checked — no missing upstream fixes found.

PR Lint ✅ All checks passed

Details
Checking 1 commits...

Cherry-pick digest:
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local        │ Referenced upstream / Patch subject                              │ Patch-ID   │ Subject │ SoB chain                 │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3bda771df678 │ 54a3cc145456 KVM: arm64: Remove extra ISBs when using msr_hcr_el │ match      │ match   │ preserved + emilys added  │
└──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘

Lint: all checks passed.

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

Hi @esot0,

Same comment for this and #534:

This patch picks cleanly, so it should be reported as:

(cherry picked from commit 54a3cc145456272b10c1452fe89e1dcf933d5c39)

rather than:

(backported from commit 54a3cc145456272b10c1452fe89e1dcf933d5c39)

As such, you ought to drop the backport note too:

[emilys: Removes redundant ISBs after msr_hcr_el2, so HCR_EL2 writes do one barrier instead of two and run a bit faster.]

This describes what the upstream patch does rather than what was changed while moving it to this branch. The other bracketed notes on this branch record the adjustment that was made, for example:

  [ltrager: minor merge conflicts]
  [mochs: Minor context adjustment due to absent definitions]

@esot0
esot0 force-pushed the 26.04_linux-nvidia-isb branch from 2f55cd0 to 093ec09 Compare August 7, 2026 16:01
@clsotog

clsotog commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Acked-by: Carol L Soto <csoto@nvidia.com>

The msr_hcr_el2 macro is slightly awkward, as it provides an ISB
when CONFIG_AMPERE_ERRATUM_AC04_CPU_23 is present, and none
otherwise. Note that this this option is 'default y', meaning that
it is likely to be selected.

Most instances of msr_hcr_el2 are also immediately followed by an ISB,
meaning that in most cases, you end-up with two back-to-back ISBs.
This isn't a big deal, but once you have seen that, you can't unsee it.

Rework the msr_hcr_el2 macro to always provide the ISB, and drop
the superfluous ISBs everywhere else.

Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com>
Link: https://patch.msgid.link/20260321212419.2803972-6-maz@kernel.org
Signed-off-by: Marc Zyngier <maz@kernel.org>
(cherry picked from commit 54a3cc1)
Signed-off-by: Emily Soto <emilys@nvidia.com>
@esot0
esot0 force-pushed the 26.04_linux-nvidia-isb branch from 093ec09 to 3bda771 Compare August 7, 2026 16:30
@nvmochs

nvmochs commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

LGTM!

Acked-by: Matthew R. Ochs <mochs@nvidia.com>

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

Acked-by: Jamie Nguyen <jamien@nvidia.com>

@nirmoy nirmoy added has_2_acks and removed help wanted Extra attention is needed has_1_ack labels Aug 7, 2026
@nvmochs

nvmochs commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Merged, closing PR.

7caa3af067e7 (nresolute/main-next) KVM: arm64: Remove extra ISBs when using msr_hcr_el2

@nvmochs nvmochs closed this Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants