[PATCH] perf/x86/intel/pt: Fix outdated and add docs

From: Marco Cavenati
Date: Thu May 16 2024 - 17:44:35 EST


This patch adds docs for the TOPA_SHIFT constatnt and for the sizes
function, removes two outdated parameters from the documentation of the
struct pt_buffer and renames the constant PT_FILTERS_NUM to
PT_FILTERS_MAX_NUM making clearer that the number of filters can be lower
since it depends on the CPU as specified in Intel's SDM.

Signed-off-by: Marco Cavenati <cavenati.marco@xxxxxxxxx>
---
arch/x86/events/intel/pt.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/x86/events/intel/pt.h b/arch/x86/events/intel/pt.h
index 96906a62aacd..fd5d9095997b 100644
--- a/arch/x86/events/intel/pt.h
+++ b/arch/x86/events/intel/pt.h
@@ -17,8 +17,18 @@
*/
#define TOPA_PMI_MARGIN 512

+/*
+ * Shift for 4K-aligned values
+ */
#define TOPA_SHIFT 12

+/**
+ * sizes() - compute output buffer size in bytes from ToPA entry encoded size
+ *
+ * @tsz: encoded ToPA entry size
+ *
+ * Return: size in bytes
+ */
static inline unsigned int sizes(unsigned int tsz)
{
return 1 << (tsz + TOPA_SHIFT);
@@ -61,7 +71,6 @@ struct pt_pmu {
* @cur_idx: current output region's index within @cur table
* @output_off: offset within the current output region
* @data_size: running total of the amount of data in this buffer
- * @lost: if data was lost/truncated
* @head: logical write offset inside the buffer
* @snapshot: if this is for a snapshot/overwrite counter
* @single: use Single Range Output instead of ToPA
@@ -70,7 +79,6 @@ struct pt_pmu {
* @stop_te: STOP topa entry pointer
* @intr_te: INT topa entry pointer
* @data_pages: array of pages from perf
- * @topa_index: table of topa entries indexed by page offset
*/
struct pt_buffer {
struct list_head tables;
@@ -87,7 +95,7 @@ struct pt_buffer {
void **data_pages;
};

-#define PT_FILTERS_NUM 4
+#define PT_FILTERS_MAX_NUM 4

/**
* struct pt_filter - IP range filter configuration
@@ -107,7 +115,7 @@ struct pt_filter {
* @nr_filters: number of defined filters in the @filter array
*/
struct pt_filters {
- struct pt_filter filter[PT_FILTERS_NUM];
+ struct pt_filter filter[PT_FILTERS_MAX_NUM];
unsigned int nr_filters;
};

--
2.39.2