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

Re: [PATCH 2/2] xen/mm: do not assign pages to a domain until they are scrubbed


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Wed, 25 Mar 2026 17:54:40 +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=p5cIfIRVdeZwC68hmSTsf+2fF1KF+UXOKOFvWyEOsWs=; b=m45+VQrdb5Lmb/vvDXwciztg8TqIXBPacNv29XBte8zGsOsccmVwdWuUH5PaM77boS1K0lMcmpOh88dBmZQYI9CUj5mkmM53NuTGqP1BOygbTnnD+H/JemQvFQHSKRMqmRGDLK9EiegcEFwuLfmcBZ3c81q92LUCUktuUnI7+9DVEznLMwwBwZbh2otkZdHoUN4Zf/7+itZ27RN1tZysgu0QuJxszvLu2tFz3cQLuZOk+fNZDhObRpCl4WqV8Q7GJLkNh/Ugpb9L4YN4jg84APPPcun1QbY1IVw97D/MGh+2BRkKZErnNOADqvhDk8P0bE3rsfHngnPFlTBr5Uj9gA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SW/3Bb3lRgCnWW+EzWCGPgr+J+vIqaSGMNTzOtub+7S0qifFDEeUto+4GRWNDWTdd8XBol6H2GlbmvmNOyk2X41QI0z07UHp7m6SaVPu5BqhYsUgBdHGP62E1LObRQ/Cdj5uf42wYv3j/jVWbX8ZUtEaO92nGfoj+fBl27CqcMo3bab0pErMtUt5HjqE9aAx963MU8yyHoK7+CcxLTLs5F3/MqOXh08L5zkeH9BEl4IrmweyV2X+OVdb/nfiSYCkNt0LDf+In7BV1ewnKCrfe8sw+4/uhyxaJHpPv0uPPZZpi1nP3uEG12oeAC5zO/cgOCedj1sTh3xwd8n92d/doQ==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=citrix.com header.i="@citrix.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 25 Mar 2026 16:54:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Mar 25, 2026 at 05:26:01PM +0100, Roger Pau Monné wrote:
> On Wed, Mar 25, 2026 at 03:56:05PM +0100, Jan Beulich wrote:
> > On 25.03.2026 11:08, Roger Pau Monne wrote:
> > >  * Disallow XENMEM_decrease_reservation until the domain has finished
> > >    creation would fix the issue of pages being freed while pending scrub,
> > >    but it's not clear there might be other usages that would be 
> > > problematic,
> > >    as get_page() on non-scrubbed pages would still return success.
> > 
> > I agree this is of concern.
> > 
> > > --- a/xen/common/memory.c
> > > +++ b/xen/common/memory.c
> > > @@ -388,6 +388,12 @@ static void populate_physmap(struct memop_args *a)
> > >                              goto out;
> > >                          }
> > >                      }
> > > +
> > > +                    if ( assign_page(page, a->extent_order, d, memflags) 
> > > )
> > > +                    {
> > > +                        free_domheap_pages(page, a->extent_order);
> > 
> > The pages don't have an owner set yet, so that function will go straight
> > to free_heap_pages(), needlessly passing "true" as last argument. Correct,
> > but (for large pages, which the stashing is about) highly inefficient.
> 
> My bad, I was sure I was using the same freeing function as
> alloc_domheap_pages() on failure to assign, but I clearly wasn't.  I
> will switch to using free_heap_pages().

Coming back to this, I can export free_heap_pages(), but then the call
would also unconditionally have need_scrub == true, as the pages have
been allocated without scrubbing.  So I don't see much benefit of
using free_heap_pages(), the more that it requires making such
function global then.

Thanks, Roger.



 


Rackspace

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