Subject: Re: multiple references to p -> v mappings
To: Chuck Silvers <chuq@chuq.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 09/12/2005 00:14:17
On Sun, Sep 11, 2005 at 02:09:34PM -0700, Chuck Silvers wrote:
> > It seems that the hypervisor doesn't allow multiple mappings in this case.
> > Either multiple mappings in the same domain (one remplacing the other)
> > or mapping of the page in both domain0 and the guest.
> > The Xen doc isn't clear about this, at several place it's implied that
> > the page must be unmapped from domain0 before the I/O is ack'd to the
> > guest. So even if multiple mappings work, I need to keep track of which
> > request use which pages, to ack the requests only once the no mappings
> > remain.
> 
> whacky.  if that's really required, then you'll also need to synchronize
> mapping of new pages in domain0 with acks of old pages which have just
> been unmapped.  ie., once you've decided to ack the old request you'll
> need to defer processing a new request that uses the same page until
> after the ack completes.

On second though I don't think it's the problem. I guess the hypervisor just
doesn't deal with loaned pages being mapped multiple times in domain0.

> 
> actually, to avoid livelock, you should probably not defer acks at all,
> but rather defer processing of a new request that uses the same page
> until after the previous request is ack'd.  or maybe some mixture of these.
> 
> there's no code already in the system that will do quite what you want.
> I would suggest using a new hash table to track pages used by these
> requests-in-progress.

Thanks. I already started doing this. It needs more work, my code is much
slower than the previous map/copy/unmap code :)

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--