PERFORCE change 143591 for review
Marko Zec
zec at FreeBSD.org
Mon Jun 16 15:24:15 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=143591
Change 143591 by zec at zec_tca51 on 2008/06/16 15:23:32
Redefine the "basevnet" macro to pull the context from
thread0.td_ucred->cr_vimage->v_net, not from thread0.td_vnet.
The purpose of ((struct thread *) td)->td_vnet field is to hold
temporary vnet affinity of the _current_ thread; it should be
set / restored only using the CURVNET_SET() / CURVNET_RESTORE()
macros, and read _only_ via the curvnet macro. Reading
td->td_vnet of an arbitrary thread can never yield useful
results: if the thread is not executing networking code
this field will be NULL, and even if it's not NULL, the value
of td_vnet is meaningless to an external thread.
Introduce "basevprocg" and "basevcpu" macros in addition to
basevnet, and modify the G_hostname macro to resolve V_hostname
inside a vprocg, not inside a vnet.
While here, comment out macro definitions for a few virtualized
CPU accounting and scheduling globals, which are entirely
independent of network stack virtualization work, and which
will require more work for proper virtualization.
Affected files ...
.. //depot/projects/vimage/src/sys/sys/vimage.h#54 edit
Differences ...
==== //depot/projects/vimage/src/sys/sys/vimage.h#54 (text+ko) ====
@@ -51,7 +51,10 @@
struct ifnet; /* XXX must go away */
#define curvnet curthread->td_vnet
-#define basevnet thread0.td_vnet
+
+#define basevnet thread0.td_ucred->cr_vimage->v_vnet
+#define basevprocg thread0.td_ucred->cr_vimage->v_procg
+#define basevcpu thread0.td_ucred->cr_vimage->v_cpu
typedef int vnet_attach_fn(const void *);
typedef int vnet_detach_fn(const void *);
@@ -321,13 +324,16 @@
#define VCPU(sym) VSYM(vcpu, sym)
#define V_hostname VPROCG(hostname)
-#define G_hostname VSYM(basevnet, hostname) /* global hostname */
+#define G_hostname VSYM(basevprocg, hostname) /* global hostname */
#define V_domainname VPROCG(domainname)
#define V_morphing_symlinks VPROCG(morphing_symlinks)
+
+#ifdef NOTYET
#define V_cp_time VPROCG(cp_time)
#define V_averunnable VPROCG(averunnable)
#define V_sched_tdcnt VPROCG(sched_tdcnt)
#define V_tdq_sysload VPROCG(tdq_sysload)
+#endif
#define V_acc_statcalls VCPU(acc_statcalls)
#define V_avg1_fixp VCPU(avg1_fixp)
@@ -405,18 +411,18 @@
u_int nprocs;
- long _cp_time[CPUSTATES];
-
char _hostname[MAXHOSTNAMELEN];
char _domainname[MAXHOSTNAMELEN];
int _morphing_symlinks;
+#if 0
+ long _cp_time[CPUSTATES];
+
struct loadavg _averunnable; /* from kern/kern_synch.c */
int _sched_tdcnt; /* from kern/sched_4bsd.c */
int _tdq_sysload[32]; /* XXX MAXCPUS from kern/sched_ule.c (SMP) */
-#if 0
u_int proc_limit; /* max. number of processes */
struct msgbuf *msgbufp;
More information about the p4-projects
mailing list