[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 7/8] x86/mm: update log-dirty bitmap when manipulating P2M


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 10 Dec 2025 10:57:45 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MqW4FUxlfyINIX81hhhWKbnw+XsY3GcuwIXW3aC20cs=; b=fy0a7nwtmjfQtsxaLNC6qFylmXLzkz60q5X7WNJAWpwaSRhCN7+OZqTlAK0wyW3gzOVJVi2GXDGjblVLURoptxSREq3DI1WcM/jcJufAJ7jzrKf+M6N4LNscXxtVz7EKPPuhxQuTvSJ2oyU2Xy9q/o7Ufvk8tIdN8SbTggAHIFy9Lx+hpEp5kPypP5Sg3Elvc8EVfq651grc6czqkfE6h/q9BdL5M6xtNq3ph+7fjOPhYZoDT8KNNHbubWthUPDLmlfmGNw9T+UhGHMrMLn4hMkzIE1UH1E31r8sPCG8TqXVQBK6Nm+NjO9J7ngMuQNaQlD+TDeKTTg6zf/+guPvhA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Aql1VhiNEzRmCejp3igIZ7Dg2vKSQuIiAj86asQPsewnojB4Wa/m6PK23jADwr16WkGjd8IFIvOLyndci9rv8q8kfrfbK1d8ErrhNAHPLx0YR1ey1950lk4hsjKGtH9FW3AIi5AECg7kTgsFJfj081Czf6w1/8savxhfvIQn6ACR1PldUlN2U+K4hKUedOarXOn+TCF7TLrKr0ta3+oEtLzzx79Hww0E1+OK9QQO54TZyR8xicXcFlWrHE25VWB5S3R0dywNtxLFTIUYdgoWsI46NiHoz6KFeRRzB20Ikkb/v8vkJqUrvf+OC+XWFnj6nzEGHSsM7tu4D/9b3ZY4AA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Delivery-date: Wed, 10 Dec 2025 09:57:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Dec 10, 2025 at 10:55:50AM +0100, Jan Beulich wrote:
> On 10.12.2025 10:42, Roger Pau Monné wrote:
> > On Tue, Apr 26, 2022 at 12:26:10PM +0200, Jan Beulich wrote:
> >> Just like for PV guests MMU_MACHPHYS_UPDATE implies marking of the
> >> respective page as dirty, additions to a HVM guest's P2M should do so.
> >>
> >> For HVM the opposite is also true: Pages being removed from the P2M are
> >> no longer dirty at their prior GFN; there's no point in telling the tool
> >> stack to try and copy that page, when this will fail anyway (until
> >> perhaps a new page gets placed there). Introduce paging_mark_pfn_clean()
> >> (intentionally without a paging_mark_clean() counterpart) to handle
> >> this. Note that while there is an earlier call to set_gpfn_from_mfn() in
> >> guest_physmap_add_entry(), but there's little reason to mark the page
> >> clean there when later in the function it'll be marked dirty. This is
> >> even more so given that at this point it's only the M2P that gets
> >> updated, with the P2M still left unchanged.
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> > 
> > Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Thanks.
> 
> >> --- a/xen/arch/x86/mm/paging.c
> >> +++ b/xen/arch/x86/mm/paging.c
> >> @@ -260,7 +260,7 @@ static int paging_log_dirty_disable(stru
> >>  }
> >>  
> >>  /* Mark a page as dirty, with taking guest pfn as parameter */
> >> -void paging_mark_pfn_dirty(struct domain *d, pfn_t pfn)
> >> +static void mark_pfn_dirty(struct domain *d, pfn_t pfn, bool dirty)
> > 
> > Nit: set_pfn_logdirty() or similar?  The function name makes it look like
> > it's marking the pfn as dirty (when it's also used to clear it).
> > 
> > No strong opinion, it just seems to me the name is slightly confusing.
> 
> Changed. While making the change I noticed that I had one other change in
> there for a possible v4. This is the extra hunk:
> 
> @@ -260,7 +260,7 @@ void paging_mark_pfn_dirty(struct domain
>          return;
>  
>      /* Shared MFNs should NEVER be marked dirty */
> -    BUG_ON(paging_mode_translate(d) && SHARED_M2P(pfn_x(pfn)));
> +    BUG_ON(dirty && paging_mode_translate(d) && SHARED_M2P(pfn_x(pfn)));
>  
>      /*
>       * Values with the MSB set denote MFNs that aren't really part of the
> 
> I hope that won't invalidate your R-b.

No, that's fine, please keep the RB.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.