Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3528178pxk; Mon, 28 Sep 2020 22:14:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5ynfYls0n0den6jhREqQEIvGR1dBLL6yccgq2+8KbJrDQRlsDBggkmyCbma8xukCYFXNh X-Received: by 2002:a17:906:e918:: with SMTP id ju24mr2053917ejb.442.1601356491641; Mon, 28 Sep 2020 22:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601356491; cv=none; d=google.com; s=arc-20160816; b=y1IzZoTMGwu2cGTk0TNyXYy2r0/fS4bpw1FfQ53+RGP4fKI+lZwKB21qUFiwm/ecjL Thjz+/bsNL0tp7+VZwZQ9ckdQKLFNZAP7Mf2+fT99A/hsKnAswCQeZtp4oAueXkUikEQ GKxThk7LHlW+L2HbsBU7RkaHWy5DM/slX3n0jfE0sWk6tf4yI+APZlGG53k+OFm0xDS2 Cw98ef6UpyrjiqG4lJEmTwi2G1gdEOJRGQEDTJ59BdZWALMvcuN8+DIGXthfIxN5Au/b IDJ22HnXCjleCvOeXzrYsh4lckv77C88JTEnc8Q1n3qhsJNq2tU3XWoBkqcAbMad/KVD D7ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=p53VxCFxcFtB6AKMz6Fc0QuupQ856FeGFVBAVxenMD4=; b=KfpcgoseDApvIieudRt6k16ktJhptkO8qp2hPMfglQ1vM4ouGZI0KQorrVzMF6mJiI vYgLg6cMDod1fpxvSwDMURqXiZwwXkyGBxSD2bPk7Bd9splNJG/5TK0kDPLiLsYC6I/c ompjJwBD47yVpnZDJeplBGaCaUrWJkSFHsg5vJZ2SZhWy7at4yOaP0wTvgbOs/seVkx6 6RF0Clbmx0uuHi7IoV7JxmDwjGbKP54py3RcwHDAOTOyvM2aJa3m3c/BhJTS/9bPVG7E xJ7I2OO5DFgnVdCJR6Z+lTGqRbuadyrVb5YcuKga+2l9wVkI+mVE4AoKp1gYMi6bsBc+ O/nQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k14si2002607ejx.254.2020.09.28.22.14.18; Mon, 28 Sep 2020 22:14:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725898AbgI2FMt (ORCPT + 99 others); Tue, 29 Sep 2020 01:12:49 -0400 Received: from mga07.intel.com ([134.134.136.100]:25022 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725786AbgI2FMt (ORCPT ); Tue, 29 Sep 2020 01:12:49 -0400 IronPort-SDR: 6i0PBDolXhukmCxWsf5KGuhNX6jQs4qj7qDw3k2TY+oLOBDM8NKZQEKflrO7ewbmPV0W3WhPsB Wsj+Wa4r9zcg== X-IronPort-AV: E=McAfee;i="6000,8403,9758"; a="226261518" X-IronPort-AV: E=Sophos;i="5.77,317,1596524400"; d="scan'208";a="226261518" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 22:12:47 -0700 IronPort-SDR: HCchCqbYo5JjqGlY0drYNSEreq+kjcjcKmix9f+XbbTuQQjsxlSMRz3+SKvkJWoaUcyuetvgw8 ZxtovUCW3sSw== X-IronPort-AV: E=Sophos;i="5.77,317,1596524400"; d="scan'208";a="350085017" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.160]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2020 22:12:46 -0700 Date: Mon, 28 Sep 2020 22:12:45 -0700 From: Sean Christopherson To: Maxim Levitsky Cc: kvm@vger.kernel.org, "H. Peter Anvin" , Ingo Molnar , Borislav Petkov , Vitaly Kuznetsov , Joerg Roedel , Paolo Bonzini , Wanpeng Li , Thomas Gleixner , linux-kernel@vger.kernel.org, Jim Mattson , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" Subject: Re: [PATCH v6 3/4] KVM: x86: allow kvm_x86_ops.set_efer to return an error value Message-ID: <20200929051245.GC353@linux.intel.com> References: <20200922211025.175547-1-mlevitsk@redhat.com> <20200922211025.175547-4-mlevitsk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200922211025.175547-4-mlevitsk@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 23, 2020 at 12:10:24AM +0300, Maxim Levitsky wrote: > This will be used to signal an error to the userspace, in case > the vendor code failed during handling of this msr. (e.g -ENOMEM) > > Signed-off-by: Maxim Levitsky > --- > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index e4b07be450d4e..df53baa0059fe 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -1456,6 +1456,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > { > u64 old_efer = vcpu->arch.efer; > u64 efer = msr_info->data; > + int r; > > if (efer & efer_reserved_bits) > return 1; > @@ -1472,7 +1473,12 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info) > efer &= ~EFER_LMA; > efer |= vcpu->arch.efer & EFER_LMA; > > - kvm_x86_ops.set_efer(vcpu, efer); > + r = kvm_x86_ops.set_efer(vcpu, efer); > + Nit: IMO, omitting the newline would help the reader make a direct connection between setting 'r' and checking 'r'. > + if (r) { > + WARN_ON(r > 0); > + return r; > + } > > /* Update reserved bits */ > if ((efer ^ old_efer) & EFER_NX) > -- > 2.26.2 >