Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6643440rdb; Fri, 15 Dec 2023 04:44:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGR7MnjlmA8mUNnyddsfBYH1jgs0gb6G18wpYmUs3i0mI0jWwmzLcT+9wNG1Z7XRulZskTD X-Received: by 2002:a50:cc93:0:b0:552:378e:f019 with SMTP id q19-20020a50cc93000000b00552378ef019mr956942edi.154.1702644271346; Fri, 15 Dec 2023 04:44:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702644271; cv=none; d=google.com; s=arc-20160816; b=j4O2Zh7Wz8oi/jEfm8Tr+9CkAggkw/cilKMa8HaUMsyrtLEG2nxxlMuoRDyI7i+POf d/WKXePjIiyl3KW3J2AYpmrjMpva8UUCL8RGItTTQ2PeVQrl9wxsKsGALizjXQNUsk72 tdXnTKV8ZtOpIC/CYUXzxnQFhRrZUQ1yxsMzVToCQRH5Kt4vMy1mDKNIkupGXo+Qpo8C /F/E0uZdQQEoDogQzwEmRfVndHzC9m4lWo0ysL/xnuYorXcbo9O1fgx9Lz2xxocbyUp6 QjOMcQA/CehcfK+M+SYxhAnMyHoDJjBMuwl9X+fj2CpJBob0ZEYA+zefEifNWOXEmbQn 4Iwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=jqEjdwYBcEQzqjyJ1rwIFYSsLV+D9KscrYkis6mK468=; fh=5LNncp33aj+vclX1uQrIH+10MY7QpnRm7x2b34W6esw=; b=RJmWQ5BKPbRTT3fBla6Rh0SIieCzpmqT8x/Z2Nph9hEo5bhOpvVdSEBTgUA5o5H51w mcoCv3yX+vIn1gSE6/cSd8tXprFeiacuJ4nSoUEx2u3I5cmQ3rfIudhbhHAQj0xS5F8T 2R9nhCSQwMnzGo3lXo8nhJX895MR3x12zrtZzOorAYILOPyUuoZdK7mn/OlufTP10IQ/ jZqmB1O0h01FgvqIvh1flx3bwDWqDxRobLon9MWnpCg6/g+bXt6pP5PorH7QXVB2HQZl 3vCJkj8MoFlJzfVAT93FDNWOu8+qvIV4dXewl2kulueHTsauta9jYMJ1CoDQ6QGKatQb o7/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-945-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-945-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t25-20020a50d719000000b00551d1c06b4bsi3080385edi.436.2023.12.15.04.44.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 04:44:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-945-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-945-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-945-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DCB461F24919 for ; Fri, 15 Dec 2023 12:44:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D0E22D04D; Fri, 15 Dec 2023 12:43:57 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DF9502C6A2; Fri, 15 Dec 2023 12:43:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 68394C15; Fri, 15 Dec 2023 04:44:38 -0800 (PST) Received: from [192.168.1.3] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7635C3F738; Fri, 15 Dec 2023 04:43:49 -0800 (PST) Message-ID: <732aa152-53cc-1101-4292-0906266a4c01@arm.com> Date: Fri, 15 Dec 2023 12:43:44 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v7 05/11] arm64: perf: Include threshold control fields in PMEVTYPER mask Content-Language: en-US To: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, suzuki.poulose@arm.com, mark.rutland@arm.com, anshuman.khandual@arm.com, namhyung@gmail.com, Catalin Marinas , Jonathan Corbet , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Russell King , Marc Zyngier , Oliver Upton , James Morse , Zenghui Yu , Paolo Bonzini , Shuah Khan , Zaid Al-Bassam , Raghavendra Rao Ananta , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20231211161331.1277825-1-james.clark@arm.com> <20231211161331.1277825-6-james.clark@arm.com> <20231215120817.h2f3akgv72zhrtqo@pengutronix.de> From: James Clark In-Reply-To: <20231215120817.h2f3akgv72zhrtqo@pengutronix.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 15/12/2023 12:08, Uwe Kleine-König wrote: > Hello, > > On Mon, Dec 11, 2023 at 04:13:17PM +0000, James Clark wrote: >> FEAT_PMUv3_TH (Armv8.8) adds two new fields to PMEVTYPER, so include >> them in the mask. These aren't writable on 32 bit kernels as they are in >> the high part of the register, so only include them for arm64. >> >> It would be difficult to do this statically in the asm header files for >> each platform without resulting in circular includes or #ifdefs inline >> in the code. For that reason the ARMV8_PMU_EVTYPE_MASK definition has >> been removed and the mask is constructed programmatically. >> >> Reviewed-by: Suzuki K Poulose >> Reviewed-by: Anshuman Khandual >> Signed-off-by: James Clark > > This change is in today's next as commit > 3115ee021bfb04efde2e96507bfcc1330261a6a1. this breaks allmodconfig > building on ARCH=arm: > > In file included from include/linux/ratelimit_types.h:5, > from include/linux/printk.h:9, > from include/asm-generic/bug.h:22, > from arch/arm/include/asm/bug.h:60, > from include/linux/bug.h:5, > from include/linux/mmdebug.h:5, > from include/linux/percpu.h:5, > from include/asm-generic/irq_regs.h:11, > from ./arch/arm/include/generated/asm/irq_regs.h:1, > from drivers/perf/arm_pmuv3.c:11: > drivers/perf/arm_pmuv3.c: In function ‘armv8pmu_write_evtype’: > include/linux/bits.h:34:29: error: left shift count >= width of type [-Werror=shift-count-overflow] > 34 | (((~UL(0)) - (UL(1) << (l)) + 1) & \ > | ^~ > include/linux/bits.h:37:38: note: in expansion of macro ‘__GENMASK’ > 37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) > | ^~~~~~~~~ > include/linux/perf/arm_pmuv3.h:238:33: note: in expansion of macro ‘GENMASK’ > 238 | #define ARMV8_PMU_EVTYPE_TC GENMASK(63, 61) > | ^~~~~~~ > drivers/perf/arm_pmuv3.c:567:25: note: in expansion of macro ‘ARMV8_PMU_EVTYPE_TC’ > 567 | mask |= ARMV8_PMU_EVTYPE_TC | ARMV8_PMU_EVTYPE_TH; > | ^~~~~~~~~~~~~~~~~~~ > include/linux/bits.h:35:18: error: right shift count is negative [-Werror=shift-count-negative] > 35 | (~UL(0) >> (BITS_PER_LONG - 1 - (h)))) > | ^~ > include/linux/bits.h:37:38: note: in expansion of macro ‘__GENMASK’ > 37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) > | ^~~~~~~~~ > include/linux/perf/arm_pmuv3.h:238:33: note: in expansion of macro ‘GENMASK’ > 238 | #define ARMV8_PMU_EVTYPE_TC GENMASK(63, 61) > | ^~~~~~~ > drivers/perf/arm_pmuv3.c:567:25: note: in expansion of macro ‘ARMV8_PMU_EVTYPE_TC’ > 567 | mask |= ARMV8_PMU_EVTYPE_TC | ARMV8_PMU_EVTYPE_TH; > | ^~~~~~~~~~~~~~~~~~~ > include/linux/bits.h:34:29: error: left shift count >= width of type [-Werror=shift-count-overflow] > 34 | (((~UL(0)) - (UL(1) << (l)) + 1) & \ > | ^~ > include/linux/bits.h:37:38: note: in expansion of macro ‘__GENMASK’ > 37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) > | ^~~~~~~~~ > include/linux/perf/arm_pmuv3.h:237:33: note: in expansion of macro ‘GENMASK’ > 237 | #define ARMV8_PMU_EVTYPE_TH GENMASK(43, 32) > | ^~~~~~~ > drivers/perf/arm_pmuv3.c:567:47: note: in expansion of macro ‘ARMV8_PMU_EVTYPE_TH’ > 567 | mask |= ARMV8_PMU_EVTYPE_TC | ARMV8_PMU_EVTYPE_TH; > | ^~~~~~~~~~~~~~~~~~~ > include/linux/bits.h:35:18: error: right shift count is negative [-Werror=shift-count-negative] > 35 | (~UL(0) >> (BITS_PER_LONG - 1 - (h)))) > | ^~ > include/linux/bits.h:37:38: note: in expansion of macro ‘__GENMASK’ > 37 | (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l)) > | ^~~~~~~~~ > include/linux/perf/arm_pmuv3.h:237:33: note: in expansion of macro ‘GENMASK’ > 237 | #define ARMV8_PMU_EVTYPE_TH GENMASK(43, 32) > | ^~~~~~~ > drivers/perf/arm_pmuv3.c:567:47: note: in expansion of macro ‘ARMV8_PMU_EVTYPE_TH’ > 567 | mask |= ARMV8_PMU_EVTYPE_TC | ARMV8_PMU_EVTYPE_TH; > | ^~~~~~~~~~~~~~~~~~~ > > I guess that's easy to fix but I didn't look into that. > > Best regards > Uwe > Thanks for the report. I see that the build is only broken with GCC and is working with LLVM. I will look into a fix. Worst case the if can be changed to an #ifdef James