Subject: Re: can MEXTADD() storage be remapped ?
To: Jason Thorpe <>
From: Manuel Bouyer <>
List: tech-kern
Date: 05/24/2005 18:37:34
On Tue, May 24, 2005 at 08:35:37AM -0700, Jason Thorpe wrote:
> On May 23, 2005, at 9:16 AM, Manuel Bouyer wrote:
> >In if_xennet, data received from the interface is passed to the kernel
> >in a mbuf with external storage (MEXTADD). In the external storage
> >free  routine (xennet_rx_mbuf_free()), there is a comment saying
> >that that there may be some MMU operation pending for this buffer
> >(in Xen, some MMU operations are delayed via a MMU update queue),
> >and the MMU update queue must be flushed. This cause problems,
> >and I'm wondering if there can ever be MMU operations queued for
> >these pages, once they have been MEXTADD()'d to a mbuf and passed  
> >to the
> >network stack. If would make my life much easier if the anserw was  
> >"no" :)
> I don't think there are any cases where something takes additional  
> mappings of an mbuf external buffer for the inbound case.  If  
> something wants to reference that buffer, then it needs to actually  
> take an mbuf external storage reference to it.  By the time your  
> xennet mbuf_free routine is called, you are guaranteed that there are  
> no other references to that buffer.

Yes (I guess otherwise, the free routine woudln't be called).
The problem I have is if an additionnal mapping has existed and has been
removed, the removal may still be in Xen's pmap update queue (that is,
it may still be effectively mapped). Flushing the pmap update queue from the
mbuf free routine cause problems (because it can be called from interrupt
context), and I could just skip this if I was sure that no additionnal
mapping ever existed for this buffer.

Manuel Bouyer, LIP6, Universite Paris VI. 
     NetBSD: 26 ans d'experience feront toujours la difference