On 26/05/2022 12:11, Roger Pau Monne wrote:
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index f08a00dcbb..476ab72463 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -4065,6 +4065,16 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
>
> if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) )
> return vmx_failed_vmentry(exit_reason, regs);
> + if ( unlikely(exit_reason & VMX_EXIT_REASONS_BUS_LOCK) )
> + {
> + /*
> + * Delivery of Bus Lock VM exit was pre-empted by a higher priority
> VM
> + * exit.
> + */
> + exit_reason &= ~VMX_EXIT_REASONS_BUS_LOCK;
> + if ( exit_reason != EXIT_REASON_BUS_LOCK )
> + perfc_incr(buslock);
> + }
I know this post-dates you posting v2, but given the latest update from
Intel, VMX_EXIT_REASONS_BUS_LOCK will be set on all exits.
So the code logic would be simpler as:
if ( exit_reason & VMX_EXIT_REASONS_BUS_LOCK )
{
perfc_incr(buslock);
exit_reason &= ~VMX_EXIT_REASONS_BUS_LOCK;
}
and ...
>
> if ( v->arch.hvm.vmx.vmx_realmode )
> {
> @@ -4561,6 +4571,14 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)
> vmx_handle_descriptor_access(exit_reason);
> break;
>
> + case EXIT_REASON_BUS_LOCK:
> + perfc_incr(buslock);
... dropping this perf counter.
With something along these lines, Reviewed-by: Andrew Cooper
<[email protected]>