From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2634ECDB474 for ; Fri, 20 Oct 2023 12:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QkXXkebCFJDOhM/seJszBUiA9/HPex17KPtS4yy7mxw=; b=GW9nQEYVsElBSn zVmErI1nlyclZGt+k0L1oyoeDMSraZ2UMCkW1lcTyXr1gekAvBeiBoqzMbT9elQElmYmYqUSOM2zv cIay5VlnXLVzuLtcK8ILVm+Yx3ez1JH4ne6LJ6hCLqMx0vlzoqKaFJMNO4cA+qVbkUwETWvn9GmWm Z912o9p+/yK7MHc+kkLfGN2KjVxUgNb8GhkpXNUg67oL8dDnkwWfVeHF1t5TaYetK6J4S9vi5BsrB 5RNp41GDn1dYWz2qEvV4BI9Qs84qii33lkTCjI2/1wzqjynbTTFzKxdRpDJDcW4mRF/iDaimsn6VO JMWFviERZEWJkIMumr4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtoz7-002HC5-21; Fri, 20 Oct 2023 12:52:13 +0000 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtoz4-002HB1-0l for linux-arm-kernel@lists.infradead.org; Fri, 20 Oct 2023 12:52:11 +0000 Received: by mail-lj1-x229.google.com with SMTP id 38308e7fff4ca-2c515527310so11248501fa.2 for ; Fri, 20 Oct 2023 05:52:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1697806320; x=1698411120; darn=lists.infradead.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=YJ2rNxHtt+O1xvO+buVTB/lXtqb4AV5UuwwFt4RaJHM=; b=UMsGuyyxIGyEI+W23DxAvml6exDNipfj7PSViYwzz7SpMHDJvT5qb0T762CDZVV0e6 u0W4KlR4hurxNRFToTeU2CGUYD48DoaVGtAvbwiMxhcNCFNRgHoTIll63pvRf8wV0KVS S2CMiz+18IDeGMxVgu+E1kMXnFzUSmk1UFwhM7cYecBciWnLIjefTJec42CGCh/k/OQ1 Nh9PKfenrlOH+4XzU/K66qCevZoya1sdaTQ+qeweeOZts8EOl24LPu6lmnihRGsP0aqm lZ9HjNAV5/1iwmJbiNth9mjPkZsxRvMLsBF2y2YQ0WjJ4xFl5LS46FrrBv88oy/OwxPK H2Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697806320; x=1698411120; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YJ2rNxHtt+O1xvO+buVTB/lXtqb4AV5UuwwFt4RaJHM=; b=ekGJufG15C72UTbLROqMSAOTpYDCtNXMq9r725iSrC0mC5EG7cIMbJZ1TlnTJbxz2/ MBzqRWPwAmZ2ONhsYj+AF4xp6DcJuewJ+7+N0GfWKGm+C9cKf/EdWXFjQGhB//+hmQ6b YegmLvDtc6wd5xRPRXpLgiykhGNrIGCk6R6bDj26c7zWRi9mhdTL1GoBYaUgEnw63m6k JnrYvoV0N11LFQrj62ODB1+NxszLDDa93B3Mw3z2v/ABZPWZTD71yTVEvOGPl4kGat8V jUWFdm+IXfIy2FlaPj732gm9IvlJgVgXhzauhOsw10bM5rgS7AUmUnjQhTVRVGrm1nBO WGyw== X-Gm-Message-State: AOJu0YwDvojKtLOE78v6N7072+T9dcRvKyQIgx35/Q6IEyvBbEK/3GYN w9ENjb0oXV9kBJ4IuoomgzO7nw== X-Google-Smtp-Source: AGHT+IHugvfk5cxGPj8ACys9s5ycx97jrr/zvGkg3y0J+yohoSEOehKHa7JfZykIrg0KeT4sBZN9rg== X-Received: by 2002:a2e:9952:0:b0:2bf:f989:b8e5 with SMTP id r18-20020a2e9952000000b002bff989b8e5mr1156153ljj.33.1697806320558; Fri, 20 Oct 2023 05:52:00 -0700 (PDT) Received: from localhost ([95.148.15.118]) by smtp.gmail.com with ESMTPSA id j20-20020a05600c1c1400b004065daba6casm7038686wms.46.2023.10.20.05.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 05:52:00 -0700 (PDT) From: Punit Agrawal To: Jeremy Linton Cc: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, mark.rutland@arm.com, maz@kernel.org, anshuman.khandual@arm.com, krisman@suse.de, broonie@kernel.org, james.morse@arm.com, ionela.voinescu@arm.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64: cpufeature: Display the set of cores with a feature In-Reply-To: <20231013013016.197102-1-jeremy.linton@arm.com> (Jeremy Linton's message of "Thu, 12 Oct 2023 20:30:16 -0500") References: <20231013013016.197102-1-jeremy.linton@arm.com> Date: Fri, 20 Oct 2023 13:51:59 +0100 Message-ID: <874jilpic0.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231020_055210_315594_FB69F665 X-CRM114-Status: GOOD ( 29.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Jeremy Linton writes: > The AMU feature can be enabled on a subset of the cores in a system. > Because of that, it prints a message for each core as it is detected. > This becomes tedious when there are hundreds of cores. Instead, for > CPU features which can be enabled on a subset of the present cores, > lets wait until update_cpu_capabilities() and print the subset of cores > the feature was enabled on. > > Signed-off-by: Jeremy Linton > --- > arch/arm64/include/asm/cpufeature.h | 2 ++ > arch/arm64/kernel/cpufeature.c | 16 +++++++++++++--- > 2 files changed, 15 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h > index 5bba39376055..19b4d001d845 100644 > --- a/arch/arm64/include/asm/cpufeature.h > +++ b/arch/arm64/include/asm/cpufeature.h > @@ -23,6 +23,7 @@ > #include > #include > #include > +#include > > /* > * CPU feature register tracking > @@ -380,6 +381,7 @@ struct arm64_cpu_capabilities { > * method is robust against being called multiple times. > */ > const struct arm64_cpu_capabilities *match_list; > + const struct cpumask *cpus; > }; > > static inline int cpucap_default_scope(const struct arm64_cpu_capabilities *cap) > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index 444a73c2e638..18711e35924c 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -1944,8 +1944,6 @@ int get_cpu_with_amu_feat(void) > static void cpu_amu_enable(struct arm64_cpu_capabilities const *cap) > { > if (has_cpuid_feature(cap, SCOPE_LOCAL_CPU)) { > - pr_info("detected CPU%d: Activity Monitors Unit (AMU)\n", > - smp_processor_id()); > cpumask_set_cpu(smp_processor_id(), &amu_cpus); > > /* 0 reference values signal broken/disabled counters */ > @@ -2411,10 +2409,12 @@ static const struct arm64_cpu_capabilities arm64_features[] = { > * message to be shown until at least one CPU is detected to > * support the feature. > */ > + .desc = "Activity Monitors Unit (AMU)", > .capability = ARM64_HAS_AMU_EXTN, > .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, > .matches = has_amu, > .cpu_enable = cpu_amu_enable, > + .cpus = &amu_cpus, > ARM64_CPUID_FIELDS(ID_AA64PFR0_EL1, AMU, IMP) > }, > #endif /* CONFIG_ARM64_AMU_EXTN */ > @@ -2981,7 +2981,7 @@ static void update_cpu_capabilities(u16 scope_mask) > !caps->matches(caps, cpucap_default_scope(caps))) > continue; > > - if (caps->desc) > + if (caps->desc && !caps->cpus) > pr_info("detected: %s\n", caps->desc); > > __set_bit(caps->capability, system_cpucaps); > @@ -3330,6 +3330,7 @@ unsigned long cpu_get_elf_hwcap2(void) > > static void __init setup_system_capabilities(void) > { > + int i; > /* > * We have finalised the system-wide safe feature > * registers, finalise the capabilities that depend > @@ -3338,6 +3339,15 @@ static void __init setup_system_capabilities(void) > */ > update_cpu_capabilities(SCOPE_SYSTEM); > enable_cpu_capabilities(SCOPE_ALL & ~SCOPE_BOOT_CPU); > + > + for (i = 0; i < ARM64_NCAPS; i++) { > + const struct arm64_cpu_capabilities *caps = cpucap_ptrs[i]; > + > + if (caps && caps->cpus && caps->desc && > + cpumask_any(caps->cpus) < nr_cpu_ids) > + pr_info("detected: %s on CPU%*pbl\n", > + caps->desc, cpumask_pr_args(caps->cpus)); > + } > } > > void __init setup_cpu_features(void) Thanks, Jeremy for putting this patch together. The duplicated prints bothered me too every time I stared at the boot logs. Fwiw,, Reviewed-by: Punit Agrawal Tested-by: Punit Agrawal The patch was verified on an N2 based platform. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel