From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6954CD4F24 for ; Tue, 12 May 2026 15:56:07 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1307093.1578825 (Exim 4.92) (envelope-from ) id 1wMpSc-0003XP-7j; Tue, 12 May 2026 15:55:54 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1307093.1578825; Tue, 12 May 2026 15:55:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wMpSc-0003WC-1l; Tue, 12 May 2026 15:55:54 +0000 Received: by outflank-mailman (input) for mailman id 1307093; Tue, 12 May 2026 15:55:53 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) id 1wMpSa-0003UK-Vd for xen-devel@lists.xenproject.org; Tue, 12 May 2026 15:55:52 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wMpSa-001eB7-CF for xen-devel@lists.xenproject.org; Tue, 12 May 2026 17:55:52 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a034d80-2eae-0a2a0a5409dd-0a2a450696ee-8 for ; Tue, 12 May 2026 17:55:52 +0200 Received: from [209.85.128.45] (helo=mail-wm1-f45.google.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.56.1) (envelope-from ) id 6a034d88-7371-0a2a45060019-d155802dd027-3 for ; Tue, 12 May 2026 17:55:52 +0200 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-488e1a8ac40so55895555e9.2 for ; Tue, 12 May 2026 08:55:52 -0700 (PDT) Received: from localhost.localdomain (host-78-146-242-105.as13285.net. [78.146.242.105]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48fc8d69d0bsm4361335e9.13.2026.05.12.08.55.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 May 2026 08:55:50 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=citrix.com header.i="@citrix.com" header.h="Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1778601351; x=1779206151; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F5KS7/+TNO6Mwmt8V0F9s0vRqo8U83BG2diX81j3zbo=; b=Uk/kMh0q1dKI+I79XoCmEbXdkOGVXiicrGQYU4DDStrxTQNHJq4AQdyVhwXwGElM+w JUTb59oOR92tjdWHxqMA1KDdvlu+bNk5rziqgi9PvHLlvJd7Z5rA/AP/Eh/wjnvs45B0 sMGG9uo0W3iBB0PCTavvSHM9beeh4cTil8jxk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778601351; x=1779206151; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=F5KS7/+TNO6Mwmt8V0F9s0vRqo8U83BG2diX81j3zbo=; b=dGUkKxnpSIIgwohVElHVr6RS4pQXncYNjHl6DgseC3MOPTmpEHuyqrCM0LsGeiIlsB Smee8BBPShbQgxZ41L8rr50+BTplnwT04SPnJS0+hs0+8pf2hRORG8MYF9PGAVDB8Exc etoqDbJzhJDC3dzlMxO1dY3GpbhBHCV5wp06q4AEyOFr/ZaFw9sNMPhFYkX7l7L2ktZX BXWrMjLVdk5jtFcFL0uq2FyESD3snwXmcmGaUKMlZKDhRLNFuoKREPzAUHz/a6ucfF4F OBASKIf3pVVEEdlMXbSsRjw4rAm0vr/BWA9xjILF1MzQ5poIOtthinBm60t9tpkmN0Z3 /DQg== X-Gm-Message-State: AOJu0YxdHArqNnlLLJUXyCTpJibqnQeAl+huA6lzhrrbN15mighgfEQH q5B7ZOeCF5EdEsjuRb0RFvlkD4T2eJoM28u/MapXPfDgob9a7Myq0V2X1fpVhNOA0BE88syRkZi FvlpligI= X-Gm-Gg: Acq92OEMaJ/Tgv0KJ83YsJSdwVoUSHJreW643EN0Q83hXSc0XgFV7d4NT/0pCmdQgFh qqrvCAUeorMRZ3YTwnRgSpbRojj9u8haiuY/m8NpaqsR5fqPPUBH+bBwwq4a/x1pdlBagSqrC0b bbt5hQVwxTTZmk7UWFe34ZPpEV+YMYJIno51bm5RfXiNm8HySZNcVdkBMqUo0RQArhzmkPqk8sL m5VG0L5M3D9X8+kYaYMR5r8GwpBK7DU2ql8pZBm/YcOYLYAUw8+epy0J2Y8AsRIyrmGr15HgvD5 DBql54I7gA/9GmQzUeaQVq5LiKFyJivodvr7G8WqH54/9joN4M1U9YN2o0CjxL6zMpFEfU2Whc7 ULYEp3CtPq0GrsNYBFiV1bvy/WJafHZBwyzMrb0c0wnP3OqpdBHap+1SmZLYTPsr9Si62n8nrfZ vd78bd8QrmO8pFKCXU/hNiaVNbatEI6wfzCQIjT2XGR2QzMH7F/4p1eOHsSxisd7yK48JIw838v Ar3 X-Received: by 2002:a05:600c:c4a4:b0:48a:906b:14ca with SMTP id 5b1f17b1804b1-48e8fe7cdfbmr53019775e9.20.1778601351053; Tue, 12 May 2026 08:55:51 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , Julien Grall , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Oleksii Kurochko Subject: [PATCH 1/2] tests/paging-mempool: Misc cleanup Date: Tue, 12 May 2026 16:55:39 +0100 Message-Id: <20260512155540.1733403-2-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260512155540.1733403-1-andrew.cooper3@citrix.com> References: <20260512155540.1733403-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-purgate-ID: tlsNG-16d1c6/1778601352-87F7BD75-59128DD6/10/73395122804 X-purgate-type: spam X-purgate-size: 3334 ... ahead of extending it with a second test. Rename run_tests() to test_paging_mempool_size() and have it return int so the newly wrapping run_tests() can decide whether to run the next or not. Comment the parameters to xc_domain_populate_physmap_exact() to make it clearer what's going on, and remove the page added to the physmap when the test is done. No practical change. Signed-off-by: Andrew Cooper --- CC: Anthony PERARD CC: Michal Orzel CC: Jan Beulich CC: Julien Grall CC: Roger Pau Monné CC: Stefano Stabellini CC: Oleksii Kurochko --- .../paging-mempool/test-paging-mempool.c | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/tools/tests/paging-mempool/test-paging-mempool.c b/tools/tests/paging-mempool/test-paging-mempool.c index 1ebc13455ac2..d1207d26d3fc 100644 --- a/tools/tests/paging-mempool/test-paging-mempool.c +++ b/tools/tests/paging-mempool/test-paging-mempool.c @@ -15,6 +15,7 @@ static unsigned int nr_failures; ({ \ nr_failures++; \ (void)printf(fmt, ##__VA_ARGS__); \ + -1; \ }) static xc_interface *xch; @@ -40,7 +41,7 @@ static uint64_t default_mempool_size_bytes = 16 << 12; #endif -static void run_tests(void) +static int test_paging_mempool_size(void) { xen_pfn_t physmap[] = { 0 }; uint64_t size_bytes, old_size_bytes; @@ -80,7 +81,8 @@ static void run_tests(void) return fail(" Fail: setmaxmem: : %d - %s\n", errno, strerror(errno)); - rc = xc_domain_populate_physmap_exact(xch, domid, 1, 0, 0, physmap); + rc = xc_domain_populate_physmap_exact(xch, domid, ARRAY_SIZE(physmap), + 0 /* order 4k */, 0 /* flags */, physmap); if ( rc ) return fail(" Fail: populate physmap: %d - %s\n", errno, strerror(errno)); @@ -98,6 +100,11 @@ static void run_tests(void) return fail(" Fail: mempool size changed %"PRIu64" => %"PRIu64"\n", old_size_bytes, size_bytes); + /* We added one 4k page. Check we can remove it. */ + rc = xc_domain_remove_from_physmap(xch, domid, physmap[0]); + if ( rc ) + return fail(" Fail: remove from physmap: %d - %s\n", + errno, strerror(errno)); printf("Test bad set size\n"); @@ -134,6 +141,19 @@ static void run_tests(void) if ( size_bytes != 64 << 20 ) return fail(" Fail: expected mempool size %u, got %"PRIu64"\n", 64 << 20, size_bytes); + + return 0; +} + +static int run_tests(void) +{ + int rc; + + rc = test_paging_mempool_size(); + if ( rc ) + return rc; + + return 0; } int main(int argc, char **argv) @@ -143,7 +163,6 @@ int main(int argc, char **argv) printf("Paging mempool tests\n"); xch = xc_interface_open(NULL, NULL, 0); - if ( !xch ) err(1, "xc_interface_open"); -- 2.39.5