xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: Oleksandr <olekstysh@gmail.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	xen-devel@lists.xenproject.org,
	"Oleksandr Tyshchenko" <oleksandr_tyshchenko@epam.com>,
	"Daniel De Graaf" <dgdegra@tycho.nsa.gov>,
	"Daniel P. Smith" <dpsmith@apertussolutions.com>,
	"Ian Jackson" <iwj@xenproject.org>, "Wei Liu" <wl@xen.org>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Wei Chen" <Wei.Chen@arm.com>
Subject: Re: [RFC PATCH] xen/memory: Introduce a hypercall to provide unallocated space
Date: Thu, 5 Aug 2021 18:25:46 +0100	[thread overview]
Message-ID: <cb1c8fd4-a4c5-c18e-c8db-f8e317d95526@xen.org> (raw)
In-Reply-To: <775a2c0b-fbcc-db6d-c2a1-4ad350448c92@gmail.com>

Hi Oleksandr,

On 05/08/2021 15:52, Oleksandr wrote:
> 
> On 05.08.21 01:00, Julien Grall wrote:
>>
>>
>> On 04/08/2021 21:56, Oleksandr wrote:
>>>
>>> Hi Julien, Stefano.
>>
>> Hi Oleksandr,
> 
> 
> Hi, Julien
> 
> 
> Thank you for the prompt reply and explanations.
> 
> 
>>
>>>
>>> On 02.08.21 22:12, Oleksandr wrote:
>>> I have done some experiments with Xen and toolstack according to the 
>>> discussion above. So, I re-used DTB to pass a safe range to the 
>>> domain. For the range I borrowed some space from the second RAM bank.
>>>
>>> -#define GUEST_RAM1_BASE   xen_mk_ullong(0x0200000000) /* 1016GB of 
>>> RAM @ 8GB */
>>> -#define GUEST_RAM1_SIZE   xen_mk_ullong(0xfe00000000)
>>> +#define GUEST_RAM1_BASE   xen_mk_ullong(0x0200000000) /* 888GB of 
>>> RAM @ 8GB */
>>> +#define GUEST_RAM1_SIZE   xen_mk_ullong(0xDE00000000)
>>> +
>>
>> I am a bit split with reducing the amount of RAM. On one hand large 
>> guest is not unheard on the server side (at least in the x86 world). 
>> On the other hand, I am not aware of anyone using Xen on Arm in such 
>> setup.
>>
>> So technically this will be a regression, but it may be OK.
> 
> I got it.
> 
> 
>>
>>
>> Regarding the range, this will be a problem as Xen configure the 
>> number of the IPA bits based on the PA bits. The lowest possible 
>> address space ize on 64-bit is 4GB.
>>
>> From my understanding, this is because the number of IPA bits 
>> supported is contrained by the PA bits. So the position and the size 
>> of the region
>> would need to depend on the P2M configuration.
> 
> Indeed, I missed these bits that IPA bits on Arm64 might be < 40 bit, I 
> remember, we select p2m_ipa_bits in setup_virt_paging() depending on 
> pabits, moreover the p2m_ipa_bits might be even restricted by some 
> external entity (IOMMU, if P2M is shared).
> 
> 
>>
>> For simplicity, this could be the last few X bytes of the supported 
>> address space.
> ok, agree. To summarize, so it sounds like we can't use the fixed safe 
> range as in my example, it must be variable. Well, I hope, we will be 
> able to achieve this without reducing the total amount of domain RAM in 
> front (GUEST_RAM1_SIZE). After all, we know the IPA size and the domain 
> RAM in advance, so we certainly can choose the start and size of the 
> range. In case, we won't be able to find a suitable large chunk (for 
> example, when IPA bits = 32, and domain has a lot of RAM assigned and as 
> the result - almost all address space below 4GB is in use), we won't 
> expose a safe range to a domain at all, and domain will just fall back 
> to use real pages instead (actually, how it currently behaves on Arm).

I think it would be fine for a first approach. We can refine it in the 
future. What matters is that we correctly define the binding/hypercall.

> 
> A side note: we would likely need the toolstack (that generates 
> device-tree for guests) to query IPA size, or similar.

I think we can use XEN_SYSCTL_* (or possibly hypfs) for that.

>>
>>
>> For 32-bit domain, we also need to make sure the address is usable for 
>> domain short page tables (not too long ago Debian was shipping the 
>> kernel with them rather than LPAE). I haven't yet checked what's the 
>> limit here.
> 
> Hmm, I didn't take this use-case into the account. So, I assume we need 
> the safe range to be located below 4GB if is_32bit_domain() returns true.

Yes. Or we can say that if you are using a 32-bit domain then we don't 
(yet) support a safe range for range.
>> So we would need some heuristic to decide whether to stole some RAM or 
>> use the safe space.
>> Another possibility would be to add a new compatible in the DT that 
>> indicates the region is "big" enough.
> I like the last idea, did you perhaps mean new property (optional) 
> rather than new compatible? Let's say "xen, safe-range" or "xen, 
> extended-regions"  ...

I actually meant adding an extra compatible because this is technically 
a change of the binding (even though it is backward compatible).

Although, I would be OK with the property. You may first want to ask the 
Device-Tree folks how they expect a binding to be extended in a backward 
compatible way.

Cheers,

-- 
Julien Grall


  reply	other threads:[~2021-08-05 17:26 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 16:18 [RFC PATCH] xen/memory: Introduce a hypercall to provide unallocated space Oleksandr Tyshchenko
2021-07-28 17:06 ` Oleksandr
2021-07-28 17:19 ` Andrew Cooper
2021-07-28 17:27   ` Julien Grall
2021-07-28 19:00     ` Andrew Cooper
2021-07-28 19:53       ` Julien Grall
2021-07-30 16:13         ` Oleksandr
2021-07-30 23:57           ` Stefano Stabellini
2021-08-02 19:12             ` Oleksandr
2021-08-04 20:56               ` Oleksandr
2021-08-04 22:00                 ` Julien Grall
2021-08-05 14:52                   ` Oleksandr
2021-08-05 17:25                     ` Julien Grall [this message]
2021-08-05 20:48                       ` Oleksandr
2021-08-06  0:20                       ` Stefano Stabellini
2021-08-06 18:03                         ` Oleksandr
2021-08-13 23:49                       ` Oleksandr
2021-08-06  0:30                   ` Stefano Stabellini
2021-08-07 17:03                     ` Oleksandr
2021-08-09 15:42                       ` Julien Grall
2021-08-09 18:24                         ` Oleksandr
2021-08-09 20:45                           ` Julien Grall
2021-08-09 21:18                             ` Oleksandr
2021-08-10 16:28                               ` Julien Grall
2021-08-10 17:03                                 ` Oleksandr
2021-08-17 17:53                                   ` Julien Grall
2021-08-17 17:54                                     ` Julien Grall
2021-08-27 20:34                                       ` Oleksandr
2021-08-10  6:34                           ` Wei Chen
2021-08-10 11:58                             ` Oleksandr
2021-08-10 16:21                               ` Julien Grall
2021-08-10 16:49                                 ` Oleksandr
2021-08-09 14:51                   ` Julien Grall
2021-08-09 17:14                     ` Oleksandr
2021-08-09 17:18                       ` Julien Grall
2021-08-09 17:49                         ` Oleksandr
2021-08-13 21:45                     ` Oleksandr
2021-08-03 12:53           ` Jan Beulich
2021-08-04 19:18             ` Oleksandr
2021-08-05  5:58               ` Jan Beulich
2021-08-05 15:10                 ` Oleksandr
2021-08-03 12:49         ` Jan Beulich
2021-08-03 12:53           ` Julien Grall
2021-08-17 17:59           ` Julien Grall
2021-08-05 15:03 ` Daniel P. Smith
2021-08-05 15:59   ` Oleksandr
2021-08-05 16:37     ` Daniel P. Smith
2021-08-05 21:56       ` Oleksandr
2021-08-06  6:09       ` Jan Beulich
2021-08-06 15:08         ` Daniel P. Smith
2021-09-07  8:53 ` Henry Wang
2021-09-07 21:34   ` Oleksandr

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb1c8fd4-a4c5-c18e-c8db-f8e317d95526@xen.org \
    --to=julien@xen.org \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=Wei.Chen@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=dpsmith@apertussolutions.com \
    --cc=george.dunlap@citrix.com \
    --cc=iwj@xenproject.org \
    --cc=jbeulich@suse.com \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=olekstysh@gmail.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).