Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2255633imj; Mon, 18 Feb 2019 02:49:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IZKssuPgD7uNE1ivO3HkpICyOPEu2oRfENiaQxonQHcjxmsA1efRzIBqecrY0uAjWYFFHX5 X-Received: by 2002:a63:f844:: with SMTP id v4mr18055772pgj.82.1550486984006; Mon, 18 Feb 2019 02:49:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550486983; cv=none; d=google.com; s=arc-20160816; b=SbJL2S5Wcf73qCp/y40VWluwJ9DI/Sf2OlRyqSSJY9TKFIR69mdmm9ynEutBJhArI4 VFnLGcFlUFImlC1gwEbVYPyZeYq2cSnyCbMsOdvnhD3vgd9Z5AkAI7dntO8WrMM6DHS9 BPSMnhd/Gezmtksv3Wf9ik+x+cAQklHqgUcyvAuJ+8ZjBAswrmxegVoVxEtB/YyJAkHE 0DXkre8Oexdka2/CGeJ9sNuIkVXUOaOR1fVWSs7AjnHLkn+Z+sVa9qwaXHe+EkQTcUvP I2SfHqSYu7etKKSGq4oNA9Qm5prggXHPAZTF9cBzXQGnMmgJ/I8RAdEXF/NB2CdhI4nn lr5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=hsmB1RJpqbjjRocwVK8nYcKZ4CC1QjKIPChxk5+tOvc=; b=AdGD32CcntwA2IFmdWXiiRCv62qII6qd7JrFmm5+H5juMAK63M1a66+ySZuj4JdepD 1wlgltC9Yz1Yyedn5u5igu6mqMsgpw6HqL1BLydYh6JySELHQW1nfaons9tSLSu0CMm1 kdMa86vJFHNywf9XBor8ma52EWrz2n9XUdxfv3pM/6Z2pEYjLyEWVBb3FuTtXQqFWHnG ENrmO6ihFast12qcEgGf2GSxkcZjav2cVh8QTvur+SmX0gmX8ZlUTeNFcKVwXh5zgHR0 1+qNHoYjObqrGeLz4zBcJjEN/T7d7BjpmufnCWjUk9jySURhEm0h6SDvg2A0PhX8vk/z uyog== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id v3si12605247pff.158.2019.02.18.02.49.28; Mon, 18 Feb 2019 02:49:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1730326AbfBRKsm (ORCPT + 99 others); Mon, 18 Feb 2019 05:48:42 -0500 Received: from mga12.intel.com ([192.55.52.136]:36112 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730132AbfBRKsl (ORCPT ); Mon, 18 Feb 2019 05:48:41 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2019 02:48:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,384,1544515200"; d="scan'208";a="147738714" Received: from lxy-dell.sh.intel.com ([10.239.159.147]) by fmsmga001.fm.intel.com with ESMTP; 18 Feb 2019 02:48:39 -0800 Message-ID: <1e29ef488b637d3ddcdc02c35895e30dfece89b8.camel@linux.intel.com> Subject: Re: [PATCH] kvm: vmx: Fix entry nubmer check for add_atomic_switch_msr() From: Xiaoyao Li To: Konrad Rzeszutek Wilk , Paolo Bonzini Cc: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Radim =?UTF-8?Q?Kr=C4=8Dm=C3=A1=C5=99?= , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Date: Mon, 18 Feb 2019 18:45:41 +0800 In-Reply-To: <03c21ba903c472ef64c57baca0c58217b2212d7e.camel@linux.intel.com> References: <20190214040858.15975-1-xiaoyao.li@linux.intel.com> <20190215164645.GD889@char.us.oracle.com> <03c21ba903c472ef64c57baca0c58217b2212d7e.camel@linux.intel.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.1-1build1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-02-18 at 16:26 +0800, linux.intel.com wrote: > On Fri, 2019-02-15 at 11:46 -0500, Konrad Rzeszutek Wilk wrote: > > On Thu, Feb 14, 2019 at 12:08:58PM +0800, Xiaoyao Li wrote: > > > Commit ca83b4a7f2d068da79a0 ("x86/KVM/VMX: Add find_msr() helper > > > function") > > > introduces the helper function find_msr(), which returns -ENOENT when > > > not find the msr in vmx->msr_autoload.guest/host. Correct checking contion > > > > s/not find/cannot find/ > > s/contion/condition/ ? > > > > Hi Paolo, > Could you correct these typos in KVM tree or when sending a PR? > Please disregard this. I just noticed tha this patch had been merged into mainline. > > > of no more available entry in vmx->msr_autoload. > > > > > > Fixes: ca83b4a7f2d0 ("x86/KVM/VMX: Add find_msr() helper function") > > > Signed-off-by: Xiaoyao Li > > > --- > > > arch/x86/kvm/vmx/vmx.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > > > index 95d618045001..1aaef2d536bd 100644 > > > --- a/arch/x86/kvm/vmx/vmx.c > > > +++ b/arch/x86/kvm/vmx/vmx.c > > > @@ -863,7 +863,8 @@ static void add_atomic_switch_msr(struct vcpu_vmx > > > *vmx, > > > unsigned msr, > > > if (!entry_only) > > > j = find_msr(&m->host, msr); > > > > > > - if (i == NR_AUTOLOAD_MSRS || j == NR_AUTOLOAD_MSRS) { > > > + if ((i < 0 && m->guest.nr == NR_AUTOLOAD_MSRS) || > > > + (j < 0 && m->host.nr == NR_AUTOLOAD_MSRS)) { > > > printk_once(KERN_WARNING "Not enough msr switch entries. " > > > "Can't add msr %x\n", msr); > > > return; > > > -- > > > 2.19.1 > > >