Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752999AbbBXV61 (ORCPT ); Tue, 24 Feb 2015 16:58:27 -0500 Received: from mail-bn1on0138.outbound.protection.outlook.com ([157.56.110.138]:53601 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750748AbbBXV6Z (ORCPT ); Tue, 24 Feb 2015 16:58:25 -0500 X-Greylist: delayed 1116 seconds by postgrey-1.27 at vger.kernel.org; Tue, 24 Feb 2015 16:58:24 EST X-WSS-ID: 0NKAOTS-07-1M7-02 X-M-MSG: Message-ID: <54ECEC2F.1090700@amd.com> Date: Tue, 24 Feb 2015 15:25:03 -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> In-Reply-To: <20150223191729.GA2186@potion.brq.redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.180.168.240] 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)(189002)(51914003)(199003)(575784001)(86362001)(83506001)(64706001)(87936001)(47776003)(65956001)(19580395003)(65806001)(80316001)(65816999)(87266999)(76176999)(50986999)(46102003)(54356999)(101416001)(97736003)(50466002)(33656002)(92566002)(77156002)(62966003)(59896002)(64126003)(2950100001)(68736005)(77096005)(36756003)(23676002)(5820100001)(53416004)(106466001)(110136001)(105586002);DIR:OUT;SFP:1102;SCL:1;SRVR:BY2PR0201MB0839;H:atltwp01.amd.com;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB0839; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005004);SRVR:BY2PR0201MB0839; X-Forefront-PRVS: 04976078F0 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BY2PR0201MB0839; X-OriginatorOrg: amd4.onmicrosoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Feb 2015 21:25:06.6732 (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: BY2PR0201MB0839 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 880 Lines: 19 >> - 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. -- 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/