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 26235CDB474 for ; Fri, 20 Oct 2023 13:07:33 +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=dUGH1Ks5NujNOK3F8aFXn02UBcbtYZqsiRCuGZc63hc=; b=VO8c6drLpdPH7r ZYVJsIIllOgKMa2I3CgQ2cVJ97FR7ECmY1tS9wX6MWfKWPh+wffL3S5uH0RiOKI8+pcwcTUcYNnGO z+h1WbXKmw7+Q2ffCxvrnu8K1d4FU6DOB7Az3vY7MY9k25M/5HeGfuXwn/qvvdmjBKTk2nC6jdv11 O42fP31GscKJaqaS/1dho9rEM4PIIE31734uqeGHPxLLuCshIDWyVPrAkwqBliiYFZtYZhQbREQKZ 4Z39Iag+ExJC8BhxOP1c1mnbeR6qDBZ9Zr0/hrQKe2qZbCAx7ktWlmnvaEn8pvVGpQFW/e/cU0UuN f3W5QOs88TDFI5IoaYKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qtpDQ-002K7e-1s; Fri, 20 Oct 2023 13:07:00 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qtpDN-002K3u-0H for linux-arm-kernel@lists.infradead.org; Fri, 20 Oct 2023 13:06:58 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40837ebba42so6150925e9.0 for ; Fri, 20 Oct 2023 06:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1697807211; x=1698412011; 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=WCm+EqBMn/4mUTNVySVuHeEM7hbwegHPI112FGAJ2Rg=; b=ZYFOlvDR4h1yNx/jbMT86uk/xeGH9CRx8YHShmGy/tdBRjDS/ORpDlY3rOv0X/Zexb TAkGKfCEzU0RqcbR6KOgeGFXovE0RVauSWO+6LU++ArEookcD3vpjpO0Q3xENeIPduAX klOxvjLh1vmfdaNMOmx1+uK01eEGdPzA8zTkVXMcXpekWbeXjN5pd4tq/2FfUSEftA0k /k6wPskwNub/8o1n2El/IWMdtlrYUCcP9wcBxnea+mfcX3Dhx+FBTvsWAj+Gl4eyo3cC 1wsxcPskwij4s0JLEXk3W4SnV6l81l5DkcgKGTJwZBhcgX2ZV5bw3bEUA/7qBdFQ/EKL zcag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697807211; x=1698412011; 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=WCm+EqBMn/4mUTNVySVuHeEM7hbwegHPI112FGAJ2Rg=; b=ApJqo6m0jJezGpPQJN/tydIoHLLS03pHj4lDrQ881N/wohdVsY2/UUeYIhiOjX79Gn t1IEsVRFRWClMQKA53cnM3h3shThjR6p4vOgM4f3lGyhMCkEhFKrKMKvHkqiRbo3H+4C vQQWWt6XMLxhca0krMwCHBeFnIlYPwfcpBwEiRwd8b/gjERM2I2xOYqIpAgrR+dRROAK KQ2vfDAWiA1sSTKoJkqaFR+m4dxgL5VojH67y506xrZtGi38YtfZurwB4c4XfCAXTXIw R4g3zUGQzwS+xSPNlW9RvmdU6LcrWHqYvKz9kP7jieJiAk7lIhgjdd/W4KkwSpX11Iqa aa7g== X-Gm-Message-State: AOJu0YzxqBxCgkiYOtuL8w6aGgTiaKQSJkgJww0LJWiGi+FXQsTte5y2 feeqaLssMBVZGCwvzpJ5wqGeBFwEiwKdGVrmvsQ8yQ== X-Google-Smtp-Source: AGHT+IFIvV5TUpm/s3Z1DUytrd1IeI/v7LKPHLGYxHYYOsW2nyBVcgsbo9bseFvy7Lte64hmpJsR0w== X-Received: by 2002:a05:600c:3096:b0:405:95c3:e79d with SMTP id g22-20020a05600c309600b0040595c3e79dmr1396174wmn.40.1697807210658; Fri, 20 Oct 2023 06:06:50 -0700 (PDT) Received: from localhost ([95.148.15.118]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c198a00b00403b63e87f2sm2155727wmq.32.2023.10.20.06.06.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 06:06:50 -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 v2 1/3] arm64: cpufeature: Display the set of cores with a feature In-Reply-To: <20231017052322.1211099-2-jeremy.linton@arm.com> (Jeremy Linton's message of "Tue, 17 Oct 2023 00:23:20 -0500") References: <20231017052322.1211099-1-jeremy.linton@arm.com> <20231017052322.1211099-2-jeremy.linton@arm.com> Date: Fri, 20 Oct 2023 14:06:49 +0100 Message-ID: <87ttqlo32u.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_060657_167888_0C880504 X-CRM114-Status: GOOD ( 30.22 ) 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 > Reviewed-by: Ionela Voinescu > Tested-by: Ionela Voinescu > --- > arch/arm64/include/asm/cpufeature.h | 2 ++ > arch/arm64/kernel/cpufeature.c | 22 +++++++++++++--------- > 2 files changed, 15 insertions(+), 9 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..2dd695fc3472 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 */ > @@ -2405,16 +2403,12 @@ static const struct arm64_cpu_capabilities arm64_features[] = { > #endif /* CONFIG_ARM64_RAS_EXTN */ > #ifdef CONFIG_ARM64_AMU_EXTN > { > - /* > - * The feature is enabled by default if CONFIG_ARM64_AMU_EXTN=y. > - * Therefore, don't provide .desc as we don't want the detection > - * 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 +2975,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 +3324,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 +3333,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) Ah I replied to the previous version without realising there's a new one. This patch looks unchanged, so, fwiw, feel free to add Reviewed-by: Punit Agrawal Tested-by: Punit Agrawal Thanks, Punit _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel