Patchset adds performance stats reporting support for nvdimm.
Added interface includes support for pmu register/unregister
functions. A structure is added called nvdimm_pmu to be used for
adding arch/platform specific data such as supported events, cpumask
pmu event functions like event_init/add/read/del.
User could use the standard perf tool to access perf
events exposed via pmu.
Added implementation to expose IBM pseries platform nmem*
device performance stats using this interface.
Result from power9 pseries lpar with 2 nvdimm device:
command:# perf list nmem
nmem0/cchrhcnt/ [Kernel PMU event]
nmem0/cchwhcnt/ [Kernel PMU event]
nmem0/critrscu/ [Kernel PMU event]
nmem0/ctlresct/ [Kernel PMU event]
nmem0/ctlrestm/ [Kernel PMU event]
nmem0/fastwcnt/ [Kernel PMU event]
nmem0/hostlcnt/ [Kernel PMU event]
nmem0/hostldur/ [Kernel PMU event]
nmem0/hostscnt/ [Kernel PMU event]
nmem0/hostsdur/ [Kernel PMU event]
nmem0/medrcnt/ [Kernel PMU event]
nmem0/medrdur/ [Kernel PMU event]
nmem0/medwcnt/ [Kernel PMU event]
nmem0/medwdur/ [Kernel PMU event]
nmem0/memlife/ [Kernel PMU event]
nmem0/noopstat/ [Kernel PMU event]
nmem0/ponsecs/ [Kernel PMU event]
nmem1/cchrhcnt/ [Kernel PMU event]
nmem1/cchwhcnt/ [Kernel PMU event]
nmem1/critrscu/ [Kernel PMU event]
...
nmem1/noopstat/ [Kernel PMU event]
nmem1/ponsecs/ [Kernel PMU event]
Patch1:
Introduces the nvdimm_pmu structure
Patch2:
Adds common interface to add arch/platform specific data
includes supported events, pmu event functions. It also
adds code for cpu hotplug support.
Patch3:
Add code in arch/powerpc/platform/pseries/papr_scm.c to expose
nmem* pmu. It fills in the nvdimm_pmu structure with event attrs
cpumask andevent functions and then registers the pmu by adding
callbacks to register_nvdimm_pmu.
Patch4:
Sysfs documentation patch
Changelog
---
v3 -> v4
- Rebase code on top of current papr_scm code without any logical
changes.
- Added Acked-by tag from Peter Zijlstra and Reviewed by tag
from Madhavan Srinivasan.
- Link to the patchset v3: https://lkml.org/lkml/2021/6/17/605
v2 -> v3
- Added Tested-by tag.
- Fix nvdimm mailing list in the ABI Documentation.
- Link to the patchset v2: https://lkml.org/lkml/2021/6/14/25
v1 -> v2
- Fix hotplug code by adding pmu migration call
incase current designated cpu got offline. As
pointed by Peter Zijlstra.
- Removed the retun -1 part from cpu hotplug offline
function.
- Link to the patchset v1: https://lkml.org/lkml/2021/6/8/500
Kajol Jain (4):
drivers/nvdimm: Add nvdimm pmu structure
drivers/nvdimm: Add perf interface to expose nvdimm performance stats
powerpc/papr_scm: Add perf interface support
powerpc/papr_scm: Document papr_scm sysfs event format entries
Documentation/ABI/testing/sysfs-bus-papr-pmem | 31 ++
arch/powerpc/include/asm/device.h | 5 +
arch/powerpc/platforms/pseries/papr_scm.c | 365 ++++++++++++++++++
drivers/nvdimm/Makefile | 1 +
drivers/nvdimm/nd_perf.c | 230 +++++++++++
include/linux/nd.h | 46 +++
6 files changed, 678 insertions(+)
create mode 100644 drivers/nvdimm/nd_perf.c
--
2.26.2
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) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
include/linux/nd.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
From: Dan Williams <hidden> Date: 2021-09-07 22:00:13
Hi Kajol,
Apologies for the delay in responding to this series, some comments below:
On Thu, Sep 2, 2021 at 10:10 PM Kajol Jain [off-list ref] wrote:
quoted hunk
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) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
include/linux/nd.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
This is not valid kernel-doc:
include/linux/nd.h:67: warning: Function parameter or member
'event_init' not described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'add' not
described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'del' not
described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'read'
not described in 'nvdimm_pmu'
...but I think rather than fixing those up 'struct nvdimm_pmu' should be pruned.
It's not clear to me that it is worth the effort to describe these
details to the nvdimm core which is just going to turn around and call
the pmu core. I'd just as soon have the driver call the pmu core
directly, optionally passing in attributes and callbacks that come
from the nvdimm core and/or the nvdimm provider.
Otherwise it's also not clear which of these structure members are
used at runtime vs purely used as temporary storage to pass parameters
to the pmu core.
+ * @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];
Following from above, I'd rather this was organized as static
attributes with an is_visible() helper for the groups for any dynamic
aspects. That mirrors the behavior of nvdimm_create() and allows for
device drivers to compose the attribute groups from a core set and /
or a provider specific set.
+ 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
Hi Kajol,
Apologies for the delay in responding to this series, some comments below:
Hi Dan,
No issues, thanks for reviewing the patches.
On Thu, Sep 2, 2021 at 10:10 PM Kajol Jain [off-list ref] wrote:
quoted
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) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
include/linux/nd.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
This is not valid kernel-doc:
include/linux/nd.h:67: warning: Function parameter or member
'event_init' not described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'add' not
described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'del' not
described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'read'
not described in 'nvdimm_pmu'
...but I think rather than fixing those up 'struct nvdimm_pmu' should be pruned.
It's not clear to me that it is worth the effort to describe these
details to the nvdimm core which is just going to turn around and call
the pmu core. I'd just as soon have the driver call the pmu core
directly, optionally passing in attributes and callbacks that come
from the nvdimm core and/or the nvdimm provider.
The intend for adding these callbacks(event_init/add/del/read) is to give
flexibility to the nvdimm core to add some common checks/routines if required
in the future. Those checks can be common for all architecture with still having the
ability to call arch/platform specific driver code to use its own routines.
But as you said, currently we don't have any common checks and it directly
calling platform specific code, so we can get rid of it.
Should we remove this part for now?
Otherwise it's also not clear which of these structure members are
used at runtime vs purely used as temporary storage to pass parameters
to the pmu core.
quoted
+ * @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];
Following from above, I'd rather this was organized as static
attributes with an is_visible() helper for the groups for any dynamic
aspects. That mirrors the behavior of nvdimm_create() and allows for
device drivers to compose the attribute groups from a core set and /
or a provider specific set.
Since we don't have any common events right now, Can I use papr
attributes directly or should we create dummy events for common thing and
then merged it with papr event list.
Thanks,
Kajol Jain
quoted
+ 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
From: Dan Williams <hidden> Date: 2021-09-15 04:08:23
On Thu, Sep 9, 2021 at 12:56 AM kajoljain [off-list ref] wrote:
On 9/8/21 3:29 AM, Dan Williams wrote:
quoted
Hi Kajol,
Apologies for the delay in responding to this series, some comments below:
Hi Dan,
No issues, thanks for reviewing the patches.
quoted
On Thu, Sep 2, 2021 at 10:10 PM Kajol Jain [off-list ref] wrote:
quoted
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) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
include/linux/nd.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
This is not valid kernel-doc:
include/linux/nd.h:67: warning: Function parameter or member
'event_init' not described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'add' not
described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'del' not
described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'read'
not described in 'nvdimm_pmu'
...but I think rather than fixing those up 'struct nvdimm_pmu' should be pruned.
It's not clear to me that it is worth the effort to describe these
details to the nvdimm core which is just going to turn around and call
the pmu core. I'd just as soon have the driver call the pmu core
directly, optionally passing in attributes and callbacks that come
from the nvdimm core and/or the nvdimm provider.
The intend for adding these callbacks(event_init/add/del/read) is to give
flexibility to the nvdimm core to add some common checks/routines if required
in the future. Those checks can be common for all architecture with still having the
ability to call arch/platform specific driver code to use its own routines.
But as you said, currently we don't have any common checks and it directly
calling platform specific code, so we can get rid of it.
Should we remove this part for now?
Yes, lets go direct to the perf api for now and await the need for a
common core wrapper to present itself.
quoted
Otherwise it's also not clear which of these structure members are
used at runtime vs purely used as temporary storage to pass parameters
to the pmu core.
quoted
+ * @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];
Following from above, I'd rather this was organized as static
attributes with an is_visible() helper for the groups for any dynamic
aspects. That mirrors the behavior of nvdimm_create() and allows for
device drivers to compose the attribute groups from a core set and /
or a provider specific set.
Since we don't have any common events right now, Can I use papr
attributes directly or should we create dummy events for common thing and
then merged it with papr event list.
From: Dan Williams <hidden> Date: 2021-09-15 04:11:27
On Tue, Sep 14, 2021 at 9:08 PM Dan Williams [off-list ref] wrote:
On Thu, Sep 9, 2021 at 12:56 AM kajoljain [off-list ref] wrote:
quoted
On 9/8/21 3:29 AM, Dan Williams wrote:
quoted
Hi Kajol,
Apologies for the delay in responding to this series, some comments below:
Hi Dan,
No issues, thanks for reviewing the patches.
quoted
On Thu, Sep 2, 2021 at 10:10 PM Kajol Jain [off-list ref] wrote:
quoted
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) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
include/linux/nd.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
This is not valid kernel-doc:
include/linux/nd.h:67: warning: Function parameter or member
'event_init' not described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'add' not
described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'del' not
described in 'nvdimm_pmu'
include/linux/nd.h:67: warning: Function parameter or member 'read'
not described in 'nvdimm_pmu'
...but I think rather than fixing those up 'struct nvdimm_pmu' should be pruned.
It's not clear to me that it is worth the effort to describe these
details to the nvdimm core which is just going to turn around and call
the pmu core. I'd just as soon have the driver call the pmu core
directly, optionally passing in attributes and callbacks that come
from the nvdimm core and/or the nvdimm provider.
The intend for adding these callbacks(event_init/add/del/read) is to give
flexibility to the nvdimm core to add some common checks/routines if required
in the future. Those checks can be common for all architecture with still having the
ability to call arch/platform specific driver code to use its own routines.
But as you said, currently we don't have any common checks and it directly
calling platform specific code, so we can get rid of it.
Should we remove this part for now?
Yes, lets go direct to the perf api for now and await the need for a
common core wrapper to present itself.
quoted
quoted
Otherwise it's also not clear which of these structure members are
used at runtime vs purely used as temporary storage to pass parameters
to the pmu core.
quoted
+ * @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];
Following from above, I'd rather this was organized as static
attributes with an is_visible() helper for the groups for any dynamic
aspects. That mirrors the behavior of nvdimm_create() and allows for
device drivers to compose the attribute groups from a core set and /
or a provider specific set.
Since we don't have any common events right now, Can I use papr
attributes directly or should we create dummy events for common thing and
then merged it with papr event list.
Just use papr events directly.
That is to say...I think if another implementation followed it should
try to match as many common event names as papr_scm picked, and
possibly extend with its own rather than start with a papr_scm
specific namespace for everything.
A common interface is added to get performance stats reporting
support for nvdimm devices. Added interface includes support for
pmu register/unregister functions, cpu hotplug and pmu event
functions like event_init/add/read/del.
User could use the standard perf tool to access perf
events exposed via pmu.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
drivers/nvdimm/Makefile | 1 +
drivers/nvdimm/nd_perf.c | 230 +++++++++++++++++++++++++++++++++++++++
include/linux/nd.h | 3 +
3 files changed, 234 insertions(+)
create mode 100644 drivers/nvdimm/nd_perf.c
@@ -0,0 +1,230 @@+// SPDX-License-Identifier: GPL-2.0-or-later+/*+*nd_perf.c:NVDIMMDevicePerformanceMonitoringUnitsupport+*+*Perfinterfacetoexposenvdimmperformancestats.+*+*Copyright(C)2021IBMCorporation+*/++#define pr_fmt(fmt) "nvdimm_pmu: " fmt++#include<linux/nd.h>++staticssize_tnvdimm_pmu_cpumask_show(structdevice*dev,+structdevice_attribute*attr,char*buf)+{+structpmu*pmu=dev_get_drvdata(dev);+structnvdimm_pmu*nd_pmu;++nd_pmu=container_of(pmu,structnvdimm_pmu,pmu);++returncpumap_print_to_pagebuf(true,buf,cpumask_of(nd_pmu->cpu));+}++staticintnvdimm_pmu_cpu_offline(unsignedintcpu,structhlist_node*node)+{+structnvdimm_pmu*nd_pmu;+u32target;+intnodeid;+conststructcpumask*cpumask;++nd_pmu=hlist_entry_safe(node,structnvdimm_pmu,node);++/* Clear it, incase given cpu is set in nd_pmu->arch_cpumask */+cpumask_test_and_clear_cpu(cpu,&nd_pmu->arch_cpumask);++/*+*Ifgivencpuisnotsameascurrentdesignatedcpufor+*counteraccess,justreturn.+*/+if(cpu!=nd_pmu->cpu)+return0;++/* Check for any active cpu in nd_pmu->arch_cpumask */+target=cpumask_any(&nd_pmu->arch_cpumask);++/*+*Incasewedon'thaveanyactivecpuinnd_pmu->arch_cpumask,+*checkingivencpu'snumanodelist.+*/+if(target>=nr_cpu_ids){+nodeid=cpu_to_node(cpu);+cpumask=cpumask_of_node(nodeid);+target=cpumask_any_but(cpumask,cpu);+}+nd_pmu->cpu=target;++/* Migrate nvdimm pmu events to the new target cpu if valid */+if(target>=0&&target<nr_cpu_ids)+perf_pmu_migrate_context(&nd_pmu->pmu,cpu,target);++return0;+}++staticintnvdimm_pmu_cpu_online(unsignedintcpu,structhlist_node*node)+{+structnvdimm_pmu*nd_pmu;++nd_pmu=hlist_entry_safe(node,structnvdimm_pmu,node);++if(nd_pmu->cpu>=nr_cpu_ids)+nd_pmu->cpu=cpu;++return0;+}++staticintcreate_cpumask_attr_group(structnvdimm_pmu*nd_pmu)+{+structperf_pmu_events_attr*attr;+structattribute**attrs;+structattribute_group*nvdimm_pmu_cpumask_group;++attr=kzalloc(sizeof(*attr),GFP_KERNEL);+if(!attr)+return-ENOMEM;++attrs=kzalloc(2*sizeof(structattribute*),GFP_KERNEL);+if(!attrs){+kfree(attr);+return-ENOMEM;+}++/* Allocate memory for cpumask attribute group */+nvdimm_pmu_cpumask_group=kzalloc(sizeof(*nvdimm_pmu_cpumask_group),GFP_KERNEL);+if(!nvdimm_pmu_cpumask_group){+kfree(attr);+kfree(attrs);+return-ENOMEM;+}++sysfs_attr_init(&attr->attr.attr);+attr->attr.attr.name="cpumask";+attr->attr.attr.mode=0444;+attr->attr.show=nvdimm_pmu_cpumask_show;+attrs[0]=&attr->attr.attr;+attrs[1]=NULL;++nvdimm_pmu_cpumask_group->attrs=attrs;+nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR]=nvdimm_pmu_cpumask_group;+return0;+}++staticintnvdimm_pmu_cpu_hotplug_init(structnvdimm_pmu*nd_pmu)+{+intnodeid,rc;+conststructcpumask*cpumask;++/*+*Incasecpuhotplugisnothandledbyarchspecificcode+*theycanstillproviderequiredcpumaskwhichcanbeused+*togetdesignatdcpuforcounteraccess.+*Checkforanyactivecpuinnd_pmu->arch_cpumask.+*/+if(!cpumask_empty(&nd_pmu->arch_cpumask)){+nd_pmu->cpu=cpumask_any(&nd_pmu->arch_cpumask);+}else{+/* pick active cpu from the cpumask of device numa node. */+nodeid=dev_to_node(nd_pmu->dev);+cpumask=cpumask_of_node(nodeid);+nd_pmu->cpu=cpumask_any(cpumask);+}++rc=cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,"perf/nvdimm:online",+nvdimm_pmu_cpu_online,nvdimm_pmu_cpu_offline);++if(rc<0)+returnrc;++nd_pmu->cpuhp_state=rc;++/* Register the pmu instance for cpu hotplug */+rc=cpuhp_state_add_instance_nocalls(nd_pmu->cpuhp_state,&nd_pmu->node);+if(rc){+cpuhp_remove_multi_state(nd_pmu->cpuhp_state);+returnrc;+}++/* Create cpumask attribute group */+rc=create_cpumask_attr_group(nd_pmu);+if(rc){+cpuhp_state_remove_instance_nocalls(nd_pmu->cpuhp_state,&nd_pmu->node);+cpuhp_remove_multi_state(nd_pmu->cpuhp_state);+returnrc;+}++return0;+}++voidnvdimm_pmu_free_hotplug_memory(structnvdimm_pmu*nd_pmu)+{+cpuhp_state_remove_instance_nocalls(nd_pmu->cpuhp_state,&nd_pmu->node);+cpuhp_remove_multi_state(nd_pmu->cpuhp_state);++if(nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR])+kfree(nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR]->attrs);+kfree(nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR]);+}++intregister_nvdimm_pmu(structnvdimm_pmu*nd_pmu,structplatform_device*pdev)+{+intrc;++if(!nd_pmu||!pdev)+return-EINVAL;++/* event functions like add/del/read/event_init should not be NULL */+if(WARN_ON_ONCE(!(nd_pmu->event_init&&nd_pmu->add&&nd_pmu->del&&nd_pmu->read)))+return-EINVAL;++nd_pmu->pmu.task_ctx_nr=perf_invalid_context;+nd_pmu->pmu.name=nd_pmu->name;+nd_pmu->pmu.event_init=nd_pmu->event_init;+nd_pmu->pmu.add=nd_pmu->add;+nd_pmu->pmu.del=nd_pmu->del;+nd_pmu->pmu.read=nd_pmu->read;++nd_pmu->pmu.attr_groups=nd_pmu->attr_groups;+nd_pmu->pmu.capabilities=PERF_PMU_CAP_NO_INTERRUPT|+PERF_PMU_CAP_NO_EXCLUDE;++/*+*Addplatform_device->devpointertonvdimm_pmutoaccess+*devicedataineventsfunctions.+*/+nd_pmu->dev=&pdev->dev;++/*+*Incasecpumaskattributeissetitmeanscpu+*hotplugishandledbythearchspecificcodeand+*wecanskipcallinghotplug_init.+*/+if(!nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR]){+/* init cpuhotplug */+rc=nvdimm_pmu_cpu_hotplug_init(nd_pmu);+if(rc){+pr_info("cpu hotplug feature failed for device: %s\n",nd_pmu->name);+returnrc;+}+}++rc=perf_pmu_register(&nd_pmu->pmu,nd_pmu->name,-1);+if(rc){+nvdimm_pmu_free_hotplug_memory(nd_pmu);+returnrc;+}++pr_info("%s NVDIMM performance monitor support registered\n",+nd_pmu->name);++return0;+}+EXPORT_SYMBOL_GPL(register_nvdimm_pmu);++voidunregister_nvdimm_pmu(structnvdimm_pmu*nd_pmu)+{+/* handle freeing of memory nd_pmu in arch specific code */+perf_pmu_unregister(&nd_pmu->pmu);+nvdimm_pmu_free_hotplug_memory(nd_pmu);+}+EXPORT_SYMBOL_GPL(unregister_nvdimm_pmu);
drivers/nvdimm/nd_perf.c:159:6: warning: no previous prototype for function 'nvdimm_pmu_free_hotplug_memory' [-Wmissing-prototypes]
void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
^
drivers/nvdimm/nd_perf.c:159:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
^
static
1 warning generated.
vim +/nvdimm_pmu_free_hotplug_memory +159 drivers/nvdimm/nd_perf.c
158
> 159 void nvdimm_pmu_free_hotplug_memory(struct nvdimm_pmu *nd_pmu)
160 {
161 cpuhp_state_remove_instance_nocalls(nd_pmu->cpuhp_state, &nd_pmu->node);
162 cpuhp_remove_multi_state(nd_pmu->cpuhp_state);
163
164 if (nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR])
165 kfree(nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR]->attrs);
166 kfree(nd_pmu->attr_groups[NVDIMM_PMU_CPUMASK_ATTR]);
167 }
168
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
From: kernel test robot <hidden> Date: 2021-09-03 15:20:40
Hi Kajol,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux-nvdimm/libnvdimm-for-next]
[also build test WARNING on powerpc/next linus/master v5.14 next-20210903]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
base: https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
config: x86_64-randconfig-s021-20210903 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-rc1-dirty
# https://github.com/0day-ci/linux/commit/f841601cc058e6033761bd2157b886a30190fc3a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
git checkout f841601cc058e6033761bd2157b886a30190fc3a
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/nvdimm/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>
sparse warnings: (new ones prefixed by >>)
quoted
drivers/nvdimm/nd_perf.c:159:6: sparse: sparse: symbol 'nvdimm_pmu_free_hotplug_memory' was not declared. Should it be static?
Hi Kajol,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux-nvdimm/libnvdimm-for-next]
[also build test WARNING on powerpc/next linus/master v5.14 next-20210903]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
base: https://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git libnvdimm-for-next
config: x86_64-randconfig-s021-20210903 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-rc1-dirty
# https://github.com/0day-ci/linux/commit/f841601cc058e6033761bd2157b886a30190fc3a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Kajol-Jain/Add-perf-interface-to-expose-nvdimm/20210903-131212
git checkout f841601cc058e6033761bd2157b886a30190fc3a
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/nvdimm/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>
sparse warnings: (new ones prefixed by >>)
quoted
quoted
drivers/nvdimm/nd_perf.c:159:6: sparse: sparse: symbol 'nvdimm_pmu_free_hotplug_memory' was not declared. Should it be static?
Please review and possibly fold the followup patch.
Hi,
Sure I will correct it and send follow-up patchset.
Thanks,
Kajol Jain
From: kernel test robot <hidden> Date: 2021-09-03 15:20:50
drivers/nvdimm/nd_perf.c:159:6: warning: symbol 'nvdimm_pmu_free_hotplug_memory' was not declared. Should it be static?
Reported-by: kernel test robot <redacted>
Signed-off-by: kernel test robot <redacted>
---
nd_perf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvdimm/nd_perf.c:159:6: warning: symbol 'nvdimm_pmu_free_hotplug_memory' was not declared. Should it be static?
Reported-by: kernel test robot <redacted>
Signed-off-by: kernel test robot <redacted>
---
nd_perf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -68,6 +70,8 @@#define PAPR_SCM_PERF_STATS_EYECATCHER __stringify(SCMSTATS)#define PAPR_SCM_PERF_STATS_VERSION 0x1+#define to_nvdimm_pmu(_pmu) container_of(_pmu, struct nvdimm_pmu, pmu)+/* Struct holding a single performance metric */structpapr_scm_perf_stat{u8stat_id[8];
@@ -120,6 +124,12 @@ struct papr_scm_priv {/* length of the stat buffer as expected by phyp */size_tstat_buffer_len;++/* array to have event_code and stat_id mappings */+char**nvdimm_events_map;++/* count of supported events */+u32total_events;};staticintpapr_scm_pmem_flush(structnd_region*nd_region,
@@ -340,6 +350,354 @@ static ssize_t drc_pmem_query_stats(struct papr_scm_priv *p,return0;}+PMU_FORMAT_ATTR(event,"config:0-4");++staticstructattribute*nvdimm_pmu_format_attr[]={+&format_attr_event.attr,+NULL,+};++staticstructattribute_groupnvdimm_pmu_format_group={+.name="format",+.attrs=nvdimm_pmu_format_attr,+};++staticintpapr_scm_pmu_get_value(structperf_event*event,structdevice*dev,u64*count)+{+structpapr_scm_perf_stat*stat;+structpapr_scm_perf_stats*stats;+structpapr_scm_priv*p=(structpapr_scm_priv*)dev->driver_data;+intrc,size;++/* Allocate request buffer enough to hold single performance stat */+size=sizeof(structpapr_scm_perf_stats)++sizeof(structpapr_scm_perf_stat);++if(!p||!p->nvdimm_events_map)+return-EINVAL;++stats=kzalloc(size,GFP_KERNEL);+if(!stats)+return-ENOMEM;++stat=&stats->scm_statistic[0];+memcpy(&stat->stat_id,+p->nvdimm_events_map[event->attr.config-1],+sizeof(stat->stat_id));+stat->stat_val=0;++rc=drc_pmem_query_stats(p,stats,1);+if(rc<0){+kfree(stats);+returnrc;+}++*count=be64_to_cpu(stat->stat_val);+kfree(stats);+return0;+}++staticintpapr_scm_pmu_event_init(structperf_event*event)+{+structnvdimm_pmu*nd_pmu=to_nvdimm_pmu(event->pmu);+structpapr_scm_priv*p;++if(!nd_pmu)+return-EINVAL;++/* test the event attr type for PMU enumeration */+if(event->attr.type!=event->pmu->type)+return-ENOENT;++/* it does not support event sampling mode */+if(is_sampling_event(event))+return-EOPNOTSUPP;++/* no branch sampling */+if(has_branch_stack(event))+return-EOPNOTSUPP;++p=(structpapr_scm_priv*)nd_pmu->dev->driver_data;+if(!p)+return-EINVAL;++/* Invalid eventcode */+if(event->attr.config==0||event->attr.config>p->total_events)+return-EINVAL;++return0;+}++staticintpapr_scm_pmu_add(structperf_event*event,intflags)+{+u64count;+intrc;+structnvdimm_pmu*nd_pmu=to_nvdimm_pmu(event->pmu);++if(!nd_pmu)+return-EINVAL;++if(flags&PERF_EF_START){+rc=papr_scm_pmu_get_value(event,nd_pmu->dev,&count);+if(rc)+returnrc;++local64_set(&event->hw.prev_count,count);+}++return0;+}++staticvoidpapr_scm_pmu_read(structperf_event*event)+{+u64prev,now;+intrc;+structnvdimm_pmu*nd_pmu=to_nvdimm_pmu(event->pmu);++if(!nd_pmu)+return;++rc=papr_scm_pmu_get_value(event,nd_pmu->dev,&now);+if(rc)+return;++prev=local64_xchg(&event->hw.prev_count,now);+local64_add(now-prev,&event->count);+}++staticvoidpapr_scm_pmu_del(structperf_event*event,intflags)+{+papr_scm_pmu_read(event);+}++staticssize_tdevice_show_string(structdevice*dev,structdevice_attribute*attr,+char*buf)+{+structperf_pmu_events_attr*d;++d=container_of(attr,structperf_pmu_events_attr,attr);++returnsysfs_emit(buf,"%s\n",(char*)d->event_str);+}++staticchar*strtolower(char*updated_name)+{+inti=0;++while(updated_name[i]){+if(isupper(updated_name[i]))+updated_name[i]=tolower(updated_name[i]);+i++;+}+updated_name[i]='\0';+returnstrim(updated_name);+}++/* device_str_attr_create : Populate event "name" and string "str" in attribute */+staticstructattribute*device_str_attr_create_(char*name,char*str)+{+structperf_pmu_events_attr*attr;++attr=kzalloc(sizeof(*attr),GFP_KERNEL);++if(!attr)+returnNULL;++sysfs_attr_init(&attr->attr.attr);+attr->event_str=str;+attr->attr.attr.name=strtolower(name);+attr->attr.attr.mode=0444;+attr->attr.show=device_show_string;++return&attr->attr.attr;+}++staticintpapr_scm_pmu_check_events(structpapr_scm_priv*p,structnvdimm_pmu*nd_pmu)+{+structpapr_scm_perf_stat*stat;+structpapr_scm_perf_stats*stats,*single_stats;+intindex,size,rc,count;+u32available_events;+structattribute**events;+char*eventcode,*eventname,*statid;+structattribute_group*nvdimm_pmu_events_group;++if(!p->stat_buffer_len)+return-ENOENT;++available_events=(p->stat_buffer_len-sizeof(structpapr_scm_perf_stats))+/sizeof(structpapr_scm_perf_stat);++/* Allocate memory for events attribute group */+nvdimm_pmu_events_group=kzalloc(sizeof(*nvdimm_pmu_events_group),GFP_KERNEL);+if(!nvdimm_pmu_events_group)+return-ENOMEM;++/* Allocate the buffer for phyp where stats are written */+stats=kzalloc(p->stat_buffer_len,GFP_KERNEL);+if(!stats){+rc=-ENOMEM;+gotoout_nvdimm_pmu_events_group;+}++/* Allocate memory to nvdimm_event_map */+p->nvdimm_events_map=kcalloc(available_events,sizeof(char*),GFP_KERNEL);+if(!p->nvdimm_events_map){+rc=-ENOMEM;+gotoout_stats;+}++/* Called to get list of events supported */+rc=drc_pmem_query_stats(p,stats,0);+if(rc)+gotoout_nvdimm_events_map;++/* Allocate buffer to hold single performance stat */+size=sizeof(structpapr_scm_perf_stats)+sizeof(structpapr_scm_perf_stat);++single_stats=kzalloc(size,GFP_KERNEL);+if(!single_stats){+rc=-ENOMEM;+gotoout_nvdimm_events_map;+}++events=kzalloc(available_events*sizeof(structattribute*),GFP_KERNEL);+if(!events){+rc=-ENOMEM;+gotoout_single_stats;+}++for(index=0,stat=stats->scm_statistic,count=0;+index<available_events;index++,++stat){++single_stats->scm_statistic[0]=*stat;+rc=drc_pmem_query_stats(p,single_stats,1);++if(rc<0){+pr_info("Event not supported %s for device %s\n",+stat->stat_id,nvdimm_name(p->nvdimm));+}else{+eventcode=kasprintf(GFP_KERNEL,"event=0x%x",count+1);+eventname=kzalloc(strlen(stat->stat_id)+1,GFP_KERNEL);+statid=kzalloc(strlen(stat->stat_id)+1,GFP_KERNEL);++if(!eventname||!statid||!eventcode)+gotoout;++strcpy(eventname,stat->stat_id);+events[count]=device_str_attr_create_(eventname,+eventcode);+if(!events[count])+gotoout;++strcpy(statid,stat->stat_id);+p->nvdimm_events_map[count]=statid;+count++;+continue;+out:+kfree(eventcode);+kfree(eventname);+kfree(statid);+}+}++if(!count)+gotoout_events;++events[count]=NULL;+p->nvdimm_events_map[count]=NULL;+p->total_events=count;++nvdimm_pmu_events_group->name="events";+nvdimm_pmu_events_group->attrs=events;++/* Fill attribute groups for the nvdimm pmu device */+nd_pmu->attr_groups[NVDIMM_PMU_FORMAT_ATTR]=&nvdimm_pmu_format_group;+nd_pmu->attr_groups[NVDIMM_PMU_EVENT_ATTR]=nvdimm_pmu_events_group;+nd_pmu->attr_groups[NVDIMM_PMU_NULL_ATTR]=NULL;++kfree(single_stats);+kfree(stats);+return0;++out_events:+kfree(events);+out_single_stats:+kfree(single_stats);+out_nvdimm_events_map:+kfree(p->nvdimm_events_map);+out_stats:+kfree(stats);+out_nvdimm_pmu_events_group:+kfree(nvdimm_pmu_events_group);+returnrc;+}++/* Function to free the attr_groups which are dynamically allocated */+staticvoidpapr_scm_pmu_mem_free(structnvdimm_pmu*nd_pmu)+{+if(nd_pmu){+if(nd_pmu->attr_groups[NVDIMM_PMU_EVENT_ATTR])+kfree(nd_pmu->attr_groups[NVDIMM_PMU_EVENT_ATTR]->attrs);+kfree(nd_pmu->attr_groups[NVDIMM_PMU_EVENT_ATTR]);+}+}++staticvoidpapr_scm_pmu_register(structpapr_scm_priv*p)+{+structnvdimm_pmu*nd_pmu;+intrc,nodeid;++nd_pmu=kzalloc(sizeof(*nd_pmu),GFP_KERNEL);+if(!nd_pmu){+rc=-ENOMEM;+gotopmu_err_print;+}++rc=papr_scm_pmu_check_events(p,nd_pmu);+if(rc)+gotopmu_check_events_err;++nd_pmu->name=nvdimm_name(p->nvdimm);+nd_pmu->event_init=papr_scm_pmu_event_init;+nd_pmu->read=papr_scm_pmu_read;+nd_pmu->add=papr_scm_pmu_add;+nd_pmu->del=papr_scm_pmu_del;++/*updating the cpumask variable */+nodeid=dev_to_node(&p->pdev->dev);+nd_pmu->arch_cpumask=*cpumask_of_node(nodeid);++/* cpumask should not be NULL */+WARN_ON_ONCE(cpumask_empty(&nd_pmu->arch_cpumask));++rc=register_nvdimm_pmu(nd_pmu,p->pdev);+if(rc)+gotopmu_register_err;++/*+*Setarchdata.privvaluetonvdimm_pmustructure,tohandlethe+*unregisteringofpmudevice.+*/+p->pdev->archdata.priv=nd_pmu;+return;++pmu_register_err:+papr_scm_pmu_mem_free(nd_pmu);+kfree(p->nvdimm_events_map);+pmu_check_events_err:+kfree(nd_pmu);+pmu_err_print:+dev_info(&p->pdev->dev,"nvdimm pmu didn't register rc=%d\n",rc);+}++staticvoidpapr_scm_pmu_uninit(structnvdimm_pmu*nd_pmu)+{+unregister_nvdimm_pmu(nd_pmu);+papr_scm_pmu_mem_free(nd_pmu);+kfree(nd_pmu);+}+/**Issuehcalltoretrievedimmhealthinfoandpopulatepapr_scm_privwiththe*healthinformation.
@@ -1236,6 +1594,7 @@ static int papr_scm_probe(struct platform_device *pdev)gotoerr2;platform_set_drvdata(pdev,p);+papr_scm_pmu_register(p);return0;
@@ -1254,6 +1613,12 @@ static int papr_scm_remove(struct platform_device *pdev)nvdimm_bus_unregister(p->bus);drc_pmem_unbind(p);++if(pdev->archdata.priv)+papr_scm_pmu_uninit(pdev->archdata.priv);++pdev->archdata.priv=NULL;+kfree(p->nvdimm_events_map);kfree(p->bus_desc.provider_name);kfree(p);
Details is added for the event, cpumask and format attributes
in the ABI documentation.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
Documentation/ABI/testing/sysfs-bus-papr-pmem | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
@@ -61,3 +61,34 @@ Description: * "CchRHCnt" : Cache Read Hit Count * "CchWHCnt" : Cache Write Hit Count * "FastWCnt" : Fast Write Count++What: /sys/devices/nmemX/format+Date: June 2021+Contact: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, nvdimm@lists.linux.dev,+Description: (RO) Attribute group to describe the magic bits+ that go into perf_event_attr.config for a particular pmu.+ (See ABI/testing/sysfs-bus-event_source-devices-format).++ Each attribute under this group defines a bit range of the+ perf_event_attr.config. Supported attribute is listed+ below::++ event = "config:0-4" - event ID++ For example::+ noopstat = "event=0x1"++What: /sys/devices/nmemX/events+Date: June 2021+Contact: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, nvdimm@lists.linux.dev,+Description: (RO) Attribute group to describe performance monitoring+ events specific to papr-scm. Each attribute in this group describes+ a single performance monitoring event supported by this nvdimm pmu.+ The name of the file is the name of the event.+ (See ABI/testing/sysfs-bus-event_source-devices-events).++What: /sys/devices/nmemX/cpumask+Date: June 2021+Contact: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, nvdimm@lists.linux.dev,+Description: (RO) This sysfs file exposes the cpumask which is designated to make+ HCALLs to retrieve nvdimm pmu event counter data.
From: Dan Williams <hidden> Date: 2021-09-08 01:04:01
On Thu, Sep 2, 2021 at 10:11 PM Kajol Jain [off-list ref] wrote:
quoted hunk
Details is added for the event, cpumask and format attributes
in the ABI documentation.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
Documentation/ABI/testing/sysfs-bus-papr-pmem | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
@@ -61,3 +61,34 @@ Description: * "CchRHCnt" : Cache Read Hit Count * "CchWHCnt" : Cache Write Hit Count * "FastWCnt" : Fast Write Count++What: /sys/devices/nmemX/format+Date: June 2021+Contact: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, nvdimm@lists.linux.dev,+Description: (RO) Attribute group to describe the magic bits+ that go into perf_event_attr.config for a particular pmu.+ (See ABI/testing/sysfs-bus-event_source-devices-format).++ Each attribute under this group defines a bit range of the+ perf_event_attr.config. Supported attribute is listed+ below::++ event = "config:0-4" - event ID++ For example::+ noopstat = "event=0x1"++What: /sys/devices/nmemX/events
That's not a valid sysfs path. Did you mean /sys/bus/nd/devices/nmemX?
+Date: June 2021
+Contact: linuxppc-dev [off-list ref], nvdimm@lists.linux.dev,
+Description: (RO) Attribute group to describe performance monitoring
+ events specific to papr-scm. Each attribute in this group describes
+ a single performance monitoring event supported by this nvdimm pmu.
+ The name of the file is the name of the event.
+ (See ABI/testing/sysfs-bus-event_source-devices-events).
Given these events are in the generic namespace the ABI documentation
should be generic as well. So I think move these entries to
Documentation/ABI/testing/sysfs-bus-nvdimm directly.
You can still mention papr-scm, but I would expect something like:
What: /sys/bus/nd/devices/nmemX/events
Date: September 2021
KernelVersion: 5.16
Contact: Kajol Jain [off-list ref]
Description:
(RO) Attribute group to describe performance monitoring events
for the nvdimm memory device. Each attribute in this group
describes a single performance monitoring event supported by
this nvdimm pmu. The name of the file is the name of the event.
(See ABI/testing/sysfs-bus-event_source-devices-events). A
listing of the events supported by a given nvdimm provider type
can be found in Documentation/driver-api/nvdimm/$provider, for
example: Documentation/driver-api/nvdimm/papr-scm.
+
+What: /sys/devices/nmemX/cpumask
+Date: June 2021
+Contact: linuxppc-dev [off-list ref], nvdimm@lists.linux.dev,
+Description: (RO) This sysfs file exposes the cpumask which is designated to make
+ HCALLs to retrieve nvdimm pmu event counter data.
Seems this one would be provider generic, so no need to refer to PPC
specific concepts like HCALLs.
On Thu, Sep 2, 2021 at 10:11 PM Kajol Jain [off-list ref] wrote:
quoted
Details is added for the event, cpumask and format attributes
in the ABI documentation.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Tested-by: Nageswara R Sastry <redacted>
Signed-off-by: Kajol Jain <redacted>
---
Documentation/ABI/testing/sysfs-bus-papr-pmem | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
@@ -61,3 +61,34 @@ Description: * "CchRHCnt" : Cache Read Hit Count * "CchWHCnt" : Cache Write Hit Count * "FastWCnt" : Fast Write Count++What: /sys/devices/nmemX/format+Date: June 2021+Contact: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>, nvdimm@lists.linux.dev,+Description: (RO) Attribute group to describe the magic bits+ that go into perf_event_attr.config for a particular pmu.+ (See ABI/testing/sysfs-bus-event_source-devices-format).++ Each attribute under this group defines a bit range of the+ perf_event_attr.config. Supported attribute is listed+ below::++ event = "config:0-4" - event ID++ For example::+ noopstat = "event=0x1"++What: /sys/devices/nmemX/events
That's not a valid sysfs path. Did you mean /sys/bus/nd/devices/nmemX?
Hi Dan,
Thanks, I will correct it and update it to `/sys/bus/event_source/devices/`
where perf creates sysfs files for given pmu.
quoted
+Date: June 2021
+Contact: linuxppc-dev [off-list ref], nvdimm@lists.linux.dev,
+Description: (RO) Attribute group to describe performance monitoring
+ events specific to papr-scm. Each attribute in this group describes
+ a single performance monitoring event supported by this nvdimm pmu.
+ The name of the file is the name of the event.
+ (See ABI/testing/sysfs-bus-event_source-devices-events).
Given these events are in the generic namespace the ABI documentation
should be generic as well. So I think move these entries to
Documentation/ABI/testing/sysfs-bus-nvdimm directly.
You can still mention papr-scm, but I would expect something like:
What: /sys/bus/nd/devices/nmemX/events
Date: September 2021
KernelVersion: 5.16
Contact: Kajol Jain [off-list ref]
Description:
(RO) Attribute group to describe performance monitoring events
for the nvdimm memory device. Each attribute in this group
describes a single performance monitoring event supported by
this nvdimm pmu. The name of the file is the name of the event.
(See ABI/testing/sysfs-bus-event_source-devices-events). A
listing of the events supported by a given nvdimm provider type
can be found in Documentation/driver-api/nvdimm/$provider, for
example: Documentation/driver-api/nvdimm/papr-scm.
I will update it accordingly.
quoted
+
+What: /sys/devices/nmemX/cpumask
+Date: June 2021
+Contact: linuxppc-dev [off-list ref], nvdimm@lists.linux.dev,
+Description: (RO) This sysfs file exposes the cpumask which is designated to make
+ HCALLs to retrieve nvdimm pmu event counter data.
Seems this one would be provider generic, so no need to refer to PPC
specific concepts like HCALLs.