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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 2 Mar 2015 17:03:20 +0100
From:	Radim Krčmář <rkrcmar@...hat.com>
To:	Bandan Das <bsd@...hat.com>
Cc:	Joel Schopp <joel.schopp@....com>, Gleb Natapov <gleb@...nel.org>,
	Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
	David Kaplan <David.Kaplan@....com>,
	Joerg Roedel <joro@...tes.org>,
	Marcelo Tosatti <mtosatti@...hat.com>,
	linux-kernel@...r.kernel.org, Borislav Petkov <bp@...en8.de>
Subject: Re: [PATCH] x86: svm: make wbinvd faster

2015-03-02 10:25-0500, Bandan Das:
> Radim Krčmář <rkrcmar@...hat.com> writes:
> > 2015-03-01 21:29-0500, Bandan Das:
> >> Joel Schopp <joel.schopp@....com> writes:
> >> > +static int wbinvd_interception(struct vcpu_svm *svm)
> >> > +{
> >> > +	kvm_emulate_wbinvd(&svm->vcpu);
> >> > +	skip_emulated_instruction(&svm->vcpu);
> >> > +	return 1;
> >> > +}
> >> Can't we merge this to kvm_emulate_wbinvd, and just call that function
> >> directly for both vmx and svm ?
> >
> > kvm_emulate_wbinvd() lives in x86.c and skip_emulated_instruction() is
> > from svm.c/vmx.c:  so we'd have to create a new x86 op and change the
> > emulator code as well ... it's probably better like this.
> 
> There's already one - kvm_x86_ops->skip_emulated_instruction

My bad, its usage is inconsistent and I only looked at two close
interceptions where it was used ... kvm_emulate_cpuid() calls
kvm_x86_ops->skip_emulated_instruction(), while kvm_emulate_halt() and
kvm_emulate_hypercall() need an external skip.

We do "skip" the instruction with kvm_emulate(), so automatically
skipping the instruction on kvm_emulate_*() makes sense:
 1. rename kvm_emulate_halt() and kvm_emulate_wbinvd() to accommodate
    callers that don't want to skip
 2. introduce kvm_emulate_{halt,wbinvd}() and move the skip to to
    kvm_emulate_{halt,wbinvd,hypercall}()

The alternative is to remove kvm_x86_ops->skip_emulated_instruction():
 1. remove skip from kvm_emulate_cpuid() and modify callers
 2. move kvm_complete_insn_gp to a header file and use
    skip_emulated_instruction directly
 3. remove unused kvm_x86_ops->skip_emulated_instruction()

Which one do you prefer?

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ