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]
Date:   Mon, 27 Apr 2020 11:38:25 -0700
From:   Sean Christopherson <sean.j.christopherson@...el.com>
To:     Wanpeng Li <kernellwp@...il.com>
Cc:     linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
        Paolo Bonzini <pbonzini@...hat.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>,
        Haiwei Li <lihaiwei@...cent.com>
Subject: Re: [PATCH v3 4/5] KVM: X86: TSCDEADLINE MSR emulation fastpath

On Fri, Apr 24, 2020 at 02:22:43PM +0800, Wanpeng Li wrote:
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 4561104..99061ba 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -1616,27 +1616,45 @@ static int handle_fastpath_set_x2apic_icr_irqoff(struct kvm_vcpu *vcpu, u64 data
>  	return 1;
>  }
>  
> +static int handle_fastpath_set_tscdeadline(struct kvm_vcpu *vcpu, u64 data)
> +{
> +	if (!kvm_x86_ops.set_hv_timer ||
> +		kvm_mwait_in_guest(vcpu->kvm) ||
> +		kvm_can_post_timer_interrupt(vcpu))

Bad indentation.

> +		return 1;
> +
> +	kvm_set_lapic_tscdeadline_msr(vcpu, data);
> +	return 0;
> +}
> +
>  enum exit_fastpath_completion handle_fastpath_set_msr_irqoff(struct kvm_vcpu *vcpu)
>  {
>  	u32 msr = kvm_rcx_read(vcpu);
>  	u64 data;
> -	int ret = 0;
> +	int ret = EXIT_FASTPATH_NONE;
>  
>  	switch (msr) {
>  	case APIC_BASE_MSR + (APIC_ICR >> 4):
>  		data = kvm_read_edx_eax(vcpu);
> -		ret = handle_fastpath_set_x2apic_icr_irqoff(vcpu, data);
> +		if (!handle_fastpath_set_x2apic_icr_irqoff(vcpu, data))
> +			ret = EXIT_FASTPATH_SKIP_EMUL_INS;
> +		break;
> +	case MSR_IA32_TSCDEADLINE:
> +		data = kvm_read_edx_eax(vcpu);
> +		if (!handle_fastpath_set_tscdeadline(vcpu, data))
> +			ret = EXIT_FASTPATH_CONT_RUN;
>  		break;
>  	default:
> -		return EXIT_FASTPATH_NONE;
> +		ret = EXIT_FASTPATH_NONE;
>  	}
>  
> -	if (!ret) {
> +	if (ret != EXIT_FASTPATH_NONE) {
>  		trace_kvm_msr_write(msr, data);
> -		return EXIT_FASTPATH_SKIP_EMUL_INS;
> +		if (ret == EXIT_FASTPATH_CONT_RUN)
> +			kvm_skip_emulated_instruction(vcpu);
>  	}
>  
> -	return EXIT_FASTPATH_NONE;
> +	return ret;
>  }
>  EXPORT_SYMBOL_GPL(handle_fastpath_set_msr_irqoff);
>  
> -- 
> 2.7.4
> 

Powered by blists - more mailing lists