Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp159399pxb; Thu, 2 Sep 2021 22:22:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhWf0/+gRNHnZFiVOtp9lDKpPXfGIdIh1AM2cHzTfbnFAHbSxgpMxSnCM324LuasjGii2G X-Received: by 2002:a05:6e02:1250:: with SMTP id j16mr1306608ilq.215.1630646525234; Thu, 02 Sep 2021 22:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630646525; cv=none; d=google.com; s=arc-20160816; b=t9oRiNNTIDv2TBOV80zfZZA6L0H2gucp539ZBMVC9mGLoW+ZGDGLP0ltTRCQAvTBGA kiFqKss6nFzVhmzp6ZmxBZPF8IHoy/+B6u3WPZTImwe8WKvPuzrSZNLnCzFS7dyLCQAl KV7HKfkxE2KTP2BHNFkAxo5B/5y8E2+tyQ7PjGsy5BMDBPKKvYcOpebSCVpze1r6ZHlx FfAiiEs3PQqmVAvIke/rc7ItEcWf9NpfWTpvSFiIiIbdBzl0wPx55zuhxtRUZlokq8Kk y65cdeXQoXLga6koa0rRYClOgIVlo22se5pgegXgvkhCIbtY+i49tkpdkkz8hSLziMKl YxHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9KfUvzYgAT3H6qM2KQ85LLSVJMiL9yuP9cnvQZGOeGU=; b=yr8oxqVNg+pXLEXYWYNHmugJzeEuGtwxa/nPhYOv/gCdZ+h1TXw7d4Jp4gTbpcAKLB +73xwaZ/6i4S0D5R/4zOWR1A0uFiPMTwnd/SBvG86uy15fUN4ZBvc12zDEiLoEVLt0Vd OZyvFGOngHsJndviwKtQRkcszpJOADEO+lU4NjuSKmaNF4LLS27eeCM14PpWZfZeBUZF efmM4zRKGMj7ACFqG4PZloWdmfwPKcHbNFF92ciIDWZvPXR3legJLR7RwJIJMJaXK2Fa 6iFZ+y15ii7YKphrlmJQx6RnuscE4GVRe9POZSDkRXyaT4fPJAgLHedyAkUsR4+Q0cej catw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=mGlBJyPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o16si4088879ils.161.2021.09.02.22.21.53; Thu, 02 Sep 2021 22:22:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=mGlBJyPl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233591AbhICFLz (ORCPT + 99 others); Fri, 3 Sep 2021 01:11:55 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:19682 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231705AbhICFLx (ORCPT ); Fri, 3 Sep 2021 01:11:53 -0400 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 18354SRr060741; Fri, 3 Sep 2021 01:10:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=9KfUvzYgAT3H6qM2KQ85LLSVJMiL9yuP9cnvQZGOeGU=; b=mGlBJyPlBGStHzwZ35Parhmdi88hAWs8x1t7coWTGd6SXUbLnHx2CdHmruC2QxTeAaks hb/4j5VA0G16m6TqI21PHXHd96ibh4qg2RDq3wf9K1xHAqkToLiqigkMFInQDhOUFWlP A+GTvGteRkZIEpAJ3W+A8KGEajZPGGaODA6uTQ9K55Vhl7bT77bLNT7no4iS75vLBxef lDVmwwAZpI68kjkERKN8O/0WLHmt+nHzGx3Wp2aCCkLLH9T22n2BVUWNPqdBfxPo0sqF akMKugzlFTtGvk8R3GjUkcuXTrnD+Afoomk879e2EaCLIHRpuPPAVPgxVF0WDyBzOkh0 ng== Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 3aucqu8ptw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Sep 2021 01:10:31 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 18357Jx7027003; Fri, 3 Sep 2021 05:10:29 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma05fra.de.ibm.com with ESMTP id 3au6psjnxs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 Sep 2021 05:10:29 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 18356JbZ59048196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 3 Sep 2021 05:06:19 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5527E42052; Fri, 3 Sep 2021 05:10:25 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1A8174204C; Fri, 3 Sep 2021 05:10:21 +0000 (GMT) Received: from localhost.localdomain.com (unknown [9.43.127.78]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 3 Sep 2021 05:10:20 +0000 (GMT) From: Kajol Jain To: mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, peterz@infradead.org, dan.j.williams@intel.com, ira.weiny@intel.com, vishal.l.verma@intel.com Cc: maddy@linux.ibm.com, santosh@fossix.org, aneesh.kumar@linux.ibm.com, vaibhav@linux.ibm.com, atrajeev@linux.vnet.ibm.com, tglx@linutronix.de, kjain@linux.ibm.com, rnsastry@linux.ibm.com Subject: [RESEND PATCH v4 1/4] drivers/nvdimm: Add nvdimm pmu structure Date: Fri, 3 Sep 2021 10:39:11 +0530 Message-Id: <20210903050914.273525-2-kjain@linux.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210903050914.273525-1-kjain@linux.ibm.com> References: <20210903050914.273525-1-kjain@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 0wxz1PkiS_Umng3agSmwxgoKeXbB8m8b X-Proofpoint-GUID: 0wxz1PkiS_Umng3agSmwxgoKeXbB8m8b X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-09-03_01:2021-09-03,2021-09-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 lowpriorityscore=0 phishscore=0 adultscore=0 clxscore=1015 spamscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2108310000 definitions=main-2109030031 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A structure is added, called nvdimm_pmu, for performance stats reporting support of nvdimm devices. It can be used to add nvdimm pmu data such as supported events and pmu event functions like event_init/add/read/del with cpu hotplug support. Acked-by: Peter Zijlstra (Intel) Reviewed-by: Madhavan Srinivasan Tested-by: Nageswara R Sastry Signed-off-by: Kajol Jain --- include/linux/nd.h | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/include/linux/nd.h b/include/linux/nd.h index ee9ad76afbba..712499cf7335 100644 --- a/include/linux/nd.h +++ b/include/linux/nd.h @@ -8,6 +8,8 @@ #include #include #include +#include +#include enum nvdimm_event { NVDIMM_REVALIDATE_POISON, @@ -23,6 +25,47 @@ enum nvdimm_claim_class { NVDIMM_CCLASS_UNKNOWN, }; +/* Event attribute array index */ +#define NVDIMM_PMU_FORMAT_ATTR 0 +#define NVDIMM_PMU_EVENT_ATTR 1 +#define NVDIMM_PMU_CPUMASK_ATTR 2 +#define NVDIMM_PMU_NULL_ATTR 3 + +/** + * struct nvdimm_pmu - data structure for nvdimm perf driver + * + * @name: name of the nvdimm pmu device. + * @pmu: pmu data structure for nvdimm performance stats. + * @dev: nvdimm device pointer. + * @functions(event_init/add/del/read): platform specific pmu functions. + * @attr_groups: data structure for events, formats and cpumask + * @cpu: designated cpu for counter access. + * @node: node for cpu hotplug notifier link. + * @cpuhp_state: state for cpu hotplug notification. + * @arch_cpumask: cpumask to get designated cpu for counter access. + */ +struct nvdimm_pmu { + const char *name; + struct pmu pmu; + struct device *dev; + int (*event_init)(struct perf_event *event); + int (*add)(struct perf_event *event, int flags); + void (*del)(struct perf_event *event, int flags); + void (*read)(struct perf_event *event); + /* + * Attribute groups for the nvdimm pmu. Index 0 used for + * format attribute, index 1 used for event attribute, + * index 2 used for cpusmask attribute and index 3 kept as NULL. + */ + const struct attribute_group *attr_groups[4]; + int cpu; + struct hlist_node node; + enum cpuhp_state cpuhp_state; + + /* cpumask provided by arch/platform specific code */ + struct cpumask arch_cpumask; +}; + struct nd_device_driver { struct device_driver drv; unsigned long type; -- 2.26.2