aboutsummaryrefslogtreecommitdiff
path: root/lib/libkvm/kvm_private.h
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2010-03-01 00:27:55 +0000
committerRobert Watson <rwatson@FreeBSD.org>2010-03-01 00:27:55 +0000
commitccd8bad0bb6c4363a788fd40346b4e6838f4cb7f (patch)
tree04416be9d793aa3a6797065cfdbdfbee0a289fde /lib/libkvm/kvm_private.h
parent15f8d4975676d724c229bdd4121ea06e27cc1674 (diff)
downloadsrc-ccd8bad0bb6c4363a788fd40346b4e6838f4cb7f.tar.gz
src-ccd8bad0bb6c4363a788fd40346b4e6838f4cb7f.zip
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.
Notes
Notes: svn path=/head/; revision=204494
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 cc073db5fe42..69b1658f8e48 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 *);