[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] wireshark capture of failed download from mirage-www on ARM



On 24 Jul 2014, at 00:24, Thomas Leonard <talex5@xxxxxxxxx> wrote:
> 
> I notice that FLOW explicitly states that the buffer need not be page-aligned:
> 
> module type FLOW = sig
>  type buffer
>  (** Abstract type for a memory buffer that may not be page aligned. *)
> 
>  val write : flow -> buffer -> [`Ok of unit | `Eof | `Error of error ] io

I think there's a terminology confusion here that needs to be corrected
somewhere in the docs:

- the Bigarray underlying the Cstruct must always be page-aligned if it's
  ever going to be used for a grant, since otherwise the offset in the grant
  entry is wrong.  Allocate through Io_page to ensure this for now.

- the Cstruct view may not be page-aligned if the off!=0.  This shouldn't
  matter from the perspective of granting it, since the backend should
  adjust the offset in the grant entry to account for the Cstruct offset.
  If it doesn't do this right now, that's a definite bug.

- Granters should be aware that the backend may see more of a Cstruct
  view than they intend, since the grantee could potentially see the whole
  Io_page (need to check into Xen sub-page grants to see if that's better
  supported now -- it would only work with grant copies I imagine).

> 
> Also, it can fail even if it is aligned:
> 
> S.TCPV4.write flow (Io_page.get 10 |> Io_page.to_cstruct)
> 
> gives
> 
> RX exn Failure("Invalid page: offset=2920, length=1460")
> 
> (presumably because splitting the pages into TCP-packet-sized chunks
> loses the alignment)

Some seat belts definitely need to be applied to this API...

-anil

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.