summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2020-09-12 17:08:51 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2020-09-12 17:08:51 +0000
commit464a9f14de462cef89db62b434b99509e6c531b7 (patch)
treef2fd2cc29a831286fe18c39c6e92328b6cf00d81 /sys
parentc5840e3b3130965c91f1817bb9f5643e3b8ba021 (diff)
Add tracepoints in the page fault handler and when entries are added to maps.
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/dt/dt_prov_static.c18
-rw-r--r--sys/uvm/uvm_fault.c4
-rw-r--r--sys/uvm/uvm_map.c9
3 files changed, 26 insertions, 5 deletions
diff --git a/sys/dev/dt/dt_prov_static.c b/sys/dev/dt/dt_prov_static.c
index cf496d198e3..286148af6c9 100644
--- a/sys/dev/dt/dt_prov_static.c
+++ b/sys/dev/dt/dt_prov_static.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dt_prov_static.c,v 1.2 2020/03/25 14:59:23 mpi Exp $ */
+/* $OpenBSD: dt_prov_static.c,v 1.3 2020/09/12 17:08:50 mpi Exp $ */
/*
* Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
@@ -34,7 +34,7 @@ struct dt_provider dt_prov_static = {
};
/*
- * Scheduler provider
+ * Scheduler
*/
DT_STATIC_PROBE2(sched, dequeue, "pid_t", "pid_t");
DT_STATIC_PROBE2(sched, enqueue, "pid_t", "pid_t");
@@ -51,6 +51,13 @@ DT_STATIC_PROBE1(raw_syscalls, sys_enter, "register_t");
DT_STATIC_PROBE1(raw_syscalls, sys_exit, "register_t");
/*
+ * UVM
+ */
+DT_STATIC_PROBE3(uvm, fault, "vaddr_t", "vm_fault_t", "vm_prot_t");
+DT_STATIC_PROBE3(uvm, map_insert, "vaddr_t", "vaddr_t", "vm_prot_t");
+DT_STATIC_PROBE3(uvm, map_remove, "vaddr_t", "vaddr_t", "vm_prot_t");
+
+/*
* List of all static probes
*/
struct dt_probe *dtps_static[] = {
@@ -65,6 +72,10 @@ struct dt_probe *dtps_static[] = {
/* Raw syscalls */
&_DT_STATIC_P(raw_syscalls, sys_enter),
&_DT_STATIC_P(raw_syscalls, sys_exit),
+ /* UVM */
+ &_DT_STATIC_P(uvm, fault),
+ &_DT_STATIC_P(uvm, map_insert),
+ &_DT_STATIC_P(uvm, map_remove),
};
int
@@ -91,7 +102,8 @@ dt_prov_static_alloc(struct dt_probe *dtp, struct dt_softc *sc,
if (dp == NULL)
return ENOMEM;
- dp->dp_filter = dtrq->dtrq_filter;
+ if (dt_pcb_filter_insert(dp, &dtrq->dtrq_filter))
+ return ENOMEM;
dp->dp_evtflags = dtrq->dtrq_evtflags;
TAILQ_INSERT_HEAD(plist, dp, dp_snext);
diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c
index 0cedd6d6c4a..0b0fe3e9274 100644
--- a/sys/uvm/uvm_fault.c
+++ b/sys/uvm/uvm_fault.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_fault.c,v 1.97 2019/12/08 12:37:45 mpi Exp $ */
+/* $OpenBSD: uvm_fault.c,v 1.98 2020/09/12 17:08:49 mpi Exp $ */
/* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */
/*
@@ -38,6 +38,7 @@
#include <sys/proc.h>
#include <sys/malloc.h>
#include <sys/mman.h>
+#include <sys/tracepoint.h>
#include <uvm/uvm.h>
@@ -507,6 +508,7 @@ uvm_fault(vm_map_t orig_map, vaddr_t vaddr, vm_fault_t fault_type,
pg = NULL;
uvmexp.faults++; /* XXX: locking? */
+ TRACEPOINT(uvm, fault, vaddr, fault_type, access_type, NULL);
/* init the IN parameters in the ufi */
ufi.orig_map = orig_map;
diff --git a/sys/uvm/uvm_map.c b/sys/uvm/uvm_map.c
index 754c93d68e8..fc23bc67e30 100644
--- a/sys/uvm/uvm_map.c
+++ b/sys/uvm/uvm_map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_map.c,v 1.265 2020/07/06 19:22:40 deraadt Exp $ */
+/* $OpenBSD: uvm_map.c,v 1.266 2020/09/12 17:08:50 mpi Exp $ */
/* $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
/*
@@ -95,6 +95,7 @@
#include <sys/signalvar.h>
#include <sys/syslog.h>
#include <sys/user.h>
+#include <sys/tracepoint.h>
#ifdef SYSVSHM
#include <sys/shm.h>
@@ -455,6 +456,9 @@ uvm_mapent_addr_insert(struct vm_map *map, struct vm_map_entry *entry)
KDASSERT((entry->start & (vaddr_t)PAGE_MASK) == 0 &&
(entry->end & (vaddr_t)PAGE_MASK) == 0);
+ TRACEPOINT(uvm, map_insert,
+ entry->start, entry->end, entry->protection, NULL);
+
UVM_MAP_REQ_WRITE(map);
res = RBT_INSERT(uvm_map_addr, &map->addr, entry);
if (res != NULL) {
@@ -475,6 +479,9 @@ uvm_mapent_addr_remove(struct vm_map *map, struct vm_map_entry *entry)
{
struct vm_map_entry *res;
+ TRACEPOINT(uvm, map_remove,
+ entry->start, entry->end, entry->protection, NULL);
+
UVM_MAP_REQ_WRITE(map);
res = RBT_REMOVE(uvm_map_addr, &map->addr, entry);
if (res != entry)