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

Re: [Xen-devel] [PATCH v5 7/8] xen/arm: introduce nr_spis


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Julien Grall <Julien.Grall@xxxxxxx>
  • Date: Wed, 25 Sep 2019 21:23:39 +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-SenderADCheck; bh=PmjQuaGRyRlQZ75qLMY8BXcFrMqK0bUfkjI8/2NbmCk=; b=Pzy4pSdqYDFsFVpVXxsO7pvKi0ykQOZjo4KRtv5WIPyRKEHOObaFOrkMHwfn5K2vnaI1U+0A+Jx9DZrV7sCAutI+PlYiJSkUVlnLlPYg8HyIxd/pTHTfoaiGdsK2+T3tE8Z69t633kd0VOOKJPDY5oLqZs+6mBrvv8aM83S74wuB5Bu5lkG28tHMc1Xu1tUNLYMehs7mgSZxhhCSgqNGlZnRANbgtQuhWf7EExyCAl1hMAyv7mhgFsffSkedNbg9wm08oqIBM9zfmsRwmIG51qeHqicVi6cSj6HMABiHtky9BW1OpVvsn+6aztK1Q92zo3/QXD91zcp0sXvafU1mqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H36jZEn/bbWKFZZHxRCzHo+R/cZgeh0MlSc9PlP+WDBBFjKQCHrG6hoj8mpW//uwlEMawEcHtlOIDHuQrMXBLWpAf/MZdpOQAaBTEBWvn1Qs3uLUvPjh6WwL57uG3lsR9tEppP5644zCCEXYO833kiCvoyyB2Lill1mfjS5L6vUfSmqKeCC7Rp8pEdI2v9Etzkr22XmrmUP/t8dQOldBZkjBUSZgjt9kqEuMHNvj4LQyHqp5EF8Ebdq+kX0hrNwAOav9bC71WLdtS9KM+F6Qr5QJMpJYYqPfDJ7mUYAH5vYN7V3squuvFrTDHxEbw7R0KKPtbzDXeaJXPzBtyo+XZg==
  • Authentication-results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xen.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;lists.xen.org; dmarc=none action=none header.from=arm.com;
  • Authentication-results-original: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
  • Cc: Stefano Stabellini <stefanos@xxxxxxxxxx>, "andrii_anisov@xxxxxxxx" <andrii_anisov@xxxxxxxx>, Achin Gupta <Achin.Gupta@xxxxxxx>, "xen-devel@xxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxx>, nd <nd@xxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 25 Sep 2019 21:24:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
  • Thread-index: AQHVc9H5ldiyvfJQhECATJdPfl5tIqc851cA
  • Thread-topic: [PATCH v5 7/8] xen/arm: introduce nr_spis

Hi,

On 25/09/2019 19:49, Stefano Stabellini wrote:
> We don't have a clear way to know how many virtual SPIs we need for the
> dom0-less domains. Introduce a new option under xen,domain to specify
> the number of SPIs to allocate for a domain.
> 
> The property is optional. When absent, we'll use the physical number of
> GIC lines for dom0-less domains, just like for dom0.

Based on the code below, this is not correct when using vpl011.

> 
> Remove the old setting of nr_spis based on the presence of the vpl011.
> 
> The implication of this change is that without nr_spis dom0less domains
> get the same amount of SPI allocated as dom0, regardless of how many
> physical devices they have assigned, and regardless of whether they have
> a virtual pl011 (which also needs an emulated SPI). For instance, we
> could end up exposing 256 SPIs for each dom0less domain without a
> nr_spis property. If we have 4 dom0less domains without nr_spis, it
> would result in 80K of additional memory being used.

I don't understand what you are trying to imply with your example. Ok, 
this tell you how much memory you are going to waste... but this does 
still not explain why the nr_spis are increased in the default case.

> 
> When nr_spis is present, the domain gets exactly nr_spis allocated SPIs.
> If the number is too low, it might not be enough for the devices
> assigned it to it. If the number is less than GUEST_VPL011_SPI, the
> virtual pl011 won't work.
> 
> Signed-off-by: Stefano Stabellini <stefanos@xxxxxxxxxx>
> Reviewed-by: Volodymyr Babchuk <volodymyr_babchuk@xxxxxxxx>
> ---
> Changes in v5:
> - improve commit message
> - allocate enough SPIs for vpl011
> 
> Changes in v4:
> - improve commit message
> 
> Changes in v3:
> - improve commit message
> - introduce nr_spis
> ---
>   xen/arch/arm/domain_build.c | 17 +++++++++++++----
>   1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 414893bc24..bf4d960eb5 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -2345,7 +2345,6 @@ void __init create_domUs(void)
>           struct domain *d;
>           struct xen_domctl_createdomain d_cfg = {
>               .arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE,
> -            .arch.nr_spis = 0,
>               .flags = XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_hap |
>                        XEN_DOMCTL_CDF_iommu,
>               .max_evtchn_port = -1,
> @@ -2356,13 +2355,23 @@ void __init create_domUs(void)
>           if ( !dt_device_is_compatible(node, "xen,domain") )
>               continue;
>   
> -        if ( dt_property_read_bool(node, "vpl011") )
> -            d_cfg.arch.nr_spis = GUEST_VPL011_SPI - 32 + 1;
> -
>           if ( !dt_property_read_u32(node, "cpus", &d_cfg.max_vcpus) )
>               panic("Missing property 'cpus' for domain %s\n",
>                     dt_node_name(node));
>   
> +        if ( !dt_property_read_u32(node, "nr_spis", &d_cfg.arch.nr_spis) )
> +        {
> +            d_cfg.arch.nr_spis = gic_number_lines() - 32;
> +
> +            /*
> +             * vpl011 uses one emulated SPI. If vpl011 is requested, make
> +             * sure that we allocate enough SPIs for it.
> +             */
> +            if ( dt_property_read_bool(node, "vpl011") )
> +                d_cfg.arch.nr_spis = MAX(d_cfg.arch.nr_spis,
> +                                         GUEST_VPL011_SPI - 32 + 1);
> +        }
> +
>           d = domain_create(++max_init_domid, &d_cfg, false);
>           if ( IS_ERR(d) )
>               panic("Error creating domain %s\n", dt_node_name(node));
> 

Cheers,

-- 
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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