Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1263117imc; Mon, 11 Mar 2019 09:49:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcHSt9M2rdPBfkq5oSi8HYHXSOcrKCG9raRkL66b8Yx0yJiR0YNa+RbxUQD0noq4btrgZs X-Received: by 2002:aa7:885a:: with SMTP id k26mr33926618pfo.70.1552322978527; Mon, 11 Mar 2019 09:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552322978; cv=none; d=google.com; s=arc-20160816; b=nhKgDBGybNk28LQMTaIFC1gQEk8ZzIQsbNxewsKlLzOQh6GQMA/Gb1hgBeMkcSHKUF 7qZCl0iMxdWwKspPykFq79b9qjpq2Nk3szqUSFKwdLDgIw2DLhxSE3Ce9jhlcLVl3rE7 Rd0EpFB855oYlWYILmdojMUUkvz/3BtAkwRTpd+zu5W2W5IY0+CfY7PHjZ1jFuV6fNBl ozL5qdVEGceP+2+Ldn9WfHb+ZqrJ+D6Eb2xUA0t9uvWpId1ly7VYyv5HvC8UxumYF1am ub67jZ/xgKDAJRAk/bBCT68iIImXYjGW8NlL88YflglDj1AiLtgRRJKvGruGfROmfZp3 Lyjw== 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=ha/AkOvp6lBvpUzy4kIEr4RqIU4kdZWrra9R2jiwPWE=; b=Uq2IHN7ZD471xBudWM8U8wo7QD8ZNEOoEVhfdZ0FmCXz0OW7swsr+vKBvWYw+mxpek aZou5eM0MBqYVRir47+lpUiWqFez7T7/rDKPbvsrhb8/ZrE8Ip4d/GRz5FWCzeyl/i+f bWccrYX0OZmcMkhSynQIjewNB5H+Ru2Qq1Eux8ViYu/OLapGBSM8Wa1oEqc6JcDv9n1p UQw0j1oMp4rRPBUFhhh7KtBxmIkrxqAKjPpGnLfOALswnzACFNo8z6/Z5BEAtacdNmNu WntZchJ8JiEFCFwzbDLAyufsjdoprYWNwuXgzP/12tYygCX+hd5DT5Rf2yYfcIkT5dZW CLSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=jtZoQk+e; 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 z3si5869139plb.402.2019.03.11.09.49.23; Mon, 11 Mar 2019 09:49:38 -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=jtZoQk+e; 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 S1727534AbfCKQss (ORCPT + 99 others); Mon, 11 Mar 2019 12:48:48 -0400 Received: from mail-eopbgr720077.outbound.protection.outlook.com ([40.107.72.77]:27444 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726675AbfCKQss (ORCPT ); Mon, 11 Mar 2019 12:48:48 -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=ha/AkOvp6lBvpUzy4kIEr4RqIU4kdZWrra9R2jiwPWE=; b=jtZoQk+e4jSnSFRCJxZQm5OBVU9zLtk1VO8nFIYpseIv2iHPTR2z9pGAv4iekbohNiTK/iqslSzO9HNXSDQI/FnIsb4cCvj2yQcqjhv+BLzJ37Va72+1pLLQod1JluKryox52yBE9LQwjMT5zMM5qLw/MHRyz2dfkN3dVP68LAc= Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.104.150) by DM6PR12MB2891.namprd12.prod.outlook.com (20.179.71.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1686.18; Mon, 11 Mar 2019 16:48:44 +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.1686.021; Mon, 11 Mar 2019 16:48:44 +0000 From: "Lendacky, Thomas" To: "x86@kernel.org" , "linux-kernel@vger.kernel.org" CC: Peter Zijlstra , Arnaldo Carvalho de Melo , Alexander Shishkin , Ingo Molnar , Borislav Petkov , Namhyung Kim , Thomas Gleixner , Jiri Olsa Subject: [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: AQHU2CpKo7pHNnmOoEW3d1kfA2Kibg== Date: Mon, 11 Mar 2019 16:48:44 +0000 Message-ID: <155232292270.21417.18139649076000959940.stgit@tlendack-t1.amdoffice.net> References: <155232291547.21417.2499429555505085131.stgit@tlendack-t1.amdoffice.net> In-Reply-To: <155232291547.21417.2499429555505085131.stgit@tlendack-t1.amdoffice.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: SN4PR0401CA0016.namprd04.prod.outlook.com (2603:10b6:803:21::26) 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.78.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 9fb3e4a7-ac52-418e-3624-08d6a6416c7f 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:DM6PR12MB2891; x-ms-traffictypediagnostic: DM6PR12MB2891: x-microsoft-exchange-diagnostics: 1;DM6PR12MB2891;20:0kyTGNsLP2v36YDGsBwRKk+6QQIEPtitFCP8wQL3ZRRgT3TOEjMtouKcYpcOoYV6qlWNcAMbtcoBVKdM1j3NiDxlxpd6aPrJD4iIORxIeJuJMXdXUMtkenzBepzTTeTEL+edet2X2jxhMkhRw0DIoABz0nLlMXPGB5lcNQJX2ifxcAA/6geg3yNDHYPGd8w7UAgsgbmNA93yDprT5dPr3MdSAy/aQEEfH2icoIBe07emDHWzCFFD4fAKDnBs9dlD x-microsoft-antispam-prvs: x-forefront-prvs: 09730BD177 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(39860400002)(366004)(136003)(346002)(376002)(199004)(189003)(4326008)(25786009)(6116002)(72206003)(103116003)(9686003)(102836004)(66066001)(68736007)(186003)(476003)(11346002)(446003)(256004)(478600001)(8676002)(71200400001)(6436002)(97736004)(6486002)(81156014)(81166006)(71190400001)(14444005)(6512007)(86362001)(316002)(110136005)(54906003)(2906002)(106356001)(7416002)(105586002)(2501003)(53936002)(5660300002)(3846002)(14454004)(486006)(26005)(8936002)(7736002)(305945005)(52116002)(76176011)(6506007)(386003)(99286004);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB2891;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX: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: 8WVrs+cQLae7XRdILpNOyWRxo52kyxXz6XDJwLt9IKqDVDyeTa3K6Y3wIAHS6V2hSac1ZkIR3Aovav48U46qsPlK/aMlr28uPeawbvNUJsDA+gGC3fYdA8JExpplOzNnla2AvytNOuYsslDu1o9Av2p8Wpjrh0MtAsCpkYhZlRLZD2bgey3KGToSmmujc43FJHj0Bz70QDj8cnjlECkkg9lNrubhc0IXIIupWp9v8tovfSeedGXmHy7I2SMD39RKY7+f+jkfu0VTRd+cpw7nrORQi14/GuYbFt3fdMxf5X0H9b82DQ1+0YVqOmvSFikZHYAGXU1HG71+VPEI6Wa+lX0ZOlTpiMPblWppCc1IGMXjh4J9yWuWEYN4yYUJWbJunJeZlNXUaXvfKGlL/ZfTLiLiXrrguSVDu748tf1V/kk= Content-Type: text/plain; charset="utf-8" Content-ID: <97B576A56419FB4FB26C53C19AEC493B@namprd12.prod.outlook.com> Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9fb3e4a7-ac52-418e-3624-08d6a6416c7f X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Mar 2019 16:48:44.5006 (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: DM6PR12MB2891 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org T24gQU1EIHByb2Nlc3NvcnMsIHRoZSBkZXRlY3Rpb24gb2YgYW4gb3ZlcmZsb3dlZCBjb3VudGVy IGluIHRoZSBOTUkNCmhhbmRsZXIgcmVsaWVzIG9uIHRoZSBjdXJyZW50IHZhbHVlIG9mIHRoZSBj b3VudGVyLiBTbywgZm9yIGV4YW1wbGUsIHRvDQpjaGVjayBmb3Igb3ZlcmZ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