Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 25 Oct 2001 03:59:43 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Luigi Rizzo <rizzo@aciri.org>
Cc:        current@freebsd.org
Subject:   RE: where is the idle_loop in current ?
Message-ID:  <XFMail.011025035943.jhb@FreeBSD.org>
In-Reply-To: <20011025113139.A56942@iguana.aciri.org>

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

On 25-Oct-01 Luigi Rizzo wrote:
> I have some code (in stable) which is invoked from the idle
> loop, see below. I was trying to port it to CURRENT, but
> cannot find where the idle_loop (or idlethread ?) has gone.
> Any pointers ? A grep for idlethread did not return
> anything that i could parse.
> 
> Furthermore, what kind of locking should i use instead of
> splimp() (the procedures called by ether_input() are a
> stripped down, bounded-execution-time version of the
> interrupt service routines for ethernet adapters).

kern_idle.c.  However, it cannot use any blocking locks if you invoke it from
idle_loop().  You could also consider using a low priority kernel thread which
is what the vm zeroing code does.  So far the network stack is not locked, so
leave the splimp's in as place holders and ensure your kthread acquires Giant
around ether_poll().

>       thanks
>       luigi
> 
> --- i386/i386/swtch.s   2001/07/26 02:29:10     1.89.2.4
> +++ i386/i386/swtch.s   2001/10/23 04:00:27
> @@ -246,6 +246,15 @@
>         call    _procrunnable
>         testl   %eax,%eax
>         CROSSJUMP(jnz, sw1a, jz)
> +#ifdef XORP_ETHER_POLLING  
> +       incl    idle_done
> +       call    ether_poll
> +       sti
> +       nop
> +       cli
> +       testl   %eax, %eax
> +       jnz     idle_loop
> +#endif
>         call    _vm_page_zero_idle
>         testl   %eax, %eax
>         jnz     idle_loop
> 
> 
> --- i386/isa/intr_machdep.c     2001/08/24 17:39:12     1.29.2.3
> +++ i386/isa/intr_machdep.c     2001/10/24 02:03:55
> 
> int
> +ether_poll(void)
> +{
> +    static int i;
> +
> +    int s = splimp();
> +    if (i >= pr_next)
> +       i = 0 ;
> +    if (pr[i].handler)
> +       (*pr[i].handler)(pr[i].argument, 2);
> +    i++ ;
> +    splx(s);
> +    return 1; /* more polling */
> +}
>       
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message

-- 

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-current" in the body of the message




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