Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp476608ima; Fri, 15 Mar 2019 07:07:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqz99HLRkMyJf58e9yC5UTJRFNHr2jIdDB3OMk6u5Zj1h7J3eHr2tdp1WGno51i/xYVflx0P X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11mr4349433plb.328.1552658876349; Fri, 15 Mar 2019 07:07:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552658876; cv=none; d=google.com; s=arc-20160816; b=T+JlIkFNnaxkTFjOqfAhbvhOfktqK2NpCw8OX1SaUne/hqUw7x+q+98+LqSpsFQZ+u txKYb8pguJ2JjSmjQKqfxwUs4t6bqPvFSvMsR1OoX7DpVnaeGNtIht0VOADOBvkBx/Q3 EnpSwx5CXOqr00YTuuwzR5G7B7NLFVsmM8wTLAaEphF2CTV5t1y73eA53k9OIrbsXzZx L0JZ6vdXSJ6CvjnCE5mX9K5Wegh1j8uwgRLpxxb2ht9H2cQFo+/J9N9Sv9s9A4hnRf5O YHfmipAmxwBZIz2kPsNyPn1trrj3t4+p986Z08ZXHAVF9mE/O7T3Sif1vcIuPEyyst/J U90A== 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 :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=JvwGEw1dw9jmmMiFejFsjbIrwYf4JclzysSrku9NfYk=; b=YyGlTaW4P+yZzDMNYQKZdHiGVDL3f0AP5NkHbtaoioKoHcYG5mY/ohI9+/vG+BMRHD h4uCD3AGCx1PVgMFA28XRsARMd0Zh8nMztW41OqEx4NWpU8e1P09J2Ed2azSTv+CP6R1 FCRuB8bGt8ngNh06rXvjHySKtbEgEJ80KdzT5hLq268YO6POKTeW7rn+suMV/+QojMNB 0JR9g8KBTZOfl+FBxMDPEBIJV6sw8FB7jYNx4Tnqw2xKdM+GQmZLsFQFIhJB6Mjt5xAl He3Rj7N0nMsTjr6bY7a1ymfZ0A/y7CilhS+enIpln3VCNLwQefL6AlfrXF5+PoCl7KUx 1gDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=AikgcJLa; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i10si2049465pfj.186.2019.03.15.07.07.40; Fri, 15 Mar 2019 07:07:56 -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; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=AikgcJLa; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729226AbfCOOG4 (ORCPT + 99 others); Fri, 15 Mar 2019 10:06:56 -0400 Received: from mail-eopbgr730056.outbound.protection.outlook.com ([40.107.73.56]:9952 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728914AbfCOOG4 (ORCPT ); Fri, 15 Mar 2019 10:06:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JvwGEw1dw9jmmMiFejFsjbIrwYf4JclzysSrku9NfYk=; b=AikgcJLanMva6Pr+7q5rCzc675VYsgkHBeSnfUSU2qUH0n/weOTCK1F51Jw4QBhyFE3AzTO6LnZ/qoiWTiaMKhcmfaUAxDTbNvHhrtCeBso0TOVKHZ22aTZMCVBydi95wCodd+hHKS8NmNj1U3aQxBCd9VYMwlQz9IyVti7Xm7E= Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.104.150) by DM6PR12MB3545.namprd12.prod.outlook.com (20.179.106.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.13; Fri, 15 Mar 2019 14:06:52 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::a8aa:c9af:1f69:2a89]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::a8aa:c9af:1f69:2a89%6]) with mapi id 15.20.1709.011; Fri, 15 Mar 2019 14:06:52 +0000 From: "Lendacky, Thomas" To: Peter Zijlstra CC: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Arnaldo Carvalho de Melo , Alexander Shishkin , Ingo Molnar , Borislav Petkov , Namhyung Kim , Thomas Gleixner , Jiri Olsa Subject: Re: [RFC PATCH 1/2] x86/perf/amd: Resolve race condition when disabling PMC Thread-Topic: [RFC PATCH 1/2] x86/perf/amd: Resolve race condition when disabling PMC Thread-Index: AQHU2CpKo7pHNnmOoEW3d1kfA2KibqYMiVwAgAA29oA= Date: Fri, 15 Mar 2019 14:06:52 +0000 Message-ID: <41b30e9d-dcfe-ccae-8cd4-e88df8e4cb9c@amd.com> References: <155232291547.21417.2499429555505085131.stgit@tlendack-t1.amdoffice.net> <155232292270.21417.18139649076000959940.stgit@tlendack-t1.amdoffice.net> <20190315105004.GW5996@hirez.programming.kicks-ass.net> In-Reply-To: <20190315105004.GW5996@hirez.programming.kicks-ass.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN4PR0201CA0060.namprd02.prod.outlook.com (2603:10b6:803:20::22) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:182::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [165.204.84.11] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8b3e8d9a-348a-41f6-bcdb-08d6a94f7910 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:DM6PR12MB3545; x-ms-traffictypediagnostic: DM6PR12MB3545: x-microsoft-antispam-prvs: x-forefront-prvs: 09778E995A x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(376002)(136003)(396003)(39860400002)(366004)(346002)(51914003)(189003)(199004)(256004)(6506007)(53546011)(486006)(86362001)(316002)(305945005)(5660300002)(476003)(81156014)(66066001)(6436002)(81166006)(76176011)(102836004)(6116002)(36756003)(7416002)(229853002)(3846002)(6486002)(31696002)(52116002)(71200400001)(2906002)(71190400001)(72206003)(68736007)(186003)(26005)(105586002)(8676002)(6916009)(7736002)(14454004)(386003)(11346002)(478600001)(25786009)(2616005)(99286004)(446003)(54906003)(31686004)(8936002)(53936002)(106356001)(97736004)(6246003)(4326008)(6512007)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3545;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: amd.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: 6XnYUA5cTiRnPnamgyYf+HCoFjpTVnukSUSCMwEwgViBrk2EGm8EM8BH99piwvJhKjip7BJgVhxeEm7X/bz7qMrMvAOFfoivckWwcaqp19RRrqHqoipmiHUeUXs6xrZkBIFmFIsfSD+r2qYoecmpEvWjUIp/Qs4ijtGmJI/OivCuOolLK24XNdIevRDYZpmbcotpPwOwiXwaL001A6uvrtZJBY6eXn7tAq3s4CyET8Y/RQ3cfnP3S5SFWCRgaeI5q6xvcMG6wUsRdWmTOUNTUJrzgZYfiRGRxm2DMy41K6ocxs+JI423hI9VcLrlbZfn8dFvd0jFApw/brjq/ksGaBg9eH8F5jqgNjri2aZI45F/yONydW/v4AbXizRRSuw4iL0RI1nLLMujygedYQYPXUgpePKC+jfDXaAsIxQl/7Q= Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b3e8d9a-348a-41f6-bcdb-08d6a94f7910 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Mar 2019 14:06:52.2097 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3545 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org T24gMy8xNS8xOSA1OjUwIEFNLCBQZXRlciBaaWpsc3RyYSB3cm90ZToNCj4gT24gTW9uLCBNYXIg MTEsIDIwMTkgYXQgMDQ6NDg6NDRQTSArMDAwMCwgTGVuZGFja3ksIFRob21hcyB3cm90ZToNCj4+ IE9uIEFNRCBwcm9jZXNzb3JzLCB0aGUgZGV0ZWN0aW9uIG9mIGFuIG92ZXJmbG93ZWQgY291bnRl ciBpbiB0aGUgTk1JDQo+PiBoYW5kbGVyIHJlbGllcyBvbiB0aGUgY3VycmVudCB2YWx1ZSBvZiB0 aGUgY291bnRlci4gU28sIGZvciBleGFtcGxlLCB0bw0KPj4gY2hlY2sgZm9yIG92ZXJmbG93IG9u IGEgNDggYml0IGNvdW50ZXIsIGJpdCA0NyBpcyBjaGVja2VkIHRvIHNlZ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