Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751695AbdHaP1i (ORCPT ); Thu, 31 Aug 2017 11:27:38 -0400 Received: from mail-sn1nam02on0063.outbound.protection.outlook.com ([104.47.36.63]:46752 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751412AbdHaP1h (ORCPT ); Thu, 31 Aug 2017 11:27:37 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jan.Glauber@cavium.com; Date: Thu, 31 Aug 2017 17:27:23 +0200 From: Jan Glauber To: Suzuki K Poulose Cc: Mark Rutland , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Borislav Petkov , David Daney Subject: Re: [RFC PATCH v9 5/7] perf: cavium: Support memory controller PMU counters Message-ID: <20170831152723.GA23982@hc> References: <20170829131238.4988-1-jglauber@cavium.com> <20170829131238.4988-6-jglauber@cavium.com> <09997d9f-0003-0eb0-63d1-9b31e26e2229@arm.com> <20170831113508.GE15906@hc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [88.67.130.225] X-ClientProxiedBy: VI1PR0102CA0033.eurprd01.prod.exchangelabs.com (2603:10a6:802::46) To SN2PR07MB2590.namprd07.prod.outlook.com (2603:10b6:804:7::20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7ef245ce-1dcd-49b3-9577-08d4f084ce27 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:SN2PR07MB2590; X-Microsoft-Exchange-Diagnostics: 1;SN2PR07MB2590;3:Wrsy06xp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4MpsaJoWlrt82n1tlHr72rCgR1umUFMfQP+7z6iIbb37g76QVHuiw+esHNjE+U+yWbBu30XojaqqIGshgn7p3ExfFqTR89DtkeIEGLSR5pE9u1elfLVkz4sJymsM7uoJzlaaPsPI++GF4d/DfzJ0oAy9RRoWyoTuoKxsv3mjpeU4s/1sSaib2StWbkAzHwv262OJfdkzjo32uJ4ZAnSzsL05vBq6EmX5d+352PbC03BY8E6LNXEWoyk/+at4MjjuTm033LUFsLxt6sDVppxSrUERh6pO9vCM3QIsmtn59JM+CGQx43SG3YmgqEGTIIXyMpggFy3fUCW//f36hltdlHuQOHPompNu0QeOLH5xutfAoZf2HS5E107oLiN49kIQPX5jVV9e5KC4KAzuVidPxguLddaQsnZ/dZuLAK07DgjuMJoOrdBYDEinWERvRnGj0OKD0Hs8Q=;4:b4S+FbXMFFRnSQJ7I9WkAc7TQEjjWIQQLoUbvrSt4hGVJwFm6uoOmN3JSgn5cJpucOs5MeP8RRctAGzOY61A/AwEMk/ap8gz6z11KtWtMURbAsDUTOpa1/HYc6HPo9AKB3POE8kQ/DJ8II9+UA1+p5m+yFUB2PXOmYccNtH+qfDLjfaxHbCTiDg5hWE/IBwa8AGOgl1LlvwyYKCimCDEj5waaAuR2vVPtoaB7YqI+xUdlWKpYUUXN3SfdjiBQ35D X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3002001)(100000703101)(100105400095)(6041248)(20161123558100)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123564025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN2PR07MB2590;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN2PR07MB2590; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(199003)(189002)(24454002)(189998001)(2906002)(5660300001)(33716001)(72206003)(83506001)(478600001)(47776003)(66066001)(25786009)(68736007)(4326008)(53546010)(4001350100001)(23726003)(1076002)(97736004)(50466002)(6116002)(53936002)(6496005)(6246003)(9686003)(6666003)(54356999)(50986999)(76176999)(8936002)(106356001)(93886005)(42186005)(305945005)(105586002)(3846002)(55016002)(107886003)(54906002)(7736002)(110136004)(33656002)(229853002)(8676002)(6916009)(2950100002)(42882006)(81166006)(81156014)(101416001)(18370500001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2590;H:hc;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR07MB2590;23:9owbLHZfzHzfJRaPBV9k84G359DKXsFLjDjKkwhxw?= =?us-ascii?Q?cgxo9eW6dGYUBhCv32whotajMnTLxRjCz98awkWTNyJgg++cbJGkCJzVygbM?= =?us-ascii?Q?vu9ZCInNvILWw5Zyhei1sxtmHxuc0ymBQM5k5OVX40CCkyvmEjqEVzBCdlOv?= =?us-ascii?Q?lrCwbRkamfHZcUHkIS9hp/wfjAITbKgJcd+TSZcMjDMAX4zw8zidXkjKxiSW?= =?us-ascii?Q?2XraJ7YYfzBAAi6pn5p/QSuh4XoqHfY5WvpCO1UPzGcPqz7qcuzRf3fovpew?= =?us-ascii?Q?TXV9HYR4dg4c20u+/wEkpB8iL4DDrk15cmQD2nJIsbJCwgjIjQAg10ON3r53?= =?us-ascii?Q?hFFSXddrfN03mabiPNhjNtOWsmbLcRNcoC+cqizcbTJYBGMnf05HouxkXpwp?= =?us-ascii?Q?2m5a9bIRkcfF6dJMoO8ZseCZ9ZCxdotnd2/C4xMtE+2mPEY4pVSxxnO3DxDi?= =?us-ascii?Q?o0/y1q90JNAiEpWELT/PUizDZyjzYti4YNBbqSaEyJgXJYtUZAoChPevrPqC?= =?us-ascii?Q?FbT12qTdaH/HMyAGgD67AyyHYHp/qhM4o6lfHlhA/23gMCGrIDN5c3NNZnDp?= =?us-ascii?Q?uzM3r6XnHdVB9/FporIwwUCBsGEAIlGa38fAOt5GYNGoEBGwzj+g0qxxHpGM?= =?us-ascii?Q?x1J1B+PSHz0KlDypYymBSiN08gqQly7hY4juBfp+e9n3Xbandf2shRdeKrNm?= =?us-ascii?Q?cbCE41UrPbXzib+dUaoJyinBPR/3aACfDmUiqQ8Ym/OGZpWbU29U3e0med0x?= =?us-ascii?Q?bd+gHv0J0oczP5FEWdlOrbHLFtUfZZYnJ7+bCi/N3Hk7Bvbbq6X2u44XVshP?= =?us-ascii?Q?lwbIOwJq/Uokb2yG3fuK2fXumVxx9ILdJJW614cqm1tk07k3/7301bt5vJYy?= =?us-ascii?Q?p8/1HDZkkkV4ipVFZwoBoqu0qQMn2H6bY3JDr3enk9R1a24qtypqtnUHvXpn?= =?us-ascii?Q?AxZeTs5cpY0nUeDJi5s2StC5/kBCC72+kjTMGfHL6DjK0NKTkrUE1XBCfMPT?= =?us-ascii?Q?M19ST05nzAbMC6zPTzV1qZfCxMCxzHDGNJdMcyGasAjfy6IV2iNN+5RpU53K?= =?us-ascii?Q?Hp8hAfXLD6ZqggOy8ioXW0Bmd68iRUNLo7CPfHSqQ9lOI9HBzWrKgLBqoKWv?= =?us-ascii?Q?vsqUqBjX2wFLfAvAZrjnzgpD7BgxU372m0mR1aKn7jcKW1jntil3e71sFCBo?= =?us-ascii?Q?9ntH+bsDFOf3xVsBD8p/8o96XmW+sZZ6taDg9VdcCyEBOd79Ovi1hgijiDHq?= =?us-ascii?Q?6SOTNRQQTqOyNI6CL8qDLKKPncdmGc3bTi9hGsQ?= X-Microsoft-Exchange-Diagnostics: 1;SN2PR07MB2590;6:ATivO8gw48LfnMIP+kL1yXa0Y310nmjwm7crlQSUYtumOlb5SxZ/37z6WHFymBTZt0Gotf+2z1Z4cW8hNT476GfjQMggSsxeBlPnD4lrgAuuLgv7Q9nYdxITiTJ/9Z1GJUrBhf5+vOQ6CbKI/Su02KZLRNHtnUrogBYhz9+mR6NGTdZiqbf0gkTenMNZvvWmhObceUxR70znAqfu1f69aOZTCzFaFhrjWlQjzc3VW5SS8rBnTvPp2ZTWevOjxihjwgCrdOB8vgbYwffa0zH61RFCBPfpXSCsgy2Y0l9oIWt8z+8dFT8YOzBb2/IXYRX2aJOrq6dZTsZv4kki9hRq9w==;5:XyvMuEM/XK33xCnnlK74gd6W79Ww+/LoF9E9PDabo/vV6KOYr4vPkCsrSfTIgszFZ8TiUtI4dSoVnFYTVk6tZSSQL/TFMfeqhXTljVZIuYl+EHxmYSD8oAE1TW9HvLLiG5p1i3VY1kVPo8gVw045eA==;24:GFKiJAzgdXuIMT0ZAbbSYQdfk2BfMm4EcYj88Um0G8WKdR281YrY+d3JahqImu1v8AIgFV2kHvk+AVEuDEk8VtfSFnfmtB96wCMspJ7Zo5Y=;7:fJb0jH+C7WUgt0YUAi6G7opso6WjMMfv8JUf+Sp7lFGJ9XXb6hNGR1BEl8+yD3JBsiSsFhIlWaNawMiWQxl0fgZRfNxr5ZTffm7yzNv+b0bXwAlce6J9tS6v/bScch3mdPu3EFwrjUS54nPKJ1Le0Rxt1yVvEz4oqD2jlXFB8ldlmoYl7hMKC9kAaqkj8FEFcsPKcqdHXGg3fgu//U7tT30ysvo0oJQzQMS7ieD4cSk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 15:27:33.5038 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2590 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2300 Lines: 68 On Thu, Aug 31, 2017 at 02:26:22PM +0100, Suzuki K Poulose wrote: > On 31/08/17 12:35, Jan Glauber wrote: > >On Wed, Aug 30, 2017 at 11:03:00AM +0100, Suzuki K Poulose wrote: > >>On 29/08/17 14:12, Jan Glauber wrote: [...] > >>>+/* LMC events */ > >>>+#define LMC_EVENT_IFB_CNT 0x1d0 > >>>+#define LMC_EVENT_OPS_CNT 0x1d8 > >>>+#define LMC_EVENT_DCLK_CNT 0x1e0 > >>>+#define LMC_EVENT_BANK_CONFLICT1 0x360 > >>>+#define LMC_EVENT_BANK_CONFLICT2 0x368 > >>>+ > >>>+#define CVM_PMU_LMC_EVENT_ATTR(_name, _id) \ > >>>+ &((struct perf_pmu_events_attr[]) { \ > >>>+ { \ > >>>+ __ATTR(_name, S_IRUGO, cvm_pmu_event_sysfs_show, NULL), \ > >>>+ _id, \ > >>>+ "lmc_event=" __stringify(_id), \ > >>>+ } \ > >>>+ })[0].attr.attr > >>>+ > >>>+/* map counter numbers to register offsets */ > >>>+static int lmc_events[] = { > >>>+ LMC_EVENT_IFB_CNT, > >>>+ LMC_EVENT_OPS_CNT, > >>>+ LMC_EVENT_DCLK_CNT, > >>>+ LMC_EVENT_BANK_CONFLICT1, > >>>+ LMC_EVENT_BANK_CONFLICT2, > >>>+}; > >>>+ > >>>+static int cvm_pmu_lmc_add(struct perf_event *event, int flags) > >>>+{ > >>>+ struct hw_perf_event *hwc = &event->hw; > >>>+ > >>>+ return cvm_pmu_add(event, flags, LMC_CONFIG_OFFSET, > >>>+ lmc_events[hwc->config]); > >>>+} > >>>+ > >> > >>Is there any reason why we can't use the LMC event code directly > >>here, avoiding the mapping altogether ? > > > >I wanted to avoid exposing the raw numbers (0x1d0 - 0x368) here. > > Thats the primarily the reason why we expose the "aliases" in events/. > The other problem with adding another layer of mapping is, you are preventing > someone from actually mapping the raw code used by the perf tool (which is now > a mapping index) to the real raw code used by the hardware unless they have > the kernel source handy. If you choose to expose the raw numbers, like *all* > the other PMUs, the user can map it by looking up the manual. So what would that do to the config bits? Currently they are: PMU_FORMAT_ATTR(lmc_event, "config:0-2"); Should I have config:0-9 then? Wouldn't that be confusing as there are only 5 events? Also I need to be very careful as we need to prevent a user from accessing anything else then the counters. I can do that with the event_valid callback though. thanks, Jan > Cheers > Suzuki