ia64/xen-unstable

changeset 779:30c521db4c71 latest-stable split-1.0

bitkeeper revision 1.475 (3f796d3bblNbmAFIYOUxNwNgsLILNg)

network.c, dev.c, keyhandler.c:
Stronger SMP memory barriers in the newtork code.
author kaf24@scramble.cl.cam.ac.uk
date Tue Sep 30 11:47:07 2003 +0000 (2003-09-30)
parents 5e39ada9640f
children 7e78d76f7ba6 14481f959026
files xen/common/keyhandler.c xen/net/dev.c xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c
line diff
     1.1 --- a/xen/common/keyhandler.c	Tue Sep 30 11:40:44 2003 +0000
     1.2 +++ b/xen/common/keyhandler.c	Tue Sep 30 11:47:07 2003 +0000
     1.3 @@ -89,12 +89,15 @@ static char *task_states[] =
     1.4  
     1.5  void do_task_queues(u_char key, void *dev_id, struct pt_regs *regs) 
     1.6  {
     1.7 -    u_long flags; 
     1.8 +    unsigned long       flags; 
     1.9      struct task_struct *p; 
    1.10 -    shared_info_t *s; 
    1.11 +    shared_info_t      *s; 
    1.12 +    net_vif_t          *v;
    1.13  
    1.14      printk("'%c' pressed -> dumping task queues\n", key); 
    1.15 +
    1.16      read_lock_irqsave(&tasklist_lock, flags); 
    1.17 +
    1.18      p = &idle0_task;
    1.19      do {
    1.20          printk("Xen: DOM %d, CPU %d [has=%c], state = %s, "
    1.21 @@ -102,17 +105,21 @@ void do_task_queues(u_char key, void *de
    1.22  	       p->domain, p->processor, p->has_cpu ? 'T':'F', 
    1.23  	       task_states[p->state], p->hyp_events); 
    1.24  	s = p->shared_info; 
    1.25 -	if(!is_idle_task(p)) {
    1.26 -	  net_vif_t *v = find_vif_by_id((p->domain)<<VIF_DOMAIN_SHIFT);
    1.27 +	if( !is_idle_task(p) )
    1.28 +        {
    1.29 +            net_vif_t *v = find_vif_by_id((p->domain)<<VIF_DOMAIN_SHIFT);
    1.30  	    printk("Guest: events = %08lx, events_mask = %08lx\n", 
    1.31  		   s->events, s->events_mask); 
    1.32  	  
    1.33 -	    if (v) {	      
    1.34 -	      printk("rx_prod=%d ,rx_cons=%d, tx_prod=%d, tx_cons=%d\n",
    1.35 -		   v->rx_prod,v->rx_cons,v->tx_prod,v->tx_cons );
    1.36 -	      printk("rx_req_cons=%d, rx_resp_prod=%d, tx_req_cons=%d, tx_resp_prod=%d\n", 
    1.37 -		   v->rx_req_cons,v->rx_resp_prod,v->tx_req_cons,v->tx_resp_prod);
    1.38 -	      put_vif(v);
    1.39 +	    if ( v != NULL )
    1.40 +            {
    1.41 +                printk("rx_prod=%d ,rx_cons=%d, tx_prod=%d, tx_cons=%d\n",
    1.42 +                       v->rx_prod, v->rx_cons, v->tx_prod, v->tx_cons );
    1.43 +                printk("rx_req_cons=%d, rx_resp_prod=%d, "
    1.44 +                       "tx_req_cons=%d, tx_resp_prod=%d\n", 
    1.45 +                       v->rx_req_cons, v->rx_resp_prod, 
    1.46 +                       v->tx_req_cons, v->tx_resp_prod);
    1.47 +                put_vif(v);
    1.48  	    }
    1.49  	    printk("Notifying guest...\n"); 
    1.50  	    set_bit(_EVENT_DEBUG, &s->events); 
     2.1 --- a/xen/net/dev.c	Tue Sep 30 11:40:44 2003 +0000
     2.2 +++ b/xen/net/dev.c	Tue Sep 30 11:47:07 2003 +0000
     2.3 @@ -2111,6 +2111,7 @@ static void __make_tx_response(net_vif_t
     2.4      resp->status = st;
     2.5      pos = TX_RING_INC(pos);
     2.6      vif->tx_resp_prod = vif->shared_idxs->tx_resp_prod = pos;
     2.7 +    smp_mb(); /* Update producer before checking event threshold. */
     2.8      if ( pos == vif->shared_idxs->tx_event )
     2.9      {
    2.10          unsigned long cpu_mask = mark_guest_event(vif->domain, _EVENT_NET);
    2.11 @@ -2139,6 +2140,7 @@ static void make_rx_response(net_vif_t  
    2.12      resp->offset = off;
    2.13      pos = RX_RING_INC(pos);
    2.14      vif->rx_resp_prod = vif->shared_idxs->rx_resp_prod = pos;
    2.15 +    smp_mb(); /* Update producer before checking event threshold. */
    2.16      if ( pos == vif->shared_idxs->rx_event )
    2.17      {
    2.18          unsigned long cpu_mask = mark_guest_event(vif->domain, _EVENT_NET);
     3.1 --- a/xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c	Tue Sep 30 11:40:44 2003 +0000
     3.2 +++ b/xenolinux-2.4.22-sparse/arch/xeno/drivers/network/network.c	Tue Sep 30 11:47:07 2003 +0000
     3.3 @@ -189,7 +189,7 @@ static void network_tx_buf_gc(struct net
     3.4          /* Set a new event, then check for race with update of tx_cons. */
     3.5          np->net_idx->tx_event =
     3.6              TX_RING_ADD(prod, (atomic_read(&np->tx_entries)>>1) + 1);
     3.7 -        smp_mb();
     3.8 +        mb();
     3.9      }
    3.10      while ( prod != np->net_idx->tx_resp_prod );
    3.11  
    3.12 @@ -320,7 +320,7 @@ static int network_start_xmit(struct sk_
    3.13      np->stats.tx_packets++;
    3.14  
    3.15      /* Only notify Xen if there are no outstanding responses. */
    3.16 -    smp_mb();
    3.17 +    mb();
    3.18      if ( np->net_idx->tx_resp_prod == i )
    3.19          HYPERVISOR_net_update();
    3.20  
    3.21 @@ -394,7 +394,7 @@ static void network_interrupt(int irq, v
    3.22      network_alloc_rx_buffers(dev);
    3.23      
    3.24      /* Deal with hypervisor racing our resetting of rx_event. */
    3.25 -    smp_mb();
    3.26 +    mb();
    3.27      if ( np->net_idx->rx_resp_prod != i ) goto again;
    3.28  }
    3.29