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

Re: [PATCH v4 4/5] xen/arm: Check for Static Heap feature when freeing resources


  • To: Julien Grall <julien@xxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Sat, 7 Dec 2024 14:22:37 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=mjg6SbQSrbWZeOUJmTnq+i/dGyvRusweKp9+LjxjinA=; b=swYlE1uX8Fxy30adtFWucCodK5A9UoT1/Zo3cs/eP50t1tkKCsbXSNNC8I1HuEk5M7liGE9uloJybHzrUxDhW/9O7DX1lcYXjQ8YqYVMBbv9UfOQL00UaujyCcT9ROMxijciD0bzAJazTi0gz1RYPtoFwHEhYEEKZbHI9zc9KRIricAbq7u1lv4I2wwaGe1ypDGRi2bMbAL0o5zc3GTDg9pyFX4Qz7HmobWSmavEcWQIOs8/B//n/T5vKZr/jA6tBqFWeMTfHc4KDu68GPByHqXxR8GEsBX9sfTb/bQWjOa1gKHzGC0Kg+hBB1ObCzTg9eOnrje1q1htKy2qDhLInQ==
  • 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=mjg6SbQSrbWZeOUJmTnq+i/dGyvRusweKp9+LjxjinA=; b=Q/YdKLbkkZF5p2wwMnHOKNEx98uI1YDSTtk4xE212WmkuCOWJi1ToLDWIJk238sjY5lUEl52s/nn37nWOoEDKHd8HJfIL3rXt5WR7PUG4CCXaPIEXSL8+xL/d3yCe1FFmHQQEdvJv+VfxT2IwpOGVhpRk9/aInF2bFbw3lmM8V/lGdbPI4TJ0biuLUXFR16Y7jg4hb8QsOHpzMgJ/enXB2oINCiYt83A120NFVRYWOY7WYgxlGZFKT71cTc/2DauULwnAaYWwvNf6YIJ2dP9Rmp6zXr4nMXQPBujutuQQEIa3VUxeDQNpqtJl5+IV5sX8gbwE1lnO3p61+QtQJ2NjQ==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=GN+uYZ7TbidrRLp3htBSEsJ+EMzCfq2O2gWIs3ihYuYbqc/IslMC/MyxHZNAso8x2aNHXGpXnxuq9LqLOEqi9Mt5NeXAZ0DsO2xIsp/A9PEY6V8FjDU0k1Td20zHNoKclpvlJ7ycZbzFB9cVbYsucXDcT7MrXDvL9bZ1lChk60eBZEmDLMNwPeT89DZL/ITpVzFoEjyKNEqy0GHO4YDWR8kzZ95MQCanOCDOmovsHYKRznGyFG9ywBtXJKn3DO8xP7tHnIfuQKS4fopRxsxegGtAZUcGLpkvQ7UcQ8BBXq6grgH2Jmbv+LyFF8zitqHGQ3b4ThqiBiLfqWC4GTe6hw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ay1U1DwpJ5a/FZfNU8AP7Kpxl6xdn+BBmvHkP3AQ/GR7PKCw72CyU6JReyJW9ZZTmMX+R6W9VnkeZfX10QigrrKxoCB38MkJIW+lKKooZfh9wai6IecavgDv2coUBsw8ZnJ+6n2nDtRpWR7wy/+ZqSVf9y3Bb0rx8ew1Zp8nI3AF0WAW0PuovmbizXV+mc/Cg4wlJzfUJPRgDK+Xhgj1P18093wdMOhIVaCiyAJv8glLYKT1QRsvU/NUzgh6dcm6rax0kC9PjxIstYCdkFusvowObduBIcDPEOEgOIZ7vA13DojTVovNs7CQ37vosQ4sEbwVBYi3ERDv+S+gDJJlTQ==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Penny Zheng <Penny.Zheng@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>
  • Delivery-date: Sat, 07 Dec 2024 14:23:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHbRWiMK0NBCC8wPk6qtayhLuvPaLLZnNkAgAE/IIA=
  • Thread-topic: [PATCH v4 4/5] xen/arm: Check for Static Heap feature when freeing resources

Hi Julien,

> On 6 Dec 2024, at 19:19, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Luca,
> 
> On 03/12/2024 09:48, Luca Fancellu wrote:
>> diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
>> index 9664e85ee6c0..8c87649bc88e 100644
>> --- a/xen/arch/arm/mmu/setup.c
>> +++ b/xen/arch/arm/mmu/setup.c
>> @@ -341,8 +341,12 @@ void free_init_memory(void)
>>      if ( rc )
>>          panic("Unable to remove the init section (rc = %d)\n", rc);
>>  -    init_domheap_pages(pa, pa + len);
>> -    printk("Freed %ldkB init memory.\n", 
>> (long)(__init_end-__init_begin)>>10);
>> +    if ( !using_static_heap )
>> +    {
>> +        init_domheap_pages(pa, pa + len);
>> +        printk("Freed %ldkB init memory.\n",
>> +               (long)(__init_end-__init_begin) >> 10);
>> +    }
>>  }
>>    /**
>> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>> index 2e27af4560a5..22ab342dc8f4 100644
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -206,24 +206,25 @@ void __init discard_initial_modules(void)
>>      struct bootmodules *mi = &bootinfo.modules;
>>      int i;
> 
> Looking at the change below, it seems that discard_initial_modules()
> is a NOP for static_heap. Do you forsee any reason where it would be 
> different?

you are right, the code could be a lot simpler.

I’ve prepared a diff on top of this patch if you are ok to do that on commit, 
but
It won’t be a problem for me to send another patch for that.

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 22ab342dc8f4..85f743a2c6ad 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -206,25 +206,27 @@ void __init discard_initial_modules(void)
     struct bootmodules *mi = &bootinfo.modules;
     int i;
 
-    if ( !using_static_heap )
-    {
-        for ( i = 0; i < mi->nr_mods; i++ )
-        {
-            paddr_t s = mi->module[i].start;
-            paddr_t e = s + PAGE_ALIGN(mi->module[i].size);
+    if ( using_static_heap )
+        return;
 
-            if ( mi->module[i].kind == BOOTMOD_XEN )
-                continue;
+    for ( i = 0; i < mi->nr_mods; i++ )
+    {
+        paddr_t s = mi->module[i].start;
+        paddr_t e = s + PAGE_ALIGN(mi->module[i].size);
 
-            if ( !mfn_valid(maddr_to_mfn(s)) ||
-                 !mfn_valid(maddr_to_mfn(e)) )
-                continue;
+        if ( mi->module[i].kind == BOOTMOD_XEN )
+            continue;
 
-            fw_unreserved_regions(s, e, init_domheap_pages, 0);
-        }
+        if ( !mfn_valid(maddr_to_mfn(s)) ||
+             !mfn_valid(maddr_to_mfn(e)) )
+            continue;
 
-        mi->nr_mods = 0;
+        fw_unreserved_regions(s, e, init_domheap_pages, 0);
     }
+
+    mi->nr_mods = 0;
+
+    remove_early_mappings();
 }
 
 /* Relocate the FDT in Xen heap */





 


Rackspace

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