Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752766AbdLFRCS (ORCPT ); Wed, 6 Dec 2017 12:02:18 -0500 Received: from mail-he1eur01on0123.outbound.protection.outlook.com ([104.47.0.123]:27680 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752627AbdLFRCP (ORCPT ); Wed, 6 Dec 2017 12:02:15 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jan.dakinevich@virtuozzo.com; Date: Wed, 6 Dec 2017 20:02:07 +0300 From: Jan Dakinevich To: Andi Kleen Cc: , "Denis V . Lunev" , Roman Kagan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , "H. Peter Anvin" , , Paolo Bonzini , Radim =?UTF-8?B?S3LEjW3DocWZ?= , Kan Liang , Stephane Eranian , Colin King , Sebastian Andrzej Siewior , Jin Yao , Subject: Re: [PATCH RFC 2/2] KVM: x86/vPMU: ignore access to LBR-related MSRs Message-ID: <20171206200207.11094037@virtuozzo.com> In-Reply-To: <20171206155728.GL3070@tassilo.jf.intel.com> References: <1512560585-27263-1-git-send-email-jan.dakinevich@virtuozzo.com> <1512560585-27263-3-git-send-email-jan.dakinevich@virtuozzo.com> <20171206155728.GL3070@tassilo.jf.intel.com> Organization: Virtuozzo X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: DB6PR0202CA0016.eurprd02.prod.outlook.com (2603:10a6:4:29::26) To AM4PR0801MB2737.eurprd08.prod.outlook.com (2603:10a6:200:14::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b4b937a2-2dd1-424e-ecca-08d53ccb1744 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(5600026)(4604075)(4534020)(4602075)(7168020)(4627115)(201703031133081)(201702281549075)(2017052603286);SRVR:AM4PR0801MB2737; X-Microsoft-Exchange-Diagnostics: 1;AM4PR0801MB2737;3:UZak7a3DSeOQTDdkwTTl8ipvltGeh4XvARdzuHt5Rt3EIOgvRCjdpy3hJxR2Bov/hl/kve+zSL3RpfFLD7yAF90jaGMtHI4fiJri2Lv9VGKmnkL64rYSaxCiSh5Rezug7fWTCiC4HM1+QCN4KSId1n+oftoZxjee+diP5u+L9bbbgcRRCmTb71U6QySwLLRGzXnirZHdau7n3Lhi8KsBCJVf7HQv/YXRcH7rmpo3vmNyYWL83jfsyX4sLzh63tHz;25:MAPCuB6DC5jK64eUc158E1PBpP5yigW2Sqtg8AGwu8TJxrc46jsHyht72WEGOjU0z+7NR0qzJHWcDosgM+GmYDD5lu+HTwK5vNtEQGCwUmQGCxjuMA3YjKYxBizPP5ZebeqzvHnWv67jjVgRN2XJBpz84N96F4B0SEb7O6EW9y/C9OCuqS30CCPFPs5ZMxW9HOQMKiuFPnXG+lAx3Crd66ZwBG6wsOIMizt5EZZyQ6Oz6zmxgidMHzX4afcF34tiI0bsqoLVSrV5yFljW02ryK0FDWBd6lNJwmN/SUcQndvakQcXS891O8Kk7svBMd43CCfF22w9ipEVdCtZYdIAMw==;31:2vzW45HFr39sKp5H6gxOkpgfVTQScbAhgTp6DTVa802zEqRdkvoBv/3x397IgBrLL/4SK0unZXlpuuloe6vpECEPt7Pk1jYb9h7NwyqEkRiV44tk7ixGSKttJqcoSFTRgbRWb9D2NLCWomyCpZPGFjqhnafsaTwRgxrohPaW80sO+/nPgh4Mg3s+ZaRE4H7U8CoK6MbPrl8ejbW4cjyDmy108rowcaqOYQGyd5g6G0w= X-MS-TrafficTypeDiagnostic: AM4PR0801MB2737: X-Microsoft-Exchange-Diagnostics: 1;AM4PR0801MB2737;20:GBAu6VEAlGWzGxIzRznNyhhJlUc324VVnGcHOyNpM0UdahtdA8QKnEQvynY03XPGFGHN6bCPeGbjXlSrZ9XPuS0+VWXOgptWBJkgtZuxCi3+HsDcqIXRjPdDsBBdGWpJZ0XJbuRTrbSqYQ/xNNqBhyphlHcv3N5xsgG4kKIWo2SW+HThmENe2MpCEYvKSpNBDiQu4jxa5k4LsC2LkSd+VQWw+thPGAQFhRmORXS1mNLbMM4ruF2vGl3Jsn4v7v2Khq2pxsTegZIj/M9X8gk2nabYokYLwGKun5gTAPOkYSL9CGNqMRtng4QEtvJ7Ies7RTB9B3ZCFxAfm2wxpaprbl8KbtcnI2PDAsqOeQbpRKyxDGD/rBGu26w1qu4N0G/3TpRYhfu2CyR8lgHTL6KRd3tKzah+QdKJAoR7aH4Cr1A=;4:2o27/tJ9Ij+TgEZ/RIfcOLzP4Vudxq6RZiqnSdGI5L+DeaK1rcoKOmVKtdd/GlqwlExRsMog5MmonDgFENS2LQKr01NYrl8JD5xIQo8ksF6cUApsFE9idNQ7zcPiOGxQIGyVQhWr6vIWy5HiEbrpWS4YwC1jAMk49CbE85iMAHlxz/TcWnsG7+I12q4Kj63PG1hsP69qqgOcG+ClOD8KMgm97fTavigOJguYBlLMOQPcFgpvTaCN8jVz8Xb9ebQ3zUpiWBHCrunjaHBryzW9Om304k/ZQ80MtYYOv/lZLMtn/gdI7bFFEPa/wrkrZrYA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(228905959029699); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231022)(3002001)(10201501046)(6041248)(20161123555025)(20161123564025)(20161123562025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011);SRVR:AM4PR0801MB2737;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:AM4PR0801MB2737; X-Forefront-PRVS: 05134F8B4F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(346002)(366004)(376002)(24454002)(189003)(199004)(2950100002)(7736002)(316002)(16526018)(81166006)(8266002)(25786009)(6486002)(305945005)(50226002)(54906003)(8676002)(81156014)(8936002)(68736007)(229853002)(86362001)(6916009)(36916002)(2906002)(5660300001)(52116002)(478600001)(76176011)(230700001)(101416001)(106356001)(97736004)(70486001)(105586002)(97876018)(66066001)(53936002)(6496006)(55236003)(1076002)(4326008)(6116002)(23726003)(7416002)(6246003)(76506005)(3846002)(47776003)(117636001)(50466002)(36756003)(1970100001)(39210200001)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:AM4PR0801MB2737;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM4PR0801MB2737;23:xJgAqw4bZZSCCggB6xtEbHMSxgNoxyHlrHdz/oT?= =?us-ascii?Q?/5yOm7c3D6rKnwwWUF0eJLfUAQ85aAX5KFcWQVlonRRDhr6DIqGhvEMai9Le?= =?us-ascii?Q?+0PwQDiP1G9jBtPxdvsIh1ecxbAQpn0tWSVRT6ZFAuCY233iyGBY92kS7Qkf?= =?us-ascii?Q?ipKzSC2qigu+2k0+D9uu6U2AFhV4v8elCUEqbX54cpPbPa3gm7OyIEzGLojF?= =?us-ascii?Q?Lb7GPSolO6VsjFNXL3BGMeYvWZS6NHyyUb/ePcc9yYInICSjzj65rR9z3/yG?= =?us-ascii?Q?OlQeybHfopopxNy5/UecHu8JH5Y0N45iLe6YDCiJ4PqF2wnGiX8Dl2ksE6xX?= =?us-ascii?Q?ihHUmEAieBzLIlMKOnKzL6H6TSXstZRDKOVewb98wvOJEeckq8bNJbjOiV1f?= =?us-ascii?Q?0TK+rEgsU5ztFCVxifVbro1iaS3iS/PqbmQ2YGF/0xglkboWOmwn67iJjQbA?= =?us-ascii?Q?YWKouyurW93gV9e9+Crwn3BJI/B9Cri7RQXakgVWvL6Zfr+EGlqA0VAQ6hrn?= =?us-ascii?Q?YW5030auLehd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vbumVGdmIEKQ= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2017 17:02:08.9213 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b4b937a2-2dd1-424e-ecca-08d53ccb1744 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0801MB2737 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 874 Lines: 30 On Wed, 6 Dec 2017 07:57:28 -0800 Andi Kleen wrote: > > If you do all this it's only a small step to fully enable LBRs for > guests. It is quite simple in a case where guest LBR-related MSRs matches host ones. They could be handled by MSR load/store areas, I suppose. In other cases, it could be expected the different amount of these MSRs and different theirs base values (e.g. Nehalem vs Core). Guest MSRs could be both subset and superset of host MSRs, so additional efforts to support this would be required. > > Just need to allow them to be written, expose PERF_CAPABILITIES too, > and start/stop them on entry/exit, and enable context switching > through perf in the host. > > That would be far better than creating a frankenstate where LBR is > there but mostly broken on some KVM versions. > > -Andi -- Best regards Jan Dakinevich