From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH] KVM: x86: no need to check CPL for XSETBV on VMX Date: Fri, 15 Apr 2016 13:03:20 +0200 Message-ID: <5710CA78.3000002@redhat.com> References: <57104A23.4070405@gmail.com> <5710BE49.4000702@redhat.com> <5710C463.4080308@gmail.com> <5710C5DB.1040800@redhat.com> <5710C8B3.8060901@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit To: Yang Zhang , "kvm@vger.kernel.org" , "rkrcmar@redhat.com" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:45356 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbcDOLDd (ORCPT ); Fri, 15 Apr 2016 07:03:33 -0400 In-Reply-To: <5710C8B3.8060901@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 15/04/2016 12:55, Yang Zhang wrote: >> >>>> I don't think this is performance-sensitive, hence it's simpler to keep >>>> the code as simple as possible. For example, if one added XSETBV >>>> support to the emulator, your patch would introduce a bug. >>> >>> In what case we need to decode XSETBV? >> >> The emulator can be a way to unify code between vmx and svm. It is an >> alternative to writing small wrapper functions such as kvm_set_xcr. > > I still think the correctness is important. What correctness? You said "the CPL check is done by hardware on VMX". Doing the check twice is not incorrect. Unifying code between VMX and SVM is exactly useful because it makes it easier to have correct code. Paolo