Commit f71523ca authored by Ze Zuo's avatar Ze Zuo
Browse files

tracing, mem-sampling-sample: Adding tracking events to hardware-sampled page access

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9GZAQ


CVE: NA

--------------------------------

Provide a tracing interface for eBPF to collect hardware memory access
data in user space.

Signed-off-by: default avatarZe Zuo <zuoze1@huawei.com>
Signed-off-by: default avatarTong Tiangen <tongtiangen@huawei.com>
parent 06fcc73c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
#include <linux/perf/arm_pmu.h>
#include <linux/platform_device.h>
#include <linux/mem_sampling.h>
#include <linux/perf/arm_pmu.h>
#include <trace/events/kmem.h>

#include "spe-decoder/arm-spe-decoder.h"
#include "spe-decoder/arm-spe-pkt-decoder.h"
@@ -687,6 +689,7 @@ void arm_spe_record_enqueue(struct arm_spe_record *record)
		return;
	}

	trace_spe_record((struct mem_sampling_record *)record, smp_processor_id());
	record_tail = spe_buf->record_base +
			spe_buf->nr_records * SPE_RECORD_ENTRY_SIZE;
	*record_tail = *(struct mem_sampling_record *)record;
+27 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@
#include <linux/types.h>
#include <linux/tracepoint.h>
#include <trace/events/mmflags.h>
#include <linux/mem_sampling.h>

DECLARE_EVENT_CLASS(kmem_alloc,

@@ -416,6 +417,32 @@ TRACE_EVENT(mm_mem_sampling_access_record,
		__entry->cpuid, __entry->pid)
);
#endif /* CONFIG_NUMABALANCING_MEM_SAMPLING */
#ifdef CONFIG_ARM_SPE_MEM_SAMPLING
TRACE_EVENT(spe_record,
	TP_PROTO(struct mem_sampling_record *record, int cpuid),

	TP_ARGS(record, cpuid),

	TP_STRUCT__entry(
		__field(u64, vaddr)
		__field(u64, paddr)
	__field(int, cpuid)
		__field(int, pid)
	),

	TP_fast_assign(
		__entry->vaddr = record->virt_addr;
		__entry->paddr = record->phys_addr;
	__entry->cpuid = cpuid;
		__entry->pid = record->context_id;

	),

	TP_printk("vaddr=%llu paddr=%llu cpuid=%d pid=%d",
		__entry->vaddr, __entry->paddr,
		__entry->cpuid, __entry->pid)
);
#endif /* CONFIG_ARM_SPE_MEM_SAMPLING */
#endif /* _TRACE_KMEM_H */

/* This part must be outside protection */