From: Alexander Shishkin <alexander.shishkin@linux.intel.com> To: Mathieu Poirier <mathieu.poirier@linaro.org>, peterz@infradead.org Cc: acme@kernel.org, jolsa@kernel.org, mingo@redhat.com, vince@deater.net, mtk.manpages@gmail.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Mathieu Poirier <mathieu.poirier@linaro.org> Subject: Re: [PATCH V5 9/9] coresight: etm-perf: incorporating sink definition from cmd line Date: Mon, 22 Aug 2016 19:40:16 +0300 [thread overview] Message-ID: <8737lwn4en.fsf@ashishki-desk.ger.corp.intel.com> (raw) In-Reply-To: <1470932464-726-10-git-send-email-mathieu.poirier@linaro.org> Mathieu Poirier <mathieu.poirier@linaro.org> writes: > +enum { > + ETM_TOKEN_SINK_CPU, > + ETM_TOKEN_SINK, > + ETM_TOKEN_ERR, > +}; > + > +static const match_table_t drv_cfg_tokens = { > + {ETM_TOKEN_SINK_CPU, "sink=cpu%d:%s"}, > + {ETM_TOKEN_SINK, "sink=%s"}, > + {ETM_TOKEN_ERR, NULL}, > +}; Wait, but we just parsed away the '=' and the whole thing is now a linked list of { key, value }? This also answers my question from the other email about the use cases for sending in ascii strings. In my opinion, all this is completely unnecessary. > +static int > +etm_set_drv_configs(struct perf_event *event, > + struct list_head *drv_configs) > +{ > + char *config, *sink; > + int len; > + struct perf_drv_config *drv_config; > + void *old_sink; > + > + list_for_each_entry(drv_config, drv_configs, entry) { > + /* ETM HW configuration needs a sink specification */ > + if (!drv_config->option) > + return -EINVAL; > + > + len = strlen(drv_config->config) + strlen("=") + > + strlen(drv_config->option) + 1; > + > + config = kmalloc(len, GFP_KERNEL); > + if (!config) > + return -ENOMEM; > + > + /* Reconstruct user configuration */ > + snprintf(config, len, "%s=%s", > + drv_config->config, drv_config->option); Wait, what? We parse this *twice*? There's basically a malloc+snprintf[which could have been kasprintf()]+match_token just to see if drv_config::option starts with a 'cpu%d:'? Regards, -- Alex
WARNING: multiple messages have this Message-ID (diff)
From: alexander.shishkin@linux.intel.com (Alexander Shishkin) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH V5 9/9] coresight: etm-perf: incorporating sink definition from cmd line Date: Mon, 22 Aug 2016 19:40:16 +0300 [thread overview] Message-ID: <8737lwn4en.fsf@ashishki-desk.ger.corp.intel.com> (raw) In-Reply-To: <1470932464-726-10-git-send-email-mathieu.poirier@linaro.org> Mathieu Poirier <mathieu.poirier@linaro.org> writes: > +enum { > + ETM_TOKEN_SINK_CPU, > + ETM_TOKEN_SINK, > + ETM_TOKEN_ERR, > +}; > + > +static const match_table_t drv_cfg_tokens = { > + {ETM_TOKEN_SINK_CPU, "sink=cpu%d:%s"}, > + {ETM_TOKEN_SINK, "sink=%s"}, > + {ETM_TOKEN_ERR, NULL}, > +}; Wait, but we just parsed away the '=' and the whole thing is now a linked list of { key, value }? This also answers my question from the other email about the use cases for sending in ascii strings. In my opinion, all this is completely unnecessary. > +static int > +etm_set_drv_configs(struct perf_event *event, > + struct list_head *drv_configs) > +{ > + char *config, *sink; > + int len; > + struct perf_drv_config *drv_config; > + void *old_sink; > + > + list_for_each_entry(drv_config, drv_configs, entry) { > + /* ETM HW configuration needs a sink specification */ > + if (!drv_config->option) > + return -EINVAL; > + > + len = strlen(drv_config->config) + strlen("=") + > + strlen(drv_config->option) + 1; > + > + config = kmalloc(len, GFP_KERNEL); > + if (!config) > + return -ENOMEM; > + > + /* Reconstruct user configuration */ > + snprintf(config, len, "%s=%s", > + drv_config->config, drv_config->option); Wait, what? We parse this *twice*? There's basically a malloc+snprintf[which could have been kasprintf()]+match_token just to see if drv_config::option starts with a 'cpu%d:'? Regards, -- Alex
next prev parent reply other threads:[~2016-08-22 16:40 UTC|newest] Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-08-11 16:20 [PATCH V5 0/9] perf: Driver specific configuration for PMU Mathieu Poirier 2016-08-11 16:20 ` Mathieu Poirier 2016-08-11 16:20 ` [PATCH V5 1/9] tools: Copy the header file needed by perf tools Mathieu Poirier 2016-08-11 16:20 ` Mathieu Poirier 2016-08-24 9:23 ` [tip:perf/core] tools: Copy coresight-pmu.h " tip-bot for Mathieu Poirier 2016-08-11 16:20 ` [PATCH V5 2/9] perf tools: making coresight PMU listable Mathieu Poirier 2016-08-11 16:20 ` Mathieu Poirier 2016-08-11 16:20 ` [PATCH V5 3/9] perf tools: adding coresight etm PMU record capabilities Mathieu Poirier 2016-08-11 16:20 ` Mathieu Poirier 2016-08-11 16:20 ` [PATCH V5 4/9] perf/core: Adding PMU driver specific configuration Mathieu Poirier 2016-08-11 16:20 ` Mathieu Poirier 2016-08-22 16:18 ` Alexander Shishkin 2016-08-22 16:18 ` Alexander Shishkin 2016-08-23 14:44 ` Mathieu Poirier 2016-08-23 14:44 ` Mathieu Poirier 2016-08-11 16:21 ` [PATCH V5 5/9] perf: Passing struct perf_event to function setup_aux() Mathieu Poirier 2016-08-11 16:21 ` Mathieu Poirier 2016-08-11 16:21 ` [PATCH V5 6/9] perf tools: add infrastructure for PMU specific configuration Mathieu Poirier 2016-08-11 16:21 ` Mathieu Poirier 2016-08-11 16:21 ` [PATCH V5 7/9] perf tools: pushing driver configuration down to the kernel Mathieu Poirier 2016-08-11 16:21 ` Mathieu Poirier 2016-08-11 16:21 ` [PATCH V5 8/9] coresight: adding sink parameter to function coresight_build_path() Mathieu Poirier 2016-08-11 16:21 ` Mathieu Poirier 2016-08-11 16:21 ` [PATCH V5 9/9] coresight: etm-perf: incorporating sink definition from cmd line Mathieu Poirier 2016-08-11 16:21 ` Mathieu Poirier 2016-08-22 16:40 ` Alexander Shishkin [this message] 2016-08-22 16:40 ` Alexander Shishkin 2016-08-23 14:46 ` Mathieu Poirier 2016-08-23 14:46 ` Mathieu Poirier 2016-08-22 15:15 ` [PATCH V5 0/9] perf: Driver specific configuration for PMU Alexander Shishkin 2016-08-22 15:15 ` Alexander Shishkin 2016-08-23 14:51 ` Mathieu Poirier 2016-08-23 14:51 ` Mathieu Poirier 2016-08-23 17:02 ` Alexander Shishkin 2016-08-23 17:02 ` Alexander Shishkin 2016-08-23 19:47 ` Mathieu Poirier 2016-08-23 19:47 ` Mathieu Poirier
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=8737lwn4en.fsf@ashishki-desk.ger.corp.intel.com \ --to=alexander.shishkin@linux.intel.com \ --cc=acme@kernel.org \ --cc=jolsa@kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mathieu.poirier@linaro.org \ --cc=mingo@redhat.com \ --cc=mtk.manpages@gmail.com \ --cc=peterz@infradead.org \ --cc=vince@deater.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.