Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2011114rda; Tue, 24 Oct 2023 09:35:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGgSeoIBC41GnfePcPAxdlVpHXiBbJq/Eiqk8u/rZtCZBt88p6bv/zPFCWf7+OUO0VT0wrJ X-Received: by 2002:a05:6300:8002:b0:16b:f71d:1b82 with SMTP id an2-20020a056300800200b0016bf71d1b82mr3160904pzc.34.1698165318516; Tue, 24 Oct 2023 09:35:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698165318; cv=none; d=google.com; s=arc-20160816; b=SoFoPZNMUDuqD2OKwdQcnyxh3LO+6veaPoliH0xT/lF4+mhzioKAnqmDmq/FORLNH9 tJGqDa5quOiUl91f7KrWA3/BTz2sNlrG3OkhsU5zh5iRr49YulLkWpNEYkoe1eI6svc7 RW4g72i3XaDazeCLGVD5Br+9IexotXyuns6Pfzp3wHYIrpppTphfy4mAcwq6dGtmX6pS Yx87nSbrSNrwRxWD7DPfv4zRl/JNSMnsD/CA9qZsoyxMg7z1XemAJmxqtFAHvmzF3HJm 6Uxs6KAun3WkKwN3niMXG3q3mDiwVfNxZUWixXhi1Nn2qpzhgr/k5bIDG6JCNEZHfNvA GShQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7aiZywvRsY6Q9Q6XdkE7hDVMPUu+CQ0jOQmrFXLh59M=; fh=5yK0IAkTibzc8ZNJ5uE9XAXKrJeuQ9x+zCqI3Rqiiqc=; b=MFHR+FUnIpbE/ttdk4UPov8Aid1zzvrtRntQN4Ik4S3dxM9pAq9jqkvwDikRtRSdGb CoHvRmhF1tUnOfED3mMVcQYL9tsATnvTscmcZnoCasxg1klMlVftPjdwfgd/+oj8ADf3 I4RgsMBcZYEDDq1dRcGrfD2Zt+1hh8swPsPjQUFVD5RoM1B7pAH4ulGYBSmeSdtaDNH6 6vhnDIVmH3g82IjXJzq7UDPs2Pi9Ebre2A+HGByDoiL25b299Att1tIjl4zidYVQyYGN IAgVtiFmmSUj6WGgg88RJ1CpLRsnSh4AcNhM9JQzoelmpV0qEYkYsBko8rDVRJ1UbDSH fUhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=kQisp2Zw; 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 Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id bs68-20020a632847000000b005859c874eb7si8544261pgb.701.2023.10.24.09.35.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 09:35:18 -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=@infradead.org header.s=desiato.20200630 header.b=kQisp2Zw; 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 Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4853B802A731; Tue, 24 Oct 2023 09:35:17 -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 S1343947AbjJXQfO (ORCPT + 99 others); Tue, 24 Oct 2023 12:35:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343931AbjJXQfM (ORCPT ); Tue, 24 Oct 2023 12:35:12 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 462E812B; Tue, 24 Oct 2023 09:35:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=7aiZywvRsY6Q9Q6XdkE7hDVMPUu+CQ0jOQmrFXLh59M=; b=kQisp2ZwovIQVYckoNXGBwGKrG 3e5egzEVLe1e9mWSI3TxFDX2czlSZvM4r5St10+3Ba15FiqYx6/kgC6Ao/O2QQ3RFynG1n30yjLGl 0Q+aRCWgyu285A3GXng3Wv3VO5dd7T47Mlf3QyhvuBQRKylud7r7l6Se6giPpbRbMLsUVDM1zEs/h BMPcGl/VXrAj7TbDJliAzOz0HPLD+lvQPpxqI9bjQXzYrhNUp3YqCYgbdwbbIRZk4QKxJG3jFh+G1 xf0KanQY+iQxsK6T6gyqjJJb4aB+0PltrXFk33g/5NTp+XJSKg6XyTlX9NsiLrAPpWR8b/Yl83hRs qiKuv7Gw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qvKMl-00Fdwy-0L; Tue, 24 Oct 2023 16:34:51 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id BD326300392; Tue, 24 Oct 2023 18:34:50 +0200 (CEST) Date: Tue, 24 Oct 2023 18:34:50 +0200 From: Peter Zijlstra To: Mario Limonciello Cc: Ingo Molnar , Borislav Petkov , Thomas Gleixner , Dave Hansen , Sandipan Das , "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 Subject: Re: [PATCH 2/2] perf/x86/amd: Don't allow pre-emption in amd_pmu_lbr_reset() Message-ID: <20231024163450.GB13938@noisy.programming.kicks-ass.net> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024163038.GC40044@noisy.programming.kicks-ass.net> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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]); Tue, 24 Oct 2023 09:35:17 -0700 (PDT) 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() ? > > > #1025 > > Call Trace: > > > > dump_stack_lvl+0x44/0x60 > > check_preemption_disabled+0xce/0xf0 > > ? __pfx_x86_pmu_dead_cpu+0x10/0x10 > > amd_pmu_lbr_reset+0x19/0xc0 > > ? __pfx_x86_pmu_dead_cpu+0x10/0x10 > > amd_pmu_cpu_reset.constprop.0+0x51/0x60 > > amd_pmu_cpu_dead+0x3e/0x90 > > x86_pmu_dead_cpu+0x13/0x20 > > cpuhp_invoke_callback+0x169/0x4b0 > > ? __pfx_virtnet_cpu_dead+0x10/0x10 > > __cpuhp_invoke_callback_range+0x76/0xe0 > > _cpu_down+0x112/0x270 > > freeze_secondary_cpus+0x8e/0x280