Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752405AbcCAHg5 (ORCPT ); Tue, 1 Mar 2016 02:36:57 -0500 Received: from mail-bl2on0092.outbound.protection.outlook.com ([65.55.169.92]:19904 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750850AbcCAHg4 (ORCPT ); Tue, 1 Mar 2016 02:36:56 -0500 Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=caviumnetworks.com; Date: Tue, 1 Mar 2016 08:21:06 +0100 From: Jan Glauber To: Will Deacon CC: Mark Rutland , , , Subject: Re: [PATCH v4 4/5] arm64/perf: Enable PMCR long cycle counter bit Message-ID: <20160301072106.GA6326@hardcore> References: <467597048eda3004bd69f1fbe3981aab111e00dd.1455810755.git.jglauber@cavium.com> <20160229153934.GB14848@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20160229153934.GB14848@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [109.193.44.139] X-ClientProxiedBy: DB5PR03CA0007.eurprd03.prod.outlook.com (25.162.150.17) To CO2PR0701MB759.namprd07.prod.outlook.com (10.141.245.21) X-Microsoft-Exchange-Diagnostics: 1;CO2PR0701MB759;2:YQTKXU5JPUVcEaIcNuLuWEmroYCpLY1fGMWmP2qhP56PU2A1S+u9AS+9jZFwBmLRLDcSRQ9PTONZ9wxoxn7lF8M8arIbe1TRjHRnPz3U6UG/iFkCMLCcnvVI5HY6wiCMn2WK+RZfbI7sAW19GhzvnQ==;3:tKvBBqdvrlVDCbxgYvWunTdVYLUJWDtDhV0HIHE9T0ipMJN3jjxsM0XDGgd4s3MLGSrxbyDBw8xO2eiUYfOHzd5tJLTGAPqzUMpQGecfv9K9mM60kpPVaumSYUaCMcVd;25:3HEtkb4MY04G/EFRWvgHa8MOgcjfG1r8efSVzoA5ACh6tH9GZUb/2hD7xffSzSS11G0LgWirlF3xYlb/VGYqSKvnAyDBTkB0ZND24NXX1tj4AC9JZWsiU7MohvLovdVtFmncH949GRHlCWhjT7PecU4fpT4wwEJGgy0AqH4vtOjoBU6+BDb19YbW6R9cU1GkBjIJshUM1RNskMYXN5Eh04TgM9sOYLgJWQ5C593fDBIydOj+5+zLFLmnukdWLrw5/r82rfk+ulZikh87mn9dby+DFaVrMkhiWxf8JxU/qDUq6NUBxkE/SRyq6G8SuKME66nEW15t7C5rDMKrTishOQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR0701MB759; X-MS-Office365-Filtering-Correlation-Id: 7ab9039b-7dd3-4c0c-9f31-08d341a21757 X-Microsoft-Exchange-Diagnostics: 1;CO2PR0701MB759;20:9tA0z/Jj2KvQwQB1rRTHHI3BLLdCoQT5WXjhflJXHP5Xfdzr85EQ+WhyhtSedUR5kg5e7+cseE1QyXAGodWG0d2WSUYhf9caEsxpQ2QUUCkzRNLHjU4tYA18bbV6peNgAMvWphkT3TpymaUIHZ2LlpsxPJo2B4X9QNv0hqgzK9TlCDVAENhjpwwVzp87equLfMHNdVh5VEoRO2SmL7GvwF//FQCrsP3Fx+EfFVkHv/naQy2kaIqzwJWz8iEkBMHDIAOC1FGYC43sJUiVvHoj2+zzFIsjVB/COXTnahqqfAk5HaJWy3RzMq4M7S5bj9U1G623A2W5f5FVUEKSwm/qqF93YoJofsHwarYfzZ9ktwh81WoI70nKlnRDOngsgO+CNaJM9H4RyWUsCBM4Pa/dcojLPls72UYXEYjUgvC9cOq1NDpQunKzi6snjpVVSwQUTDj65Cz6IuS6v7ohaHRhimNgqv2VGfWHiD0wKVe6sHIDwdJ8OLrD8Ydd9FuVQjFLBhJSmJihUyU9V0yXQXUTuzEmuGEEDbn0qAKO4uANiUC1K0vN02FYTBksktqWPSDPdlLNDilw3t0AgBdtSE3GryJgJ6xC5Eibx5f7N/SCM8M= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:CO2PR0701MB759;BCL:0;PCL:0;RULEID:;SRVR:CO2PR0701MB759; X-Microsoft-Exchange-Diagnostics: 1;CO2PR0701MB759;4:NbeX/DjCLwNW62tiLvd2Wf8UbvlQ3Pu0d1y9Q4soLhA0TsWdLqvaaLw3/9x0g1J26Ah18vWyxJXbzZx7yOaAfn4csA4zLLDi7MuIcYWsFbGVmxG5bYKae29o5pkXFgTJeGOSkSu5+SKCDHdOre0hG4T58k0K+F2mB4gEBO+pLWL56hs1EpeBhD7S0tQ2inyYADlifvyt85fvWNAOIYckfR/L5O+dbVCCO7n202gAHHRUrR1anspEHY82YwuQR6pliAaPtiWcCdH/p5/BkOwdr8w5S9l3Qfzy1vhIJ++2pchxDNNOb+xF/00I+xFeUR2wKbU1vH/IM/Asq2Fj2slIqed85Sg1S2pr+8RwqJv5iG/iUpuaFXxAEpti2uoZpMhR X-Forefront-PRVS: 086831DFB4 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(24454002)(4326007)(5004730100002)(2906002)(5008740100001)(33716001)(19580395003)(19580405001)(4001350100001)(87976001)(5001960100003)(83506001)(110136002)(189998001)(42186005)(122386002)(77096005)(2950100001)(66066001)(97756001)(92566002)(47776003)(23726003)(33656002)(50986999)(6116002)(54356999)(76176999)(1076002)(46406003)(1096002)(40100003)(50466002)(586003)(3846002)(81156008)(86362001);DIR:OUT;SFP:1101;SCL:1;SRVR:CO2PR0701MB759;H:hardcore;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CO2PR0701MB759;23:Ejwn1ByPNNh+BKMCF2FvSe/f5xjwgVMdfglq6WD+?= =?us-ascii?Q?Hg+nLIZ5C4GAc6B7btOuUMcYYJne6LbEY9xI3heVqT3IfYpHw5S9+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EhCWlGhBt8yWmbaAUjpJSRt6eQTRDFeLgNy2W7CQKUzzg?= =?us-ascii?Q?LoKUmHnuhZQSjLZ2P2QidDIR7WB/9FHq85zgNoHn6QaVm1FFCkMD6b0oX7rW?= =?us-ascii?Q?BEbOKjc=3D?= X-Microsoft-Exchange-Diagnostics: 1;CO2PR0701MB759;5:YLnhuN+AygdwASwxY5mX3/r6daaj1nTg1FkiOd1K7bHicd0NBfbAoAbpNmf/83vP9XX1fPVN28En+4ArB633m5fCD58bfB9YpAA0neLwHkizL9vl+gniHr6lix6xxrg+rpIaD6keuvvHAIxakoz4cQ==;24:uBbmsOGmiqUXTHzNuVfXx+hlpqYXJuis1P7NrSJFdhv2b6AslWXFbNy18RwyTx7GOrq9Ajp0A7T6YVt52g3uPaISt36OgWOh3CV8STwpRgE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2016 07:21:20.6966 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR0701MB759 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2440 Lines: 58 On Mon, Feb 29, 2016 at 03:39:35PM +0000, Will Deacon wrote: > Hi Jan, > > I've queued this lot on my perf/updates branch, but I just noticed an > oddity whilst dealing with some potential conflicts with the kvm tree. > > On Thu, Feb 18, 2016 at 05:50:13PM +0100, Jan Glauber wrote: > > With the long cycle counter bit (LC) disabled the cycle counter is not > > working on ThunderX SOC (ThunderX only implements Aarch64). > > Also, according to documentation LC == 0 is deprecated. > > > > To keep the code simple the patch does not introduce 64 bit wide counter > > functions. Instead writing the cycle counter always sets the upper > > 32 bits so overflow interrupts are generated as before. > > > > Original patch from Andrew Pinksi > > > > Signed-off-by: Jan Glauber > > --- > > arch/arm64/kernel/perf_event.c | 21 ++++++++++++++++----- > > 1 file changed, 16 insertions(+), 5 deletions(-) > > > > diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c > > index 0ed05f6..c68fa98 100644 > > --- a/arch/arm64/kernel/perf_event.c > > +++ b/arch/arm64/kernel/perf_event.c > > @@ -405,6 +405,7 @@ static const struct attribute_group *armv8_pmuv3_attr_groups[] = { > > #define ARMV8_PMCR_D (1 << 3) /* CCNT counts every 64th cpu cycle */ > > #define ARMV8_PMCR_X (1 << 4) /* Export to ETM */ > > #define ARMV8_PMCR_DP (1 << 5) /* Disable CCNT if non-invasive debug*/ > > +#define ARMV8_PMCR_LC (1 << 6) /* Overflow on 64 bit cycle counter */ > > #define ARMV8_PMCR_N_SHIFT 11 /* Number of counters supported */ > > #define ARMV8_PMCR_N_MASK 0x1f > > #define ARMV8_PMCR_MASK 0x3f /* Mask for writable bits */ > > You haven't extended this mask to cover the LC bit, so it will be ignored > by armv8pmu_pmcr_write afaict. This is weird. I've double checked and I missed this mask. Annoying. Nevertheless it works for me without the LC bit set. > How did you test this? I can easily update the mask, but it would be > good to know that it doesn't end up cause a breakage. For testing I used: - perf top and perf record & report - looked at interrupt numbers in /proc/interrupts Without the patch _no_ samples at all are recorded and the interrupt does not occur. With the patch I get samples and see a reasonable number of interrupts. Extending the mask so the LC bit is covered would make sense, I'm going to test this now. Jan > Will