[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v2 3/4] xen/arm: Handle reserved heap pages in boot and heap allocator
- To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Henry Wang <Henry.Wang@xxxxxxx>
- Date: Tue, 6 Sep 2022 13:39:14 +0000
- Accept-language: zh-CN, 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=armh.onmicrosoft.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=arcselector9901; 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=aVAlHBxa9WEe0XuoVY9Uw69t/Lji3A7G+OQ0S4NLccQ=; b=H9SXldM2KfDSa5PNSHABhd5HKx7LxMZGjh4Ki9cElbsFx4dCcacgmFHyiRrE98QYWe+19iXKVYaUShYvn8P1VySzbfw6u9HTPoUqETsTdGnoxyygokVC9+C4cK3wSjqk0XO27m6pkTBt9egeYzKi0YVicyKfXGd2l2SzqNH4dg9XV0TiccZs0Yc6VXa0ndukbsgj9V2LubwuOGlmw8RgzfOBJvney28Q46lGRwd5ifUEZMiGgQMQkchv+N3Sb2od7VGJo5cnQD7MXFqm3Zuaw6Te/bkvfB03jZBioF8pjSEe7cguCapUJh6g7YEOCCO+OTIlOdHOP5/VyaY6/ljkbw==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=aVAlHBxa9WEe0XuoVY9Uw69t/Lji3A7G+OQ0S4NLccQ=; b=nqMwpL1F8s2ShKWHr8qdgzG2O9Gq6dB8rkCvvTV0KXAu1TGrjIWwwsLH/AOVRG8du8VYhm4LH7Mz3FEoRBSRFzCDDiBFRqZ2yUAkonwmkoLHJHqIkXfaPd6GEFPmcLdjM3fHftGI/OwZkDcKKafEUqWKfEf+vNl+jOiGhDiEdVBXwDbtrnHIQRqlcqc26zF7F3/ZEhPVKaX6eSworHgHqfw9BExasC2JjyBCYLa0c11KmogKrMcQThcgeexHZ2KMds4mndU3PEZxiBPyQ9uIZuFNV1aXyBjnGbBRL0KokacBfU/wdufD3CWhPnfB+o8kqeCZylJBz9PUCF7dsM5G5g==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=Cd85VEMN9pp0Eko9Acsa9JaTC5VjEvXegEXy6tY4IdSoO4OLQcXk6pNv8P8oL4L8sgIlb3Ks5Kw9HcKUz0f7NUNEt7T5L0h7WLcwiwJpwpKnmwOv6zHhtTJawn8Eb3+21AAs/FhEj7TL5gr8JUa3xJmkDk35RjKvzv8uVwHak5+aDyeIj7aaKMTWosRcpy0IZTv6S6iQg+Rwu062/K/ht4PpJ8iX0+htRt2KRZSDLUJhZ9/etxU1CNaHN3a3qykxosMm/jjEPiYDb+QooWQ1COsdXX7A9kDnQILdbcGzyj3pp+14VN3a7c+Cg9vnggQ3fTbJi3Yozb1SDEpKhEQojA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dPaVyECqfOwxfk9qt7xaGPPieg5IXlJI8bxTI3elFNAryx8CpF/6sdYYyD72BzvzSoY2E/3ocmliFZeXOMuYWRPW3NOzvx0xZN6QkVcSMbU6mPVBNLG3Qbpj8uA3v26PMii+fwEgSMEu1OYnlOhq1+03nZJtsk7kbtnn2mzZxKXjJlwbzXUyuHjp51XXAy9wiIf2YPdQkOkWVE0rwg3JwRLsAx3M14kMQfZLH04JcBerMVNzeZ+g3yKq6mRehq/umtQYva/RP9ZIxAkzYjFuAW+SceZ1MQHK/LrFyQTU/2n5LSapeTJElZL1Za6MOFVl27B9jG2kbSOjaFcLA8qBDw==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Wei Chen <Wei.Chen@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Tue, 06 Sep 2022 21:39:30 +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: AQHYwPj6dlOKXE+k5kuuj2vKrDnG5K3RJT6AgAB0+PCAAIHpAIAAAbyAgAA7oYCAAA2RAA==
- Thread-topic: [PATCH v2 3/4] xen/arm: Handle reserved heap pages in boot and heap allocator
Hi Julien,
> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> > I agree we need to require 64KB alignment, and currently we are following
> > this because we are doing 32MB alignment.
> Hmmm... I think we are talking about two different things here. What I
> am referring to is the alignment of the start/end of the region provided
> by the admin.
Ahh sorry my bad, yeah I should add the alignment requirement in dt-binding.
Will do that in v3.
>
> [...]
>
> >> Note that to handle arm32, you will also need to exclude the xenheap
> area.
> >
> > When I implement the code, I found that the arm32 Xenheap excluding
> logic
> > somehow can be reused.
> >
> > So I think I tried to reuse as much as current code. Would below
> > populate_boot_allocator() seem ok to you?
>
> I would prefer if they are separate because the logic can be simplified
> when using the static heap (the xenheap cannot across a region).
I think whether separate this logic or not is personal taste, I did miss
the "xenheap cannot across the bank" part so I agree your suggestion
is better, but I think...
>
> Something like:
>
> for ( i = 0; i < banks->nr_banks; i++ )
> {
>
> #ifdef CONFIG_ARM_32
> if ( (bank_start >= mfn_to_maddr(direct_mfn_start) &&
> bank_end < mfn_to_maddr(direct_mfn_start) )
... this is probably wrong or I misunderstood? IMHO the xenheap
is always smaller (or equal) than the bank, based on the logic that
finding a contiguous xenheap in a bank.
So the code I propose would be:
```
@@ -712,12 +712,37 @@ static void __init populate_boot_allocator(void)
{
unsigned int i;
const struct meminfo *banks = &bootinfo.mem;
+ paddr_t s, e;
+
+ if ( bootinfo.static_heap )
+ {
+ for ( i = 0 ; i < bootinfo.reserved_mem.nr_banks; i++ )
+ {
+ if ( bootinfo.reserved_mem.bank[i].type != MEMBANK_STATIC_HEAP )
+ continue;
+
+ s = bootinfo.reserved_mem.bank[i].start;
+ e = s + bootinfo.reserved_mem.bank[i].size;
+#ifdef CONFIG_ARM_32
+ /* Avoid the xenheap, note that the xenheap cannot across a bank */
+ if ( s <= mfn_to_maddr(directmap_mfn_start) &&
+ e >= mfn_to_maddr(directmap_mfn_end) )
+ {
+ init_boot_pages(s, mfn_to_maddr(directmap_mfn_start));
+ init_boot_pages(mfn_to_maddr(directmap_mfn_end), e);
+ }
+ else
+#endif
+ init_boot_pages(s, e);
+ }
+
+ return;
+ }
for ( i = 0; i < banks->nr_banks; i++ )
/* The original logic in populate_boot_allocator()*/
```
Kind regards,
Henry
|