ia64/xen-unstable

changeset 1836:ac1a83f52439

bitkeeper revision 1.1108.2.8 (40fcf4c7Jq90GJBHcWC0vcq2_vRLqA)

More backend driver fixes and robustifying.
author kaf24@scramble.cl.cam.ac.uk
date Tue Jul 20 10:32:39 2004 +0000 (2004-07-20)
parents 15f6d38481b0
children fd7b2f01d894
files linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/main.c linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/main.c
line diff
     1.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/main.c	Tue Jul 20 10:14:24 2004 +0000
     1.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/blkif/backend/main.c	Tue Jul 20 10:32:39 2004 +0000
     1.3 @@ -93,7 +93,8 @@ static void fast_flush_area(int idx, int
     1.4      }
     1.5  
     1.6      mcl[nr_pages-1].args[2] = UVMF_FLUSH_TLB;
     1.7 -    (void)HYPERVISOR_multicall(mcl, nr_pages);
     1.8 +    if ( unlikely(HYPERVISOR_multicall(mcl, nr_pages) != 0) )
     1.9 +        BUG();
    1.10  }
    1.11  
    1.12  
    1.13 @@ -402,7 +403,8 @@ static void dispatch_rw_block_io(blkif_t
    1.14              phys_seg[i].buffer >> PAGE_SHIFT;
    1.15      }
    1.16  
    1.17 -    (void)HYPERVISOR_multicall(mcl, nr_psegs);
    1.18 +    if ( unlikely(HYPERVISOR_multicall(mcl, nr_psegs) != 0) )
    1.19 +        BUG();
    1.20  
    1.21      for ( i = 0; i < nr_psegs; i++ )
    1.22      {
     2.1 --- a/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/main.c	Tue Jul 20 10:14:24 2004 +0000
     2.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/drivers/netif/backend/main.c	Tue Jul 20 10:32:39 2004 +0000
     2.3 @@ -73,10 +73,7 @@ static void __refresh_mfn_list(void)
     2.4      int ret = HYPERVISOR_dom_mem_op(MEMOP_increase_reservation,
     2.5                                      mfn_list, MAX_MFN_ALLOC);
     2.6      if ( unlikely(ret != MAX_MFN_ALLOC) )
     2.7 -    {
     2.8 -        printk(KERN_ALERT "Unable to increase memory reservation (%d)\n", ret);
     2.9          BUG();
    2.10 -    }
    2.11      alloc_index = MAX_MFN_ALLOC;
    2.12  }
    2.13  
    2.14 @@ -97,8 +94,8 @@ static void dealloc_mfn(unsigned long mf
    2.15      spin_lock_irqsave(&mfn_lock, flags);
    2.16      if ( alloc_index != MAX_MFN_ALLOC )
    2.17          mfn_list[alloc_index++] = mfn;
    2.18 -    else
    2.19 -        (void)HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, &mfn, 1);
    2.20 +    else if ( HYPERVISOR_dom_mem_op(MEMOP_decrease_reservation, &mfn, 1) != 1 )
    2.21 +        BUG();
    2.22      spin_unlock_irqrestore(&mfn_lock, flags);
    2.23  }
    2.24  
    2.25 @@ -238,7 +235,8 @@ static void net_rx_action(unsigned long 
    2.26          return;
    2.27  
    2.28      mcl[-2].args[2] = UVMF_FLUSH_TLB;
    2.29 -    (void)HYPERVISOR_multicall(rx_mcl, mcl - rx_mcl);
    2.30 +    if ( unlikely(HYPERVISOR_multicall(rx_mcl, mcl - rx_mcl) != 0) )
    2.31 +        BUG();
    2.32  
    2.33      mcl = rx_mcl;
    2.34      mmu = rx_mmu;
    2.35 @@ -261,6 +259,10 @@ static void net_rx_action(unsigned long 
    2.36          netif->stats.rx_bytes += size;
    2.37          netif->stats.rx_packets++;
    2.38  
    2.39 +        /* The update_va_mapping() must not fail. */
    2.40 +        if ( unlikely(mcl[0].args[5] != 0) )
    2.41 +            BUG();
    2.42 +
    2.43          /* Check the reassignment error code. */
    2.44          status = NETIF_RSP_OKAY;
    2.45          if ( unlikely(mcl[1].args[5] != 0) )
    2.46 @@ -372,14 +374,15 @@ static void net_tx_action(unsigned long 
    2.47      NETIF_RING_IDX i;
    2.48      struct page *page;
    2.49      multicall_entry_t *mcl;
    2.50 +    PEND_RING_IDX dc, dp;
    2.51  
    2.52 -    if ( (i = dealloc_cons) == dealloc_prod )
    2.53 +    if ( (dc = dealloc_cons) == (dp = dealloc_prod) )
    2.54          goto skip_dealloc;
    2.55  
    2.56      mcl = tx_mcl;
    2.57 -    while ( i != dealloc_prod )
    2.58 +    while ( dc != dp )
    2.59      {
    2.60 -        pending_idx = dealloc_ring[MASK_PEND_IDX(i++)];
    2.61 +        pending_idx = dealloc_ring[MASK_PEND_IDX(dc++)];
    2.62          mcl[0].op = __HYPERVISOR_update_va_mapping;
    2.63          mcl[0].args[0] = MMAP_VADDR(pending_idx) >> PAGE_SHIFT;
    2.64          mcl[0].args[1] = 0;
    2.65 @@ -388,10 +391,16 @@ static void net_tx_action(unsigned long 
    2.66      }
    2.67  
    2.68      mcl[-1].args[2] = UVMF_FLUSH_TLB;
    2.69 -    (void)HYPERVISOR_multicall(tx_mcl, mcl - tx_mcl);
    2.70 +    if ( unlikely(HYPERVISOR_multicall(tx_mcl, mcl - tx_mcl) != 0) )
    2.71 +        BUG();
    2.72  
    2.73 -    while ( dealloc_cons != dealloc_prod )
    2.74 +    mcl = tx_mcl;
    2.75 +    while ( dealloc_cons != dp )
    2.76      {
    2.77 +        /* The update_va_mapping() must not fail. */
    2.78 +        if ( unlikely(mcl[0].args[5] != 0) )
    2.79 +            BUG();
    2.80 +
    2.81          pending_idx = dealloc_ring[MASK_PEND_IDX(dealloc_cons++)];
    2.82  
    2.83          netif = pending_tx_info[pending_idx].netif;
    2.84 @@ -413,6 +422,8 @@ static void net_tx_action(unsigned long 
    2.85              add_to_net_schedule_list_tail(netif);
    2.86          
    2.87          netif_put(netif);
    2.88 +
    2.89 +        mcl++;
    2.90      }
    2.91  
    2.92   skip_dealloc:
    2.93 @@ -521,7 +532,8 @@ static void net_tx_action(unsigned long 
    2.94      if ( mcl == tx_mcl )
    2.95          return;
    2.96  
    2.97 -    (void)HYPERVISOR_multicall(tx_mcl, mcl - tx_mcl);
    2.98 +    if ( unlikely(HYPERVISOR_multicall(tx_mcl, mcl - tx_mcl) != 0) )
    2.99 +        BUG();
   2.100  
   2.101      mcl = tx_mcl;
   2.102      while ( (skb = __skb_dequeue(&tx_queue)) != NULL )