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

Re: [MINI-OS PATCH 06/19] mm: don't add module pages to free memory


  • To: Juergen Gross <jgross@xxxxxxxx>, <minios-devel@xxxxxxxxxxxxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Tue, 8 Jul 2025 17:14:37 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • 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=nDpEFlCoXVD7ENnADuKDW8nwDvpTX/4/kG//QGY/Szo=; b=oa1SlA1cPokJqGEp4kCeyF6eI5q02kCpKWUvwiGikiO4kN18Mkh567jjt2VY30E25TvGhhFXJvA88av6pUfvXxlkawzh3oII+2EW6O95/4Ew2j296F5MKB8Rp/D4pmvAyNzqsJTJPaVJcycXniXFgWymsBX6mEoDg6B4pvhv6lZAqv6nLcMArWVUNL9Dn9X8sQUW7YG9i5KaeQJ6iYm+AILo5qgRIb/vopUB+bNfgwUhxZz5JKxwO29X1oXWyqs/wEvT7kUeA5YdiAb6A1W4F2vzAzAk/PUkSRVYd0oM4P/RmheOFEwCxuZ00OPmi4sZmxlxcS/6D5ivjj3nv/Jnmg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fk65MYOMeNx/S3F5yiupCOufauHMylUsxryeiqene7EAt6SwLF2r9deq9/oq2N85OC3PZw9n5a9kVXULNYj9zgrK6+FuwneJWwNMqTypru/uvOif9f6Ay3Al4WSFQ2yPnOY8qVJIt9AxR4rqxJIDVSfEX0ipUUe815J9FSbRaO/pQNSMQz4Mf2OYCZY5eOC3PwWmxajy2QxRElcLDUM4ZP5r4fwFpFfkY0hMbJqAFY9EPWJbrmCH5RZXtCnq1/07WXUarR8Hz1mv8YIiilBK/FobsNQJ/3MX8pIz+7I15U4JnXOoFhn2creD3SMC470yuCgo7jrzf3shHcntMquq8Q==
  • Cc: <samuel.thibault@xxxxxxxxxxxx>
  • Delivery-date: Tue, 08 Jul 2025 21:41:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2025-07-02 04:12, Juergen Gross wrote:
When initializing the memory allocator, don't add memory pages of
modules and the initial boot info structure to the free memory.

This is relevant only when running in PVH mode, as in PV mode only
memory above the initial page tables is added to free memory, and the
module and start_info pages are below the page tables.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

+/* Reserved memory ranges not added to free memory. */
+#define MAX_RSV_RANGES  1
+static struct {
+    unsigned long start;
+    unsigned long size;
+} reserved_range[MAX_RSV_RANGES];
+
+void check_memory_range(unsigned long *from, unsigned long *to)
+{
+    unsigned int m;
+    struct hvm_modlist_entry *mod;
+
+    for ( m = 0; m < MAX_RSV_RANGES && reserved_range[m].size; m++ )
+        check_memory_range_conflict(from, to, reserved_range[m].start,
+                                    reserved_range[m].size);

reserved_range[] isn't updated, so this is dead code. I guess that is fine for now.
+
+    mod = (struct hvm_modlist_entry *)(unsigned long)
+          hvm_start_info_ptr->modlist_paddr;
+    for ( m = 0; m < hvm_start_info_ptr->nr_modules; m++ )
+        check_memory_range_conflict(from, to, mod[m].paddr, mod[m].size);
+}
+

static const struct {
@@ -888,6 +964,10 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned 
long* max_pfn_p)
      if ( max_pfn >= MAX_MEM_SIZE / PAGE_SIZE )
          max_pfn = MAX_MEM_SIZE / PAGE_SIZE - 1;
+#ifndef CONFIG_PARAVIRT
+    pvh_reserve_start_info(&start_pfn);
+#endif

Maybe this ifdef can be removed and arch_mm_preinit() can call pvh_reserve_start_info() and update first_free_pfn (which is assigned to start_pfn)?

Regards,
Jason



 


Rackspace

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