From: Kajol Jain <kjain@linux.ibm.com> To: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, peterz@infradead.org, dan.j.williams@intel.com, ira.weiny@intel.com, vishal.l.verma@intel.com, sfr@canb.auug.org.au Cc: santosh@fossix.org, maddy@linux.ibm.com, rnsastry@linux.ibm.com, aneesh.kumar@linux.ibm.com, atrajeev@linux.vnet.ibm.com, vaibhav@linux.ibm.com, tglx@linutronix.de, kjain@linux.ibm.com, linux-mm@kvack.org Subject: [PATCH 2/2] powerpc/papr_scm: Fix build failure when CONFIG_PERF_EVENTS is not set Date: Fri, 18 Mar 2022 17:11:33 +0530 [thread overview] Message-ID: <20220318114133.113627-2-kjain@linux.ibm.com> (raw) In-Reply-To: <20220318114133.113627-1-kjain@linux.ibm.com> The following build failure occures when CONFIG_PERF_EVENTS is not set as generic pmu functions are not visible in that scenario. arch/powerpc/platforms/pseries/papr_scm.c:372:35: error: ‘struct perf_event’ has no member named ‘attr’ p->nvdimm_events_map[event->attr.config], ^~ In file included from ./include/linux/list.h:5, from ./include/linux/kobject.h:19, from ./include/linux/of.h:17, from arch/powerpc/platforms/pseries/papr_scm.c:5: arch/powerpc/platforms/pseries/papr_scm.c: In function ‘papr_scm_pmu_event_init’: arch/powerpc/platforms/pseries/papr_scm.c:389:49: error: ‘struct perf_event’ has no member named ‘pmu’ struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); ^~ ./include/linux/container_of.h:18:26: note: in definition of macro ‘container_of’ void *__mptr = (void *)(ptr); \ ^~~ arch/powerpc/platforms/pseries/papr_scm.c:389:30: note: in expansion of macro ‘to_nvdimm_pmu’ struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); ^~~~~~~~~~~~~ In file included from ./include/linux/bits.h:22, from ./include/linux/bitops.h:6, from ./include/linux/of.h:15, from arch/powerpc/platforms/pseries/papr_scm.c:5: Fix the build issue by adding check for CONFIG_PERF_EVENTS config option and disabling the papr_scm perf interface support incase this config is not set Fixes: 4c08d4bbc089 ("powerpc/papr_scm: Add perf interface support") (Commit id based on linux-next tree) Signed-off-by: Kajol Jain <kjain@linux.ibm.com> --- arch/powerpc/platforms/pseries/papr_scm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- - This fix patch changes are added and tested on top of linux-next tree on the 'next-20220315' branch. --- diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c index 4f65bc0fb861..ffe85aeb4127 100644 --- a/arch/powerpc/platforms/pseries/papr_scm.c +++ b/arch/powerpc/platforms/pseries/papr_scm.c @@ -19,7 +19,10 @@ #include <asm/papr_pdsm.h> #include <asm/mce.h> #include <asm/unaligned.h> + +#ifdef CONFIG_PERF_EVENTS #include <linux/perf_event.h> +#endif #define BIND_ANY_ADDR (~0ul) @@ -69,7 +72,9 @@ #define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS) #define PAPR_SCM_PERF_STATS_VERSION 0x1 +#ifdef CONFIG_PERF_EVENTS #define to_nvdimm_pmu(_pmu) container_of(_pmu, struct nvdimm_pmu, pmu) +#endif /* Struct holding a single performance metric */ struct papr_scm_perf_stat { @@ -127,8 +132,10 @@ struct papr_scm_priv { /* The bits which needs to be overridden */ u64 health_bitmap_inject_mask; +#ifdef CONFIG_PERF_EVENTS /* array to have event_code and stat_id mappings */ char **nvdimm_events_map; +#endif }; static int papr_scm_pmem_flush(struct nd_region *nd_region, @@ -349,6 +356,7 @@ static ssize_t drc_pmem_query_stats(struct papr_scm_priv *p, return 0; } +#ifdef CONFIG_PERF_EVENTS static int papr_scm_pmu_get_value(struct perf_event *event, struct device *dev, u64 *count) { struct papr_scm_perf_stat *stat; @@ -560,6 +568,7 @@ static void papr_scm_pmu_register(struct papr_scm_priv *p) pmu_err_print: dev_info(&p->pdev->dev, "nvdimm pmu didn't register rc=%d\n", rc); } +#endif /* * Issue hcall to retrieve dimm health info and populate papr_scm_priv with the @@ -1537,7 +1546,10 @@ static int papr_scm_probe(struct platform_device *pdev) goto err2; platform_set_drvdata(pdev, p); + +#ifdef CONFIG_PERF_EVENTS papr_scm_pmu_register(p); +#endif return 0; @@ -1557,11 +1569,14 @@ static int papr_scm_remove(struct platform_device *pdev) nvdimm_bus_unregister(p->bus); drc_pmem_unbind(p); +#ifdef CONFIG_PERF_EVENTS if (pdev->archdata.priv) unregister_nvdimm_pmu(pdev->archdata.priv); pdev->archdata.priv = NULL; kfree(p->nvdimm_events_map); +#endif + kfree(p->bus_desc.provider_name); kfree(p); -- 2.31.1
WARNING: multiple messages have this Message-ID (diff)
From: Kajol Jain <kjain@linux.ibm.com> To: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, peterz@infradead.org, dan.j.williams@intel.com, ira.weiny@intel.com, vishal.l.verma@intel.com, sfr@canb.auug.org.au Cc: santosh@fossix.org, maddy@linux.ibm.com, rnsastry@linux.ibm.com, aneesh.kumar@linux.ibm.com, linux-mm@kvack.org, atrajeev@linux.vnet.ibm.com, kjain@linux.ibm.com, vaibhav@linux.ibm.com, tglx@linutronix.de Subject: [PATCH 2/2] powerpc/papr_scm: Fix build failure when CONFIG_PERF_EVENTS is not set Date: Fri, 18 Mar 2022 17:11:33 +0530 [thread overview] Message-ID: <20220318114133.113627-2-kjain@linux.ibm.com> (raw) In-Reply-To: <20220318114133.113627-1-kjain@linux.ibm.com> The following build failure occures when CONFIG_PERF_EVENTS is not set as generic pmu functions are not visible in that scenario. arch/powerpc/platforms/pseries/papr_scm.c:372:35: error: ‘struct perf_event’ has no member named ‘attr’ p->nvdimm_events_map[event->attr.config], ^~ In file included from ./include/linux/list.h:5, from ./include/linux/kobject.h:19, from ./include/linux/of.h:17, from arch/powerpc/platforms/pseries/papr_scm.c:5: arch/powerpc/platforms/pseries/papr_scm.c: In function ‘papr_scm_pmu_event_init’: arch/powerpc/platforms/pseries/papr_scm.c:389:49: error: ‘struct perf_event’ has no member named ‘pmu’ struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); ^~ ./include/linux/container_of.h:18:26: note: in definition of macro ‘container_of’ void *__mptr = (void *)(ptr); \ ^~~ arch/powerpc/platforms/pseries/papr_scm.c:389:30: note: in expansion of macro ‘to_nvdimm_pmu’ struct nvdimm_pmu *nd_pmu = to_nvdimm_pmu(event->pmu); ^~~~~~~~~~~~~ In file included from ./include/linux/bits.h:22, from ./include/linux/bitops.h:6, from ./include/linux/of.h:15, from arch/powerpc/platforms/pseries/papr_scm.c:5: Fix the build issue by adding check for CONFIG_PERF_EVENTS config option and disabling the papr_scm perf interface support incase this config is not set Fixes: 4c08d4bbc089 ("powerpc/papr_scm: Add perf interface support") (Commit id based on linux-next tree) Signed-off-by: Kajol Jain <kjain@linux.ibm.com> --- arch/powerpc/platforms/pseries/papr_scm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- - This fix patch changes are added and tested on top of linux-next tree on the 'next-20220315' branch. --- diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c index 4f65bc0fb861..ffe85aeb4127 100644 --- a/arch/powerpc/platforms/pseries/papr_scm.c +++ b/arch/powerpc/platforms/pseries/papr_scm.c @@ -19,7 +19,10 @@ #include <asm/papr_pdsm.h> #include <asm/mce.h> #include <asm/unaligned.h> + +#ifdef CONFIG_PERF_EVENTS #include <linux/perf_event.h> +#endif #define BIND_ANY_ADDR (~0ul) @@ -69,7 +72,9 @@ #define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS) #define PAPR_SCM_PERF_STATS_VERSION 0x1 +#ifdef CONFIG_PERF_EVENTS #define to_nvdimm_pmu(_pmu) container_of(_pmu, struct nvdimm_pmu, pmu) +#endif /* Struct holding a single performance metric */ struct papr_scm_perf_stat { @@ -127,8 +132,10 @@ struct papr_scm_priv { /* The bits which needs to be overridden */ u64 health_bitmap_inject_mask; +#ifdef CONFIG_PERF_EVENTS /* array to have event_code and stat_id mappings */ char **nvdimm_events_map; +#endif }; static int papr_scm_pmem_flush(struct nd_region *nd_region, @@ -349,6 +356,7 @@ static ssize_t drc_pmem_query_stats(struct papr_scm_priv *p, return 0; } +#ifdef CONFIG_PERF_EVENTS static int papr_scm_pmu_get_value(struct perf_event *event, struct device *dev, u64 *count) { struct papr_scm_perf_stat *stat; @@ -560,6 +568,7 @@ static void papr_scm_pmu_register(struct papr_scm_priv *p) pmu_err_print: dev_info(&p->pdev->dev, "nvdimm pmu didn't register rc=%d\n", rc); } +#endif /* * Issue hcall to retrieve dimm health info and populate papr_scm_priv with the @@ -1537,7 +1546,10 @@ static int papr_scm_probe(struct platform_device *pdev) goto err2; platform_set_drvdata(pdev, p); + +#ifdef CONFIG_PERF_EVENTS papr_scm_pmu_register(p); +#endif return 0; @@ -1557,11 +1569,14 @@ static int papr_scm_remove(struct platform_device *pdev) nvdimm_bus_unregister(p->bus); drc_pmem_unbind(p); +#ifdef CONFIG_PERF_EVENTS if (pdev->archdata.priv) unregister_nvdimm_pmu(pdev->archdata.priv); pdev->archdata.priv = NULL; kfree(p->nvdimm_events_map); +#endif + kfree(p->bus_desc.provider_name); kfree(p); -- 2.31.1
next prev parent reply other threads:[~2022-03-18 11:42 UTC|newest] Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-18 11:41 [PATCH 1/2] drivers/nvdimm: Fix build failure when CONFIG_PERF_EVENTS is not set Kajol Jain 2022-03-18 11:41 ` Kajol Jain 2022-03-18 11:41 ` Kajol Jain [this message] 2022-03-18 11:41 ` [PATCH 2/2] powerpc/papr_scm: " Kajol Jain 2022-03-21 21:39 ` Dan Williams 2022-03-21 21:39 ` Dan Williams 2022-03-22 1:45 ` Dan Williams 2022-03-22 1:45 ` Dan Williams 2022-03-22 14:30 ` kajoljain 2022-03-22 14:30 ` kajoljain 2022-03-22 14:29 ` kajoljain 2022-03-22 14:29 ` kajoljain 2022-03-22 16:32 ` Dan Williams 2022-03-22 16:32 ` Dan Williams 2022-03-23 7:43 ` Aneesh Kumar K V 2022-03-23 7:43 ` Aneesh Kumar K V 2022-03-23 7:48 ` Vaibhav Jain 2022-03-23 7:48 ` Vaibhav Jain 2022-03-23 10:04 ` Michael Ellerman 2022-03-23 10:04 ` Michael Ellerman 2022-03-23 15:32 ` Dan Williams 2022-03-23 15:32 ` Dan Williams 2022-03-23 16:40 ` kajoljain 2022-03-23 16:40 ` kajoljain 2022-03-22 2:10 ` [PATCH 1/2] drivers/nvdimm: " Dan Williams 2022-03-22 2:10 ` Dan Williams 2022-03-23 16:43 ` kajoljain 2022-03-23 16:43 ` kajoljain
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=20220318114133.113627-2-kjain@linux.ibm.com \ --to=kjain@linux.ibm.com \ --cc=aneesh.kumar@linux.ibm.com \ --cc=atrajeev@linux.vnet.ibm.com \ --cc=dan.j.williams@intel.com \ --cc=ira.weiny@intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=linux-next@vger.kernel.org \ --cc=linuxppc-dev@lists.ozlabs.org \ --cc=maddy@linux.ibm.com \ --cc=mpe@ellerman.id.au \ --cc=nvdimm@lists.linux.dev \ --cc=peterz@infradead.org \ --cc=rnsastry@linux.ibm.com \ --cc=santosh@fossix.org \ --cc=sfr@canb.auug.org.au \ --cc=tglx@linutronix.de \ --cc=vaibhav@linux.ibm.com \ --cc=vishal.l.verma@intel.com \ /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.