[5/5] libxl/PCI: align reserved device memory boundary for HAP guests
diff mbox series

Message ID 2a9a998e-f2d0-3c07-e85e-7fdda18b506e@suse.com
State New
Headers show
Series
  • libxl/PCI: reserved device memory adjustments
Related show

Commit Message

Jan Beulich Feb. 18, 2020, 3:47 p.m. UTC
As the code comment says, this will allow use of a 2Mb super page
mapping at the end of "low" memory.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Comments

Wei Liu Feb. 20, 2020, 11:43 a.m. UTC | #1
On Tue, Feb 18, 2020 at 04:47:49PM +0100, Jan Beulich wrote:
> As the code comment says, this will allow use of a 2Mb super page
> mapping at the end of "low" memory.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/tools/libxl/libxl_dm.c
> +++ b/tools/libxl/libxl_dm.c
> @@ -563,6 +563,13 @@ int libxl__domain_device_construct_rdm(l
>          /* Just check if RDM > our memory boundary. */
>          if (rdm_start > rdm_mem_boundary) {
>              /*
> +             * For HAP guests round down to a 2Mb boundary to allow use
> +             * of large page mappings.
> +             */
> +            if (libxl_defbool_val(d_config->c_info.hap)
> +                && rdm_start > 0x200000)

Please use MB(2) here.

With this fixed:

Acked-by: Wei Liu <wl@xen.org>
Jan Beulich Feb. 20, 2020, 11:45 a.m. UTC | #2
On 20.02.2020 12:43, Wei Liu wrote:
> On Tue, Feb 18, 2020 at 04:47:49PM +0100, Jan Beulich wrote:
>> As the code comment says, this will allow use of a 2Mb super page
>> mapping at the end of "low" memory.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> --- a/tools/libxl/libxl_dm.c
>> +++ b/tools/libxl/libxl_dm.c
>> @@ -563,6 +563,13 @@ int libxl__domain_device_construct_rdm(l
>>          /* Just check if RDM > our memory boundary. */
>>          if (rdm_start > rdm_mem_boundary) {
>>              /*
>> +             * For HAP guests round down to a 2Mb boundary to allow use
>> +             * of large page mappings.
>> +             */
>> +            if (libxl_defbool_val(d_config->c_info.hap)
>> +                && rdm_start > 0x200000)
> 
> Please use MB(2) here.

Will do, but then what about the ~0x1fffff on the next line? Should
this become ~(MB(2) - 1)?

> With this fixed:
> 
> Acked-by: Wei Liu <wl@xen.org>

Thanks.

Jan
Wei Liu Feb. 20, 2020, 11:48 a.m. UTC | #3
On Thu, Feb 20, 2020 at 12:45:54PM +0100, Jan Beulich wrote:
> On 20.02.2020 12:43, Wei Liu wrote:
> > On Tue, Feb 18, 2020 at 04:47:49PM +0100, Jan Beulich wrote:
> >> As the code comment says, this will allow use of a 2Mb super page
> >> mapping at the end of "low" memory.
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> >>
> >> --- a/tools/libxl/libxl_dm.c
> >> +++ b/tools/libxl/libxl_dm.c
> >> @@ -563,6 +563,13 @@ int libxl__domain_device_construct_rdm(l
> >>          /* Just check if RDM > our memory boundary. */
> >>          if (rdm_start > rdm_mem_boundary) {
> >>              /*
> >> +             * For HAP guests round down to a 2Mb boundary to allow use
> >> +             * of large page mappings.
> >> +             */
> >> +            if (libxl_defbool_val(d_config->c_info.hap)
> >> +                && rdm_start > 0x200000)
> > 
> > Please use MB(2) here.
> 
> Will do, but then what about the ~0x1fffff on the next line? Should
> this become ~(MB(2) - 1)?

Yes that would be good too.

Wei.

Patch
diff mbox series

--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -563,6 +563,13 @@  int libxl__domain_device_construct_rdm(l
         /* Just check if RDM > our memory boundary. */
         if (rdm_start > rdm_mem_boundary) {
             /*
+             * For HAP guests round down to a 2Mb boundary to allow use
+             * of large page mappings.
+             */
+            if (libxl_defbool_val(d_config->c_info.hap)
+                && rdm_start > 0x200000)
+                rdm_start &= ~0x1fffff;
+            /*
              * We will move downwards lowmem_end so we have to expand
              * highmem_end.
              */