Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751205AbdHaLOQ (ORCPT ); Thu, 31 Aug 2017 07:14:16 -0400 Received: from mail-bn3nam01on0043.outbound.protection.outlook.com ([104.47.33.43]:1376 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750828AbdHaLOP (ORCPT ); Thu, 31 Aug 2017 07:14:15 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jan.Glauber@cavium.com; Date: Thu, 31 Aug 2017 13:13:59 +0200 From: Jan Glauber To: Mark Rutland Cc: Zhangshaokun , Will Deacon , David Daney , Suzuki K Poulose , linux-kernel@vger.kernel.org, Borislav Petkov , linux-arm-kernel@lists.infradead.org Subject: Re: [RFC PATCH v9 5/7] perf: cavium: Support memory controller PMU counters Message-ID: <20170831111359.GC15906@hc> References: <20170829131238.4988-1-jglauber@cavium.com> <20170829131238.4988-6-jglauber@cavium.com> <20170831095746.GB15906@hc> <20170831103119.GC15031@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170831103119.GC15031@leverpostej> User-Agent: Mutt/1.5.21 (2010-09-15) X-Originating-IP: [88.67.130.225] X-ClientProxiedBy: HE1PR0102CA0050.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::27) To SN2PR07MB2592.namprd07.prod.outlook.com (2603:10b6:804:7::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a1c75a79-295e-45a0-149a-08d4f0616894 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:SN2PR07MB2592; X-Microsoft-Exchange-Diagnostics: 1;SN2PR07MB2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FTj1kOT7synnlbWnzY/on22SmOuSg6JJQLe5pvlFOSnSwaCqOrIrW4vSwSvC5BPWxqCOxhQYSS5dhVIs0yef+OuBHTXa1tKVaDKuW+4muOBRcuRO8XWwI8YGBKsuC2qL/A4v2BYZGTr8MuxSVpvnmEbkqTVadrCEbm811SnLPkEbvWuvLtWRKCLww/DwwZ1+10CavH4hEH0j/t1yu934jkDA9/7McDbbFpcr1WOl3kpTe/M+8xABUI+G/IKQswQoNUYdOVpzm0zJihk6TO59foEwy+XWN6Xvr/pocX4jRLDuuRnVi+b36+6i5W69spAIBI+3amwCJVpLhW1kQj8pHvqTZhH9chrz3NKtYBHmgNYlh04ELUg+GRzooAr1g3kZATlrNk+qTM7LIpaHbX9BdIv444Ck67/70Z7snftoRPj3fPbv/KLQ7AXjf58LtrIv+K8s/tV/qQ=;4:dbOu8UbN7tEmwi1pJMUOmGyvcj/qt37IZDCrwPvj+83XHcpsxBp5vx/8zDe+6jULPHFkqr9IB7t92FMCm4zpYSe2NkzPVG+gS822a63dy7yxUbtRF9vd4KF/EQ0uCLXQtF/a60NqrqCmdAkehF+yUsLVGlXeeAcr5GklJTyYmk2jE8//T5nTDR+1MAUrqLtHX+DVgnU6TWwKDJZJp2MwKRFMjGqmf2MMOCGgAGRIWQbOIPa1d2zdefAdSdYkHjij 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)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:SN2PR07MB2592;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:SN2PR07MB2592; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(189002)(199003)(24454002)(81156014)(23726003)(81166006)(47776003)(8676002)(6116002)(3846002)(33716001)(66066001)(76176999)(54356999)(189998001)(50986999)(93886005)(305945005)(97736004)(7736002)(72206003)(68736007)(25786009)(83506001)(966005)(8936002)(1076002)(478600001)(4001350100001)(53546010)(2906002)(105586002)(6916009)(54906002)(55016002)(42186005)(2950100002)(42882006)(6306002)(53936002)(6496005)(110136004)(229853002)(4326008)(6246003)(6666003)(9686003)(106356001)(101416001)(33656002)(5660300001)(50466002)(18370500001)(217873001);DIR:OUT;SFP:1101;SCL:1;SRVR:SN2PR07MB2592;H:hc;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN2PR07MB2592;23:pvqHdKHEPMujXdUhKtDQtAKLQXYrXLydt4ui5FlO5?= =?us-ascii?Q?Km5BFjAU4dT3ob9Hct8xOtb9CXKlIvDFE90nbJaX6haNcHskUeU3thoKmK41?= =?us-ascii?Q?kTaKXimkL3Uzp+tQY0pb5/4Jwi4HtEe1/5uDS9WdGhRypWnUkHPg5t6sMYMS?= =?us-ascii?Q?WcekBWecA1HsuuOaH//lc68xE/jOoD/DVrqiRBLM2ZpmJWIlQIYfUVERNu8m?= =?us-ascii?Q?3Hpk63bArJo+JX7zvP1tlSbE+IcwktLq3yhh7QIqOk+5Wd7xCq32RzQ9CFHb?= =?us-ascii?Q?IGzAQClUXtCUt30is42clUuxVgzpNPMeK6ACMtlgrZYWsFZv/ODEoBerlQJK?= =?us-ascii?Q?3SIk9UhyqOgkFm0ohM2E1LnQWgXTXe0uOOqQBzST6f8FrwBK73TsmObWUokw?= =?us-ascii?Q?Z/pMjPLWXQaHoGfhRmISCaY37tcTR14iiqjBSMe33rYRb0lZOhWFRN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change-Diagnostics: 1;SN2PR07MB2592;6:K+sgYmiNdpE6YNStSNmSM5682pEnjeCLpLHZGM0ZIbB5xvRW43dMumnyC2f5/7G1lc1CSyCHRjUOiWNgYWBabwDM8T6/XRLu/JCzM72jNEZ/8ycUwfAHrwKj2JSifpPUVUDRJ4MAF7RP/FyH/pCCQp+U6MB9AIyuR5tyHZJk0MYL1Hq8kU8ZJiMQnVvg+v/6CRp0hcLNrPJim04ASL5cUCgD3L2W0UI9psnNMBrcpulG2s5sMe3fq9h4PIk36H1HBIFB8qU7lFcLysFvyfQbMQtYLYyjEsvwTEcDjir5cBld7MkYSCTVRSxRI2Q0Kg8dqjPBKd+IXN4P3OpEIe3Z7A==;5:NLfQcwLIdlaYD09TGnUlH9vYZUY5eDscQxdZyJIdVgNxdW3BCPELjTQsfS+qTf76T8NjQoMKgOd2ZcQBvSBZ5tP378ipDkqyDal7D4rgh07ej+vbPUY2lhEMxunb1inERC6h1ZMTJbGlQvQC4oRZhw==;24:do6yyziLxSBDatiAgq45W5vKIJfhVBAHuC9cK8V84eY4tBCVQA0t3YHyVzg2MTB5D+DRHW/Ngnt1EyQBAcDiZRAmp63OyCjIadq0tdbDBTg=;7:j3jaRPY9p/s2Q3RQz9RmzP9sIEWAljAPPxMOAUVStwzCymXMR8dVRTdCKE7nAOzoYvTnLJH55MQI8MUwXY7MbsMKDvSLLGef8Bar83+yfPvzuzb7MGm5SfVWUMtcRRHavMPo2VyD6mUAo4WHIGtRFZ/fxzeq3pHLo596Hlsr82QaVxlHZL7LKRwdIYOCadaMg6dElecB0jGSWx+dzfvM0tz4jgp0nIk779ffrZfN69U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 11:14:10.2487 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR07MB2592 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1615 Lines: 44 On Thu, Aug 31, 2017 at 11:31:20AM +0100, Mark Rutland wrote: > On Thu, Aug 31, 2017 at 11:57:46AM +0200, Jan Glauber wrote: > > On Wed, Aug 30, 2017 at 10:54:03AM +0800, Zhangshaokun wrote: > > > On 2017/8/29 21:12, Jan Glauber wrote: > > > > Add support for the PMU counters on Cavium SOC memory controllers. > > > > > > > > This patch also adds generic functions to allow supporting more > > > > devices with PMU counters. > > > > > +/* generic struct to cover the different pmu types */ > > > > +struct cvm_pmu_dev { > > > > + struct pmu pmu; > > > > + const char *pmu_name; > > > > > > It seems that pmu_name is redundant since struct pmu has a name field, > > > Mark has mentioned it in HiSilicon uncore PMU driver, Link: > > > https://patchwork.kernel.org/patch/9861821/ > > > > I don't get it. perf_pmu_register() just copies the char* from the > > argument into pmu->name. Somewhere the string must be allocated. > > That's why I have cvm_pmu_dev->pmu_name. > > I'm not sure I follow. cvm_pmu_dev->pmu_name is just a char *, so what > does that have to do with allocation? As you pointed out here: https://lkml.org/lkml/2017/6/2/530 perf_pmu_register does not copy the string, so _somewhere_ the name must be allocated and freed afterwards. Are you suggesting to use pmu.name directly to allocate the name there and pass perf_register_pmu(..., tlk->pmu.name, ...)? --Jan > ... unless you mean you want to allocate this in some variant-specific > code prior to passing it to code which calls perf_pmu_register(), and > you just need a place to stash it in the mean time? [...] > THanks, > Mark.