[PATCH v4 3/7] xen/evtchn: restrict the maximum number of evtchn supported for domUs

Rahul Singh posted 7 patches 3 years, 5 months ago
Only 6 patches received!
There is a newer version of this series
[PATCH v4 3/7] xen/evtchn: restrict the maximum number of evtchn supported for domUs
Posted by Rahul Singh 3 years, 5 months ago
Restrict the maximum number of evtchn supported for domUs to avoid
allocating a large amount of memory in Xen.

Set the default value of max_evtchn_port to 1023. The value of 1023
should be sufficient for domUs guests because on ARM we don't bind
physical interrupts to event channels. The only use of the evtchn port
is inter-domain communications. Another reason why we choose the value
of 1023 to follow the default behavior of libxl.

Signed-off-by: Rahul Singh <rahul.singh@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
Changes in v4:
 - fix minor comments in commit msg
 - Added Michal Reviewed-by
Changes in v3:
 - added in commit msg why we set the max_evtchn_port value to 1023.
 - added the comment in code also why we set the max_evtchn_port to 1023
 - remove the define and set the value to 1023 in code directly.
Changes in v2:
 - new patch in the version
---
 xen/arch/arm/domain_build.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 3fd1186b53..fde133cd94 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -3277,7 +3277,13 @@ void __init create_domUs(void)
         struct xen_domctl_createdomain d_cfg = {
             .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
             .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
-            .max_evtchn_port = -1,
+            /*
+             * The default of 1023 should be sufficient for domUs guests
+             * because on ARM we don't bind physical interrupts to event
+             * channels. The only use of the evtchn port is inter-domain
+             * communications.
+             */
+            .max_evtchn_port = 1023,
             .max_grant_frames = -1,
             .max_maptrack_frames = -1,
             .grant_opts = XEN_DOMCTL_GRANT_version(opt_gnttab_max_version),
-- 
2.25.1
Re: [PATCH v4 3/7] xen/evtchn: restrict the maximum number of evtchn supported for domUs
Posted by Julien Grall 3 years, 5 months ago

On 06/09/2022 14:40, Rahul Singh wrote:
> Restrict the maximum number of evtchn supported for domUs to avoid
> allocating a large amount of memory in Xen.
> 
> Set the default value of max_evtchn_port to 1023. The value of 1023
> should be sufficient for domUs guests because on ARM we don't bind

To me, domUs and guests mean the same. So s/guests//

> physical interrupts to event channels. The only use of the evtchn port
> is inter-domain communications. Another reason why we choose the value
> of 1023 to follow the default behavior of libxl.
> 
> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
> ---
> Changes in v4:
>   - fix minor comments in commit msg
>   - Added Michal Reviewed-by
> Changes in v3:
>   - added in commit msg why we set the max_evtchn_port value to 1023.
>   - added the comment in code also why we set the max_evtchn_port to 1023
>   - remove the define and set the value to 1023 in code directly.
> Changes in v2:
>   - new patch in the version
> ---
>   xen/arch/arm/domain_build.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 3fd1186b53..fde133cd94 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -3277,7 +3277,13 @@ void __init create_domUs(void)
>           struct xen_domctl_createdomain d_cfg = {
>               .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
>               .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
> -            .max_evtchn_port = -1,
> +            /*
> +             * The default of 1023 should be sufficient for domUs guests

To me, domUs and guests mean the same. So s/guests//

Same here. With that:

Acked-by: Julien Grall <jgrall@amazon.com>

Cheers,

-- 
Julien Grall
Re: [PATCH v4 3/7] xen/evtchn: restrict the maximum number of evtchn supported for domUs
Posted by Rahul Singh 3 years, 5 months ago
Hi Julien,

> On 7 Sep 2022, at 2:01 pm, Julien Grall <julien@xen.org> wrote:
> 
> 
> 
> On 06/09/2022 14:40, Rahul Singh wrote:
>> Restrict the maximum number of evtchn supported for domUs to avoid
>> allocating a large amount of memory in Xen.
>> Set the default value of max_evtchn_port to 1023. The value of 1023
>> should be sufficient for domUs guests because on ARM we don't bind
> 
> To me, domUs and guests mean the same. So s/guests//

Ack. 
> 
>> physical interrupts to event channels. The only use of the evtchn port
>> is inter-domain communications. Another reason why we choose the value
>> of 1023 to follow the default behavior of libxl.
>> Signed-off-by: Rahul Singh <rahul.singh@arm.com>
>> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
>> ---
>> Changes in v4:
>>  - fix minor comments in commit msg
>>  - Added Michal Reviewed-by
>> Changes in v3:
>>  - added in commit msg why we set the max_evtchn_port value to 1023.
>>  - added the comment in code also why we set the max_evtchn_port to 1023
>>  - remove the define and set the value to 1023 in code directly.
>> Changes in v2:
>>  - new patch in the version
>> ---
>>  xen/arch/arm/domain_build.c | 8 +++++++-
>>  1 file changed, 7 insertions(+), 1 deletion(-)
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index 3fd1186b53..fde133cd94 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -3277,7 +3277,13 @@ void __init create_domUs(void)
>>          struct xen_domctl_createdomain d_cfg = {
>>              .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
>>              .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap,
>> -            .max_evtchn_port = -1,
>> +            /*
>> +             * The default of 1023 should be sufficient for domUs guests
> 
> To me, domUs and guests mean the same. So s/guests//
> 
> Same here. With that:
> 
> Acked-by: Julien Grall <jgrall@amazon.com>
> 
> Cheers,

Ack. 

Regards,
Rahul