From: Tim Deegan Subject: Re: [PATCH v6 4/4] xen: rework paging_log_dirty_op to work with hvm guests Date: Thu, 14 May 2015 12:35:22 +0100 Message-ID: <20150514113522.GH81528@deinos.phlegethon.org> References: <1431354328-30453-1-git-send-email-roger.pau@citrix.com> <1431354328-30453-5-git-send-email-roger.pau@citrix.com> <20150514095317.GD81528@deinos.phlegethon.org> <55547FD9.4040808@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YsrQC-000715-Im for xen-devel@lists.xenproject.org; Thu, 14 May 2015 11:35:24 +0000 Content-Disposition: inline In-Reply-To: <55547FD9.4040808@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: xen-devel@lists.xenproject.org, Jan Beulich , Andrew Cooper List-Id: xen-devel@lists.xenproject.org At 12:58 +0200 on 14 May (1431608313), Roger Pau Monn=E9 wrote: > El 14/05/15 a les 11.53, Tim Deegan ha escrit: > > At 16:25 +0200 on 11 May (1431361528), 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. > >> > >> Fix this by independently mapping each page of the guest bitmap as nee= ded > >> without the paging lock held. > >> > >> Signed-off-by: Roger Pau Monn=E9 > > > > This looks mostly correct, but OTOH we now seem to have two nested > > stop-and-retry mechsnisms in one function. I think this would be > > cleaner if here: > > > >> + if ( pages >> (3 + PAGE_SHIFT) !=3D > >> + index_mapped >> (3 + PAGE_SHIFT) ) > >> { > >> - rv =3D -EFAULT; > >> - goto out; > >> + /* We need to map next page */ > >> + d->arch.paging.preempt.log_dirty.i4 =3D i4; > >> + d->arch.paging.preempt.log_dirty.i3 =3D i3; > >> + d->arch.paging.preempt.log_dirty.i2 =3D i2; > >> + d->arch.paging.preempt.log_dirty.done =3D pag= es; > >> + paging_unlock(d); > >> + unmap_dirty_bitmap(dirty_bitmap, page); > > > > we set the rest of the preempt state, like so: > > > > d->arch.paging.preempt.dom =3D current->domain; > > d->arch.paging.preempt.op =3D sc->op; > > resuming =3D 1; > > > > and bailed to the very top of the function. I think we might also > > need a hypercall_preempt_check() here as well, so that this restart > > path doesn't stop us ever reaching the preempt_checks below. > = > OK, I don't mind adding a preempt check here, although I think we would > hit the ones below anyway as we go scanning the dirty bitmap even if we > have to restart. Oh, so we do. No need for the extra check here, then. But I'd still prefer restarting the whole function to having a second restart point. Cheers, Tim.