Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753682AbbBYWkE (ORCPT ); Wed, 25 Feb 2015 17:40:04 -0500 Received: from mail-bl2on0134.outbound.protection.outlook.com ([65.55.169.134]:22976 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752835AbbBYWkB convert rfc822-to-8bit (ORCPT ); Wed, 25 Feb 2015 17:40:01 -0500 X-Greylist: delayed 90887 seconds by postgrey-1.27 at vger.kernel.org; Wed, 25 Feb 2015 17:39:57 EST X-WSS-ID: 0NKCMYD-07-X12-02 X-M-MSG: Message-ID: <54EE4F35.7070808@amd.com> Date: Wed, 25 Feb 2015 16:39:49 -0600 From: Joel Schopp User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= CC: Gleb Natapov , Paolo Bonzini , , Joerg Roedel , Borislav Petkov , , David Kaplan Subject: Re: [PATCH] x86: svm: don't intercept CR0 TS or MP bit write References: <20150220224445.2875.66846.stgit@joelvmguard2.amd.com> <20150223191729.GA2186@potion.brq.redhat.com> <54ECEC2F.1090700@amd.com> <20150225202600.GA11660@potion.brq.redhat.com> In-Reply-To: <20150225202600.GA11660@potion.brq.redhat.com> Content-Type: text/plain; charset="UTF-8" X-Originating-IP: [10.180.168.240] Content-Transfer-Encoding: 8BIT X-EOPAttributedMessage: 0 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=Joel.Schopp@amd.com; 8bytes.org; dkim=none (message not signed) header.d=none; X-Forefront-Antispam-Report: CIP:165.204.84.221;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(428002)(51704005)(377424004)(24454002)(51914003)(377454003)(189002)(479174004)(199003)(65816999)(87266999)(54356999)(93886004)(59896002)(50986999)(53416004)(76176999)(64126003)(33656002)(101416001)(5820100001)(23676002)(80316001)(19580395003)(77096005)(68736005)(2950100001)(46102003)(86362001)(575784001)(65956001)(87936001)(62966003)(64706001)(47776003)(77156002)(97736003)(65806001)(106466001)(105586002)(92566002)(83506001)(50466002)(110136001)(36756003);DIR:OUT;SFP:1102;SCL:1;SRVR:BN1PR0201MB0834;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:3;LANG:en; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN1PR0201MB0834; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006);SRVR:BN1PR0201MB0834;BCL:0;PCL:0;RULEID:;SRVR:BN1PR0201MB0834; X-Forefront-PRVS: 049897979A X-OriginatorOrg: amd4.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2015 22:39:52.2959 (UTC) X-MS-Exchange-CrossTenant-Id: fde4dada-be84-483f-92cc-e026cbee8e96 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fde4dada-be84-483f-92cc-e026cbee8e96;Ip=[165.204.84.221] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0201MB0834 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1647 Lines: 33 On 02/25/2015 02:26 PM, Radim Krčmář wrote: > 2015-02-24 15:25-0600, Joel Schopp: >>>> - clr_cr_intercept(svm, INTERCEPT_CR0_WRITE); >>>> } else { >>>> set_cr_intercept(svm, INTERCEPT_CR0_READ); >>> (There is no point in checking fpu_active if cr0s are equal.) >>> >>>> - set_cr_intercept(svm, INTERCEPT_CR0_WRITE); >>> KVM uses lazy FPU and the state is undefined before the first access. >>> We set cr0.ts when !svm->vcpu.fpu_active to detect the first access, but >>> if we allow the guest to clear cr0.ts without exiting, it can access FPU >>> with undefined state. >> Thanks for the valuable feedback. It's apparent I hadn't thought >> through the interaction with lazy FPU and will need to go back and >> rethink my approach here. > I don't think we can gain much without sacrificing some laziness, like: > when a guest with lazy FPU clears CR0.TS, it is going to use that FPU, > so we could pre-load FPU in this case and drop the write intercept too; > guests that unconditionally clear CR0.TS would perform worse though. > > It's going to take a lot of time, but two hunks in your patch, that made > selective intercept benefit from decode assists, look useful even now. > > Would you post them separately? I can re-post those separately. They are less useful, though probably still worth doing, on their own because SVM_EXIT_WRITE_CR0 takes precidence over SVM_EXIT_CR0_SEL_WRITE -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/