Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1956443pxb; Fri, 25 Mar 2022 08:35:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyf3yGqG34EAW0X0LwGH/u7J6FlrY/HiHwa1vI851EP3nReJMUAI00VPWXZhLlV5gJRWNwr X-Received: by 2002:a05:6402:d0e:b0:418:f011:275e with SMTP id eb14-20020a0564020d0e00b00418f011275emr13646572edb.323.1648222555821; Fri, 25 Mar 2022 08:35:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648222555; cv=none; d=google.com; s=arc-20160816; b=kBDkX78ccyEH3/DmQ3Bj7Y+1f2GnbliGerUmMC+bphHcJJYg8ncqVjzDXz885Pehmp W86NgUM4x4pcGe/m+x7xkW1EHz2KPQR9IBKqlcEl6r8E6LOOo/nnuIGZtq+hsi0LmrqV 3MTotyFTxwBkcD2qb3RpBYhe/5rN8P8eK5zr+Ait866ypdu6fTkH2wF3yw7HipHFW4oM OIYZYfY2EQiImaeoSA5Vlfm7d1D002vnQz3nIAZYWey4lim2NEr79+40aNCsSlPYPNP/ Nm1H+yjKstMmPqoDDuaP59VtrI/3yMqhxu/a4ankMfZaMN2my5yT4UUJDoXCynugpF4z V2IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=bR3Xdsc0A/CEVp68Z04s5U/ffS6+4SVOvjC43+ZAa40=; b=wnDke/tHGxk+21XIVBS2eOurTT+jlnGv73jco7PeTrunhO8E+2VS/sT/kYkQEO/tNe iu7z/CRELQbkprCpbAIpQADvJTX8GdPISvqFQivLyYo04rEsk73KGNptTk3aoccWdnuS Csf7jsA6zC4+mGHajIlN+6h+nuan65DBBIRqctbpbpwqHQy6VQYV/D5c9xFmA/UJ/ZEm 5liqeJD2VEzLS8q/c1Lgc8jhSH53KltR5dxKJNxr1L0MNDvxpIjdM+qz5xSB3iDVzF+4 tB2LBarDKLTrr39hkyjA+M6q9UwyBnpnaBBxECnYGc6IWDZQzLaj872Fxp6s/ttBqMgi 2snQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=YzUVucaa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j25-20020a17090686d900b006df76385cebsi2376282ejy.395.2022.03.25.08.35.28; Fri, 25 Mar 2022 08:35:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=YzUVucaa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239165AbiCWQqP (ORCPT + 99 others); Wed, 23 Mar 2022 12:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236943AbiCWQqO (ORCPT ); Wed, 23 Mar 2022 12:46:14 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD21FCC0; Wed, 23 Mar 2022 09:44:43 -0700 (PDT) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22NGVjho004726; Wed, 23 Mar 2022 16:44:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=bR3Xdsc0A/CEVp68Z04s5U/ffS6+4SVOvjC43+ZAa40=; b=YzUVucaaU5yV0vnkJHaFFd+8UrRaJplDB96as66T8J4YYHG0himdGCf51LlY3ajgDtOn BNNZylPW0cjv70ZaA/U1Ua0z3mEI4hui/cTb4FAsEooO98l/seSWgEtTG/a6PVSr3M7w AUSRsSzJbxnaPNAgQBXtp0M+fpDZ3rvSxLL4N3dJ8uDG6BkUnXnZHKoz0HAWJNPulEDb Z7hFY0fANCfnhMetD9CO86aTSBpY8DGSkQvm7+NVtPmxF2BPFQHZW+5nxqAOSm5DOhC7 I7xpZYUyIjqlPC+PPdf0bPEnlAIJzqkBb35gaUe4CEfhuU1+tnrzwKpeBk18t69itNQy 2Q== Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 3f0757875g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Mar 2022 16:43:59 +0000 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 22NGhdwY022968; Wed, 23 Mar 2022 16:43:57 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04ams.nl.ibm.com with ESMTP id 3ew6t910m2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 23 Mar 2022 16:43:57 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 22NGhsVX26345744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 23 Mar 2022 16:43:54 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C0A242045; Wed, 23 Mar 2022 16:43:54 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 385434203F; Wed, 23 Mar 2022 16:43:49 +0000 (GMT) Received: from [9.43.30.161] (unknown [9.43.30.161]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 23 Mar 2022 16:43:48 +0000 (GMT) Message-ID: <51698a4d-1940-2191-5bdc-f3f7e4fa6e0e@linux.ibm.com> Date: Wed, 23 Mar 2022 22:13:47 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 1/2] drivers/nvdimm: Fix build failure when CONFIG_PERF_EVENTS is not set Content-Language: en-US To: Dan Williams 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 References: <20220318114133.113627-1-kjain@linux.ibm.com> From: kajoljain In-Reply-To: Content-Type: text/plain; charset=UTF-8 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: g66pYFIrv4bvqoq2-4MUOpsjFTo-mARV X-Proofpoint-ORIG-GUID: g66pYFIrv4bvqoq2-4MUOpsjFTo-mARV Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.850,Hydra:6.0.425,FMLib:17.11.64.514 definitions=2022-03-23_07,2022-03-23_01,2022-02-23_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 impostorscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 clxscore=1015 phishscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203230087 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 3/22/22 07:40, Dan Williams wrote: > 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; Hi Dan, Sure I will do the required changes. Thanks, Kajol Jain > >> +#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 >>