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

RE: [PATCH v1 06/13] xen/arm: assign shared memory to owner when host address not provided


  • To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Penny Zheng <Penny.Zheng@xxxxxxx>
  • Date: Mon, 9 Jan 2023 11:58:28 +0000
  • Accept-language: en-US
  • 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=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=mso8kklQ8Xtd7MdJcZvsl0oNwRmlZTQARRAzdSnXFls=; b=M9by6Y/Xf43w6XylRpIvTLgWIKHiGm4eKszfjPFjra5Ggj3c68jzY+KbXMQN4yDE14cOj6QnVRegjfCGwlRUotC/jfTVr7mzVEYs74Vh8faj67Tfd9F/EntaM9M9JHL0OjWZVtrTCrGD4BDBIUVm4IxYvV9RCNTfHSjKEIdoq30KzHjBtUQSLeVZwwdAs85N0f9Enkz0CNKSmW6fzGxj2gVjLBG8Z2NnX0kvI8so833RL9Wz2zidZI5FziOOUtr99Ta5euFJf7nXKZ7DJq3fG/nR+RxgQFt+Np2NQl/dWfyQ8DyQEa/VJdIxbds7DjSfAQQzh9e9wfvjWhcynAHVsg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fh6bQe1ISWjVQz5sKuDjU5rYItbpkwoojcdYRAJVp2P5OIukw9CUbzZWy7wIHsaA/Oo/tFxvq9m8eHiKUYRyIIy4PJ4AdRG3jC21ZmNnEk2LYo1V0HG5Cy+So2QMVzoe7RU6JUqQxR6so8+qnYwjZ/x59c6XU3zZZHRWBHSrNvqtJUeS9ohgmrdfo34Q1eLTCqrzPb5zWr1k6k75F3WaYugUJfW8ookD3fXwJlxAQfWXuXSvXNr7P44LZ3jisLi4T2Bq4swmYD9sdVP+t0UsQYpnu4ET3CYShmcqLluOngh+T7jLzrSg+1H+xzHb/YxXE7sKWvCdr4edE6amEEiG3Q==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Mon, 09 Jan 2023 11:58:57 +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: AQHY+J1pmmYEajWz5UynKX+c5rdEZK6UzwiAgAEQoXCAAGGAAIAACRWA
  • Thread-topic: [PATCH v1 06/13] xen/arm: assign shared memory to owner when host address not provided

> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Sent: Monday, January 9, 2023 6:58 PM
> To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>;
> Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> Subject: Re: [PATCH v1 06/13] xen/arm: assign shared memory to owner
> when host address not provided
> 
> 
> 
> On 09/01/2023 07:49, Penny Zheng wrote:
> > Hi Julien
> 
> Hi Penny,
> 
> > Happy new year~~~~
> 
> Happy new year too!
> 
> >> -----Original Message-----
> >> From: Julien Grall <julien@xxxxxxx>
> >> Sent: Sunday, January 8, 2023 8:53 PM
> >> To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-
> devel@xxxxxxxxxxxxxxxxxxxx
> >> Cc: Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini
> >> <sstabellini@xxxxxxxxxx>; Bertrand Marquis
> >> <Bertrand.Marquis@xxxxxxx>; Volodymyr Babchuk
> >> <Volodymyr_Babchuk@xxxxxxxx>
> >> Subject: Re: [PATCH v1 06/13] xen/arm: assign shared memory to owner
> >> when host address not provided
> >>
> >> Hi,
> >>
> >
> > A few concerns explained why I didn't choose "struct meminfo" over two
> > pointers "struct membank*" and "struct meminfo*".
> > 1) memory usage is the main reason.
> > If we use "struct meminfo" over the current "struct membank*" and
> > "struct meminfo*", "struct shm_meminfo" will become a array of 256
> > "struct shm_membank", with "struct shm_membank" being also an 256-
> item
> > array, that is 256 * 256, too big for a structure and If I remembered 
> > clearly,
> it will lead to "more than PAGE_SIZE" compiling error.
> 
> I am not aware of any place where we would restrict the size of kinfo in
> upstream. Can you give me a pointer?
> 

If I remembered correctly, my first version of "struct shm_meminfo" is this
"big"(256 * 256) structure, and it leads to the whole xen binary is bigger than 
2MB. ;\

> > FWIT, either reworking meminfo or using a different structure, are
> > both leading to sizing down the array, hmmm, I don't know which size
> > is suitable. That's why I prefer pointer and dynamic allocation.
> 
> I would expect that in most cases, you will need only one bank when the host
> address is not provided. So I think this is a bit odd to me to impose a 
> "large"
> allocation for them.
> 

Only if user is not defining size as something like (2^a + 2^b + 2^c + ...). ;\
So maybe 8 or 16 is enough?
struct new_meminfo {
    unsigned int nr_banks;
    struct membank bank[8];
};

Correct me if I'm wrong:
The "struct shm_membank" you are suggesting is looking like this, right?
struct shm_membank {
    char shm_id[MAX_SHM_ID_LENGTH];
    unsigned int nr_shm_borrowers;
    struct new_meminfo shm_banks;
    unsigned long total_size;
};
Let me try~

> > 2) If we use "struct meminfo*" over the current "struct membank*" and
> > "struct meminfo*", we will need a new flag to differentiate two
> > scenarios(host address provided or not), As the special case "struct
> membank*" is already helping us differentiate.
> > And since when host address is provided, the related "struct membank"
> > also needs to be reserved in "bootinfo.reserved_mem". That's why I
> > used pointer " struct membank*" to avoid memory waste.
> 
> I am confused... Today you are defining as:
> 
> struct {
>      struct membank *;
>      struct {
>         struct meminfo *;
>         unsigned long total_size;
>      }
> }
> 
> So on arm64 host, you would use 24 bytes. If we were using an union instead.
> We would use 16 bytes. Adding a 32-bit fields, would bring to
> 20 bytes (assuming we can re-use a padding).
> 
> Therefore, there is no memory waste here with a flag...
> 
> Cheers,
> 
> --
> Julien Grall

 


Rackspace

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