* [PATCH 1/3] powerpc/pseries: Macros and wrapper functions for H_HTM call
@ 2024-06-20 17:46 Madhavan Srinivasan
2024-06-20 17:46 ` [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs Madhavan Srinivasan
2024-06-20 17:46 ` [PATCH 3/3] powerpc: Document details on H_HTM hcall Madhavan Srinivasan
0 siblings, 2 replies; 9+ messages in thread
From: Madhavan Srinivasan @ 2024-06-20 17:46 UTC (permalink / raw)
To: mpe
Cc: atrajeev, kjain, christophe.leroy, Madhavan Srinivasan, npiggin,
naveen.n.rao, disgoel, linuxppc-dev
Define macros and wrapper functions to handle
H_HTM (Hardware Trace Macro) hypervisor call.
H_HTM is new HCALL added to export data from
Hardware Trace Macro (HTM) function.
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
arch/powerpc/include/asm/hvcall.h | 34 +++++++++++++++++++++++
arch/powerpc/include/asm/plpar_wrappers.h | 21 ++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 7a8495660c2f..7ad13685c127 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -348,6 +348,7 @@
#define H_SCM_FLUSH 0x44C
#define H_GET_ENERGY_SCALE_INFO 0x450
#define H_PKS_SIGNED_UPDATE 0x454
+#define H_HTM 0x458
#define H_WATCHDOG 0x45C
#define H_GUEST_GET_CAPABILITIES 0x460
#define H_GUEST_SET_CAPABILITIES 0x464
@@ -497,6 +498,39 @@
#define H_GUEST_CAP_POWER10 (1UL<<(63-2))
#define H_GUEST_CAP_BITMAP2 (1UL<<(63-63))
+/*
+ * Defines for H_HTM - Macros for hardware trace macro (HTM) function.
+ */
+#define H_HTM_FLAGS_HARDWARE_TARGET (1ul << 63)
+#define H_HTM_FLAGS_LOGICAL_TARGET (1ul << 62)
+#define H_HTM_FLAGS_PROCID_TARGET (1ul << 61)
+#define H_HTM_FLAGS_NOWRAP (1ul << 60)
+
+#define H_HTM_OP_SHIFT (63-15)
+#define H_HTM_OP(x) ((unsigned long)(x)<<H_HTM_OP_SHIFT)
+#define H_HTM_OP_CAPABILITIES 0x01
+#define H_HTM_OP_STATUS 0x02
+#define H_HTM_OP_SETUP 0x03
+#define H_HTM_OP_CONFIGURE 0x04
+#define H_HTM_OP_START 0x05
+#define H_HTM_OP_STOP 0x06
+#define H_HTM_OP_DECONFIGURE 0x07
+#define H_HTM_OP_DUMP_DETAILS 0x08
+#define H_HTM_OP_DUMP_DATA 0x09
+#define H_HTM_OP_DUMP_SYSMEM_CONF 0x0a
+#define H_HTM_OP_DUMP_SYSPROC_CONF 0x0b
+
+#define H_HTM_TYPE_SHIFT (63-31)
+#define H_HTM_TYPE(x) ((unsigned long)(x)<<H_HTM_TYPE_SHIFT)
+#define H_HTM_TYPE_NEST 0x01
+#define H_HTM_TYPE_CORE 0x02
+#define H_HTM_TYPE_LLAT 0x03
+#define H_HTM_TYPE_GLOBAL 0xff
+
+#define H_HTM_TARGET_NODE_INDEX(x) ((unsigned long)(x)<<(63-15))
+#define H_HTM_TARGET_NODAL_CHIP_INDEX(x) ((unsigned long)(x)<<(63-31))
+#define H_HTM_TARGET_CORE_INDEX_ON_CHIP(x) ((unsigned long)(x)<<(63-47))
+
#ifndef __ASSEMBLY__
#include <linux/types.h>
diff --git a/arch/powerpc/include/asm/plpar_wrappers.h b/arch/powerpc/include/asm/plpar_wrappers.h
index b3ee44a40c2f..24d5647096e0 100644
--- a/arch/powerpc/include/asm/plpar_wrappers.h
+++ b/arch/powerpc/include/asm/plpar_wrappers.h
@@ -93,6 +93,27 @@ static inline long register_dtl(unsigned long cpu, unsigned long vpa)
return vpa_call(H_VPA_REG_DTL, cpu, vpa);
}
+static inline long htm_call(unsigned long flags, unsigned long target,
+ unsigned long operation, unsigned long param1,
+ unsigned long param2, unsigned long param3)
+{
+ return plpar_hcall_norets(H_HTM, flags, target, operation,
+ param1, param2, param3);
+}
+
+static inline long htm_get_dump_hardware(unsigned long nodeindex,
+ unsigned long nodalchipindex, unsigned long coreindexonchip,
+ unsigned long type, unsigned long addr, unsigned long size,
+ unsigned long offset)
+{
+ return htm_call(H_HTM_FLAGS_HARDWARE_TARGET,
+ H_HTM_TARGET_NODE_INDEX(nodeindex) |
+ H_HTM_TARGET_NODAL_CHIP_INDEX(nodalchipindex) |
+ H_HTM_TARGET_CORE_INDEX_ON_CHIP(coreindexonchip),
+ H_HTM_OP(H_HTM_OP_DUMP_DATA) | H_HTM_TYPE(type),
+ addr, size, offset);
+}
+
extern void vpa_init(int cpu);
static inline long plpar_pte_enter(unsigned long flags,
--
2.45.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs
2024-06-20 17:46 [PATCH 1/3] powerpc/pseries: Macros and wrapper functions for H_HTM call Madhavan Srinivasan
@ 2024-06-20 17:46 ` Madhavan Srinivasan
2024-06-22 7:40 ` Ritesh Harjani
2024-06-26 0:58 ` kernel test robot
2024-06-20 17:46 ` [PATCH 3/3] powerpc: Document details on H_HTM hcall Madhavan Srinivasan
1 sibling, 2 replies; 9+ messages in thread
From: Madhavan Srinivasan @ 2024-06-20 17:46 UTC (permalink / raw)
To: mpe
Cc: atrajeev, kjain, christophe.leroy, Madhavan Srinivasan, npiggin,
naveen.n.rao, disgoel, linuxppc-dev
This patch adds debugfs interface to export Hardware Trace Macro (HTM)
function data in a LPAR. New hypervisor call "H_HTM" has been
defined to setup, configure, control and dump the HTM data.
This patch supports only dumping of HTM data in a LPAR.
New debugfs folder called "htmdump" has been added under
/sys/kernel/debug/arch path which contains files need to
pass required parameters for the H_HTM dump function. New Kconfig
option called "CONFIG_HTMDUMP" has been in platform/pseries for the same.
With patch series applied and booted, list of files in debugfs path
# pwd
/sys/kernel/debug/powerpc/htmdump
# ls
coreindexonchip htmtype nodalchipindex nodeindex trace
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
arch/powerpc/platforms/pseries/Kconfig | 8 ++
arch/powerpc/platforms/pseries/Makefile | 1 +
arch/powerpc/platforms/pseries/htmdump.c | 130 +++++++++++++++++++++++
3 files changed, 139 insertions(+)
create mode 100644 arch/powerpc/platforms/pseries/htmdump.c
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index afc0f6a61337..46c0ea605e33 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -128,6 +128,14 @@ config CMM
will be reused for other LPARs. The interface allows firmware to
balance memory across many LPARs.
+config HTMDUMP
+ tristate "PHYP HTM data dumper"
+ default y
+ help
+ Select this option, if you want to enable the kernel debugfs
+ interface to dump the Hardware Trace Macro (HTM) function data
+ in the LPAR.
+
config HV_PERF_CTRS
bool "Hypervisor supplied PMU events (24x7 & GPCI)"
default y
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 7bf506f6b8c8..3f3e3492e436 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
obj-$(CONFIG_HVCS) += hvcserver.o
obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
obj-$(CONFIG_CMM) += cmm.o
+obj-$(CONFIG_HTMDUMP) += htmdump.o
obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o
obj-$(CONFIG_LPARCFG) += lparcfg.o
obj-$(CONFIG_IBMVIO) += vio.o
diff --git a/arch/powerpc/platforms/pseries/htmdump.c b/arch/powerpc/platforms/pseries/htmdump.c
new file mode 100644
index 000000000000..540cdb7e069c
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/htmdump.c
@@ -0,0 +1,130 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) IBM Corporation, 2024
+ */
+
+#define pr_fmt(fmt) "htmdump: " fmt
+
+#include <linux/bitops.h>
+#include <linux/string.h>
+#include <linux/init.h>
+#include <linux/moduleparam.h>
+#include <linux/fs.h>
+#include <linux/debugfs.h>
+#include <linux/slab.h>
+#include <linux/memory.h>
+#include <linux/memory_hotplug.h>
+#include <linux/numa.h>
+#include <linux/memblock.h>
+#include <asm/machdep.h>
+#include <asm/plpar_wrappers.h>
+
+/* This enables us to keep track of the memory removed from each node. */
+struct htmdump_entry {
+ void *buf;
+ struct dentry *dir;
+ char name[16];
+};
+
+static u32 nodeindex = 0;
+static u32 nodalchipindex = 0;
+static u32 coreindexonchip = 0;
+static u32 htmtype = 0;
+
+#define BUFFER_SIZE PAGE_SIZE
+
+static ssize_t htmdump_read(struct file *filp, char __user *ubuf,
+ size_t count, loff_t *ppos)
+{
+ struct htmdump_entry *ent = filp->private_data;
+ unsigned long page, read_size, available;
+ loff_t offset;
+ long rc;
+
+ page = ALIGN_DOWN(*ppos, BUFFER_SIZE);
+ offset = (*ppos) % BUFFER_SIZE;
+
+ rc = htm_get_dump_hardware(nodeindex, nodalchipindex, coreindexonchip,
+ htmtype, virt_to_phys(ent->buf), BUFFER_SIZE, page);
+
+ switch(rc) {
+ case H_SUCCESS:
+ case H_PARTIAL:
+ break;
+ case H_NOT_AVAILABLE:
+ return 0;
+ case H_BUSY:
+ case H_LONG_BUSY_ORDER_1_MSEC:
+ case H_LONG_BUSY_ORDER_10_MSEC:
+ case H_LONG_BUSY_ORDER_100_MSEC:
+ case H_LONG_BUSY_ORDER_1_SEC:
+ case H_LONG_BUSY_ORDER_10_SEC:
+ case H_LONG_BUSY_ORDER_100_SEC:
+ case H_PARAMETER:
+ case H_P2:
+ case H_P3:
+ case H_P4:
+ case H_P5:
+ case H_P6:
+ case H_STATE:
+ case H_AUTHORITY:
+ return -EINVAL;
+ }
+
+ available = BUFFER_SIZE - offset;
+ read_size = min(count, available);
+ *ppos += read_size;
+ return simple_read_from_buffer(ubuf, count, &offset, ent->buf, available);
+}
+
+static const struct file_operations htmdump_fops = {
+ .llseek = default_llseek,
+ .read = htmdump_read,
+ .open = simple_open,
+};
+
+static struct dentry *htmdump_debugfs_dir;
+
+static int htmdump_init_debugfs(void)
+{
+ struct htmdump_entry *ent;
+
+ ent = kcalloc(1, sizeof(struct htmdump_entry), GFP_KERNEL);
+ if (!ent) {
+ pr_err("Failed to allocate ent\n");
+ return -EINVAL;
+ }
+
+ ent->buf = kmalloc(BUFFER_SIZE, GFP_KERNEL);
+ if (!ent->buf) {
+ pr_err("Failed to allocate htmdump buf\n");
+ return -ENOMEM;
+ }
+
+ pr_debug("%s: ent:%lx buf:%lx\n",
+ __func__, (long unsigned int)ent, (long unsigned int)ent->buf);
+
+ htmdump_debugfs_dir = debugfs_create_dir("htmdump",
+ arch_debugfs_dir);
+
+ debugfs_create_u32("nodeindex", 0600,
+ htmdump_debugfs_dir, &nodeindex);
+ debugfs_create_u32("nodalchipindex", 0600,
+ htmdump_debugfs_dir, &nodalchipindex);
+ debugfs_create_u32("coreindexonchip", 0600,
+ htmdump_debugfs_dir, &coreindexonchip);
+ debugfs_create_u32("htmtype", 0600,
+ htmdump_debugfs_dir, &htmtype);
+ debugfs_create_file("trace", 0400, htmdump_debugfs_dir, ent, &htmdump_fops);
+
+ return 0;
+}
+
+static int htmdump_init(void)
+{
+ if (htmdump_init_debugfs())
+ return -EINVAL;
+
+ return 0;
+}
+machine_device_initcall(pseries, htmdump_init);
--
2.45.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] powerpc: Document details on H_HTM hcall
2024-06-20 17:46 [PATCH 1/3] powerpc/pseries: Macros and wrapper functions for H_HTM call Madhavan Srinivasan
2024-06-20 17:46 ` [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs Madhavan Srinivasan
@ 2024-06-20 17:46 ` Madhavan Srinivasan
2024-06-22 8:27 ` Ritesh Harjani
1 sibling, 1 reply; 9+ messages in thread
From: Madhavan Srinivasan @ 2024-06-20 17:46 UTC (permalink / raw)
To: mpe
Cc: atrajeev, kjain, christophe.leroy, Madhavan Srinivasan, npiggin,
naveen.n.rao, disgoel, linuxppc-dev
Add documentation to 'papr_hcalls.rst' describing the
input, output and return values of the H_HTM hcall as
per the internal specification.
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
---
Documentation/arch/powerpc/papr_hcalls.rst | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/Documentation/arch/powerpc/papr_hcalls.rst b/Documentation/arch/powerpc/papr_hcalls.rst
index 80d2c0aadab5..805e1cb9bab9 100644
--- a/Documentation/arch/powerpc/papr_hcalls.rst
+++ b/Documentation/arch/powerpc/papr_hcalls.rst
@@ -289,6 +289,17 @@ to be issued multiple times in order to be completely serviced. The
subsequent hcalls to the hypervisor until the hcall is completely serviced
at which point H_SUCCESS or other error is returned by the hypervisor.
+**H_HTM**
+
+| Input: flags, target, operation (op), op-param1, op-param2, op-param3
+| Out: *dumphtmbufferdata*
+| Return Value: *H_Success,H_Busy,H_LongBusyOrder,H_Partial,H_Parameter,
+ H_P2,H_P3,H_P4,H_P5,H_P6,H_State,H_Not_Available,H_Authority*
+
+H_HTM supports setup, configuration, control and dumping of Hardware Trace
+Macro (HTM) function and its data. HTM buffer stores tracing data for functions
+like core instruction, core LLAT and nest.
+
References
==========
.. [1] "Power Architecture Platform Reference"
--
2.45.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs
2024-06-20 17:46 ` [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs Madhavan Srinivasan
@ 2024-06-22 7:40 ` Ritesh Harjani
2024-06-26 3:51 ` Madhavan Srinivasan
2024-06-26 8:12 ` Michael Ellerman
2024-06-26 0:58 ` kernel test robot
1 sibling, 2 replies; 9+ messages in thread
From: Ritesh Harjani @ 2024-06-22 7:40 UTC (permalink / raw)
To: Madhavan Srinivasan, mpe
Cc: atrajeev, kjain, npiggin, Madhavan Srinivasan, christophe.leroy,
naveen.n.rao, disgoel, linuxppc-dev
This is a generic review and I haven't looked into the PAPR spec for
htmdump hcall and it's interface.
Madhavan Srinivasan <maddy@linux.ibm.com> writes:
> This patch adds debugfs interface to export Hardware Trace Macro (HTM)
> function data in a LPAR. New hypervisor call "H_HTM" has been
> defined to setup, configure, control and dump the HTM data.
> This patch supports only dumping of HTM data in a LPAR.
> New debugfs folder called "htmdump" has been added under
> /sys/kernel/debug/arch path which contains files need to
> pass required parameters for the H_HTM dump function. New Kconfig
> option called "CONFIG_HTMDUMP" has been in platform/pseries for the same.
>
> With patch series applied and booted, list of files in debugfs path
>
> # pwd
> /sys/kernel/debug/powerpc/htmdump
> # ls
> coreindexonchip htmtype nodalchipindex nodeindex trace
>
> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
> ---
> arch/powerpc/platforms/pseries/Kconfig | 8 ++
> arch/powerpc/platforms/pseries/Makefile | 1 +
> arch/powerpc/platforms/pseries/htmdump.c | 130 +++++++++++++++++++++++
> 3 files changed, 139 insertions(+)
> create mode 100644 arch/powerpc/platforms/pseries/htmdump.c
>
> diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
> index afc0f6a61337..46c0ea605e33 100644
> --- a/arch/powerpc/platforms/pseries/Kconfig
> +++ b/arch/powerpc/platforms/pseries/Kconfig
> @@ -128,6 +128,14 @@ config CMM
> will be reused for other LPARs. The interface allows firmware to
> balance memory across many LPARs.
>
> +config HTMDUMP
> + tristate "PHYP HTM data dumper"
Not sure if we can make machine_device_initcall() as a tristate?
Did we try compiling it as a module?
It we would like to keep this as a module - then why not use module_init
call and then make it depend upon...
depends on PPC_PSERIES && DEBUG_FS (??)
> + default y
and then since this is mostly a debug trace facility, then we need not enable
it by default right?
> + help
> + Select this option, if you want to enable the kernel debugfs
> + interface to dump the Hardware Trace Macro (HTM) function data
> + in the LPAR.
> +
> config HV_PERF_CTRS
> bool "Hypervisor supplied PMU events (24x7 & GPCI)"
> default y
> diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
> index 7bf506f6b8c8..3f3e3492e436 100644
> --- a/arch/powerpc/platforms/pseries/Makefile
> +++ b/arch/powerpc/platforms/pseries/Makefile
> @@ -19,6 +19,7 @@ obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
> obj-$(CONFIG_HVCS) += hvcserver.o
> obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
> obj-$(CONFIG_CMM) += cmm.o
> +obj-$(CONFIG_HTMDUMP) += htmdump.o
> obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o
> obj-$(CONFIG_LPARCFG) += lparcfg.o
> obj-$(CONFIG_IBMVIO) += vio.o
> diff --git a/arch/powerpc/platforms/pseries/htmdump.c b/arch/powerpc/platforms/pseries/htmdump.c
> new file mode 100644
> index 000000000000..540cdb7e069c
> --- /dev/null
> +++ b/arch/powerpc/platforms/pseries/htmdump.c
> @@ -0,0 +1,130 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) IBM Corporation, 2024
> + */
> +
> +#define pr_fmt(fmt) "htmdump: " fmt
> +
> +#include <linux/bitops.h>
> +#include <linux/string.h>
> +#include <linux/init.h>
> +#include <linux/moduleparam.h>
> +#include <linux/fs.h>
> +#include <linux/debugfs.h>
> +#include <linux/slab.h>
> +#include <linux/memory.h>
> +#include <linux/memory_hotplug.h>
> +#include <linux/numa.h>
> +#include <linux/memblock.h>
> +#include <asm/machdep.h>
> +#include <asm/plpar_wrappers.h>
Do we need all of the above?
e.g. slab, memory_hotplug etc are not needed IMO.
Maybe only?
#include <asm/hvcall.h>
#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/plpar_wrappers.h>
#include <linux/debugfs.h>
#include <linux/module.h>
(module.h depending upon if we make it module_init())
> +
> +/* This enables us to keep track of the memory removed from each node. */
> +struct htmdump_entry {
> + void *buf;
> + struct dentry *dir;
> + char name[16];
> +};
> +
> +static u32 nodeindex = 0;
> +static u32 nodalchipindex = 0;
> +static u32 coreindexonchip = 0;
> +static u32 htmtype = 0;
> +
> +#define BUFFER_SIZE PAGE_SIZE
> +
> +static ssize_t htmdump_read(struct file *filp, char __user *ubuf,
> + size_t count, loff_t *ppos)
> +{
> + struct htmdump_entry *ent = filp->private_data;
> + unsigned long page, read_size, available;
> + loff_t offset;
> + long rc;
> +
> + page = ALIGN_DOWN(*ppos, BUFFER_SIZE);
> + offset = (*ppos) % BUFFER_SIZE;
> +
> + rc = htm_get_dump_hardware(nodeindex, nodalchipindex, coreindexonchip,
> + htmtype, virt_to_phys(ent->buf), BUFFER_SIZE, page);
> +
> + switch(rc) {
> + case H_SUCCESS:
> + case H_PARTIAL:
> + break;
> + case H_NOT_AVAILABLE:
> + return 0;
> + case H_BUSY:
> + case H_LONG_BUSY_ORDER_1_MSEC:
> + case H_LONG_BUSY_ORDER_10_MSEC:
> + case H_LONG_BUSY_ORDER_100_MSEC:
> + case H_LONG_BUSY_ORDER_1_SEC:
> + case H_LONG_BUSY_ORDER_10_SEC:
> + case H_LONG_BUSY_ORDER_100_SEC:
> + case H_PARAMETER:
> + case H_P2:
> + case H_P3:
> + case H_P4:
> + case H_P5:
> + case H_P6:
> + case H_STATE:
> + case H_AUTHORITY:
> + return -EINVAL;
> + }
> +
> + available = BUFFER_SIZE - offset;
> + read_size = min(count, available);
> + *ppos += read_size;
> + return simple_read_from_buffer(ubuf, count, &offset, ent->buf, available);
> +}
> +
> +static const struct file_operations htmdump_fops = {
> + .llseek = default_llseek,
> + .read = htmdump_read,
> + .open = simple_open,
> +};
> +
> +static struct dentry *htmdump_debugfs_dir;
> +
> +static int htmdump_init_debugfs(void)
> +{
> + struct htmdump_entry *ent;
> +
> + ent = kcalloc(1, sizeof(struct htmdump_entry), GFP_KERNEL);
> + if (!ent) {
> + pr_err("Failed to allocate ent\n");
> + return -EINVAL;
> + }
> +
> + ent->buf = kmalloc(BUFFER_SIZE, GFP_KERNEL);
> + if (!ent->buf) {
> + pr_err("Failed to allocate htmdump buf\n");
> + return -ENOMEM;
> + }
> +
> + pr_debug("%s: ent:%lx buf:%lx\n",
> + __func__, (long unsigned int)ent, (long unsigned int)ent->buf);
> +
> + htmdump_debugfs_dir = debugfs_create_dir("htmdump",
> + arch_debugfs_dir);
> +
> + debugfs_create_u32("nodeindex", 0600,
> + htmdump_debugfs_dir, &nodeindex);
> + debugfs_create_u32("nodalchipindex", 0600,
> + htmdump_debugfs_dir, &nodalchipindex);
> + debugfs_create_u32("coreindexonchip", 0600,
> + htmdump_debugfs_dir, &coreindexonchip);
> + debugfs_create_u32("htmtype", 0600,
> + htmdump_debugfs_dir, &htmtype);
minor nit: For all of the above. S_IRUSR | S_IWUSR instead of 0600.
> + debugfs_create_file("trace", 0400, htmdump_debugfs_dir, ent, &htmdump_fops);
maybe S_IRUSR instead of 0400.
(makes it more readable).
> +
> + return 0;
> +}
> +
> +static int htmdump_init(void)
maybe put it into __init section?
> +{
> + if (htmdump_init_debugfs())
> + return -EINVAL;
> +
> + return 0;
> +}
> +machine_device_initcall(pseries, htmdump_init);
> --
> 2.45.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] powerpc: Document details on H_HTM hcall
2024-06-20 17:46 ` [PATCH 3/3] powerpc: Document details on H_HTM hcall Madhavan Srinivasan
@ 2024-06-22 8:27 ` Ritesh Harjani
2024-06-26 3:55 ` Madhavan Srinivasan
0 siblings, 1 reply; 9+ messages in thread
From: Ritesh Harjani @ 2024-06-22 8:27 UTC (permalink / raw)
To: Madhavan Srinivasan, mpe
Cc: atrajeev, kjain, npiggin, Madhavan Srinivasan, christophe.leroy,
naveen.n.rao, disgoel, linuxppc-dev
Madhavan Srinivasan <maddy@linux.ibm.com> writes:
> Add documentation to 'papr_hcalls.rst' describing the
> input, output and return values of the H_HTM hcall as
> per the internal specification.
>
> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
> ---
> Documentation/arch/powerpc/papr_hcalls.rst | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/Documentation/arch/powerpc/papr_hcalls.rst b/Documentation/arch/powerpc/papr_hcalls.rst
> index 80d2c0aadab5..805e1cb9bab9 100644
> --- a/Documentation/arch/powerpc/papr_hcalls.rst
> +++ b/Documentation/arch/powerpc/papr_hcalls.rst
> @@ -289,6 +289,17 @@ to be issued multiple times in order to be completely serviced. The
> subsequent hcalls to the hypervisor until the hcall is completely serviced
> at which point H_SUCCESS or other error is returned by the hypervisor.
>
> +**H_HTM**
> +
> +| Input: flags, target, operation (op), op-param1, op-param2, op-param3
> +| Out: *dumphtmbufferdata*
> +| Return Value: *H_Success,H_Busy,H_LongBusyOrder,H_Partial,H_Parameter,
> + H_P2,H_P3,H_P4,H_P5,H_P6,H_State,H_Not_Available,H_Authority*
> +
> +H_HTM supports setup, configuration, control and dumping of Hardware Trace
> +Macro (HTM) function and its data. HTM buffer stores tracing data for functions
> +like core instruction, core LLAT and nest.
> +
Minor nit: Maybe the set of debugfs cmds to collect the trace and some
example trace log? If it is not confidential?
> References
> ==========
> .. [1] "Power Architecture Platform Reference"
> --
> 2.45.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs
2024-06-20 17:46 ` [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs Madhavan Srinivasan
2024-06-22 7:40 ` Ritesh Harjani
@ 2024-06-26 0:58 ` kernel test robot
1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2024-06-26 0:58 UTC (permalink / raw)
To: Madhavan Srinivasan, mpe
Cc: atrajeev, kjain, npiggin, Madhavan Srinivasan, christophe.leroy,
oe-kbuild-all, naveen.n.rao, disgoel, linuxppc-dev
Hi Madhavan,
kernel test robot noticed the following build errors:
[auto build test ERROR on powerpc/next]
[also build test ERROR on powerpc/fixes linus/master v6.10-rc5 next-20240625]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Madhavan-Srinivasan/powerpc-pseries-Export-hardware-trace-macro-dump-via-debugfs/20240625-144003
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
patch link: https://lore.kernel.org/r/20240620174614.53751-2-maddy%40linux.ibm.com
patch subject: [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs
config: powerpc-allmodconfig (https://download.01.org/0day-ci/archive/20240626/202406260849.z8VoytFS-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240626/202406260849.z8VoytFS-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202406260849.z8VoytFS-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
In file included from arch/powerpc/platforms/pseries/htmdump.c:19:
>> arch/powerpc/include/asm/machdep.h:262:85: error: expected ')' before numeric constant
262 | #define machine_device_initcall(mach, fn) __define_machine_initcall(mach, fn, 6)
| ^
arch/powerpc/include/asm/machdep.h:248:61: note: in definition of macro '__define_machine_initcall'
248 | __define_initcall(__machine_initcall_##mach##_##fn, id);
| ^~
arch/powerpc/platforms/pseries/htmdump.c:130:1: note: in expansion of macro 'machine_device_initcall'
130 | machine_device_initcall(pseries, htmdump_init);
| ^~~~~~~~~~~~~~~~~~~~~~~
>> arch/powerpc/include/asm/machdep.h:244:27: warning: '__machine_initcall_pseries_htmdump_init' defined but not used [-Wunused-function]
244 | static int __init __machine_initcall_##mach##_##fn(void) { \
| ^~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/machdep.h:262:49: note: in expansion of macro '__define_machine_initcall'
262 | #define machine_device_initcall(mach, fn) __define_machine_initcall(mach, fn, 6)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/platforms/pseries/htmdump.c:130:1: note: in expansion of macro 'machine_device_initcall'
130 | machine_device_initcall(pseries, htmdump_init);
| ^~~~~~~~~~~~~~~~~~~~~~~
vim +262 arch/powerpc/include/asm/machdep.h
^1da177e4c3f41 include/asm-ppc64/machdep.h Linus Torvalds 2005-04-16 242
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 243 #define __define_machine_initcall(mach, fn, id) \
800d68c3aa0dc3 include/asm-powerpc/machdep.h Grant Likely 2007-12-02 @244 static int __init __machine_initcall_##mach##_##fn(void) { \
800d68c3aa0dc3 include/asm-powerpc/machdep.h Grant Likely 2007-12-02 245 if (machine_is(mach)) return fn(); \
800d68c3aa0dc3 include/asm-powerpc/machdep.h Grant Likely 2007-12-02 246 return 0; \
800d68c3aa0dc3 include/asm-powerpc/machdep.h Grant Likely 2007-12-02 247 } \
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 248 __define_initcall(__machine_initcall_##mach##_##fn, id);
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 249
8d3c941e240ba2 arch/powerpc/include/asm/machdep.h Michael Ellerman 2014-07-15 250 #define machine_early_initcall(mach, fn) __define_machine_initcall(mach, fn, early)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 251 #define machine_core_initcall(mach, fn) __define_machine_initcall(mach, fn, 1)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 252 #define machine_core_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 1s)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 253 #define machine_postcore_initcall(mach, fn) __define_machine_initcall(mach, fn, 2)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 254 #define machine_postcore_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 2s)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 255 #define machine_arch_initcall(mach, fn) __define_machine_initcall(mach, fn, 3)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 256 #define machine_arch_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 3s)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 257 #define machine_subsys_initcall(mach, fn) __define_machine_initcall(mach, fn, 4)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 258 #define machine_subsys_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 4s)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 259 #define machine_fs_initcall(mach, fn) __define_machine_initcall(mach, fn, 5)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 260 #define machine_fs_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 5s)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 261 #define machine_rootfs_initcall(mach, fn) __define_machine_initcall(mach, fn, rootfs)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 @262 #define machine_device_initcall(mach, fn) __define_machine_initcall(mach, fn, 6)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 263 #define machine_device_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 6s)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 264 #define machine_late_initcall(mach, fn) __define_machine_initcall(mach, fn, 7)
7929d407e47fbf arch/powerpc/include/asm/machdep.h Matthew Leach 2012-12-17 265 #define machine_late_initcall_sync(mach, fn) __define_machine_initcall(mach, fn, 7s)
800d68c3aa0dc3 include/asm-powerpc/machdep.h Grant Likely 2007-12-02 266
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs
2024-06-22 7:40 ` Ritesh Harjani
@ 2024-06-26 3:51 ` Madhavan Srinivasan
2024-06-26 8:12 ` Michael Ellerman
1 sibling, 0 replies; 9+ messages in thread
From: Madhavan Srinivasan @ 2024-06-26 3:51 UTC (permalink / raw)
To: Ritesh Harjani (IBM), mpe
Cc: atrajeev, kjain, npiggin, christophe.leroy, naveen.n.rao, disgoel,
linuxppc-dev
On 6/22/24 1:10 PM, Ritesh Harjani (IBM) wrote:
> This is a generic review and I haven't looked into the PAPR spec for
> htmdump hcall and it's interface.
Sure
> Madhavan Srinivasan <maddy@linux.ibm.com> writes:
>
>> This patch adds debugfs interface to export Hardware Trace Macro (HTM)
>> function data in a LPAR. New hypervisor call "H_HTM" has been
>> defined to setup, configure, control and dump the HTM data.
>> This patch supports only dumping of HTM data in a LPAR.
>> New debugfs folder called "htmdump" has been added under
>> /sys/kernel/debug/arch path which contains files need to
>> pass required parameters for the H_HTM dump function. New Kconfig
>> option called "CONFIG_HTMDUMP" has been in platform/pseries for the same.
>>
>> With patch series applied and booted, list of files in debugfs path
>>
>> # pwd
>> /sys/kernel/debug/powerpc/htmdump
>> # ls
>> coreindexonchip htmtype nodalchipindex nodeindex trace
>>
>> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
>> ---
>> arch/powerpc/platforms/pseries/Kconfig | 8 ++
>> arch/powerpc/platforms/pseries/Makefile | 1 +
>> arch/powerpc/platforms/pseries/htmdump.c | 130 +++++++++++++++++++++++
>> 3 files changed, 139 insertions(+)
>> create mode 100644 arch/powerpc/platforms/pseries/htmdump.c
>>
>> diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
>> index afc0f6a61337..46c0ea605e33 100644
>> --- a/arch/powerpc/platforms/pseries/Kconfig
>> +++ b/arch/powerpc/platforms/pseries/Kconfig
>> @@ -128,6 +128,14 @@ config CMM
>> will be reused for other LPARs. The interface allows firmware to
>> balance memory across many LPARs.
>>
>> +config HTMDUMP
>> + tristate "PHYP HTM data dumper"
> Not sure if we can make machine_device_initcall() as a tristate?
> Did we try compiling it as a module?
>
> It we would like to keep this as a module - then why not use module_init
> call and then make it depend upon...
I will make it as bool and add depends as suggested.
>
> depends on PPC_PSERIES && DEBUG_FS (??)
>
>> + default y
> and then since this is mostly a debug trace facility, then we need not enable
> it by default right?
Yes, we want this to be there, it is up to hypervisor whether to permit
the hcalls.
>
>> + help
>> + Select this option, if you want to enable the kernel debugfs
>> + interface to dump the Hardware Trace Macro (HTM) function data
>> + in the LPAR.
>> +
>> config HV_PERF_CTRS
>> bool "Hypervisor supplied PMU events (24x7 & GPCI)"
>> default y
>> diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
>> index 7bf506f6b8c8..3f3e3492e436 100644
>> --- a/arch/powerpc/platforms/pseries/Makefile
>> +++ b/arch/powerpc/platforms/pseries/Makefile
>> @@ -19,6 +19,7 @@ obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
>> obj-$(CONFIG_HVCS) += hvcserver.o
>> obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
>> obj-$(CONFIG_CMM) += cmm.o
>> +obj-$(CONFIG_HTMDUMP) += htmdump.o
>> obj-$(CONFIG_IO_EVENT_IRQ) += io_event_irq.o
>> obj-$(CONFIG_LPARCFG) += lparcfg.o
>> obj-$(CONFIG_IBMVIO) += vio.o
>> diff --git a/arch/powerpc/platforms/pseries/htmdump.c b/arch/powerpc/platforms/pseries/htmdump.c
>> new file mode 100644
>> index 000000000000..540cdb7e069c
>> --- /dev/null
>> +++ b/arch/powerpc/platforms/pseries/htmdump.c
>> @@ -0,0 +1,130 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * Copyright (C) IBM Corporation, 2024
>> + */
>> +
>> +#define pr_fmt(fmt) "htmdump: " fmt
>> +
>> +#include <linux/bitops.h>
>> +#include <linux/string.h>
>> +#include <linux/init.h>
>> +#include <linux/moduleparam.h>
>> +#include <linux/fs.h>
>> +#include <linux/debugfs.h>
>> +#include <linux/slab.h>
>> +#include <linux/memory.h>
>> +#include <linux/memory_hotplug.h>
>> +#include <linux/numa.h>
>> +#include <linux/memblock.h>
>> +#include <asm/machdep.h>
>> +#include <asm/plpar_wrappers.h>
> Do we need all of the above?
> e.g. slab, memory_hotplug etc are not needed IMO.
>
> Maybe only?
>
> #include <asm/hvcall.h>
> #include <asm/io.h>
> #include <asm/machdep.h>
> #include <asm/plpar_wrappers.h>
>
> #include <linux/debugfs.h>
> #include <linux/module.h>
>
> (module.h depending upon if we make it module_init())
>
Yeah, my bad, Should have handled this. will fix it in v2
>> +
>> +/* This enables us to keep track of the memory removed from each node. */
>> +struct htmdump_entry {
>> + void *buf;
>> + struct dentry *dir;
>> + char name[16];
>> +};
>> +
>> +static u32 nodeindex = 0;
>> +static u32 nodalchipindex = 0;
>> +static u32 coreindexonchip = 0;
>> +static u32 htmtype = 0;
>> +
>> +#define BUFFER_SIZE PAGE_SIZE
>> +
>> +static ssize_t htmdump_read(struct file *filp, char __user *ubuf,
>> + size_t count, loff_t *ppos)
>> +{
>> + struct htmdump_entry *ent = filp->private_data;
>> + unsigned long page, read_size, available;
>> + loff_t offset;
>> + long rc;
>> +
>> + page = ALIGN_DOWN(*ppos, BUFFER_SIZE);
>> + offset = (*ppos) % BUFFER_SIZE;
>> +
>> + rc = htm_get_dump_hardware(nodeindex, nodalchipindex, coreindexonchip,
>> + htmtype, virt_to_phys(ent->buf), BUFFER_SIZE, page);
>> +
>> + switch(rc) {
>> + case H_SUCCESS:
>> + case H_PARTIAL:
>> + break;
>> + case H_NOT_AVAILABLE:
>> + return 0;
>> + case H_BUSY:
>> + case H_LONG_BUSY_ORDER_1_MSEC:
>> + case H_LONG_BUSY_ORDER_10_MSEC:
>> + case H_LONG_BUSY_ORDER_100_MSEC:
>> + case H_LONG_BUSY_ORDER_1_SEC:
>> + case H_LONG_BUSY_ORDER_10_SEC:
>> + case H_LONG_BUSY_ORDER_100_SEC:
>> + case H_PARAMETER:
>> + case H_P2:
>> + case H_P3:
>> + case H_P4:
>> + case H_P5:
>> + case H_P6:
>> + case H_STATE:
>> + case H_AUTHORITY:
>> + return -EINVAL;
>> + }
>> +
>> + available = BUFFER_SIZE - offset;
>> + read_size = min(count, available);
>> + *ppos += read_size;
>> + return simple_read_from_buffer(ubuf, count, &offset, ent->buf, available);
>> +}
>> +
>> +static const struct file_operations htmdump_fops = {
>> + .llseek = default_llseek,
>> + .read = htmdump_read,
>> + .open = simple_open,
>> +};
>> +
>> +static struct dentry *htmdump_debugfs_dir;
>> +
>> +static int htmdump_init_debugfs(void)
>> +{
>> + struct htmdump_entry *ent;
>> +
>> + ent = kcalloc(1, sizeof(struct htmdump_entry), GFP_KERNEL);
>> + if (!ent) {
>> + pr_err("Failed to allocate ent\n");
>> + return -EINVAL;
>> + }
>> +
>> + ent->buf = kmalloc(BUFFER_SIZE, GFP_KERNEL);
>> + if (!ent->buf) {
>> + pr_err("Failed to allocate htmdump buf\n");
>> + return -ENOMEM;
>> + }
>> +
>> + pr_debug("%s: ent:%lx buf:%lx\n",
>> + __func__, (long unsigned int)ent, (long unsigned int)ent->buf);
>> +
>> + htmdump_debugfs_dir = debugfs_create_dir("htmdump",
>> + arch_debugfs_dir);
>> +
>> + debugfs_create_u32("nodeindex", 0600,
>> + htmdump_debugfs_dir, &nodeindex);
>> + debugfs_create_u32("nodalchipindex", 0600,
>> + htmdump_debugfs_dir, &nodalchipindex);
>> + debugfs_create_u32("coreindexonchip", 0600,
>> + htmdump_debugfs_dir, &coreindexonchip);
>> + debugfs_create_u32("htmtype", 0600,
>> + htmdump_debugfs_dir, &htmtype);
> minor nit: For all of the above. S_IRUSR | S_IWUSR instead of 0600.
>
>> + debugfs_create_file("trace", 0400, htmdump_debugfs_dir, ent, &htmdump_fops);
> maybe S_IRUSR instead of 0400.
>
> (makes it more readable).
ok will check and changes.
Thanks for the review comments.
Maddy
>
>> +
>> + return 0;
>> +}
>> +
>> +static int htmdump_init(void)
> maybe put it into __init section?
>
>> +{
>> + if (htmdump_init_debugfs())
>> + return -EINVAL;
>> +
>> + return 0;
>> +}
>> +machine_device_initcall(pseries, htmdump_init);
>> --
>> 2.45.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] powerpc: Document details on H_HTM hcall
2024-06-22 8:27 ` Ritesh Harjani
@ 2024-06-26 3:55 ` Madhavan Srinivasan
0 siblings, 0 replies; 9+ messages in thread
From: Madhavan Srinivasan @ 2024-06-26 3:55 UTC (permalink / raw)
To: Ritesh Harjani (IBM), mpe
Cc: atrajeev, kjain, npiggin, christophe.leroy, naveen.n.rao, disgoel,
linuxppc-dev
On 6/22/24 1:57 PM, Ritesh Harjani (IBM) wrote:
> Madhavan Srinivasan <maddy@linux.ibm.com> writes:
>
>> Add documentation to 'papr_hcalls.rst' describing the
>> input, output and return values of the H_HTM hcall as
>> per the internal specification.
>>
>> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
>> ---
>> Documentation/arch/powerpc/papr_hcalls.rst | 11 +++++++++++
>> 1 file changed, 11 insertions(+)
>>
>> diff --git a/Documentation/arch/powerpc/papr_hcalls.rst b/Documentation/arch/powerpc/papr_hcalls.rst
>> index 80d2c0aadab5..805e1cb9bab9 100644
>> --- a/Documentation/arch/powerpc/papr_hcalls.rst
>> +++ b/Documentation/arch/powerpc/papr_hcalls.rst
>> @@ -289,6 +289,17 @@ to be issued multiple times in order to be completely serviced. The
>> subsequent hcalls to the hypervisor until the hcall is completely serviced
>> at which point H_SUCCESS or other error is returned by the hypervisor.
>>
>> +**H_HTM**
>> +
>> +| Input: flags, target, operation (op), op-param1, op-param2, op-param3
>> +| Out: *dumphtmbufferdata*
>> +| Return Value: *H_Success,H_Busy,H_LongBusyOrder,H_Partial,H_Parameter,
>> + H_P2,H_P3,H_P4,H_P5,H_P6,H_State,H_Not_Available,H_Authority*
>> +
>> +H_HTM supports setup, configuration, control and dumping of Hardware Trace
>> +Macro (HTM) function and its data. HTM buffer stores tracing data for functions
>> +like core instruction, core LLAT and nest.
>> +
> Minor nit: Maybe the set of debugfs cmds to collect the trace and some
> example trace log? If it is not confidential?
I could add the file structure in the commit message, but logs are just
binary data.
Maddy
>
>> References
>> ==========
>> .. [1] "Power Architecture Platform Reference"
>> --
>> 2.45.2
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs
2024-06-22 7:40 ` Ritesh Harjani
2024-06-26 3:51 ` Madhavan Srinivasan
@ 2024-06-26 8:12 ` Michael Ellerman
1 sibling, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2024-06-26 8:12 UTC (permalink / raw)
To: Ritesh Harjani, Madhavan Srinivasan
Cc: atrajeev, kjain, npiggin, Madhavan Srinivasan, christophe.leroy,
naveen.n.rao, disgoel, linuxppc-dev
Ritesh Harjani (IBM) <ritesh.list@gmail.com> writes:
> This is a generic review and I haven't looked into the PAPR spec for
> htmdump hcall and it's interface.
>
> Madhavan Srinivasan <maddy@linux.ibm.com> writes:
...
>> +
>> + debugfs_create_u32("nodeindex", 0600,
>> + htmdump_debugfs_dir, &nodeindex);
>> + debugfs_create_u32("nodalchipindex", 0600,
>> + htmdump_debugfs_dir, &nodalchipindex);
>> + debugfs_create_u32("coreindexonchip", 0600,
>> + htmdump_debugfs_dir, &coreindexonchip);
>> + debugfs_create_u32("htmtype", 0600,
>> + htmdump_debugfs_dir, &htmtype);
>
> minor nit: For all of the above. S_IRUSR | S_IWUSR instead of 0600.
>
>> + debugfs_create_file("trace", 0400, htmdump_debugfs_dir, ent, &htmdump_fops);
>
> maybe S_IRUSR instead of 0400.
Actually we prefer the octal values, see:
https://git.kernel.org/torvalds/c/57ad583f2086d55ada284c54bfc440123cf73964
cheers
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-26 8:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-20 17:46 [PATCH 1/3] powerpc/pseries: Macros and wrapper functions for H_HTM call Madhavan Srinivasan
2024-06-20 17:46 ` [PATCH 2/3] powerpc/pseries: Export hardware trace macro dump via debugfs Madhavan Srinivasan
2024-06-22 7:40 ` Ritesh Harjani
2024-06-26 3:51 ` Madhavan Srinivasan
2024-06-26 8:12 ` Michael Ellerman
2024-06-26 0:58 ` kernel test robot
2024-06-20 17:46 ` [PATCH 3/3] powerpc: Document details on H_HTM hcall Madhavan Srinivasan
2024-06-22 8:27 ` Ritesh Harjani
2024-06-26 3:55 ` Madhavan Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).