Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1224238ima; Wed, 24 Oct 2018 17:07:07 -0700 (PDT) X-Google-Smtp-Source: AJdET5cPIysd8iob++VUix7yEw3+j4cjC1nKnye2na5snK9s+xRl26RisGKrcjiseNBpvzXQub77 X-Received: by 2002:a62:2e04:: with SMTP id u4-v6mr4758401pfu.229.1540426027277; Wed, 24 Oct 2018 17:07:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540426027; cv=none; d=google.com; s=arc-20160816; b=yazDiJLbDkqURj9dnYLt8bBlaMGOHHxe2YthNNFXPyfShMTeEd4VR2JsdzR8HioA3E HJ8Kx8pbjVwdz2dfOvEGZzPSKBxlwzH3Ril/luSvLRGBGQSprw6VJs8JlN5uR3l3ljkV +DcR/Bj/1Pw5YYFHhE046lvzTJGoHJPUwM6wFVm2YTCSQJo75MCoY/DYGEzki2bk8PO0 KFfAisBu8Qsxz+3OiR5EAV6GiZJ8elD3dnuoMMX5T7Q0W4VRK96rntYZSGy/nPMod4cM yngDtwi40pzrDSySlooquLGhJYWMtIDOdkEbhw1YuWAwvVKTmR7fe8OgQGUR8mss92vl vZ7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :dlp-reaction:dlp-version:dlp-product:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from; bh=KlHLdzxgN7/8kuHog4Bxl6PPIX2kr7J8X/twzkkSwwA=; b=E1/fmr4r3E/j+D5iZc44HYnv98Zde4+E/by0gWpZJ/etZ+bJVKIcP9rKDdQJEXq8O0 9D8OdKa8zdEOhg439WlpTpMcGv+0SVl9ajMG0HvRAmNMDYaanlRTz++xEvoebB+GYBVa tTbMm9axZX//YNGmmjnd2KeXi12QKu0i3Yb8lC9ZFZylAPpNC3BnxiyzBdZQKXcRWA5U 5dJFxUvfgartPD1ZG/VsfBfyXEpMw31DomhDWgGwZU4qdpgLOVZx/o7YyzGE+s5OS6WK IqloFIHHQCYJlqC+ad4JL/jy4TBN6ufV0a6Hi8Odld9w/ZpgGBGUu+qGiWu1CCFz9QnI dW/A== 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 s132-v6si6713075pgs.492.2018.10.24.17.06.51; Wed, 24 Oct 2018 17:07:07 -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 S1726851AbeJYIgm convert rfc822-to-8bit (ORCPT + 99 others); Thu, 25 Oct 2018 04:36:42 -0400 Received: from mga12.intel.com ([192.55.52.136]:11452 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726443AbeJYIgm (ORCPT ); Thu, 25 Oct 2018 04:36:42 -0400 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; 24 Oct 2018 17:06:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,422,1534834800"; d="scan'208";a="102242309" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga001.fm.intel.com with ESMTP; 24 Oct 2018 17:06:30 -0700 Received: from fmsmsx101.amr.corp.intel.com (10.18.124.199) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 17:06:30 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx101.amr.corp.intel.com (10.18.124.199) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 24 Oct 2018 17:06:29 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.102]) by shsmsx102.ccr.corp.intel.com ([169.254.2.84]) with mapi id 14.03.0415.000; Thu, 25 Oct 2018 08:06:26 +0800 From: "Kang, Luwei" To: Alexander Shishkin , "kvm@vger.kernel.org" , "x86@kernel.org" CC: "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "hpa@zytor.com" , "pbonzini@redhat.com" , "rkrcmar@redhat.com" , "joro@8bytes.org" , "songliubraving@fb.com" , "peterz@infradead.org" , "kstewart@linuxfoundation.org" , "gregkh@linuxfoundation.org" , "thomas.lendacky@amd.com" , "konrad.wilk@oracle.com" , "mattst88@gmail.com" , "Janakarajan.Natarajan@amd.com" , "dwmw@amazon.co.uk" , "jpoimboe@redhat.com" , "marcorr@google.com" , "ubizjak@gmail.com" , "Christopherson, Sean J" , "jmattson@google.com" , "linux-kernel@vger.kernel.org" , Chao Peng Subject: RE: [PATCH v13 08/12] KVM: x86: Add Intel PT context switch for each vcpu Thread-Topic: [PATCH v13 08/12] KVM: x86: Add Intel PT context switch for each vcpu Thread-Index: AQHUa3CwucpPcxWRekKi4EsgTEAw/6Utp38AgAFsRVA= Date: Thu, 25 Oct 2018 00:06:25 +0000 Message-ID: <82D7661F83C1A047AF7DC287873BF1E172BD64B9@SHSMSX101.ccr.corp.intel.com> References: <1540368316-12998-1-git-send-email-luwei.kang@intel.com> <1540368316-12998-9-git-send-email-luwei.kang@intel.com> <87a7n37iuf.fsf@ashishki-desk.ger.corp.intel.com> In-Reply-To: <87a7n37iuf.fsf@ashishki-desk.ger.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNTQwZjMxNTAtODdkNC00NWNjLTkxNGMtNmZiY2YxZDNhNWFhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRmZMWXc2cXpxdHpVWnEzOVRhTHl4VlpXMkFwZkVHVmNRbnZWa2Q0MUc3cTdLR29HZXJQclpEMXRtUmg1ZnIrbyJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > +static void pt_guest_enter(struct vcpu_vmx *vmx) { > > + if (pt_mode == PT_MODE_SYSTEM) > > + return; > > + > > + /* Save host state before VM entry */ > > + rdmsrl(MSR_IA32_RTIT_CTL, vmx->pt_desc.host.ctl); > > + > > + /* > > + * Set guest state of MSR_IA32_RTIT_CTL MSR (PT will be disabled > > + * on VM entry when it has been disabled in guest before). > > + */ > > + vmcs_write64(GUEST_IA32_RTIT_CTL, vmx->pt_desc.guest.ctl); > > + > > + if (vmx->pt_desc.guest.ctl & RTIT_CTL_TRACEEN) { > > + wrmsrl(MSR_IA32_RTIT_CTL, 0); > > + pt_save_msr(&vmx->pt_desc.host, vmx->pt_desc.addr_range); > > + pt_load_msr(&vmx->pt_desc.guest, vmx->pt_desc.addr_range); > > + } > > +} > > From my side this is still a NAK, because [1]. > > [1] https://marc.info/?l=kvm&m=153847567226248&w=2 > This place is save the host PT status and load the guest PT status before VM-entry when working in Host-Guest mode. Thanks, Luwei Kang