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

Re: [Xen-devel] [PATCH 2/5] x86/mm: warn if we ever run out of shadow/hap pool for p2m/lgd ops.



On 07/03/13 14:53, Tim Deegan wrote:
> Even if the error propagates up through the p2m ops to the caller,
> it'll look like ENOMEM, which won't be obviously a shadow-pool problem.
>
> Warn on the console, once per domain.
>
> Signed-off-by: Tim Deegan <tim@xxxxxxx>
> ---
>  xen/arch/x86/mm/hap/hap.c       |    6 ++++++
>  xen/arch/x86/mm/shadow/common.c |    8 +++++++-
>  xen/include/asm-x86/domain.h    |    2 ++
>  3 files changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
> index 055833d..bff05d9 100644
> --- a/xen/arch/x86/mm/hap/hap.c
> +++ b/xen/arch/x86/mm/hap/hap.c
> @@ -258,6 +258,12 @@ static struct page_info *hap_alloc_p2m_page(struct 
> domain *d)
>          page_set_owner(pg, d);
>          pg->count_info |= 1;
>      }
> +    else if ( !d->arch.paging.p2m_alloc_failed )
> +    {
> +        d->arch.paging.p2m_alloc_failed = 1;
> +        dprintk(XENLOG_ERR, "d%i failed to allocate from HAP pool",
> +                d->domain_id);
> +    }
>  
>      paging_unlock(d);
>      return pg;
> diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
> index 691776c..4b576ac 100644
> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -1591,10 +1591,16 @@ shadow_alloc_p2m_page(struct domain *d)
>      if ( d->arch.paging.shadow.total_pages 
>           < shadow_min_acceptable_pages(d) + 1 )
>      {
> +        if ( !d->arch.paging.p2m_alloc_failed )
> +        {
> +            d->arch.paging.p2m_alloc_failed = 1;
> +            dprintk(XENLOG_ERR, "d%i failed to allocate from shadow pool",
> +                    d->domain_id);

domian_id is a uint16_t so %i is the wrong signedness and width.

Do we not have a PRIdomid ? I seem to remember we have PRI macros for
some Xen types, but cant find an appropriate one for domids.  It seems
like a sensible one to introduce if it doesn't already exist.

~Andrew

> +        }
>          paging_unlock(d);
>          return NULL;
>      }
> - 
> +
>      shadow_prealloc(d, SH_type_p2m_table, 1);
>      pg = mfn_to_page(shadow_alloc(d, SH_type_p2m_table, 0));
>      d->arch.paging.shadow.p2m_pages++;
> diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
> index fd9fa0f..6f9744a 100644
> --- a/xen/include/asm-x86/domain.h
> +++ b/xen/include/asm-x86/domain.h
> @@ -190,6 +190,8 @@ struct paging_domain {
>       * (used by p2m and log-dirty code for their tries) */
>      struct page_info * (*alloc_page)(struct domain *d);
>      void (*free_page)(struct domain *d, struct page_info *pg);
> +    /* Has that pool ever run out of memory? */
> +    bool_t p2m_alloc_failed;
>  };
>  
>  struct paging_vcpu {


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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