Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2058562imm; Thu, 27 Sep 2018 06:50:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV60a44e1abLKDsXu3qLekVjoxk9N+rS9aRLgXt6ykmD0M/ydrvMCAvTFD3nf59j5kQW1/H/q X-Received: by 2002:a63:e756:: with SMTP id j22-v6mr10506965pgk.185.1538056239657; Thu, 27 Sep 2018 06:50:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538056239; cv=none; d=google.com; s=arc-20160816; b=K6QT9lhriDANOqToxCJu9zpfM+UQw9sA5JP4WX9dQZ/PEgdGwjtXTy9qgFNuGM0Ao3 3a3y0CN/qNupJ/tRx4Gt0ognKV30TTdN/115kBKeUIfTWmLR3RN1JEN5ztORIZgyW63m gm3/XEYF1hPKkuzjN9p3QecrQ0tnap2DhGix56BT1bxqtq8yfh4WoMroaYFMuOPQdsCB 7ybUf6Q4wREwHcFiw2X0pLkqMOj44Ef8DSF2h/mtnuGLA8PZ+oTIGTDsk5GzrjECyNaw sXllyd8Iv9jF7DaPzb6RFnRxDPP5YiM4Y8lN1Kgp74fDV6/Q/dpWQRBcDgco2XRohej0 6KOQ== 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=BnwH3YfryhhiYe8tYHF7AQR0SqZzXsWBUXjrPDATqSI=; b=hvuxHgOv7ZHqhN3/iFnV2+lN8MFdl80Iy81B6ZFBsvXiBd7oJRQZguGIy8FM5t3es2 5OT0tXKAswQ4LLzk2yPxj2B8VHjSy+tRn5zvIsEyOqZEoUsjROyszsypsV0ttkXtOvLS WA/zj0C5ZiCFdlPZR5u6Ozq1JS0+d5smlE8lIEOI9LfUw66Ldn2r7rX1iFqYyuMAMgzH QkrJLggtvCtFX1vvQODe6FDb8Xs6yW4ItfaH19+YnCZhRYgoJtRZq9gQ5GZT6vcRzs55 rgPNeY4a30GiXJPL9bhMUAha13RxzjCrSdXc1reKKMwHR3ELvfs1TNuBRPGZHFnSl3jE KT6A== 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 e7-v6si2051527plk.122.2018.09.27.06.50.23; Thu, 27 Sep 2018 06:50:39 -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 S1727576AbeI0UGL convert rfc822-to-8bit (ORCPT + 99 others); Thu, 27 Sep 2018 16:06:11 -0400 Received: from mga09.intel.com ([134.134.136.24]:14554 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727076AbeI0UGL (ORCPT ); Thu, 27 Sep 2018 16:06:11 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2018 06:47:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,310,1534834800"; d="scan'208";a="94305070" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga001.jf.intel.com with ESMTP; 27 Sep 2018 06:45:35 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 27 Sep 2018 06:45:34 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 27 Sep 2018 06:45:34 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.140]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.37]) with mapi id 14.03.0319.002; Thu, 27 Sep 2018 21:45:32 +0800 From: "Wang, Wei W" To: Peter Zijlstra CC: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "pbonzini@redhat.com" , "ak@linux.intel.com" , "Liang, Kan" , "mingo@redhat.com" , "rkrcmar@redhat.com" , "Xu, Like" , "jannh@google.com" , "arei.gonglei@huawei.com" Subject: RE: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack Thread-Topic: [PATCH v3 4/5] KVM/x86/vPMU: Add APIs to support host save/restore the guest lbr stack Thread-Index: AQHUUM3pU3aoeAw5SE6eJtMPeYOl0qT4lD2AgAuXxtA= Date: Thu, 27 Sep 2018 13:45:31 +0000 Message-ID: <286AC319A985734F985F78AFA26841F7397FD362@shsmsx102.ccr.corp.intel.com> References: <1537437959-8751-1-git-send-email-wei.w.wang@intel.com> <1537437959-8751-5-git-send-email-wei.w.wang@intel.com> <20180920123223.GS24124@hirez.programming.kicks-ass.net> In-Reply-To: <20180920123223.GS24124@hirez.programming.kicks-ass.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzQwMmY5NjItMjZjYi00OTYxLWJkMzQtZWI2MDkzMzViMWRkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibEhxU3NpcENyalg2RGZiY1BocENDcFZ0dDYxcGUwclRyd3EzSll4U0c3cTQ0dDdwNnlHcUFVanNpRktQNTB2TCJ9 x-ctpclassification: CTP_NT 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 On Thursday, September 20, 2018 8:32 PM, Peter Zijlstra wrote: > On Thu, Sep 20, 2018 at 06:05:58PM +0800, Wei Wang wrote: > How do you deal with that situation, where the LBR is in use by a host event? I guess you were referring to this use case: "perf record -b qemu-system-x86_64..", where the qemu process also needs lbr. I also discussed with Andi about this in v1, where we switch the lbr state on VMX transitions. That could achieve the above, but adds too much overhead to VMX transitions, which are frequent. Considering the above usage is not common (it's more common to just have the task in the guest use the lbr feature), we decided to not take that usage into account, and switch lbr state only on the vCPU switching. Best, Wei