Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-03-04 Thread Henry Wang
Hi Julien, On 3/5/2024 2:38 AM, Julien Grall wrote: On 01/03/2024 03:03, Henry Wang wrote: Hi Julien, Hi Henry, On 2/28/2024 8:27 PM, Julien Grall wrote: Hi Henry, ...here basically means we want to do the finding of the unused region in toolstack. Since currently what we care about is

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-03-04 Thread Julien Grall
On 01/03/2024 03:03, Henry Wang wrote: Hi Julien, Hi Henry, On 2/28/2024 8:27 PM, Julien Grall wrote: Hi Henry, ...here basically means we want to do the finding of the unused region in toolstack. Since currently what we care about is only a couple of pages instead of the whole memory

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-29 Thread Henry Wang
Hi Julien, On 2/28/2024 8:27 PM, Julien Grall wrote: Hi Henry, ...here basically means we want to do the finding of the unused region in toolstack. Since currently what we care about is only a couple of pages instead of the whole memory map, could it be possible that we do the opposite: in

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-28 Thread Henry Wang
Hi Julien, On 2/28/2024 8:27 PM, Julien Grall wrote: Hi Henry, After checking the code flow, below rough plan came to my mind, I think what we need to do is: (1) Find a range of un-used memory using similar method in find_unallocated_memory()/find_domU_holes() AFAIK, the toolstack doesn't

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-28 Thread Julien Grall
Hi Henry, On 28/02/2024 11:53, Henry Wang wrote: On 2/28/2024 6:35 PM, Julien Grall wrote: Hi Henry, Force populate_physmap to take the "normal" memory allocation route for the magic pages even for 1:1 Dom0less DomUs. This should work as long as the 1:1 Dom0less DomU doesn't have anything

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-28 Thread Henry Wang
Hi Julien, On 2/28/2024 6:35 PM, Julien Grall wrote: Hi Henry, Force populate_physmap to take the "normal" memory allocation route for the magic pages even for 1:1 Dom0less DomUs. This should work as long as the 1:1 Dom0less DomU doesn't have anything else mapped at the same guest address

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-28 Thread Julien Grall
Hi Henry, On 27/02/2024 13:17, Henry Wang wrote: (-RISC-V and PPC people to avoid spamming their inbox as this is quite Arm specific) Hi Julien, On 2/26/2024 5:13 PM, Julien Grall wrote: Hi Henry, Welcome back! Thanks! On 26/02/2024 01:19, Henry Wang wrote: An error message can seen

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-27 Thread Henry Wang
Hi Jan, On 2/27/2024 9:51 PM, Jan Beulich wrote: On 27.02.2024 14:35, Henry Wang wrote: Hi Jan, On 2/27/2024 9:27 PM, Jan Beulich wrote: On 27.02.2024 14:24, Henry Wang wrote: On 2/26/2024 4:25 PM, Jan Beulich wrote: On 26.02.2024 02:19, Henry Wang wrote: --- a/xen/common/memory.c +++

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-27 Thread Jan Beulich
On 27.02.2024 14:35, Henry Wang wrote: > Hi Jan, > > On 2/27/2024 9:27 PM, Jan Beulich wrote: >> On 27.02.2024 14:24, Henry Wang wrote: >>> On 2/26/2024 4:25 PM, Jan Beulich wrote: On 26.02.2024 02:19, Henry Wang wrote: > --- a/xen/common/memory.c > +++ b/xen/common/memory.c > @@

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-27 Thread Henry Wang
Hi Jan, On 2/27/2024 9:27 PM, Jan Beulich wrote: On 27.02.2024 14:24, Henry Wang wrote: On 2/26/2024 4:25 PM, Jan Beulich wrote: On 26.02.2024 02:19, Henry Wang wrote: --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -219,7 +219,7 @@ static void populate_physmap(struct memop_args *a)

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-27 Thread Henry Wang
Hi Michal, On 2/26/2024 6:29 PM, Michal Orzel wrote: Hi Henry, On 26/02/2024 02:19, Henry Wang wrote: An error message can seen from the init-dom0less application on direct-mapped 1:1 domains: ``` Allocating magic pages memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1 Error on alloc magic

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-27 Thread Jan Beulich
On 27.02.2024 14:24, Henry Wang wrote: > On 2/26/2024 4:25 PM, Jan Beulich wrote: >> On 26.02.2024 02:19, Henry Wang wrote: >>> --- a/xen/common/memory.c >>> +++ b/xen/common/memory.c >>> @@ -219,7 +219,7 @@ static void populate_physmap(struct memop_args *a) >>> } >>> else >>>

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-27 Thread Henry Wang
Hi Jan, On 2/26/2024 4:25 PM, Jan Beulich wrote: On 26.02.2024 02:19, Henry Wang wrote: --- a/xen/arch/arm/include/asm/mm.h +++ b/xen/arch/arm/include/asm/mm.h @@ -428,6 +428,19 @@ static inline void page_set_xenheap_gfn(struct page_info *p, gfn_t gfn) } while ( (y =

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-27 Thread Henry Wang
(-RISC-V and PPC people to avoid spamming their inbox as this is quite Arm specific) Hi Julien, On 2/26/2024 5:13 PM, Julien Grall wrote: Hi Henry, Welcome back! Thanks! On 26/02/2024 01:19, Henry Wang wrote: An error message can seen from the init-dom0less application on direct-mapped

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-26 Thread Michal Orzel
Hi Henry, On 26/02/2024 02:19, Henry Wang wrote: > An error message can seen from the init-dom0less application on > direct-mapped 1:1 domains: > ``` > Allocating magic pages > memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1 > Error on alloc magic pages > ``` > > This is because

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-26 Thread Julien Grall
Hi Henry, Welcome back! On 26/02/2024 01:19, Henry Wang wrote: An error message can seen from the init-dom0less application on direct-mapped 1:1 domains: ``` Allocating magic pages memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1 Error on alloc magic pages ``` This is because

Re: [PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-26 Thread Jan Beulich
On 26.02.2024 02:19, Henry Wang wrote: > --- a/xen/arch/arm/include/asm/mm.h > +++ b/xen/arch/arm/include/asm/mm.h > @@ -428,6 +428,19 @@ static inline void page_set_xenheap_gfn(struct page_info > *p, gfn_t gfn) > } while ( (y = cmpxchg(>u.inuse.type_info, x, nx)) != x ); > } > > +#define

[PATCH] xen/common: Do not allocate magic pages 1:1 for direct mapped domains

2024-02-25 Thread Henry Wang
An error message can seen from the init-dom0less application on direct-mapped 1:1 domains: ``` Allocating magic pages memory.c:238:d0v0 mfn 0x39000 doesn't belong to d1 Error on alloc magic pages ``` This is because populate_physmap() automatically assumes gfn == mfn for direct mapped domains.