From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yang Zhang Subject: Re: [PATCH] KVM: x86: no need to check CPL for XSETBV on VMX Date: Fri, 15 Apr 2016 19:23:05 +0800 Message-ID: <5710CF19.9020001@gmail.com> References: <57104A23.4070405@gmail.com> <5710BE49.4000702@redhat.com> <5710C463.4080308@gmail.com> <5710C5DB.1040800@redhat.com> <5710C8B3.8060901@gmail.com> <5710CA78.3000002@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: Paolo Bonzini , "kvm@vger.kernel.org" , "rkrcmar@redhat.com" Return-path: Received: from mail-pa0-f67.google.com ([209.85.220.67]:36587 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751887AbcDOLXN (ORCPT ); Fri, 15 Apr 2016 07:23:13 -0400 Received: by mail-pa0-f67.google.com with SMTP id k3so9400745pav.3 for ; Fri, 15 Apr 2016 04:23:12 -0700 (PDT) In-Reply-To: <5710CA78.3000002@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 2016/4/15 19:03, Paolo Bonzini wrote: > > > 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. Yes, you are right. It cannot be considered as correctness issue. > > Unifying code between VMX and SVM is exactly useful because it makes it > easier to have correct code. > > Paolo > -- best regards yang