ia64/xen-unstable

changeset 2592:654b2df93458

bitkeeper revision 1.1159.99.2 (41614eedRuLOjlI5-39Ib0z3OZYFgA)

g/c kthread code.
author cl349@freefall.cl.cam.ac.uk
date Mon Oct 04 13:23:57 2004 +0000 (2004-10-04)
parents aa75f00efa54
children a28d3cf3832c
files netbsd-2.0-xen-sparse/sys/arch/xen/include/ctrl_if.h netbsd-2.0-xen-sparse/sys/arch/xen/xen/ctrl_if.c netbsd-2.0-xen-sparse/sys/arch/xen/xen/xencons.c
line diff
     1.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/include/ctrl_if.h	Mon Oct 04 13:15:55 2004 +0000
     1.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/include/ctrl_if.h	Mon Oct 04 13:23:57 2004 +0000
     1.3 @@ -117,6 +117,7 @@ void ctrl_if_suspend(void);
     1.4  void ctrl_if_resume(void);
     1.5  
     1.6  /* Start-of-day setup. */
     1.7 +void ctrl_if_early_init(void);
     1.8  void ctrl_if_init(void);
     1.9  
    1.10  /*
     2.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/xen/ctrl_if.c	Mon Oct 04 13:15:55 2004 +0000
     2.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/xen/ctrl_if.c	Mon Oct 04 13:23:57 2004 +0000
     2.3 @@ -13,7 +13,6 @@
     2.4  #include <sys/systm.h>
     2.5  #include <sys/proc.h>
     2.6  #include <sys/malloc.h>
     2.7 -#include <sys/kthread.h>
     2.8  
     2.9  #include <machine/xen.h>
    2.10  #include <machine/hypervisor.h>
    2.11 @@ -77,8 +76,6 @@ static void __ctrl_if_tx_tasklet(unsigne
    2.12  
    2.13  static void __ctrl_if_rx_tasklet(unsigned long data);
    2.14  
    2.15 -static void ctrl_if_kthread(void *);
    2.16 -
    2.17  #define get_ctrl_if() ((control_if_t *)((char *)HYPERVISOR_shared_info + 2048))
    2.18  #define TX_FULL(_c)   \
    2.19      (((_c)->tx_req_prod - ctrl_if_tx_resp_cons) == CONTROL_RING_SIZE)
    2.20 @@ -194,34 +191,22 @@ static void __ctrl_if_rx_tasklet(unsigne
    2.21      {
    2.22          __insn_barrier();
    2.23          ctrl_if_rxmsg_deferred_prod = dp;
    2.24 -#if 0
    2.25 -        wakeup(&ctrl_if_kthread);
    2.26 -#else
    2.27  	if (ctrl_if_softintr)
    2.28  		softintr_schedule(ctrl_if_softintr);
    2.29 -#endif
    2.30      }
    2.31  }
    2.32  
    2.33  static int ctrl_if_interrupt(void *arg)
    2.34  {
    2.35 -    control_if_t *ctrl_if = get_ctrl_if();
    2.36 +	control_if_t *ctrl_if = get_ctrl_if();
    2.37 +
    2.38 +	if ( ctrl_if_tx_resp_cons != ctrl_if->tx_resp_prod )
    2.39 +		__ctrl_if_tx_tasklet(0);
    2.40  
    2.41 -    if ( ctrl_if_tx_resp_cons != ctrl_if->tx_resp_prod ||
    2.42 -	ctrl_if_rx_req_cons != ctrl_if->rx_req_prod ) {
    2.43 -#if 0
    2.44 -#if 0
    2.45 -	    wakeup(&ctrl_if_kthread);
    2.46 -#else
    2.47 -	    if (ctrl_if_softintr)
    2.48 -		    softintr_schedule(ctrl_if_softintr);
    2.49 -#endif
    2.50 -#else
    2.51 -	    ctrl_if_kthread((void *)1);
    2.52 -#endif
    2.53 -    }
    2.54 +	if ( ctrl_if_rx_req_cons != ctrl_if->rx_req_prod )
    2.55 +		__ctrl_if_rx_tasklet(0);
    2.56  
    2.57 -    return 0;
    2.58 +	return 0;
    2.59  }
    2.60  
    2.61  int
    2.62 @@ -289,6 +274,7 @@ ctrl_if_send_message_block(
    2.63  	while ((rc = ctrl_if_send_message_noblock(msg, hnd, id)) == EAGAIN) {
    2.64  		/* XXXcl possible race -> add a lock and ltsleep */
    2.65  #if 1
    2.66 +		HYPERVISOR_yield();
    2.67  #else
    2.68  		rc = tsleep((caddr_t) &ctrl_if_tx_wait, PUSER | PCATCH,
    2.69  		    "ctrl_if", 0);
    2.70 @@ -459,50 +445,16 @@ ctrl_if_unregister_receiver(
    2.71      restore_flags(flags);
    2.72  
    2.73      /* Ensure that @hnd will not be executed after this function returns. */
    2.74 -#if 0
    2.75 -    wakeup(&ctrl_if_kthread);
    2.76 -#else
    2.77      if (ctrl_if_softintr)
    2.78  	    softintr_schedule(ctrl_if_softintr);
    2.79 -#endif
    2.80 -}
    2.81 -
    2.82 -static void
    2.83 -ctrl_if_kthread(void *arg)
    2.84 -{
    2.85 -	control_if_t *ctrl_if = get_ctrl_if();
    2.86 -
    2.87 -	for (;;) {
    2.88 -		if ( ctrl_if_tx_resp_cons != ctrl_if->tx_resp_prod )
    2.89 -			__ctrl_if_tx_tasklet(0);
    2.90 -
    2.91 -		if ( ctrl_if_rx_req_cons != ctrl_if->rx_req_prod )
    2.92 -			__ctrl_if_rx_tasklet(0);
    2.93 -
    2.94 -		if (arg) {
    2.95 -			// printf("ctrl_if_kthread one-shot done\n");
    2.96 -			return;
    2.97 -		}
    2.98 -
    2.99 -		tsleep((caddr_t)&ctrl_if_kthread, PUSER | PCATCH,
   2.100 -		    "ctrl_if", 0);
   2.101 -	}
   2.102  }
   2.103  
   2.104  static void
   2.105  ctrl_if_softintr_handler(void *arg)
   2.106  {
   2.107 -	static int in_handler = 0;
   2.108 -
   2.109 -	if (in_handler++ != 0) {
   2.110 -		ctrl_if_evtchn = -1;
   2.111 -		panic("recurse");
   2.112 -	}
   2.113  
   2.114  	if ( ctrl_if_rxmsg_deferred_cons != ctrl_if_rxmsg_deferred_prod )
   2.115  		__ctrl_if_rxmsg_deferred(NULL);
   2.116 -
   2.117 -	in_handler--;
   2.118  }
   2.119  
   2.120  #ifdef notyet
   2.121 @@ -545,7 +497,6 @@ void ctrl_if_resume(void)
   2.122      hypervisor_enable_irq(ctrl_if_irq);
   2.123  }
   2.124  
   2.125 -void ctrl_if_early_init(void);
   2.126  void ctrl_if_early_init(void)
   2.127  {
   2.128  
     3.1 --- a/netbsd-2.0-xen-sparse/sys/arch/xen/xen/xencons.c	Mon Oct 04 13:15:55 2004 +0000
     3.2 +++ b/netbsd-2.0-xen-sparse/sys/arch/xen/xen/xencons.c	Mon Oct 04 13:23:57 2004 +0000
     3.3 @@ -348,7 +348,6 @@ xencons_rx(ctrl_msg_t *msg, unsigned lon
     3.4  	ctrl_if_send_response(msg);
     3.5  }
     3.6  
     3.7 -void ctrl_if_early_init(void);
     3.8  void
     3.9  xenconscn_attach()
    3.10  {