Setting the pmu::capability and modify some code styles
Subsystems (2)
cover Setting the pmu::capability and modify some code styles
Advertise the PERF_PMU_CAP_NO_EXCLUDE capability.
And modify some code style, include the following:
1) Simplify the parameters of hisi_pmu_init() function.
2) Use hisi_pmu_init() function to simplify initialization of "hisi_pmu->pmu".
Junhao He (3):
drivers/perf: hisi: Advertise the PERF_PMU_CAP_NO_EXCLUDE capability drivers/perf: hisi: Simplify the parameters of hisi_pmu_init() drivers/perf: hisi: Extract initialization of "cpa_pmu->pmu"
drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c | 16 +--------------- drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_pa_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_pmu.c | 9 ++++++--- drivers/perf/hisilicon/hisi_uncore_pmu.h | 4 ++-- drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 2 +- 8 files changed, 14 insertions(+), 25 deletions(-)
Signature · 7 lines
2.33.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 1/3 drivers/perf: hisi: Advertise the PERF_PMU_CAP_NO_EXCLUDE capability
Missed initialization the variable of pmu::capabilities when extract the initialization code of hisi_pmu->pmu into a function.
HISI UNCORE PMU drivers counters that not support context exclusion. So we have to advertise the PERF_PMU_CAP_NO_EXCLUDE capability. This ensures that perf will prevent us from handling events where any exclusion flags are set.
--- drivers/perf/hisilicon/hisi_uncore_pmu.c | 1 + 1 file changed, 1 insertion(+)
drivers/perf/hisilicon/hisi_uncore_pmu.c +1 -0
@@ -546,6 +546,7 @@ void hisi_pmu_init(struct pmu *pmu, const char *name, pmu->stop = hisi_uncore_pmu_stop; pmu->read = hisi_uncore_pmu_read; pmu->attr_groups = attr_groups; + pmu->capabilities =PERF_PMU_CAP_NO_EXCLUDE ; }EXPORT_SYMBOL_GPL (hisi_pmu_init);
Signature · 7 lines
2.33.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 2/3 drivers/perf: hisi: Simplify the parameters of hisi_pmu_init()
In reply to Junhao HeUse "hisi_pmu" to simplify the parameter list for the hisi_pmu_init() function.
--- drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_pa_pmu.c | 2 +- drivers/perf/hisilicon/hisi_uncore_pmu.c | 8 +++++--- drivers/perf/hisilicon/hisi_uncore_pmu.h | 4 ++-- drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-)
drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c +1 -1
@@ -516,7 +516,7 @@ static int hisi_ddrc_pmu_probe(struct platform_device *pdev)"hisi_sccl%u_ddrc%u" , ddrc_pmu->sccl_id, ddrc_pmu->index_id); -hisi_pmu_init (&ddrc_pmu->pmu, name, ddrc_pmu->pmu_events.attr_groups,THIS_MODULE ); +hisi_pmu_init (ddrc_pmu, name,THIS_MODULE ); ret =perf_pmu_register (&ddrc_pmu->pmu, name,-1 );if (ret) {
drivers/perf/hisilicon/hisi_uncore_hha_pmu.c +1 -1
@@ -519,7 +519,7 @@ static int hisi_hha_pmu_probe(struct platform_device *pdev) name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"hisi_sccl%u_hha%u" , hha_pmu->sccl_id, hha_pmu->index_id); -hisi_pmu_init (&hha_pmu->pmu, name, hha_pmu->pmu_events.attr_groups,THIS_MODULE ); +hisi_pmu_init (hha_pmu, name,THIS_MODULE ); ret =perf_pmu_register (&hha_pmu->pmu, name,-1 );if (ret) {
drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c +1 -1
@@ -557,7 +557,7 @@ static int hisi_l3c_pmu_probe(struct platform_device *pdev)*/ name =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"hisi_sccl%u_l3c%u" , l3c_pmu->sccl_id, l3c_pmu->ccl_id); -hisi_pmu_init (&l3c_pmu->pmu, name, l3c_pmu->pmu_events.attr_groups,THIS_MODULE ); +hisi_pmu_init (l3c_pmu, name,THIS_MODULE ); ret =perf_pmu_register (&l3c_pmu->pmu, name,-1 );if (ret) {
drivers/perf/hisilicon/hisi_uncore_pa_pmu.c +1 -1
@@ -412,7 +412,7 @@ static int hisi_pa_pmu_probe(struct platform_device *pdev)return ret; } -hisi_pmu_init (&pa_pmu->pmu, name, pa_pmu->pmu_events.attr_groups,THIS_MODULE ); +hisi_pmu_init (pa_pmu, name,THIS_MODULE ); ret =perf_pmu_register (&pa_pmu->pmu, name,-1 );if (ret) {dev_err (pa_pmu->dev,"PMU register failed, ret = %d\n" , ret);
drivers/perf/hisilicon/hisi_uncore_pmu.c +5 -3
@@ -531,9 +531,11 @@ int hisi_uncore_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node) }EXPORT_SYMBOL_GPL (hisi_uncore_pmu_offline_cpu); -void hisi_pmu_init (struct pmu *pmu,const char *name, -const struct attribute_group **attr_groups,struct module *module) +void hisi_pmu_init (struct hisi_pmu *hisi_pmu,const char *name, +struct module *module) { +struct pmu *pmu = &hisi_pmu->pmu; + pmu->name = name; pmu->module = module; pmu->task_ctx_nr = perf_invalid_context;
@@ -545,7 +547,7 @@ void hisi_pmu_init(struct pmu *pmu, const char *name, pmu->start = hisi_uncore_pmu_start; pmu->stop = hisi_uncore_pmu_stop; pmu->read = hisi_uncore_pmu_read; - pmu->attr_groups = attr_groups; + pmu->attr_groups = hisi_pmu->pmu_events.attr_groups; pmu->capabilities =PERF_PMU_CAP_NO_EXCLUDE ; }EXPORT_SYMBOL_GPL (hisi_pmu_init);
drivers/perf/hisilicon/hisi_uncore_pmu.h +2 -2
@@ -121,6 +121,6 @@ ssize_t hisi_uncore_pmu_identifier_attr_show(struct device *dev,int hisi_uncore_pmu_init_irq (struct hisi_pmu *hisi_pmu,struct platform_device *pdev); -void hisi_pmu_init (struct pmu *pmu,const char *name, -const struct attribute_group **attr_groups,struct module *module); +void hisi_pmu_init (struct hisi_pmu *hisi_pmu,const char *name, +struct module *module);#endif /* __HISI_UNCORE_PMU_H__ */
drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c +1 -1
@@ -445,7 +445,7 @@ static int hisi_sllc_pmu_probe(struct platform_device *pdev)return ret; } -hisi_pmu_init (&sllc_pmu->pmu, name, sllc_pmu->pmu_events.attr_groups,THIS_MODULE ); +hisi_pmu_init (sllc_pmu, name,THIS_MODULE ); ret =perf_pmu_register (&sllc_pmu->pmu, name,-1 );if (ret) {
Signature · 7 lines
2.33.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 3/3 drivers/perf: hisi: Extract initialization of "cpa_pmu->pmu"
In reply to Junhao HeUse hisi_pmu_init() function to simplify initialization of "cpa_pmu->pmu".
--- drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/perf/hisilicon/hisi_uncore_cpa_pmu.c +1 -15
@@ -316,21 +316,7 @@ static int hisi_cpa_pmu_probe(struct platform_device *pdev)if (!name)return -ENOMEM ; - cpa_pmu->pmu = (struct pmu ) { - .name = name, - .module =THIS_MODULE , - .task_ctx_nr = perf_invalid_context, - .event_init = hisi_uncore_pmu_event_init, - .pmu_enable = hisi_uncore_pmu_enable, - .pmu_disable = hisi_uncore_pmu_disable, - .add = hisi_uncore_pmu_add, - .del = hisi_uncore_pmu_del, - .start = hisi_uncore_pmu_start, - .stop = hisi_uncore_pmu_stop, - .read = hisi_uncore_pmu_read, - .attr_groups = cpa_pmu->pmu_events.attr_groups, - .capabilities =PERF_PMU_CAP_NO_EXCLUDE , - }; +hisi_pmu_init (cpa_pmu, name,THIS_MODULE );/* Power Management should be disabled before using CPA PMU. */ hisi_cpa_pmu_disable_pm (cpa_pmu);
Signature · 7 lines
2.33.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 6 lines · Junhao He
Advertise the
PERF_PMU_CAP_NO_EXCLUDEcapability.And modify some code style, include the following:
1) Simplify the parameters ofhisi_pmu_init()function.
2) Usehisi_pmu_init()function to simplify initialization of "hisi_pmu->pmu".
Quoted 6 lines
Junhao He (3):
drivers/perf: hisi: Advertise thePERF_PMU_CAP_NO_EXCLUDEcapabilitydrivers/perf: hisi: Simplify the parameters ofhisi_pmu_init()drivers/perf: hisi: Extract initialization of "cpa_pmu->pmu"[...]
Applied to will (for-next/perf), thanks!
[1/3] drivers/perf: hisi: Advertise the PERF_PMU_CAP_NO_EXCLUDE capability
https://git.kernel.org/will/c/7f95da9d2dc4 [2/3] drivers/perf: hisi: Simplify the parameters of hisi_pmu_init() https://git.kernel.org/will/c/053b5579dacf [3/3] drivers/perf: hisi: Extract initialization of "cpa_pmu->pmu" https://git.kernel.org/will/c/e126f6f42f89
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev