Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754126AbeAHRjj (ORCPT + 1 other); Mon, 8 Jan 2018 12:39:39 -0500 Received: from mail-by2nam01on0042.outbound.protection.outlook.com ([104.47.34.42]:17040 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753117AbeAHRjd (ORCPT ); Mon, 8 Jan 2018 12:39:33 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Subject: Re: [tip:x86/pti] x86/cpu/AMD: Use LFENCE_RDTSC instead of MFENCE_RDTSC To: Paolo Bonzini , "Dr. David Alan Gilbert" , Andrew Cooper Cc: Thomas Gleixner , bp@alien8.de, dwmw@amazon.co.uk, gregkh@linux-foundation.org, pjt@google.com, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, tim.c.chen@linux.intel.com, torvalds@linux-foundation.org, peterz@infradead.org, dave.hansen@intel.com, linux-tip-commits@vger.kernel.org References: <20180105160756.23786.4220.stgit@tlendack-t1.amdoffice.net> <1b179b8b-6cc8-d736-81dc-2445be4baf02@citrix.com> <4d9a1f0d-a401-3f0f-9ee2-dd42f4b4716a@amd.com> <929a34a1-e3bc-b1c8-4c71-196610c0d02a@citrix.com> <20180108164803.GF2462@work-vm> <0be27b7e-7285-b23b-7eda-55a70338d16c@redhat.com> From: Tom Lendacky Message-ID: <00e18fcc-6a56-0d39-e3c8-7f9a1ffcc260@amd.com> Date: Mon, 8 Jan 2018 11:39:23 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <0be27b7e-7285-b23b-7eda-55a70338d16c@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR1201CA0002.namprd12.prod.outlook.com (10.174.238.12) To MWHPR12MB1151.namprd12.prod.outlook.com (10.169.204.15) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 6537a3bb-cb5f-4378-3890-08d556bec589 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060)(7193020);SRVR:MWHPR12MB1151; X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1151;3:09flgCpumQjpZ4I8OABCnrBQ1MEbL0JD64dL49kQ0Xsuq1qGey8VWptKbdLe9SDH7G0NEiPpo2eA8M49HPjADGOJFe9yk+4T52EW3V5XF+y9P6I2tNTT94/6/VvtFyn3z6SsOA+ecyRXhFmZ1J/02vtdU4t1DbmYI2hHmA/bfDDmsZp4LvnQk0RgTmnt68ez092/BtDhyZq58YDYt9oC+eM2GnPvP2f0HNqdpbXQBjm7zp6DKOdOKPsu7XfP6ibT;25:kNetUOg3L3IHxSXPky4QyonlAFab2RatDr0/+Vbwp9qceQWCqCmT2D6Spq4EneHKt2XxM0Qz8yB225Ft5svvczfAgdcWfc6PJKykQXrY/3LfZQSNmpEkymkZAukgh6Ciu4H+PN41M0GY40Aft7AzYMvmivk6F6pYx8nDJ8jQgQuZwYApv0CoM2w8uwFCHWbCg3corFw8URBFTuZkcs2j7QTam500oMhdaWHnwuMmuDquNxtnww5mUhS8xDBjWuJR8VnQU7EKMnPPHNrzlchGONuyR265IN3sR8ekqTaiXoIGPKnmUOgL+qWF8FvnmKXkt6892/twl8tw6CmRWL4Qmw==;31:ZDmKLIk3fZzsn3Uiju9BT7ZAkeBDY0Edvhjj7BblVTlGZQ826yCcovMBv0xjTTGdL81cikZYUvvelF3qUzkFUYNAasdqUGKkG1Q9cdDb4PUrCSBBKXaIF5dJ8U2nG+iB3JifFNb/G+81tsSsOK4+JqDVj+JQU9300XniZylRiAS+HckEOtwST9KmG2sZ/q7bHF4Ikw0JQ4/Gk8D0Ag58BPS00WxudJK23iALe/iwRaE= X-MS-TrafficTypeDiagnostic: MWHPR12MB1151: X-Microsoft-Exchange-Diagnostics: 1;MWHPR12MB1151;20:wBICTCLJLYavSz3Rj2toOIozpfxvsrSe6Sqqzx9X0FToqphiyr9BAcrSVkW8qFrcH1b83l7z91AOZvqrT+K086R+DeFMxpSd9c0rsSca4A/rTh9sHI9osuRpYnVaIWLnPWBMAW2vda/zSjKSXp1l81fg+K4HGN0I2o8KocDLfp5pGt+v70lnvXJneoIU9VmIfuoDOVu8sdlFg9ggbOQBSpQ1CFHsKPY0MGU42mVcjBWkErxl4+25QWNEyH/tWe+2UizAq9GtdHawI1W0f3bxuZtuSlNq5XPapimYZcawYRLDzfZt7soUA1MI2+Bwh2TOi8F6btTiYDBAXt0BqGY/NeyjJTNlH0CziT7Be0zzM9IjMBA0UxbPYUsaXQZsRs/DtjxnrAKMWmIdatfnvtEA1pDgGrxelc1I3AsIAKzlu0LAxohJmCsJP7sJYd0+ZttY1pwVvT2+jFbJv9y31oLmwZXKAlX8uUoVkahZCtLiGgnX+odTtqmehxb18qu8xgKD;4:LscTHTDCo58Nw3PlAQCn+JW4HFy1aAhaqaEgyDgQjjiorKds0o2n1EXFKfNqw6FpUpXaDexjL4MAxF6LsoSu7f49uBNKXpD6v7cWgRB02hfYs20up3EeYkIeCastKFfRd9EIrdlVo0ybB2PpzsIRJ8gT37eCgrjeWwwNNtnrlkbU0z/X8SYP9aq5UBayzdEZNQmNEL0KPmEnl9lVwJAhgsTJnppYTiz1t+1OBxZuYqGbA9jAL9Ev6l6Y24eybgyin+ivNzweGTg30/4+EXokbQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231023)(944501075)(6055026)(6041268)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011);SRVR:MWHPR12MB1151;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:MWHPR12MB1151; X-Forefront-PRVS: 054642504A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6049001)(346002)(376002)(39860400002)(366004)(39380400002)(396003)(199004)(189003)(24454002)(81156014)(97736004)(59450400001)(6486002)(77096006)(16526018)(36756003)(23676004)(52116002)(2486003)(52146003)(65956001)(65806001)(7416002)(6116002)(2870700001)(47776003)(386003)(66066001)(3846002)(50466002)(93886005)(2906002)(2950100002)(76176011)(305945005)(7736002)(90366009)(53546011)(86362001)(8676002)(8936002)(106356001)(6666003)(72206003)(81166006)(64126003)(229853002)(478600001)(68736007)(110136005)(6246003)(25786009)(65826007)(58126008)(31686004)(53936002)(31696002)(16576012)(5660300001)(316002)(105586002)(3260700006)(4326008)(83506002)(8666007);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR12MB1151;H:[10.236.65.116];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtNV0hQUjEyTUIxMTUxOzIzOkNXRFlJVklxaU40bHZpdzVCclhQRnN0RmVR?= =?utf-8?B?cmdNdHlNbnFEQWVIaU5PbE9RYVhDbzIwcC9uV1loRWdIZ1o0bzRXenA4c2FU?= =?utf-8?B?RFd5NXltMVhVV0tZWklVRkJ6RWgyU2JFRU5rYTErNldmbTFyUTNIL3dJb29N?= =?utf-8?B?VUFvclpMK2RXZ1RvTE9MaWhBbkV1WUdqSzBCV1FuQUtDMGlHT1d6bXNNVWtR?= =?utf-8?B?bm1rQ0RHL3NYMVhQYmlLb1hTaERoS21pc2g4QTB2dXFpYjJWd0liL0VyRnVw?= =?utf-8?B?NzF4VGZnQ3hMNEFmNUxQWnZkbUIxQVV0L0h4QkdBUmQwV3BKOFNNaEtkcFVr?= =?utf-8?B?Yz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/VUNaYu5EXUZDNJ8ZuLOl5yS5jsJqF9RBFTHqdp9UWbCcdEgRHGfCzXPrCDUpB3NzY87Yy7Hau+uFB8ppEHl5bu5dJIigoZ8n0hOXBQe1T X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2018 17:39:27.8484 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6537a3bb-cb5f-4378-3890-08d556bec589 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1151 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 1/8/2018 11:01 AM, Paolo Bonzini wrote: > On 08/01/2018 17:48, Dr. David Alan Gilbert wrote: >>> If your hypervisor is lying to you about the primary family, then all >>> bets are off.  I don't expect there will be any production systems doing >>> this. >> It's not that an unusual thing to do on qemu/kvm - to specify the lowest >> common denominator of the set of CPUs in your data centre (for any one >> vendor); it does tend to get some weird combinations. > > Agreed. But on a hypervisor we pretty much know that: > > - the MSR_AMD64_DE_CFG doesn't exist unless you have a fix Not sure what you mean by this... the MSR exists today on many families. Thanks, Tom > > - setting the MSR_AMD64_DE_CFG bit to 1 if you have a fix can be done > independent of the family > > So all KVM needs is a X86_FEATURE_LFENCE_SERIALIZE, it doesn't matter if > it's because of the family or because Linux has set MSR_F10H_DE_CFG. > The guest will either try setting the MSR bit and #GP, or it will find > it already set and do nothing. > > Of course no code for this has been written yet. > > Paolo >