summaryrefslogtreecommitdiffstats
path: root/sys/sys/pcpu.h
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-03-06 17:24:28 +0000
committermarcel <marcel@FreeBSD.org>2008-03-06 17:24:28 +0000
commit92b09d60694767029d174f11c0e834bdb224a417 (patch)
tree90dabde92ad3f392af17065bacf0e9fc3ae5955c /sys/sys/pcpu.h
parentd0e9f0f0d14fc27ca9c72eb21366ae4821ed756a (diff)
downloadFreeBSD-src-92b09d60694767029d174f11c0e834bdb224a417.zip
FreeBSD-src-92b09d60694767029d174f11c0e834bdb224a417.tar.gz
Move the PCPU_MD_FIELDS last in struct pcpu. While this header is
private to the kernel, some ports define _KERNEL and include this header. While arguably this is wrong, it's also reality. By having the MD fields last, architectures that have CPU-specific variations of PCPU_MD_FIELDS will at least have the MI fields at a constant offset. Of course, having all MI fields first helps kernel debugging as well, so this is not a change without some benefits to us. This change does not result in an ABI breakage, because this header is not part of the ABI. Recompilation of lsof is required though :-)
Diffstat (limited to 'sys/sys/pcpu.h')
-rw-r--r--sys/sys/pcpu.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index a129997..df73985 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -81,7 +81,6 @@ struct pcpu {
int pc_ktr_idx; /* Index into trace table */
char *pc_ktr_buf;
#endif
- PCPU_MD_FIELDS;
struct vmmeter pc_cnt; /* VM stats counters */
long pc_cp_time[CPUSTATES]; /* statclock ticks */
struct device *pc_device;
@@ -94,6 +93,17 @@ struct pcpu {
*/
struct rm_queue pc_rm_queue;
+ /*
+ * Keep MD fields last, so that CPU-specific variations on a
+ * single architecture don't result in offset variations of
+ * the machine-independent fields of the pcpu. Even though
+ * the pcpu structure is private to the kernel, some ports
+ * (e.g. lsof, part of gtop) define _KERNEL and include this
+ * header. While strictly speaking this is wrong, there's no
+ * reason not to keep the offsets of the MI fields contants.
+ * If only to make kernel debugging easier...
+ */
+ PCPU_MD_FIELDS;
};
SLIST_HEAD(cpuhead, pcpu);
OpenPOWER on IntegriCloud