Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2413616pxp; Mon, 21 Mar 2022 19:39:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxca1+/JpUVb7YdUZBUBbC/DzP8jyQd9MgiOMFRPjk/46XrbYw0OD4CsX4MPFAf55DnKAp1 X-Received: by 2002:a17:90b:3ece:b0:1bf:841e:930b with SMTP id rm14-20020a17090b3ece00b001bf841e930bmr2369608pjb.212.1647916740568; Mon, 21 Mar 2022 19:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647916740; cv=none; d=google.com; s=arc-20160816; b=PyqJ/27Wse4YkSeQd+D/jOtkEGEnntwZUpGvjoKW+BjmtpvGjIZsNax9DCDgUlyF7s 3lV+kD0l3G76V+5Yu6qZ6zY1EF77fBl870uQvj3TkuA2XPvSiodoAA7YT/9gqbm1AXks VUzEYUMXMLFPaVZXVb69E6R089JoxO2vGQlyGRy0vegbIORTu9amCHIEt3//uuJpk4IG PS+aUf7UaymrZEP3ka/0rUnNlwUWk8dcrv2m+o4z8m6lAG5Z432n5u+K5Tmo6VwhHNGC BFbh8b711olqJrBbpIz/OQrLhYqmpupOa4L7DULhmtKMuvSGrlpnLjlMTDP+kscGCBS5 Sakg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gGZp+MDIUzKlsOtQAo2TyTq0vVOirk1X0NOX9ev9OMc=; b=n8pR45gMaJQOx26PqMU7+6+lYPqBh2JHgOxhIrJwmKYjKwjN4GPbwS4jJpa+uJbchy nIVVt+tyzXaEC9vyKH2292B7DJIO03Yw7UN2PE3/tT+A3RSTKFRTjzxV1YxHnvylXpKA zSytaOO1B0QB1QFVJ9gAJj7yS5RIxMpgeZ2ZaGoAb3kHEgBIsRendRiWhd8KrCZj+jDR mtrmvEzA9fYmRJ+ZFj5TeeYcmzFmizsTRomgiS8N/4FobnHtyQS3PyTJx7A3LM9nNfCF P+wEkpTAfpG1yznhLa4GuLWj0jlVaJZxVMpG96oSxNPeNwGm2X7Usx94ogSXCn38L33U oBBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20210112.gappssmtp.com header.s=20210112 header.b=jsl5hTKi; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d24-20020a634f18000000b003816043eeedsi13990613pgb.226.2022.03.21.19.39.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 19:39:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@intel-com.20210112.gappssmtp.com header.s=20210112 header.b=jsl5hTKi; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1B4CE1BEB8; Mon, 21 Mar 2022 19:11:26 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235385AbiCVCMj (ORCPT + 99 others); Mon, 21 Mar 2022 22:12:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235223AbiCVCMi (ORCPT ); Mon, 21 Mar 2022 22:12:38 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 359231CFCD for ; Mon, 21 Mar 2022 19:11:07 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id o6-20020a17090a9f8600b001c6562049d9so900754pjp.3 for ; Mon, 21 Mar 2022 19:11:07 -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; bh=gGZp+MDIUzKlsOtQAo2TyTq0vVOirk1X0NOX9ev9OMc=; b=jsl5hTKisonrNJYTeMtNHzyDFdCfEUgD/ujMhDJCupZnphMkfd0uzKApmqk/n3FaED i46ZTIJ+Lj99NIG2v73jtrSrTVhoCDEpoHo9w7f4fY0L5l88DtDWVG91DqRej+vdmVzy Xp6pL5ctDPnLYuyosqtk4O/t+86XwfOHd3CCYIEVOeCa0p5eOsaD1qEqq8a0aXbxvWHf gX803FBk8yWx2Q0ft0SZnpgZ40r22BPfvagHhSHp0vKlLkzolVbE4jP+k1HbJAXZQKRY 0piuCSEkh7Hwa3M83oI+taVZYG/M22LqqoyUtOWoKSK3WFjcvR01ygKRGV4swgcRolZg Dgeg== 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; bh=gGZp+MDIUzKlsOtQAo2TyTq0vVOirk1X0NOX9ev9OMc=; b=mn0lhATSJav+4jy20Wy6WsKYDj7l8P/+POKK//+ebp7fcrj+e6gdXMSdp5URrweg44 scq/GVEDcroW9+AF9sF3HllG88bfDXTocIdGOjrEoZ+WwRW6DUC7Ez/KSUi4THjY6NSC abDWMLzuhFKPA/wk+oQwb+Z1vgbiG8yyz/9gWo/xp+BBO4eXqRpXrCk006Kp0e/lYNZF BxAlF0raHXJVbHhgpQQVZATKTsVh1eLuUIAIECmpBMoXkbI9YGTpq3idGODmWhZqttTh aKyqGq8I1EhcCJiNMb9atZJHQ50r5cQhXTg84I1NMa8d7DtX6+DuXwx5yytjqT9r9Ek4 WUcg== X-Gm-Message-State: AOAM532qfZnc6ck/7UVagAzLSVP6G4hfBdpTA9+QD/Mw7e5aFluKUhaJ JaxYlxUWVrUTW9DkuQeJwOAZvRKZDjawsGNbf1cCBA== X-Received: by 2002:a17:90a:430d:b0:1bc:f340:8096 with SMTP id q13-20020a17090a430d00b001bcf3408096mr2221086pjg.93.1647915066682; Mon, 21 Mar 2022 19:11:06 -0700 (PDT) MIME-Version: 1.0 References: <20220318114133.113627-1-kjain@linux.ibm.com> In-Reply-To: <20220318114133.113627-1-kjain@linux.ibm.com> From: Dan Williams Date: Mon, 21 Mar 2022 19:10:59 -0700 Message-ID: Subject: Re: [PATCH 1/2] drivers/nvdimm: 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 , kernel test robot Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > |-- s390-randconfig-r044-20220313 > | |-- nd_perf.c:(.text):undefined-reference-to-perf_pmu_migrate_context > | |-- nd_perf.c:(.text):undefined-reference-to-perf_pmu_register > | `-- nd_perf.c:(.text):undefined-reference-to-perf_pmu_unregister > > Similar build failure in nds32 architecture: > nd_perf.c:(.text+0x21e): undefined reference to `perf_pmu_migrate_context' > nd_perf.c:(.text+0x434): undefined reference to `perf_pmu_register' > nd_perf.c:(.text+0x57c): undefined reference to `perf_pmu_unregister' > > Fix this issue by adding check for CONFIG_PERF_EVENTS config option > and disabling the nvdimm perf interface incase this config is not set. > > Also removed function declaration of perf_pmu_migrate_context, > perf_pmu_register, perf_pmu_unregister functions from nd.h as these are > common pmu functions which are part of perf_event.h and since we > are disabling nvdimm perf interface incase CONFIG_PERF_EVENTS option > is not set, we not need to declare them in nd.h > > Fixes: 0fab1ba6ad6b ("drivers/nvdimm: Add perf interface to expose > nvdimm performance stats") (Commit id based on linux-next tree) > Signed-off-by: Kajol Jain > Link: https://lore.kernel.org/all/62317124.YBQFU33+s%2FwdvWGj%25lkp@intel.com/ > Reported-by: kernel test robot > --- > drivers/nvdimm/Makefile | 2 +- > include/linux/nd.h | 7 ++++--- > 2 files changed, 5 insertions(+), 4 deletions(-) > > --- > - This fix patch changes are added and tested on top of linux-next tree > on the 'next-20220315' branch. > --- > diff --git a/drivers/nvdimm/Makefile b/drivers/nvdimm/Makefile > index 3fb806748716..ba0296dca9db 100644 > --- a/drivers/nvdimm/Makefile > +++ b/drivers/nvdimm/Makefile > @@ -15,7 +15,7 @@ nd_e820-y := e820.o > libnvdimm-y := core.o > libnvdimm-y += bus.o > libnvdimm-y += dimm_devs.o > -libnvdimm-y += nd_perf.o > +libnvdimm-$(CONFIG_PERF_EVENTS) += nd_perf.o > libnvdimm-y += dimm.o > libnvdimm-y += region_devs.o > libnvdimm-y += region.o > diff --git a/include/linux/nd.h b/include/linux/nd.h > index 7b2ccbdc1cbc..a4265eaf5ae8 100644 > --- a/include/linux/nd.h > +++ b/include/linux/nd.h > @@ -8,8 +8,10 @@ > #include > #include > #include > +#ifdef CONFIG_PERF_EVENTS > #include Why must this not be included? Doesn't it already handle the CONFIG_PERF_EVENTS=n case internally? > #include I notice now that this platform-device header should have never been added in the first place, just forward declare: struct platform_device; > +#endif > > enum nvdimm_event { > NVDIMM_REVALIDATE_POISON, > @@ -25,6 +27,7 @@ enum nvdimm_claim_class { > NVDIMM_CCLASS_UNKNOWN, > }; > > +#ifdef CONFIG_PERF_EVENTS > #define NVDIMM_EVENT_VAR(_id) event_attr_##_id > #define NVDIMM_EVENT_PTR(_id) (&event_attr_##_id.attr.attr) Why must these be inside the ifdef guard? > > @@ -63,9 +66,7 @@ extern ssize_t nvdimm_events_sysfs_show(struct device *dev, > > int register_nvdimm_pmu(struct nvdimm_pmu *nvdimm, struct platform_device *pdev); > void unregister_nvdimm_pmu(struct nvdimm_pmu *nd_pmu); Shouldn't there also be stub functions in the CONFIG_PERF_EVENTS=n case? static inline int register_nvdimm_pmu(struct nvdimm_pmu *nvdimm, struct platform_device *pdev) { return -ENXIO; } static inline void unregister_nvdimm_pmu(struct nvdimm_pmu *nd_pmu) { } > -void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu); > -int perf_pmu_register(struct pmu *pmu, const char *name, int type); > -void perf_pmu_unregister(struct pmu *pmu); Yeah, I should have caught these earlier. > +#endif > > struct nd_device_driver { > struct device_driver drv; > -- > 2.31.1 >