Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2498590rda; Wed, 25 Oct 2023 04:47:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFLb2ecivK0SAty06zn7N5MTFFMhAZZ9s5HLW9rn0FtPmp0preor3ZxTybogJWIaDA6X0ML X-Received: by 2002:a25:d10e:0:b0:d9b:87f3:54fa with SMTP id i14-20020a25d10e000000b00d9b87f354famr16397562ybg.16.1698234452871; Wed, 25 Oct 2023 04:47:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698234452; cv=pass; d=google.com; s=arc-20160816; b=PMrFJQV77HvOgAxSMfHcQm2XnWnygapjRP1DQYxetYgkmEia1aqryPJnL/PBa/ePpt wEWRsUxPUw52vJQ+RWddjnVVXnNodo+JZOh0I4X7sFguhQA2YUK41ksKgujtsZCYaoK9 YGPVVwCDKG3UMj1IiQPfNA5vq/+0FNvHJaCW8O+nCvMMMIAJTDEHvX2uOjjA/atbvO8K fE+VQoIT1F1TM94T+tHYvr2mTBIprARug1O6sHPJjTfIJpJiiP86BAZs+x0YGXd3ViTn D8ThOgN67of6Lk09pwnU/GEBbp3uwZfz6z6V11mvlsV0WywpE3MkmayMr0k8Z3HYn4JN b+CQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=W39y/NRyTchyjhLeEH2HS2N2eDNQ72xNMBZSFA+IfJc=; fh=M9A5dfbupTkptCV2Atx0QlQyAa/WqNY3OPVDGz4xDoo=; b=ci9udVwxQ03qhs/VHRuvvpVWpfTZ9SKb1Y1skmdZtZk3t4gY2FhYo05GfYTZvOsw0P mx03A8yYIelJeWxa4mA/uj99ZeTJcthflD0Y8PCZLP1zwWuX0bgeWKmhAmVQ1fAFaWaQ Apwf3kJZVkJBVA5yzl//2HosZ+p+OOkf/XC2mkCZucgLXZPRXCXkaokiCBwtr9w9pwMT dh+GiSC9cI6DODdwKKrMLMXeCipe69lVJa+5KkZcibLoJ8Cn++euHzaG9PuXqDCam0Gf Ptcl47QsU2Pk5qfQIzE6YVaQ14u510fPlyce0s6QKBgLWIK/zQKGv3pK1lDFZ3EZ6vwQ AGuw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=l4eK3o9t; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e83-20020a255056000000b00d9ace9f2080si10067392ybb.48.2023.10.25.04.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 04:47:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=l4eK3o9t; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3347E80E73FC; Wed, 25 Oct 2023 04:47:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234404AbjJYLr2 (ORCPT + 99 others); Wed, 25 Oct 2023 07:47:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232688AbjJYLr1 (ORCPT ); Wed, 25 Oct 2023 07:47:27 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2050.outbound.protection.outlook.com [40.107.243.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1522812A; Wed, 25 Oct 2023 04:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UPX8JqEqBaUtfCgboWpd4K2TYz//9W13yGE8arBvl3QJEMvgNPJzLIMWn8OxOivvCx22UdP3jkqKXHiCgjbV6oWT44K/qRohSAZLyWmkoQKOwsZ8bml+FNkzwu57kcXGYBHE1UD+q4vhl0VxUGVZthXpPH9eT59Hi+UrPF5uAyv0N36EIAomN8lmY915tPNhy4Tdyo9Ie1kPOOmrrfB/HEjMAeK1fYSG64qVGtIovc4+1B+Vy0EyMwn9xY6G1oiJI9NT/IDHUWew9bjfpD1vkk1sUBcYd75EyNHARzlEhwyjf8NiuMjkPsBi8MmOqHQyqtPjNZtKqiGEChT27wV1Mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W39y/NRyTchyjhLeEH2HS2N2eDNQ72xNMBZSFA+IfJc=; b=lx9gE9eg08O3N3HTQV60cSmBecJ+LCfg50Og2XNZqAiUrb24f63SiMr7D+vLz5aEor5P7nnUQCq7y0WYmL811vVts1x/A6H2RvKqYqw6Ej7V+Ovo5BOxXRNxsJg5y3OOvneEWlNnCA9NPKFA4CAI/mfMAsAPUSqlWyCEDi92w79OFFlDkOEAPulfZ4B1mWGXDBCMX7ajGkfzicCHAP7S6HYKp/DQm/tP0aZZYbOaIEnS+THzE58s/Ff5CVvGlQLk43XUS8a29MFBc7rZHIXy87fMQNKLYl2LGqLwpKO5YXwUSbCMZHNww42pcXDuOGJ9zXOjYgyOBm7dCugWz4ZTZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W39y/NRyTchyjhLeEH2HS2N2eDNQ72xNMBZSFA+IfJc=; b=l4eK3o9t1foXN6qxBUbW20Jban957TR6j8cG6iJwhSKsXbQ0hzHrVCI18c+E/XbKN/nBoVoWsYMMq2CJPphBDGrSBlPZGX0v89NVYR0TsU5Uok0KEc1mtakKtWiClJWg03g9DHpMfXuFqHrAigpmTsI4KERjCTDR9OMj2FJ+sgw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) by SA1PR12MB7365.namprd12.prod.outlook.com (2603:10b6:806:2ba::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Wed, 25 Oct 2023 11:47:22 +0000 Received: from PH7PR12MB5712.namprd12.prod.outlook.com ([fe80::f2fc:3e18:9e90:d060]) by PH7PR12MB5712.namprd12.prod.outlook.com ([fe80::f2fc:3e18:9e90:d060%5]) with mapi id 15.20.6907.030; Wed, 25 Oct 2023 11:47:22 +0000 Message-ID: Date: Wed, 25 Oct 2023 17:17:34 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] perf/x86/amd: Don't allow pre-emption in amd_pmu_lbr_reset() Content-Language: en-US To: Peter Zijlstra , Mario Limonciello Cc: Ingo Molnar , Borislav Petkov , Thomas Gleixner , Dave Hansen , "H . Peter Anvin" , linux-kernel@vger.kernel.org, x86@kernel.org, linux-pm@vger.kernel.org, rafael@kernel.org, pavel@ucw.cz, linux-perf-users@vger.kernel.org, Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter References: <20231023160018.164054-1-mario.limonciello@amd.com> <20231023160018.164054-3-mario.limonciello@amd.com> <38ea48b4-aaba-4ba4-84a1-e88d6cb9df94@amd.com> <20231024155939.GF33965@noisy.programming.kicks-ass.net> <47518940-2803-4a6b-88fd-8cfc872b4219@amd.com> <20231024163038.GC40044@noisy.programming.kicks-ass.net> <20231024163450.GB13938@noisy.programming.kicks-ass.net> From: Sandipan Das In-Reply-To: <20231024163450.GB13938@noisy.programming.kicks-ass.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN0PR01CA0030.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:4e::12) To PH7PR12MB5712.namprd12.prod.outlook.com (2603:10b6:510:1e3::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR12MB5712:EE_|SA1PR12MB7365:EE_ X-MS-Office365-Filtering-Correlation-Id: 50bea83e-1d6a-4b91-5440-08dbd550266b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9iyDs5BYelwfXRfrKEA6HX/+w7jR7/I7jIVV8hOt+el4LZ+UfNZ42Ife9M7QoCz8JyBcPb5bHqpYXrrwL1/i7PpvcbvJzIjB0+0kg8phG+cLcYUv+MX32U93sW7mDt6g0lsZIJLvs8hkZYL7nm8Byp4reCaNlPdIWrAvmO82o1tjJry//34MhnF7VA2ZMwIgdxyetQ4MXJYFPBdMLAw6963owRduPwM0qy2RG5k17CAOmw1devvC49kPWHZq7aqhCpd9ajNpf4PtvKPBtnHlCmB3pbYVWPMDO0DCmKYSce+kW3dr6/it8Gpsz3S2UGSc+wKhWgAbrelxcdqWANGMhdLGtvJmqmzaEtgpwSy1iasHvL5AmNp9pY5O+mjGcy3Al2YgSnt1j8hAFId5JWoRiG1xRFX0o2htCO6RDiIqmyrLW9EMvMgeRCaICexRDyIDC+Pf8uVxNWfeMhvyFCVHF4UrTwJL6wljfmPmVRjK2iHYF9Q33C08wYdxdmwoM+N8E7n7FLfEbEMWWDXyCtNKcrm2DUT6irRI8gYkUrR7KHj8S11QgbQYNzAFRhq3iJbVzl3q6Za4dbn/Smd3pP6O4oVELXMEYBN26+uC87nlhhZxV3ZVWhxAbvizxhRILs3TVrEdzVmxy3xFGhKceOy8UQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH7PR12MB5712.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(376002)(396003)(346002)(39860400002)(366004)(230922051799003)(1800799009)(451199024)(64100799003)(186009)(26005)(31686004)(31696002)(44832011)(38100700002)(2906002)(86362001)(7416002)(5660300002)(36756003)(4326008)(8936002)(6666004)(8676002)(110136005)(6486002)(6636002)(2616005)(6506007)(66476007)(41300700001)(54906003)(316002)(66556008)(66946007)(478600001)(83380400001)(6512007)(53546011)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?S1lMTmtTR21YUjIvdU0xS1haTE9IL2UzNk1qWjg3WXlDaVU0YXZ6WGZBOHkr?= =?utf-8?B?c1NmajI3citWSmRUOVlSa0VIMU84QmhiN1NmZGsrdWpNSHB2RHZna3g3L2po?=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wSjM0NW03L3IwN1E5TW5PUkNnLytSQmNtU2IzQldJ?= =?utf-8?B?WllldDlJTm05aUpTRUVaa1Z6MW9KcXd3YStWblJIUWRYaGJ5NmFJb0hERlRp?= =?utf-8?B?alRUMmpQT3pZL253NEYxS1ZsNEdtd2tDR2paS2RVREtBNjVjNTA4eUJHZ1Fz?= =?utf-8?B?WnBQR0RxZFVxaS9VVm9ibWJjQWp5ZmtYUHdGcU9UbkNYcmVJUGFONGVIUVh5?= =?utf-8?Q?E4XabQci/JC/V4T9qT8KI8jvj?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 50bea83e-1d6a-4b91-5440-08dbd550266b X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB5712.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 11:47:22.5091 (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-CrossTenant-UserPrincipalName: W9/ncSs0LoWLxIF/tHc4Lz7F8Sspu1LnrN3Jgsab6USXayLGYEw4JhSM0AufbOeGc8GlznVh72kGGw8ZPToPvA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7365 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 25 Oct 2023 04:47:31 -0700 (PDT) On 10/24/2023 10:04 PM, Peter Zijlstra wrote: > On Tue, Oct 24, 2023 at 06:30:38PM +0200, Peter Zijlstra wrote: >> On Tue, Oct 24, 2023 at 11:04:06AM -0500, Mario Limonciello wrote: >> >>>> IIRC this is the hotplug thread running a teardown function on that CPU >>>> itself. It being a strict per-cpu thread should not trip >>>> smp_processor_id() wanrs. >>>> >>> >>> BUG: using smp_processor_id() in preemptible [00000000] code: rtcwake/2960 >>> caller is amd_pmu_lbr_reset+0x19/0xc0 >>> CPU: 104 PID: 2960 Comm: rtcwake Not tainted 6.6.0-rc6-00002-g3e2c7f3ac51f >> >> Very much not the cpuhp/%u thread :/, let me try and figure out how that >> happens. > > Uhh, my bad, these are the PREPARE/DEAD handlers, they run before online > and after dying. The CPU is completely dead. Running lbr_reset() here > makes no sense. > > Did that want to be in amd_pmu_cpu_dying() ? > Agreed, it should have gone into the cpu_dying() callback. lbr_reset() is called once from cpu_starting() so I wonder if its necessary to call it again in the CPU offline path.