Bug 26820 - [devel-6.6] Update PAUSEOPT instruction support
Summary: [devel-6.6] Update PAUSEOPT instruction support
Status: NEW
Alias: None
Product: ANCK 6.6 Dev
Classification: ANCK
Component: X86 (show other bugs) X86
Version: unspecified
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: Guanjun
QA Contact: shuming
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-29 18:12 UTC by LeoLiu-oc
Modified: 2025-10-29 18:20 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description LeoLiu-oc zhaoxin_group 2025-10-29 18:12:26 UTC
zxpause has been updated to pauseopt, therefore, the relevant patches need to be updated.

This patch adds support for the PAUSEOPT instruction, a Zhaoxin-specific
counterpart to Intel’s TPAUSE. Two key differences distinguish PAUSEOPT
from TPAUSE:

1. PAUSEOPT uses a delta TSC, calculated as the smaller of
   (MSR_PAUSEOPT_CONTROL[31:2] << 2) and the EDX:EAX input to PAUSEOPT,
   subtracted from the current TSC. TPAUSE, by contrast, uses a target TSC
   computed from the smaller of (MSR_IA32_UMWAIT_CONTROL[31:2] << 2) and
   its EDX:EAX input.

2. PAUSEOPT currently supports only the C0.1 optimization state, whereas
   TPAUSE may support both C0.1 and C0.2 states.

This feature depends on a pending QEMU patch to recognize PAUSEOPT, as
well as the preceding patch in this series that adds Linux kernel support
for PAUSEOPT.

Guest Behavioral notes:

- Writes to the PAUSEOPT/TPAUSE CONTROL MSR are ignored (WRMSR is nopped).
- Executing PAUSEOPT or TPAUSE succeeds in entering the optimized state
  for the duration specified by EDX:EAX.
- External interrupts and other defined events will break out of this
  optimized state.
- On any VM exit that interrupts PAUSEOPT, such as an external-interrupt
  VM exit, if the VMM will resume execution at the instruction following
  PAUSEOPT, the software must clear the PAUSEOPT_TARGET_TSC field in the
  VMCS. This cleanup is implemented in this patch.
Comment 1 小龙 admin 2025-10-29 18:20:54 UTC
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/5939