[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4iNy-RqKgwc61c+hL9g1zAE_tL5r_mqUQwCiKTzevjoDA@mail.gmail.com>
Date: Mon, 21 Mar 2022 18:45:08 -0700
From: Dan Williams <dan.j.williams@...el.com>
To: Kajol Jain <kjain@...ux.ibm.com>
Cc: Michael Ellerman <mpe@...erman.id.au>,
linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
Linux NVDIMM <nvdimm@...ts.linux.dev>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux-Next Mailing List <linux-next@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
"Weiny, Ira" <ira.weiny@...el.com>,
Vishal L Verma <vishal.l.verma@...el.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Santosh Sivaraj <santosh@...six.org>, maddy@...ux.ibm.com,
rnsastry@...ux.ibm.com,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
atrajeev@...ux.vnet.ibm.com, Vaibhav Jain <vaibhav@...ux.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Linux MM <linux-mm@...ck.org>
Subject: Re: [PATCH 2/2] powerpc/papr_scm: Fix build failure when
CONFIG_PERF_EVENTS is not set
On Mon, Mar 21, 2022 at 2:39 PM Dan Williams <dan.j.williams@...el.com> wrote:
>
> On Fri, Mar 18, 2022 at 4:42 AM Kajol Jain <kjain@...ux.ibm.com> wrote:
> >
> > 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@...ux.ibm.com>
> > ---
> > arch/powerpc/platforms/pseries/papr_scm.c | 15 +++++++++++++++
>
> This is a bit messier than I would have liked mainly because it dumps
> a bunch of ifdefery into a C file contrary to coding style, "Wherever
> possible, don't use preprocessor conditionals (#if, #ifdef) in .c
> files". I would expect this all to move to an organization like:
>
> arch/powerpc/platforms/pseries/papr_scm/main.c
> arch/powerpc/platforms/pseries/papr_scm/perf.c
>
> ...and a new config symbol like:
>
> config PAPR_SCM_PERF
> depends on PAPR_SCM && PERF_EVENTS
> def_bool y
>
> ...with wrappers in header files to make everything compile away
> without any need for main.c to carry an ifdef.
>
> Can you turn a patch like that in the next couple days? Otherwise, I
> think if Linus saw me sending a late breaking compile fix that threw
> coding style out the window he'd have cause to just drop the pull
> request entirely.
Also, please base it on the current state of the libnvdimm-for-next
branch as -next includes some of the SMART health changes leading to
at least one conflict.
Powered by blists - more mailing lists