From: Tim Deegan Subject: Re: [PATCH 2 of 4] xenpaging: use wait queues Date: Thu, 15 Dec 2011 12:28:25 +0000 Message-ID: <20111215122825.GC4274@ocelot.phlegethon.org> References: <8147822efdee65d1f5b9.1322737758@probook.site> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <8147822efdee65d1f5b9.1322737758@probook.site> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Olaf Hering Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi, Is there a more recent version of this patch? I see a newer version of the wait-queues-for-mem-events one but not of this. At 12:09 +0100 on 01 Dec (1322741358), Olaf Hering wrote: > # HG changeset patch > # User Olaf Hering > # Date 1322737507 -3600 > # Node ID 8147822efdee65d1f5b94656ab2032aedb76979f > # Parent 612f69531fd15cf59c58404f6e4762733a9a268c > xenpaging: use wait queues > > Use a wait queue to put a guest vcpu to sleep while the requested gfn is > in paging state. This adds missing p2m_mem_paging_populate() calls to > some callers of the new get_gfn* variants, which would crash now > because they get an invalid mfn. It also fixes guest crashes due to > unexpected returns from do_memory_op because copy_to/from_guest ran into > a paged gfn. Now those places will always get a valid mfn. > > Since each gfn could be requested by several guest vcpus at the same > time a queue of paged gfns is maintained. Each vcpu will be attached to > that queue. Once p2m_mem_paging_resume restored the gfn the waiting > vcpus will resume execution. > > There is untested code in p2m_mem_paging_init_queue() to allow cpu > hotplug. Since each vcpu may wait on a different gfn there have to be as > many queues as vcpus. But xl vcpu-set does not seem to work right now, > so this code path cant be excercised right now. > > > Signed-off-by: Olaf Hering > > diff -r 612f69531fd1 -r 8147822efdee xen/arch/x86/hvm/hvm.c > --- a/xen/arch/x86/hvm/hvm.c > +++ b/xen/arch/x86/hvm/hvm.c > @@ -454,6 +454,8 @@ int hvm_domain_initialise(struct domain > spin_lock_init(&d->arch.hvm_domain.irq_lock); > spin_lock_init(&d->arch.hvm_domain.uc_lock); > > + spin_lock_init(&d->arch.hvm_domain.gfn_lock); > + I agree with Andres's comments on this lock, and will go futher: please - add it to the mm-locks.h system so we see any ordering vioations in future patches. - add a detailed comment there explaining what exactly this lock protects. Cheers, Tim.