Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Feb 2001 13:25:03 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Matthew Jacob <mjacob@feral.com>
Cc:        alpha@FreeBSD.org, jake@FreeBSD.org
Subject:   RE: old fishwraps..
Message-ID:  <XFMail.010219132503.jhb@FreeBSD.org>
In-Reply-To: <Pine.LNX.4.21.0102191259410.19274-100000@zeppo.feral.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 19-Feb-01 Matthew Jacob wrote:
> (taking this to alpha where it belongs)
> 
>> 
>> On 19-Feb-01 Matthew Jacob wrote:
>> > 
>> > Welcome back john- this is all *very* old news.....
>> > 
>> > Right now we're more or less functional in the alpha-kernel front.. I
>> > still
>> > need to add the oncpu/lastcpu stuff to alpha- I've been waiting for a
>> > response
>> > from Jason Evans about making these integers (instead of chars) because
>> > that
>> > would make life on the alpha/genassym (or sparc, for that matter) a lot
>> > easier.
>> 
>> Making p_stat an integer is something we might need to do as well as right
>> now
>> proc assumes that a 32-bit wordsize in its alighnment.  And also, one thing
>> you
>> missed is that clear_resched()'ign in userret() as is currently the case is
>> wrong.  It needs to be in mi_switch() instead, but mroe on that later.
> 
> Oh- yes- sorry- I haven't checked my latest copy in because I've been
> cheesing
> it and jumping out of assembly to C-code to 'fix' this stuff- but it actually
> *is* being called from cpu_switch (see below for my current patches) but the
> hack currently is:

I mean sometihng like this:

Index: kern_synch.c
===================================================================
RCS file: /usr/cvs/src/sys/kern/kern_synch.c,v
retrieving revision 1.125
diff -u -r1.125 kern_synch.c
--- kern_synch.c        2001/02/09 06:09:50     1.125
+++ kern_synch.c        2001/02/12 21:55:06
@@ -969,6 +973,7 @@
        PCPU_SET(switchtime, new_switchtime);
        CTR4(KTR_PROC, "mi_switch: old proc %p (pid %d, %s), schedlock %p",
                p, p->p_pid, p->p_comm, (void *) sched_lock.mtx_lock);
+       clear_resched();
        cpu_switch();
        CTR4(KTR_PROC, "mi_switch: new proc %p (pid %d, %s), schedlock %p",
                p, p->p_pid, p->p_comm, (void *) sched_lock.mtx_lock);
(

Currently, p_oncpu and p_lastcpu are set in cpu_switch, but to be honest,
there's no reason to.  It would be quite fine to do something like this:

        curproc->p_lastcpu = curproc->p_oncpu;
        curproc->p_oncpu = -1;
        clear_resched();
        cpu_switch();
        curproc->p_oncpu = PCPU_GET(cpuid);

and just make it all MI and in mi_switch().  Some other stuff such as the
sched_lock dinking can also be done this way.  In fact, there are several
things in cpu_switch() that don't really belong there, IMO.  It should be for
MD stuff such as saving and restoring registers.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010219132503.jhb>