ia64/xen-unstable

changeset 7118:1643f6110469

Fixes for blkif save/restore. A 'dd if=/dev/sda1 of=/dev/null'
seems to lock up the domU kernel on restore still (can be
pinged but not ssh'ed). This still needs investigation.

Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Sep 28 17:25:08 2005 +0100 (2005-09-28)
parents 9e0b6fbab872
children 1a82995a017c
files linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c linux-2.6-xen-sparse/drivers/xen/netback/common.h linux-2.6-xen-sparse/drivers/xen/netback/netback.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Sep 28 17:02:17 2005 +0100
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Wed Sep 28 17:25:08 2005 +0100
     1.3 @@ -57,11 +57,8 @@ static unsigned int blkif_state = BLKIF_
     1.4  
     1.5  #define MAXIMUM_OUTSTANDING_BLOCK_REQS \
     1.6      (BLKIF_MAX_SEGMENTS_PER_REQUEST * BLKIF_RING_SIZE)
     1.7 -#define GRANTREF_INVALID (1<<15)
     1.8  #define GRANT_INVALID_REF	(0xFFFF)
     1.9  
    1.10 -static int recovery = 0; /* Recovery in progress: protected by blkif_io_lock */
    1.11 -
    1.12  static void kick_pending_request_queues(struct blkfront_info *info);
    1.13  
    1.14  static void blkif_completion(struct blk_shadow *s);
    1.15 @@ -84,18 +81,6 @@ static inline void ADD_ID_TO_FREELIST(
    1.16  	info->shadow_free = id;
    1.17  }
    1.18  
    1.19 -static inline void pickle_request(struct blk_shadow *s, blkif_request_t *r)
    1.20 -{
    1.21 -
    1.22 -	s->req = *r;
    1.23 -}
    1.24 -
    1.25 -static inline void unpickle_request(blkif_request_t *r, struct blk_shadow *s)
    1.26 -{
    1.27 -
    1.28 -	*r = s->req;
    1.29 -}
    1.30 -
    1.31  static inline void flush_requests(struct blkfront_info *info)
    1.32  {
    1.33  	RING_PUSH_REQUESTS(&info->ring);
    1.34 @@ -235,7 +220,7 @@ static int blkif_queue_request(struct re
    1.35  				rq_data_dir(req) );
    1.36  
    1.37  			info->shadow[id].frame[ring_req->nr_segments] =
    1.38 -				buffer_mfn;
    1.39 +				mfn_to_pfn(buffer_mfn);
    1.40  
    1.41  			ring_req->frame_and_sects[ring_req->nr_segments] =
    1.42  				blkif_fas_from_gref(ref, fsect, lsect);
    1.43 @@ -247,7 +232,7 @@ static int blkif_queue_request(struct re
    1.44  	info->ring.req_prod_pvt++;
    1.45  
    1.46  	/* Keep a private copy so we can reissue requests when recovering. */
    1.47 -	pickle_request(&info->shadow[id], ring_req);
    1.48 +	info->shadow[id].req = *ring_req;
    1.49  
    1.50  	gnttab_free_grant_references(gref_head);
    1.51  
    1.52 @@ -312,7 +297,7 @@ static irqreturn_t blkif_int(int irq, vo
    1.53  
    1.54  	spin_lock_irqsave(&blkif_io_lock, flags);
    1.55  
    1.56 -	if (unlikely(info->connected != BLKIF_STATE_CONNECTED || recovery)) {
    1.57 +	if (unlikely(info->connected != BLKIF_STATE_CONNECTED)) {
    1.58  		spin_unlock_irqrestore(&blkif_io_lock, flags);
    1.59  		return IRQ_HANDLED;
    1.60  	}
    1.61 @@ -401,28 +386,24 @@ static void blkif_recover(struct blkfron
    1.62  		if (copy[i].request == 0)
    1.63  			continue;
    1.64  
    1.65 -		/* Grab a request slot and unpickle shadow state into it. */
    1.66 +		/* Grab a request slot and copy shadow state into it. */
    1.67  		req = RING_GET_REQUEST(
    1.68  			&info->ring, info->ring.req_prod_pvt);
    1.69 -		unpickle_request(req, &copy[i]);
    1.70 +		*req = copy[i].req;
    1.71  
    1.72  		/* We get a new request id, and must reset the shadow state. */
    1.73  		req->id = GET_ID_FROM_FREELIST(info);
    1.74  		memcpy(&info->shadow[req->id], &copy[i], sizeof(copy[i]));
    1.75  
    1.76  		/* Rewrite any grant references invalidated by susp/resume. */
    1.77 -		for (j = 0; j < req->nr_segments; j++) {
    1.78 -			if ( req->frame_and_sects[j] & GRANTREF_INVALID )
    1.79 -				gnttab_grant_foreign_access_ref(
    1.80 -					blkif_gref_from_fas(
    1.81 -						req->frame_and_sects[j]),
    1.82 -					info->backend_id,
    1.83 -					info->shadow[req->id].frame[j],
    1.84 -					rq_data_dir(
    1.85 -						(struct request *)
    1.86 -						info->shadow[req->id].request));
    1.87 -			req->frame_and_sects[j] &= ~GRANTREF_INVALID;
    1.88 -		}
    1.89 +		for (j = 0; j < req->nr_segments; j++)
    1.90 +			gnttab_grant_foreign_access_ref(
    1.91 +				blkif_gref_from_fas(req->frame_and_sects[j]),
    1.92 +				info->backend_id,
    1.93 +				pfn_to_mfn(info->shadow[req->id].frame[j]),
    1.94 +				rq_data_dir(
    1.95 +					(struct request *)
    1.96 +					info->shadow[req->id].request));
    1.97  		info->shadow[req->id].req = *req;
    1.98  
    1.99  		info->ring.req_prod_pvt++;
   1.100 @@ -430,15 +411,13 @@ static void blkif_recover(struct blkfron
   1.101  
   1.102  	kfree(copy);
   1.103  
   1.104 -	recovery = 0;
   1.105 -
   1.106  	/* info->ring->req_prod will be set when we flush_requests().*/
   1.107  	wmb();
   1.108  
   1.109  	/* Kicks things back into life. */
   1.110  	flush_requests(info);
   1.111  
   1.112 -	/* Now safe to left other people use the interface. */
   1.113 +	/* Now safe to let other people use the interface. */
   1.114  	info->connected = BLKIF_STATE_CONNECTED;
   1.115  }
   1.116  
   1.117 @@ -701,7 +680,6 @@ static int blkfront_suspend(struct xenbu
   1.118  	kfree(info->backend);
   1.119  	info->backend = NULL;
   1.120  
   1.121 -	recovery = 1;
   1.122  	blkif_free(info);
   1.123  
   1.124  	return 0;
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Wed Sep 28 17:02:17 2005 +0100
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/common.h	Wed Sep 28 17:25:08 2005 +0100
     2.3 @@ -22,8 +22,6 @@
     2.4  #include <asm-xen/gnttab.h>
     2.5  #include <asm-xen/driver_util.h>
     2.6  
     2.7 -#define GRANT_INVALID_REF (0xFFFF)
     2.8 -
     2.9  #if 0
    2.10  #define ASSERT(_p) \
    2.11      if ( !(_p) ) { printk("Assertion '%s' failed, line %d, file %s", #_p , \
     3.1 --- a/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Wed Sep 28 17:02:17 2005 +0100
     3.2 +++ b/linux-2.6-xen-sparse/drivers/xen/netback/netback.c	Wed Sep 28 17:25:08 2005 +0100
     3.3 @@ -434,7 +434,6 @@ inline static void net_tx_action_dealloc
     3.4  		gop->host_addr    = MMAP_VADDR(pending_idx);
     3.5  		gop->dev_bus_addr = 0;
     3.6  		gop->handle       = grant_tx_ref[pending_idx];
     3.7 -		grant_tx_ref[pending_idx] = GRANT_INVALID_REF;
     3.8  		gop++;
     3.9  	}
    3.10  	BUG_ON(HYPERVISOR_grant_table_op(