mbox series

[for-4.19,v3,0/3] xen/x86: support foreign mappings for HVM/PVH

Message ID 20240517133352.94347-1-roger.pau@citrix.com (mailing list archive)
Headers show
Series xen/x86: support foreign mappings for HVM/PVH | expand

Message

Roger Pau Monné May 17, 2024, 1:33 p.m. UTC
Hello,

The following series attempts to solve a shortcoming of HVM/PVH guests
with the lack of support for foreign mappings.  Such lack of support
prevents using PVH based guests as stubdomains for example.

Add support in a way similar to how it's done on Arm, by iterating over
the p2m based on the maximum gfn.

Patch 2 is not strictly needed.  Moving the enablement of altp2m from an
HVM param to a create domctl flag avoids any possible race with the HVM
param changing after it's been evaluated.  Note the param can only be
set by the control domain, and libxl currently sets it at domain
create.  Also altp2m enablement is different from activation, as
activation does happen during runtime of the domain.

Thanks, Roger.

Roger Pau Monne (3):
  xen/x86: account number of foreign mappings in the p2m
  xen/x86: enable altp2m at create domain domctl
  xen/x86: remove foreign mappings from the p2m on teardown

 CHANGELOG.md                        |  1 +
 tools/libs/light/libxl_create.c     | 23 +++++++++-
 tools/libs/light/libxl_x86.c        | 26 +++++------
 tools/ocaml/libs/xc/xenctrl_stubs.c |  2 +-
 xen/arch/arm/domain.c               |  6 +++
 xen/arch/x86/domain.c               | 28 ++++++++++++
 xen/arch/x86/hvm/hvm.c              | 23 +++++++++-
 xen/arch/x86/include/asm/p2m.h      | 32 +++++++++-----
 xen/arch/x86/mm/p2m-basic.c         | 18 ++++++++
 xen/arch/x86/mm/p2m.c               | 68 +++++++++++++++++++++++++++--
 xen/include/public/domctl.h         | 20 ++++++++-
 xen/include/public/hvm/params.h     |  9 +---
 12 files changed, 215 insertions(+), 41 deletions(-)

Comments

Jan Beulich May 29, 2024, 7:24 a.m. UTC | #1
On 17.05.2024 15:33, Roger Pau Monne wrote:
> Hello,
> 
> The following series attempts to solve a shortcoming of HVM/PVH guests
> with the lack of support for foreign mappings.  Such lack of support
> prevents using PVH based guests as stubdomains for example.
> 
> Add support in a way similar to how it's done on Arm, by iterating over
> the p2m based on the maximum gfn.
> 
> Patch 2 is not strictly needed.  Moving the enablement of altp2m from an
> HVM param to a create domctl flag avoids any possible race with the HVM
> param changing after it's been evaluated.  Note the param can only be
> set by the control domain, and libxl currently sets it at domain
> create.  Also altp2m enablement is different from activation, as
> activation does happen during runtime of the domain.
> 
> Thanks, Roger.
> 
> Roger Pau Monne (3):
>   xen/x86: account number of foreign mappings in the p2m
>   xen/x86: enable altp2m at create domain domctl
>   xen/x86: remove foreign mappings from the p2m on teardown

Here, too, I'd like to ask whether to keep this as a candidate for 4.19, or
whether to postpone. Afaict what's still missing are Arm and tool chain acks
on patch 2.

Jan

>  CHANGELOG.md                        |  1 +
>  tools/libs/light/libxl_create.c     | 23 +++++++++-
>  tools/libs/light/libxl_x86.c        | 26 +++++------
>  tools/ocaml/libs/xc/xenctrl_stubs.c |  2 +-
>  xen/arch/arm/domain.c               |  6 +++
>  xen/arch/x86/domain.c               | 28 ++++++++++++
>  xen/arch/x86/hvm/hvm.c              | 23 +++++++++-
>  xen/arch/x86/include/asm/p2m.h      | 32 +++++++++-----
>  xen/arch/x86/mm/p2m-basic.c         | 18 ++++++++
>  xen/arch/x86/mm/p2m.c               | 68 +++++++++++++++++++++++++++--
>  xen/include/public/domctl.h         | 20 ++++++++-
>  xen/include/public/hvm/params.h     |  9 +---
>  12 files changed, 215 insertions(+), 41 deletions(-)
>
Oleksii Kurochko May 29, 2024, 7:41 a.m. UTC | #2
On Wed, 2024-05-29 at 09:24 +0200, Jan Beulich wrote:
> On 17.05.2024 15:33, Roger Pau Monne wrote:
> > Hello,
> > 
> > The following series attempts to solve a shortcoming of HVM/PVH
> > guests
> > with the lack of support for foreign mappings.  Such lack of
> > support
> > prevents using PVH based guests as stubdomains for example.
> > 
> > Add support in a way similar to how it's done on Arm, by iterating
> > over
> > the p2m based on the maximum gfn.
> > 
> > Patch 2 is not strictly needed.  Moving the enablement of altp2m
> > from an
> > HVM param to a create domctl flag avoids any possible race with the
> > HVM
> > param changing after it's been evaluated.  Note the param can only
> > be
> > set by the control domain, and libxl currently sets it at domain
> > create.  Also altp2m enablement is different from activation, as
> > activation does happen during runtime of the domain.
> > 
> > Thanks, Roger.
> > 
> > Roger Pau Monne (3):
> >   xen/x86: account number of foreign mappings in the p2m
> >   xen/x86: enable altp2m at create domain domctl
> >   xen/x86: remove foreign mappings from the p2m on teardown
> 
> Here, too, I'd like to ask whether to keep this as a candidate for
> 4.19, or
> whether to postpone. Afaict what's still missing are Arm and tool
> chain acks
> on patch 2.
We can consider to have this patch series in 4.19:
 Release-acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

~ Oleksii
> 
> Jan
> 
> >  CHANGELOG.md                        |  1 +
> >  tools/libs/light/libxl_create.c     | 23 +++++++++-
> >  tools/libs/light/libxl_x86.c        | 26 +++++------
> >  tools/ocaml/libs/xc/xenctrl_stubs.c |  2 +-
> >  xen/arch/arm/domain.c               |  6 +++
> >  xen/arch/x86/domain.c               | 28 ++++++++++++
> >  xen/arch/x86/hvm/hvm.c              | 23 +++++++++-
> >  xen/arch/x86/include/asm/p2m.h      | 32 +++++++++-----
> >  xen/arch/x86/mm/p2m-basic.c         | 18 ++++++++
> >  xen/arch/x86/mm/p2m.c               | 68
> > +++++++++++++++++++++++++++--
> >  xen/include/public/domctl.h         | 20 ++++++++-
> >  xen/include/public/hvm/params.h     |  9 +---
> >  12 files changed, 215 insertions(+), 41 deletions(-)
> > 
>
Julien Grall May 29, 2024, 12:21 p.m. UTC | #3
Hi Jan,

On 29/05/2024 08:24, Jan Beulich wrote:
> On 17.05.2024 15:33, Roger Pau Monne wrote:
>> Hello,
>>
>> The following series attempts to solve a shortcoming of HVM/PVH guests
>> with the lack of support for foreign mappings.  Such lack of support
>> prevents using PVH based guests as stubdomains for example.
>>
>> Add support in a way similar to how it's done on Arm, by iterating over
>> the p2m based on the maximum gfn.
>>
>> Patch 2 is not strictly needed.  Moving the enablement of altp2m from an
>> HVM param to a create domctl flag avoids any possible race with the HVM
>> param changing after it's been evaluated.  Note the param can only be
>> set by the control domain, and libxl currently sets it at domain
>> create.  Also altp2m enablement is different from activation, as
>> activation does happen during runtime of the domain.
>>
>> Thanks, Roger.
>>
>> Roger Pau Monne (3):
>>    xen/x86: account number of foreign mappings in the p2m
>>    xen/x86: enable altp2m at create domain domctl
>>    xen/x86: remove foreign mappings from the p2m on teardown
> 
> Here, too, I'd like to ask whether to keep this as a candidate for 4.19, or
> whether to postpone. Afaict what's still missing are Arm and tool chain acks
> on patch 2.

Stefano already provided an Ack [1], so the Arm part is now covered.

I am also guessing you meant "tools change" rather than "tool chain". 
Anthony is away at the moment. But this was reviewed by Juergen.

Oleksii also release-ack the series, so I think it would be fine to 
merge it.

Cheers,

[1] 
https://lore.kernel.org/xen-devel/8e9a563f1e0f45883502bc47c4942081a5d66e1a.camel@gmail.com/T/#mdcb3e89046f817bd1b98190baa2b6d6b04e1ec05

> 
> Jan
> 
>>   CHANGELOG.md                        |  1 +
>>   tools/libs/light/libxl_create.c     | 23 +++++++++-
>>   tools/libs/light/libxl_x86.c        | 26 +++++------
>>   tools/ocaml/libs/xc/xenctrl_stubs.c |  2 +-
>>   xen/arch/arm/domain.c               |  6 +++
>>   xen/arch/x86/domain.c               | 28 ++++++++++++
>>   xen/arch/x86/hvm/hvm.c              | 23 +++++++++-
>>   xen/arch/x86/include/asm/p2m.h      | 32 +++++++++-----
>>   xen/arch/x86/mm/p2m-basic.c         | 18 ++++++++
>>   xen/arch/x86/mm/p2m.c               | 68 +++++++++++++++++++++++++++--
>>   xen/include/public/domctl.h         | 20 ++++++++-
>>   xen/include/public/hvm/params.h     |  9 +---
>>   12 files changed, 215 insertions(+), 41 deletions(-)
>>
>