From owner-p4-projects@FreeBSD.ORG Mon Jun 16 15:24:15 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CF78A106566C; Mon, 16 Jun 2008 15:24:14 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FE62106564A for ; Mon, 16 Jun 2008 15:24:14 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4D83B8FC20 for ; Mon, 16 Jun 2008 15:24:14 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m5GFODZt041446 for ; Mon, 16 Jun 2008 15:24:13 GMT (envelope-from zec@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m5GFODZl041444 for perforce@freebsd.org; Mon, 16 Jun 2008 15:24:13 GMT (envelope-from zec@FreeBSD.org) Date: Mon, 16 Jun 2008 15:24:13 GMT Message-Id: <200806161524.m5GFODZl041444@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to zec@FreeBSD.org using -f From: Marko Zec To: Perforce Change Reviews Cc: Subject: PERFORCE change 143591 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Jun 2008 15:24:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=143591 Change 143591 by zec@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;