From: Tim Deegan Subject: Re: [PATCH RFC v2 3/3] xen: rework paging_log_dirty_op to work with hvm guests Date: Thu, 9 Apr 2015 14:05:31 +0100 Message-ID: <20150409130531.GE17025@deinos.phlegethon.org> References: <1427970395-16203-1-git-send-email-roger.pau@citrix.com> <1427970395-16203-4-git-send-email-roger.pau@citrix.com> <551D9C99.4070107@citrix.com> <20150403141235.GA20330@deinos.phlegethon.org> <5523ACCC.4090001@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YgC9G-0002sv-2V for xen-devel@lists.xenproject.org; Thu, 09 Apr 2015 13:05:34 +0000 Content-Disposition: inline In-Reply-To: <5523ACCC.4090001@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau =?iso-8859-1?Q?Monn=E9?= Cc: Andrew Cooper , Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org At 12:09 +0200 on 07 Apr (1428408556), Roger Pau Monn=E9 wrote: > Hello, > = > El 03/04/15 a les 16.12, Tim Deegan ha escrit: > > Hi, > > = > > At 20:46 +0100 on 02 Apr (1428007593), Andrew Cooper wrote: > >> On 02/04/15 11:26, Roger Pau Monne wrote: > >>> When the caller of paging_log_dirty_op is a hvm guest Xen would choke= when > >>> trying to copy the dirty bitmap to the guest because the paging lock = is > >>> already held. > >> > >> Are you sure? Presumably you get an mm lock ordering violation, because > >> paging_log_dirty_op() should take the target domains paging lock, rath= er > >> than your own (which is prohibited by the current check at the top of > >> paging_domctl()). > >> > >> Unfortunately, dropping the paging_lock() here is unsafe, as it will > >> result in corruption of the logdirty bitmap from non-domain sources su= ch > >> as HVMOP_modified_memory. > >> > >> I will need to find some time with a large pot of coffee and a > >> whiteboard, but I suspect it might actually be safe to alter the curre= nt > >> mm_lock() enforcement to maintain independent levels for a source and > >> destination domain. > > = > > We discussed this in an earlier thread and agreed it would be better > > to try to do this work in batches rather than add more complexity to > > the mm locking rules. (I'm AFK this week so I haven't had a chance to > > review the actual pacth yet.) > = > I don't know about the locking rules or how much complexity would > permitting this kind of accesses add to it, but IMHO this patch makes > the code quite more complex and possibly error prone, so finding a > simpler approach seems like a good option to me. I'm happier with this (relatively contained) complexity than with adding yet more logic to the mm_locks code. I don't think there are any new races introduced here that weren't already present in the -ERESTART case. Cheers, Tim.