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: <94fdce1b-9c42-e551-3099-ef7c4071a6ba@redhat.com>
Date:   Wed, 30 Jan 2019 18:02:27 +0100
From:   Paolo Bonzini <pbonzini@...hat.com>
To:     Luwei Kang <luwei.kang@...el.com>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, hpa@...or.com,
        x86@...nel.org, songliubraving@...com, rkrcmar@...hat.com,
        peterz@...radead.org, zsm@...omium.org,
        alexander.shishkin@...ux.intel.com, konrad.wilk@...cle.com,
        ak@...ux.intel.com
Subject: Re: [PATCH 2/3] perf/x86/intel/pt: Inject PMI for KVM guest

On 19/01/19 21:04, Luwei Kang wrote:
>  static struct pt_pmu pt_pmu;
>  
> @@ -1260,6 +1262,14 @@ void intel_pt_interrupt(void)
>  	struct pt_buffer *buf;
>  	struct perf_event *event = pt->handle.event;
>  
> +	if (pt->vcpu) {
> +		/* Inject PMI to Guest */
> +		kvm_make_request(KVM_REQ_PMI, pt->vcpu);
> +		__set_bit(MSR_CORE_PERF_GLOBAL_OVF_CTRL_TRACE_TOPA_PMI_BIT,
> +			(unsigned long *)&pt->vcpu->arch.pmu.global_status);
> +		return;
> +	}
> +

There is no need to touch struct pt and to know details of KVM in
arch/x86/events.  Please add a function pointer

	void (*kvm_handle_pt_interrupt)(void);

to some header, and in handle_pmi_common do

	if (unlikely(kvm_handle_intel_pt_interrupt))
		kvm_handle_intel_pt_interrupt();
	else
		intel_pt_interrupt();

The function pointer can be assigned in
kvm_before_interrupt/kvm_after_interrupt just like you do now.

This should be a simpler patch too.

Paolo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ