Date: Mon, 23 Jul 2001 00:42:49 -0700 From: Julian Elischer <julian@elischer.org> To: current@freebsd.org Subject: Progress report: KSEs. Message-ID: <3B5BD579.400FE65E@elischer.org>
next in thread | raw e-mail | index | archive | help
Despite my silence on the topic recently I've been active. step 1: get proc structure broken up, with system still running: done (twice) step 2: push the 'thread' structure into the mutex structure and the sleep queue, and then propogate all the required changes all the way up the kernel. step 3: get all state saved in a per-thread rather than per-process storage. step 4: rewrite all parts of the kernel that assume 1 thread per process. step 5: compile and run first time :-) I'm part way through #2 at the moment. So far it's meant replacing all occurances of proc with thread (and associated logical changes in some places) in the vfs system. and device layers. I'm presently wading around in kern_switch.c :-) The aim of #2 is to get a GENERIC kernel that runs with all the new parts of the proc structure all doing their own jobs, and all the rest of the kernel using the correct parts for what they need, i.e. removing the compatibility macro's e.g. #define p_cpticks p_kse.ke_cpticks but not change the system logic that assumes that there is only one thread per process. (that's #4) the diffs are presently: -rw-r--r-- 1 julian wheel 333041 Jul 23 00:29 kse.diffs.july23 and growing.. I hope to get a running GENERIC kernel in a week or so. here are some snippets from the diffs for a sample of the changes: -------- Index: alpha/alpha/exception.s =================================================================== RCS file: /unused/cvs/freebsd/src/sys/alpha/alpha/exception.s,v retrieving revision 1.12 diff -u -r1.12 exception.s --- alpha/alpha/exception.s 2001/06/08 13:38:02 1.12 +++ alpha/alpha/exception.s 2001/07/20 07:12:37 @@ -139,7 +139,7 @@ beq t1, exception_return /* set the hae register if this process has specified a value */ - ldq s0, GD_CURPROC(globalp) + ldq s0, GD_CURTHREAD(globalp) ldq t1, P_MD_FLAGS(s0) and t1, MDP_HAEUSED beq t1, 3f @@ -255,7 +255,7 @@ br pv, Ler1 Ler1: LDGP(pv) - ldq s0, GD_CURPROC(globalp) /* save curproc in s0 */ + ldq s0, GD_CURTHREAD(globalp) /* save curthread in s0 */ #ifdef SMP ldl s1, P_MD_KERNNEST(s0) subl s1, 1, s1 /* decrement nesting level */ Index: dev/random/randomdev.c =================================================================== RCS file: /unused/cvs/freebsd/src/sys/dev/random/randomdev.c,v retrieving revision 1.28 diff -u -r1.28 randomdev.c --- dev/random/randomdev.c 2001/05/01 08:12:03 1.28 +++ dev/random/randomdev.c 2001/07/22 08:51:29 @@ -201,7 +201,7 @@ } static int -random_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p) +random_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { switch (cmd) { /* Really handled in upper layer */ @@ -214,7 +214,7 @@ } static int -random_poll(dev_t dev, int events, struct proc *p) +random_poll(dev_t dev, int events, struct thread *td) { int revents; @@ -223,7 +223,7 @@ if (random_systat.seeded) revents = events & (POLLIN | POLLRDNORM); else - selrecord(p, &random_systat.rsel); + selrecord(curthread, &random_systat.rsel); } return revents; } Index: fs/msdosfs/denode.h =================================================================== RCS file: /unused/cvs/freebsd/src/sys/fs/msdosfs/denode.h,v retrieving revision 1.21 diff -u -r1.21 denode.h --- fs/msdosfs/denode.h 2000/10/22 14:22:17 1.21 +++ fs/msdosfs/denode.h 2001/07/22 09:23:33 @@ -280,6 +280,6 @@ int createde __P((struct denode *dep, struct denode *ddep, struct denode **depp , struct componentname *cnp)); int deupdat __P((struct denode *dep, int waitfor)); int removede __P((struct denode *pdep, struct denode *dep)); -int detrunc __P((struct denode *dep, u_long length, int flags, struct ucred *cr ed, struct proc *p)); +int detrunc __P((struct denode *dep, u_long length, int flags, struct ucred *cr ed, struct thread *td)); int doscheckpath __P(( struct denode *source, struct denode *target)); #endif /* _KERNEL */ Index: fs/procfs/procfs_ctl.c =================================================================== RCS file: /unused/cvs/freebsd/src/sys/fs/procfs/procfs_ctl.c,v retrieving revision 1.30 diff -u -r1.30 procfs_ctl.c --- fs/procfs/procfs_ctl.c 2001/07/05 17:10:42 1.30 +++ fs/procfs/procfs_ctl.c 2001/07/22 09:46:21 @@ -300,7 +300,7 @@ mtx_lock_spin(&sched_lock); if (p->p_stat == SSTOP) - setrunnable(p); + setrunnable(&p->p_thread); /* XXXKSE */ mtx_unlock_spin(&sched_lock); return (0); } @@ -349,7 +349,7 @@ #ifdef FIX_SSTEP FIX_SSTEP(p); #endif - setrunnable(p); + setrunnable(&p->p_thread); /* XXXKSE */ mtx_unlock_spin(&sched_lock); } else { mtx_unlock_spin(&sched_lock); ----- Above you'll see the note /* XXXKSE */ this is a note to myself that I'm doing something to get things going that relies in the assumption of a 1:1 relationship between proc<->thread. All this sort of thing needs to be removed before #4 can be done. -- +------------------------------------+ ______ _ __ | __--_|\ Julian Elischer | \ U \/ / hard at work in | / \ julian@elischer.org +------>x USA \ a very strange | ( OZ ) \___ ___ | country ! +- X_.---._/ presently in San Francisco \_/ \\ v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B5BD579.400FE65E>