From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E030C433EF for ; Mon, 21 Mar 2022 21:39:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E738F6B0072; Mon, 21 Mar 2022 17:39:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E21FB6B0073; Mon, 21 Mar 2022 17:39:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC3036B0074; Mon, 21 Mar 2022 17:39:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.28]) by kanga.kvack.org (Postfix) with ESMTP id BE9936B0072 for ; Mon, 21 Mar 2022 17:39:33 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 9082F605BB for ; Mon, 21 Mar 2022 21:39:33 +0000 (UTC) X-FDA: 79269710226.09.8D54902 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf26.hostedemail.com (Postfix) with ESMTP id 83671140033 for ; Mon, 21 Mar 2022 21:39:32 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id w8so13842505pll.10 for ; Mon, 21 Mar 2022 14:39:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=hzlxuoVcUtFNyYhd7IaP3vW/n/31iVrjVI0cYpxyVIg=; b=AJJS8AlLvE3dh4Iw3f148oDobBs8GBjNK4HQR4fd1ld62s0aCs+22XINlkoJDU3AoS 8uOi8t84billfQr0/CqrEHKAzh01irX6vV3+g/0cziRJHBRIamVkeOpo/BnaIatO7PZV Eh43oCbXlnRIdtB69OTh5c/BRYxUtttvmXan5DnrMyeb/hsvFapXSvlvx+JuWcvRFGHt Ntke3y/TTx6l6EOaJqInsPSOd9mVsFU0WbP2/5lR+aO70ZuS7ys8aNRkV3i6D/Lf0evC r6BJwCreN/NdOKs2SjJv0+1od6GQSOKpx1d5z0hh7EF2eui/EcuQxfMSPoOkBKCZ7FWC /+Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hzlxuoVcUtFNyYhd7IaP3vW/n/31iVrjVI0cYpxyVIg=; b=dOziCVMiyNWlSsYK/dJTx9Dti0NbZRz1GCmiHSheF5wsUsPI7jWDAZh81mP01hCpIe M+CgBtLSBWfOXsM7UpGjKUTZxZ9zlZ1OkYN72KcIZZnk50jOWuyLNga9VeAlXuR4t/Vr hrG+2rGH27KnMCRc6Zx9rRPBOT4Rj0iU8w2N90vJRpFPzffVHXJCW62SQy/GT5WBrSHL 3IDM72PiszHp1XuZ87ntNkyaIiMswS+CXu3xmtDI2jfvZUf8NWzn3r8Mo6zPsOl0JRNf 64hQC/v2d13q965xAHBgwnLFY6ETNCClZ4xyIxxNpThe7G+RDSe5KajMEDDNrXzOKbuA Df2A== X-Gm-Message-State: AOAM531PyxmGzowYvxaerccs4WGZnAtBO4eg2zay2wV8zYSoAS+tdyte U8qbChcMg5U4+1E5gFUFuxYq2HPH0C1KQryPJQivIO0cS9+QqA== X-Google-Smtp-Source: ABdhPJyzdofKTKHoiJ4iGCBbHSPi4Xc1wlwYjpgmL6SpWKAD7UioDwd+ubLQF8zj102JpbsH9iOBSWpSmWQXM5a6nHg= X-Received: by 2002:a17:903:32c7:b0:154:4156:f384 with SMTP id i7-20020a17090332c700b001544156f384mr10917932plr.34.1647898771195; Mon, 21 Mar 2022 14:39:31 -0700 (PDT) MIME-Version: 1.0 References: <20220318114133.113627-1-kjain@linux.ibm.com> <20220318114133.113627-2-kjain@linux.ibm.com> In-Reply-To: <20220318114133.113627-2-kjain@linux.ibm.com> From: Dan Williams Date: Mon, 21 Mar 2022 14:39:23 -0700 Message-ID: Subject: Re: [PATCH 2/2] powerpc/papr_scm: Fix build failure when CONFIG_PERF_EVENTS is not set To: Kajol Jain Cc: Michael Ellerman , linuxppc-dev , Linux NVDIMM , Linux Kernel Mailing List , Linux-Next Mailing List , Peter Zijlstra , "Weiny, Ira" , Vishal L Verma , Stephen Rothwell , Santosh Sivaraj , maddy@linux.ibm.com, rnsastry@linux.ibm.com, "Aneesh Kumar K.V" , atrajeev@linux.vnet.ibm.com, Vaibhav Jain , Thomas Gleixner , Linux MM Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Queue-Id: 83671140033 X-Stat-Signature: w8suhe563krz1qoqtjenz4ake7jifjwj Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=intel-com.20210112.gappssmtp.com header.s=20210112 header.b=AJJS8AlL; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=none (imf26.hostedemail.com: domain of dan.j.williams@intel.com has no SPF policy when checking 209.85.214.176) smtp.mailfrom=dan.j.williams@intel.com X-Rspamd-Server: rspam05 X-HE-Tag: 1647898772-82180 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Mar 18, 2022 at 4:42 AM Kajol Jain 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: =E2=80=98struct = perf_event=E2=80=99 has no member named =E2=80=98attr=E2=80=99 > 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 =E2=80=98papr_scm_= pmu_event_init=E2=80=99: > arch/powerpc/platforms/pseries/papr_scm.c:389:49: error: =E2=80=98struct = perf_event=E2=80=99 has no member named =E2=80=98pmu=E2=80=99 > struct nvdimm_pmu *nd_pmu =3D to_nvdimm_pmu(event->pmu); > ^~ > ./include/linux/container_of.h:18:26: note: in definition of macro =E2=80= =98container_of=E2=80=99 > void *__mptr =3D (void *)(ptr); \ > ^~~ > arch/powerpc/platforms/pseries/papr_scm.c:389:30: note: in expansion of m= acro =E2=80=98to_nvdimm_pmu=E2=80=99 > struct nvdimm_pmu *nd_pmu =3D 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") (Com= mit id > based on linux-next tree) > Signed-off-by: Kajol Jain > --- > 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.