Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2375328imm; Thu, 7 Jun 2018 09:34:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKjEF792JkJTk4hG5kIG4aTebb/tt6vUvQ3hkIdtmLYDCrwXmMMgtm5cbYpyRDUgkDZMxYu X-Received: by 2002:a63:8b44:: with SMTP id j65-v6mr2235349pge.203.1528389250313; Thu, 07 Jun 2018 09:34:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528389250; cv=none; d=google.com; s=arc-20160816; b=tbzsJKnPiYaJBSxUNkPrdFuGG5a/NEaFtuUir9gFat9WIToOnEYikmHFxA7eNaz0oD 5nI4qjj4MkU5k0qdpc6+tg6O9n3DfybfIwoIugKI/tvPeT5gunwYyXiwg1SPDm954icW G6TTdKOmTjDX+xV6ZERbieqgUmaACNX9pc3UHL6Ah6+GL9/nGywtQP9ek7029Y9rlpg2 yF7ZtvB3lsQt0Svp2cyVZA0gJxyCtObdRw+MKgqLUkc0ImdSB5eVUpOBmfWecm6Yajx3 zYnhYsMoCosdPS5Ttd83y/HMyKpoWTYMBeZyM2lgMG9JkBXdnDjLHNFydFht/eFwJrtH obsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=1QT7bXcY/RnZhaDPxozvemvDs1vteoW1f6u47/rqsEk=; b=aTBo5Xy61NMh4f8QmmWx6tOeJ/ltqKKRNgF2yvv9R1jIyg9sSRiNIZSojcRC8ide5s TV0jh2d5XM5fJs4xDal0RnZmqyBep5EMIRzDociRQ2D2tVEKVv6yitB0UR02DyrA4oYV nOfX0h5A7VqqFTnXIAiPUNz0RL3z5hfg84jCwXfKc0XNyYC5XXbueBIfry6R5u248L12 TuwZVtbpOUfknVa6025EaT+/akVmHWT9T1eU4pOJ+ly+g5WA9W94BxCTUAgAALerlYhx HIHeJ8D8Lt/Hs0HdvO03qx1+ZimfZqLJniE/CZkdMpIJIRB337Z/OU/wsv/A35I8yV7a SrgA== 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 s1-v6si42756818pgq.282.2018.06.07.09.33.56; Thu, 07 Jun 2018 09:34:10 -0700 (PDT) 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 S933248AbeFGOMt (ORCPT + 99 others); Thu, 7 Jun 2018 10:12:49 -0400 Received: from mga06.intel.com ([134.134.136.31]:63462 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932520AbeFGOMq (ORCPT ); Thu, 7 Jun 2018 10:12:46 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jun 2018 07:12:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,486,1520924400"; d="scan'208";a="48072335" Received: from um.fi.intel.com (HELO um) ([10.237.72.212]) by orsmga006.jf.intel.com with ESMTP; 07 Jun 2018 07:12:40 -0700 Received: from ash by um with local (Exim 4.91) (envelope-from ) id 1fQveX-0005Ha-V7; Thu, 07 Jun 2018 17:12:38 +0300 Date: Thu, 7 Jun 2018 17:12:37 +0300 From: Alexander Shishkin To: Luwei Kang Cc: kvm@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, chao.p.peng@linux.intel.com, thomas.lendacky@amd.com, bp@suse.de, Kan.liang@intel.com, Janakarajan.Natarajan@amd.com, dwmw@amazon.co.uk, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, peterz@infradead.org, mathieu.poirier@linaro.org, kstewart@linuxfoundation.org, gregkh@linuxfoundation.org, pbonzini@redhat.com, rkrcmar@redhat.com, david@redhat.com, bsd@redhat.com, yu.c.zhang@linux.intel.com, joro@8bytes.org Subject: Re: [PATCH v9 10/12] KVM: x86: Implement Intel Processor Trace MSRs read/write emulation Message-ID: <20180607141237.ruhg44wuepkf4nhz@um.fi.intel.com> References: <1526964735-16566-1-git-send-email-luwei.kang@intel.com> <1526964735-16566-11-git-send-email-luwei.kang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526964735-16566-11-git-send-email-luwei.kang@intel.com> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 22, 2018 at 12:52:13PM +0800, Luwei Kang wrote: > + /* > + * Any MSR write that attempts to change bits marked reserved will > + * case a #GP fault. > + */ > + if (data & vmx->pt_desc.ctl_bitmask) > + return 1; > + > + /* > + * Any attempt to modify IA32_RTIT_CTL while TraceEn is set will > + * result in a #GP unless the same write also clears TraceEn. > + */ > + if ((vmx->pt_desc.guest.ctl & RTIT_CTL_TRACEEN) && > + ((vmx->pt_desc.guest.ctl ^ data) & ~RTIT_CTL_TRACEEN)) > + return 1; > + > + /* > + * WRMSR to IA32_RTIT_CTL that sets TraceEn but clears this bit > + * and FabricEn would cause #GP, if > + * CPUID.(EAX=14H, ECX=0):ECX.SNGLRGNOUT[bit 2] = 0 > + */ > + if ((data & RTIT_CTL_TRACEEN) && !(data & RTIT_CTL_TOPA) && > + !(data & RTIT_CTL_FABRIC_EN) && > + !pt_cap_decode(vmx->pt_desc.caps, PT_CAP_single_range_output)) > + return 1; Ah, I see. But afaict this is still wrong: PT_CAP_single_range_output is only about allowing !RTIT_CTL_TOPA, FABRIC_EN should be checked separately against the new capability that you added in 4/12. Regards, -- Alex