summaryrefslogtreecommitdiffstats
path: root/lib/libkvm/kvm_private.h
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2010-03-01 00:27:55 +0000
committerrwatson <rwatson@FreeBSD.org>2010-03-01 00:27:55 +0000
commit2c2940cdf7c5fa033c50f9c80a5b9f860d82d858 (patch)
tree04416be9d793aa3a6797065cfdbdfbee0a289fde /lib/libkvm/kvm_private.h
parent67dd56fb510222481fc77553f9ef25a5fd1f9620 (diff)
downloadFreeBSD-src-2c2940cdf7c5fa033c50f9c80a5b9f860d82d858.zip
FreeBSD-src-2c2940cdf7c5fa033c50f9c80a5b9f860d82d858.tar.gz
A first cut at teaching libkvm how to deal with dynamic per-CPU storage
(DPCPU): A new API, kvm_dpcpu_setcpu(3), selects the active CPU for the purposes of DPCPU. Calls to kvm_nlist(3) will automatically translate DPCPU symbols and return a pointer to the current CPU's version of the data. Consumers needing to read the same symbol on several CPUs will invoke a series of setcpu/nlist calls, one per CPU of interest. This addition makes it possible for tools like netstat(1) to query the values of DPCPU variables during crashdump analysis, and is based on similar code handling virtualized global variables. MFC after: 1 week Sponsored by: Juniper Networks, Inc.
Diffstat (limited to 'lib/libkvm/kvm_private.h')
-rw-r--r--lib/libkvm/kvm_private.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/libkvm/kvm_private.h b/lib/libkvm/kvm_private.h
index cc073db..69b1658 100644
--- a/lib/libkvm/kvm_private.h
+++ b/lib/libkvm/kvm_private.h
@@ -68,6 +68,19 @@ struct __kvm {
uintptr_t vnet_stop; /* stop of kernel's vnet region */
uintptr_t vnet_current; /* vnet we're working with */
uintptr_t vnet_base; /* vnet base of current vnet */
+
+ /*
+ * Dynamic per-CPU kernel memory. We translate symbols, on-demand,
+ * to the data associated with dpcpu_curcpu, set with
+ * kvm_dpcpu_setcpu().
+ */
+ int dpcpu_initialized; /* dpcpu fields set up */
+ uintptr_t dpcpu_start; /* start of kernel's dpcpu region */
+ uintptr_t dpcpu_stop; /* stop of kernel's dpcpu region */
+ u_int dpcpu_maxcpus; /* size of base array */
+ uintptr_t *dpcpu_off; /* base array, indexed by CPU ID */
+ u_int dpcpu_curcpu; /* CPU we're currently working with */
+ uintptr_t dpcpu_curoff; /* dpcpu base of current CPU */
};
/*
@@ -88,6 +101,8 @@ int _kvm_uvatop(kvm_t *, const struct proc *, u_long, u_long *);
int _kvm_vnet_selectpid(kvm_t *, pid_t);
int _kvm_vnet_initialized(kvm_t *, int);
uintptr_t _kvm_vnet_validaddr(kvm_t *, uintptr_t);
+int _kvm_dpcpu_initialized(kvm_t *, int);
+uintptr_t _kvm_dpcpu_validaddr(kvm_t *, uintptr_t);
#if defined(__amd64__) || defined(__i386__) || defined(__arm__)
void _kvm_minidump_freevtop(kvm_t *);
OpenPOWER on IntegriCloud