Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3492755rwb; Fri, 30 Sep 2022 04:32:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6qfvu6wV+Ngjfw0rQKJmRhrzo+lsVATGp+/sw2UmwD0bgxQaZi+4sBjk/BzliwkJHg4zFi X-Received: by 2002:a17:906:5d07:b0:781:c281:f6e4 with SMTP id g7-20020a1709065d0700b00781c281f6e4mr6174236ejt.744.1664537529931; Fri, 30 Sep 2022 04:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664537529; cv=none; d=google.com; s=arc-20160816; b=g9xrGJfRiPpTxwVruFPwo0vaTCbRoQZKlW9IwFx+LPNpuJh1aYroJZiUNkBztg1DwG V4O242HeI+MyElOAokXKDRVlfZg0d+lsiqNnq752aPG+vS+mFU2/nxymUwX3Ntye7xvl RW87MJ1liNxDCaNtCwUGe7+B0Hv1Lq1yNp+eqjtWzgapCeOSAwgELEBc9ncNpacSMdI1 xmqwBwo6EFDhKV5lcSCMPLhe9nOm1c3pRpzeBqo/7HtCqe4HD+pafqw0ZH+Jw5EspHYG 3sEuU+6HUO8g446FIF/Sw7e4wvh2GNYZvOWgW/x0VI+y+5at8bOkOfEkbIRv/KCDEWpm Igiw== 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; bh=VAfYOS6mqM4VZxIYbGVqeaqzAhdNJrNZYtbMZyEufB0=; b=BWX2fUZj2wurnancy8fA/59h0cIXtMwONUFrQJtez+2ZI0maX0rVlj05TqD4YG9MoG 7xyU79teGGI8uFQvSvtGEVh3sieB8Oz+dPWN3nsz4hHBRHIgwwTgy6KsK7RyxdLKDAFP cYU54/6AyHUVypQ7MBmq9zUFVAUqzho+VZDTfLNyGCWi2ejwjLl62+gY+qQan/76OHEI naoQvt8Mn3oM4jgsiiq9pn9dEdcNcA/yfWnx7yYng5XLwn/uuaGjcNK0dk+plBHwnFrQ YP9V9SsVNNG39q5mkOjwayOSpI/kCOWf7Agbs90/DPLxhpD5IkfL4hBuP2PUtn7GXhLq RXdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr13-20020a170907720d00b0073d8659db5csi1468158ejc.966.2022.09.30.04.31.43; Fri, 30 Sep 2022 04:32:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231534AbiI3L3t (ORCPT + 99 others); Fri, 30 Sep 2022 07:29:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231458AbiI3L14 (ORCPT ); Fri, 30 Sep 2022 07:27:56 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BBD8617E13 for ; Fri, 30 Sep 2022 04:19:50 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F2F9B244B; Fri, 30 Sep 2022 04:19:55 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.81.185]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E18C73F73B; Fri, 30 Sep 2022 04:19:47 -0700 (PDT) Date: Fri, 30 Sep 2022 12:19:42 +0100 From: Mark Rutland To: Pierre Gondois Cc: linux-kernel@vger.kernel.org, Dietmar Eggemann , Valentin Schneider , Thomas Gleixner , Sebastian Andrzej Siewior , Will Deacon , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 1/1] arm_pmu: acpi: Pre-allocate pmu structures Message-ID: References: <20220912155105.1443303-1-pierre.gondois@arm.com> <20220912155105.1443303-2-pierre.gondois@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 On Fri, Sep 30, 2022 at 10:01:12AM +0200, Pierre Gondois wrote: > On 9/29/22 17:56, Mark Rutland wrote: > > On Thu, Sep 29, 2022 at 04:08:19PM +0200, Pierre Gondois wrote: > > The big problem here is that while we can detect those PMUs late, we only > > register them with the core perf code in arm_pmu_acpi_probe(), so even if we > > detect PMUs after that, those PMUs won't become usable. > > > > I don't think we can support the case where none of the CPUs associated with a > > PMU are booted at startup unless we make more substantial changes to the way we > > register the PMUs with perf (and that would be going firther than what we > > support with DT). > > > > We can support bringing those CPUs online, just not registering them with perf. > > > > > I tried the patch on a Juno-r2 with the 'maxcpus=1 apci=force' parameters. When late > > > hotplugging CPU1 (which has a different pmu than CPU0), no pmu structure is found and > > > the cpuhp state machine fails (since arm_pmu_acpi_cpu_starting() failed). > > > > Ah, sorry, I missed that returning an error here would completely halt bringing > > the CPU online. We arm_pmu_acpi_cpu_starting() to return 0 rather than -ENOENT > > when it doesn't find a matching PMU, which would permit the CPU to come online. > > > > I've made that change (and pushed that out to the branch), and it seems to work > > for me, testing in a UEFI+ACPI VM on a ThunderX2, with the arm_pmu_acpi code > > hacked to use the cpu index (rather than the MIDR) as the identifier for the > > type of CPU. > > > > With that change, booting a 64-vCPU VM with 'maxcpus=8', I see each of the > > boot-time CPUs had its PMU registered: > > > > | # ls /sys/bus/event_source/devices/ > > | armv8_pmuv3_0 armv8_pmuv3_3 armv8_pmuv3_6 software > > | armv8_pmuv3_1 armv8_pmuv3_4 armv8_pmuv3_7 tracepoint > > | armv8_pmuv3_2 armv8_pmuv3_5 breakpoint > > > > ... and if I try to online a non-matching CPU the CPU will come up, but I get a > > notification that we couldn't associate with a PMU: > > > > | # echo 1 > /sys/devices/system/cpu/cpu8/online > > | Detected PIPT I-cache on CPU8 > > | GICv3: CPU8: found redistributor 8 region 0:0x00000000081a0000 > > | GICv3: CPU8: using allocated LPI pending table @0x0000000040290000 > > | Unable to associate CPU8 with a PMU > > | CPU8: Booted secondary processor 0x0000000008 [0x431f0af1] > > > > If I do the same thing but without the MIDR hack, it also seems to work: > > > > | # ls /sys/bus/event_source/devices/ > > | armv8_pmuv3_0 breakpoint software tracepoint > > | # cat /sys/bus/event_source/devices/armv8_pmuv3_0/cpus > > | 0-7 > > | # echo 1 > /sys/devices/system/cpu/cpu10/online > > | Detected PIPT I-cache on CPU10 > > | GICv3: CPU10: found redistributor a region 0:0x00000000081e0000 > > | GICv3: CPU10: using allocated LPI pending table @0x00000000402b0000 > > | CPU10: Booted secondary processor 0x000000000a [0x431f0af1] > > | # ls /sys/bus/event_source/devices/ > > | armv8_pmuv3_0 breakpoint software tracepoint > > | # cat /sys/bus/event_source/devices/armv8_pmuv3_0/cpus > > | 0-7,10 > > > > ... so I think that should be ok? > > Ok yes, thanks for the explanation. I tried it aswel and everything > was as expected.Just some typos: Great! > patch 1: > factor out PMU<->CPU assocition > -> association > A subsequeqnt patch will rework the ACPI probing of PMUs, and we'll need > -> subsequent > > patch 2: > A subsequeqnt patch will rework the ACPI probing of PMUs, and we'll need > -> subsequent > > patch 3: > The current ACPI PMU probing logic tries to aassociate PMUs with CPUs > works. The arm_pmu_acpi_cpu_starting() callback only tries to assocaite > though we will now warn when we cannot assocaite a CPU with a PMU. > -> associate (for the 3 lines) Sorry; those were particularly typo-ridden. Thanks for the corrections! I'll send these out as a series shortly. Thanks, Mark.