lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2a10c92d38b749b09256d6e06bfe6a841e54585b.camel@redhat.com>
Date:   Wed, 04 May 2022 15:36:33 +0300
From:   Maxim Levitsky <mlevitsk@...hat.com>
To:     Suravee Suthikulpanit <suravee.suthikulpanit@....com>,
        linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Cc:     pbonzini@...hat.com, seanjc@...gle.com, joro@...tes.org,
        jon.grimm@....com, wei.huang2@....com, terry.bowman@....com
Subject: Re: [PATCH v3 14/14] KVM: SVM: Add AVIC doorbell tracepoint

On Wed, 2022-05-04 at 02:31 -0500, Suravee Suthikulpanit wrote:
> Add a tracepoint to track number of doorbells being sent
> to signal a running vCPU to process IRQ after being injected.
> 
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
> ---
>  arch/x86/kvm/svm/avic.c |  4 +++-
>  arch/x86/kvm/trace.h    | 18 ++++++++++++++++++
>  arch/x86/kvm/x86.c      |  1 +
>  3 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
> index a526fbc60bbd..e3343cfc55cd 100644
> --- a/arch/x86/kvm/svm/avic.c
> +++ b/arch/x86/kvm/svm/avic.c
> @@ -343,8 +343,10 @@ void avic_ring_doorbell(struct kvm_vcpu *vcpu)
>  	 */
>  	int cpu = READ_ONCE(vcpu->cpu);
>  
> -	if (cpu != get_cpu())
> +	if (cpu != get_cpu()) {
>  		wrmsrl(MSR_AMD64_SVM_AVIC_DOORBELL, kvm_cpu_get_apicid(cpu));
> +		trace_kvm_avic_doorbell(vcpu->vcpu_id, kvm_cpu_get_apicid(cpu));
> +	}
>  	put_cpu();
>  }
>  
> diff --git a/arch/x86/kvm/trace.h b/arch/x86/kvm/trace.h
> index de4762517569..a47bb0fdea70 100644
> --- a/arch/x86/kvm/trace.h
> +++ b/arch/x86/kvm/trace.h
> @@ -1479,6 +1479,24 @@ TRACE_EVENT(kvm_avic_kick_vcpu_slowpath,
>  		  __entry->icrh, __entry->icrl, __entry->index)
>  );
>  
> +TRACE_EVENT(kvm_avic_doorbell,
> +	    TP_PROTO(u32 vcpuid, u32 apicid),
> +	    TP_ARGS(vcpuid, apicid),
> +
> +	TP_STRUCT__entry(
> +		__field(u32, vcpuid)
> +		__field(u32, apicid)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->vcpuid = vcpuid;
> +		__entry->apicid = apicid;
> +	),
> +
> +	TP_printk("vcpuid=%u, apicid=%u",
> +		  __entry->vcpuid, __entry->apicid)
> +);
> +
>  TRACE_EVENT(kvm_hv_timer_state,
>  		TP_PROTO(unsigned int vcpu_id, unsigned int hv_timer_in_use),
>  		TP_ARGS(vcpu_id, hv_timer_in_use),
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index b14e02ea0ff6..69a91f47a509 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -13097,6 +13097,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_unaccelerated_access);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_incomplete_ipi);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_ga_log);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_kick_vcpu_slowpath);
> +EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_avic_doorbell);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_apicv_accept_irq);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_enter);
>  EXPORT_TRACEPOINT_SYMBOL_GPL(kvm_vmgexit_exit);


To be honest we already have the 'kvm_apicv_accept_irq'
which usually results in a doorbell, but no objections
to add this tracepoint.

Reviewed-by: Maxim Levitsky <mlevitsk@...hat.com>

Best regards,
        Maxim Levitsky

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ