ia64/xen-unstable

changeset 2863:0e11a91b4002

bitkeeper revision 1.1159.155.5 (41893d4fp16EKfDd_T4dIvRy13B8Qg)

update document
author ach61@labyrinth.cl.cam.ac.uk
date Wed Nov 03 20:19:27 2004 +0000 (2004-11-03)
parents 2aafe0f9a4dc
children 17ab1e2fc826 8a60d9e79b3c 322541dd9041
files docs/misc/blkif-drivers-explained.txt
line diff
     1.1 --- a/docs/misc/blkif-drivers-explained.txt	Wed Nov 03 19:42:57 2004 +0000
     1.2 +++ b/docs/misc/blkif-drivers-explained.txt	Wed Nov 03 20:19:27 2004 +0000
     1.3 @@ -50,7 +50,7 @@ solution.
     1.4  The structure is like this:
     1.5  
     1.6     +--------------------------+  +--------------------------+
     1.7 -   | Domain 0 (privileged)    |  | Domain 1 (unprivileged) |
     1.8 +   | Domain 0 (privileged)    |  | Domain 1 (unprivileged)  |
     1.9     |                          |  |                          |
    1.10     | Xend ( Application )     |  |                          |
    1.11     | Blkif Backend Driver     |  | Blkif Frontend Driver    |
    1.12 @@ -107,7 +107,7 @@ front and backend domains over the contr
    1.13  passed to a domain is just an integer "port" uniquely identifying the
    1.14  event channel's local connection to that domain.  An example of this
    1.15  setup code is in linux-2.6.x/drivers/xen/blkfront/blkfront.c in
    1.16 -blkif_status_change, which receives several status change events as
    1.17 +blkif_connect(), which receives several status change events as
    1.18  the driver starts up.  It is passed an event channel end in a
    1.19  BLKIF_INTERFACE_STATUS_CONNECTED message, and patches it in like this:
    1.20  
    1.21 @@ -136,7 +136,7 @@ static inline void flush_requests(void)
    1.22  }
    1.23  }}}
    1.24  
    1.25 -notify_via_evtchn issues a hypercall to set the event waiting flag on
    1.26 +notify_via_evtchn() issues a hypercall to set the event waiting flag on
    1.27  the other domain's end of the channel.
    1.28  
    1.29  ===== Communication Rings =====
    1.30 @@ -151,9 +151,13 @@ used, they are however worth discussing 
    1.31  places in the current code and are a useful model for communicating
    1.32  across a shared page.
    1.33  
    1.34 -A shared page is set up by a guest first allocating and passing the
    1.35 -address of a page in its own address space to the backend driver.  
    1.36 +A shared page is set up by a front end guest first allocating and passing 
    1.37 +the address of a page in its own address space to the backend driver.  
    1.38  
    1.39 +Consider the following code, also from blkfront.c.  Note:  this code
    1.40 +is in blkif_disconnect().  The driver transitions from STATE_CLOSED
    1.41 +to STATE_DISCONNECTED before becoming CONNECTED.  The state automata
    1.42 +is in blkif_status().
    1.43  
    1.44     blk_ring = (blkif_ring_t *)__get_free_page(GFP_KERNEL);
    1.45     blk_ring->req_prod = blk_ring->resp_prod = resp_cons = req_prod = 0;
    1.46 @@ -222,20 +226,20 @@ is described by four pointers into a cir
    1.47  records.  Pointers may only advance, and may not pass one another.
    1.48  
    1.49  
    1.50 -                          rsp_cons----+
    1.51 +                         resp_cons----+
    1.52                                        V
    1.53             +----+----+----+----+----+----+----+
    1.54 -           |    |    |    free      |RSP1|RSP2|
    1.55 +           |    |    |  free(A)     |RSP1|RSP2|
    1.56             +----+----+----+----+----+----+----+
    1.57   req_prod->|    |       -------->        |RSP3|
    1.58             +----+                        +----+
    1.59 -           |REQ8|                        |    |<-rsp_prod
    1.60 +           |REQ8|                        |    |<-resp_prod
    1.61             +----+                        +----+
    1.62             |REQ7|                        |    |
    1.63             +----+                        +----+
    1.64             |REQ6|       <--------        |    |
    1.65             +----+----+----+----+----+----+----+
    1.66 -           |REQ5|REQ4|    free      |    |    |
    1.67 +           |REQ5|REQ4|    free(B)   |    |    |
    1.68             +----+----+----+----+----+----+----+
    1.69    req_cons---------^
    1.70  
    1.71 @@ -299,6 +303,10 @@ 4. A domain should only ever write to th
    1.72     exclusive access to the messages between its consumer and producer,
    1.73     and should absolutely not read or write outside this region.
    1.74  
    1.75 +   Thus the front end has exclusive access to the free(A) region 
    1.76 +   in the figure above, and the back end driver has exclusive
    1.77 +   access to the free(B) region.
    1.78 +
    1.79  In general, drivers keep a private copy of their producer pointer and
    1.80  then set the shared version when they are ready for the other end to
    1.81  process a set of messages.  Additionally, it is worth paying attention