From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Roger Pau Monne <roger.pau@citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Anthony PERARD <anthony.perard@vates.tech>,
Michal Orzel <michal.orzel@amd.com>,
Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH v2 1/3] xen/mm: enforce SCRUB_DEBUG checks for MEMF_no_scrub allocations
Date: Thu, 15 Jan 2026 12:18:02 +0100 [thread overview]
Message-ID: <20260115111804.40199-2-roger.pau@citrix.com> (raw)
In-Reply-To: <20260115111804.40199-1-roger.pau@citrix.com>
The logic in alloc_heap_pages() only checks for scrubbing pattern
correctness when the caller doesn't pass MEMF_no_scrub in memflags.
However already scrubbed pages can be checked for correctness, regardless
of the caller having requested MEMF_no_scrub.
Relax the checking around the check_one_page() call, to allow for calls
with MEMF_no_scrub to also check the correctness of pages marked as already
scrubbed when allocated. This widens the checking of scrubbing
correctness, so it would also check the scrubbing correctness of
MEMF_no_scrub allocations.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
After discussing with Jan I've deliberately omitted the tag:
Fixes: 0c5f2f9cefac ("mm: Make sure pages are scrubbed")
The intended approach might have been to ensure the caller of
alloc_heap_pages() gets properly scrubbed pages, rather than asserting the
internal state of free pages is as expected.
---
xen/common/page_alloc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 2efc11ce095f..de1480316f05 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -1105,8 +1105,7 @@ static struct page_info *alloc_heap_pages(
spin_unlock(&heap_lock);
- if ( first_dirty != INVALID_DIRTY_IDX ||
- (scrub_debug && !(memflags & MEMF_no_scrub)) )
+ if ( first_dirty != INVALID_DIRTY_IDX || scrub_debug )
{
bool cold = d && d != current->domain;
@@ -1119,7 +1118,7 @@ static struct page_info *alloc_heap_pages(
dirty_cnt++;
}
- else if ( !(memflags & MEMF_no_scrub) )
+ else
check_one_page(&pg[i]);
}
--
2.51.0
next prev parent reply other threads:[~2026-01-15 11:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 11:18 [PATCH v2 0/3] xen/mm: limit in-place scrubbing Roger Pau Monne
2026-01-15 11:18 ` Roger Pau Monne [this message]
2026-01-15 11:18 ` [PATCH v2 2/3] xen/mm: allow deferred scrub of physmap populate allocated pages Roger Pau Monne
2026-01-19 13:00 ` Jan Beulich
2026-01-22 12:48 ` Roger Pau Monné
2026-01-22 13:00 ` Jan Beulich
2026-01-15 11:18 ` [PATCH v2 3/3] xen/mm: limit non-scrubbed allocations to a specific order Roger Pau Monne
2026-01-19 16:13 ` Jan Beulich
2026-01-20 7:25 ` Jan Beulich
2026-01-22 13:05 ` Roger Pau Monné
2026-01-22 13:09 ` Jan Beulich
2026-01-22 12:55 ` Roger Pau Monné
2026-01-22 13:07 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260115111804.40199-2-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.