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

Re: [PATCH v5 9/9] xen: retrieve reserved pages on populate_physmap


  • To: Penny Zheng <Penny.Zheng@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 31 May 2022 10:54:37 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aE2dBkuFXE78Hg51qAgZl+LxP+fyUswFpq7Dg+SfDAQ=; b=nNnfBmZHVu7GqE2WaeUymtxmf+ZBzUoVYiqFwV8hQtwi1G2FekuI8NGR3q7BAElPJKmg6fW+iDXm69o7cEBrAITDieATzxETFfSAmzWYk2hgPWYuXRLCc0I1YlBzQa9a3GvPujmv+hVj1NIOp73q88UIyWCpj7IeVuUhjz6RbmC1PfXDEzxM2RGuLG2Uwc5xKQyG00IfNLSbMZ1Ju2dYV0URo0Ts270JJ3+6R898JrsPvELmR0kjXq7YHXhSsTLzg24rhCZBOcPOqBEa49di+TrKDA+7KDdv02Dfrv1xMVG2WLMVGd5hgq7xFvchxqcr0tuaLt7gcx+u6izgSdUQcA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Aw4q0OnawBzI0Io9SIznulXJ5f3diVWycJckKK+IAPsznx4Rt/Bworaoylf82N6XRhm7RKf0rghAdzACUv33MKjB7ak3XB+TFhcHvANPJNeqkXwnrw2PmKzBL5YpPpKfYcoBJGVSxsloeJKdhnuQT1htjvRdep5g0eqNGpH1gY+/hyM9YE4EtvraN0w5D2N2FLXR+2DvwDEJVIfx5mCvyRX6g19C5pe9a8g9idzBqDn0Vo3zVaFqBkAMMVqO3c0SP7Re/MkqWvUyRFxWIO8kkLBqUVQk8OvNWjIl9HjA1SGy6smH6HpVrE1cCmyx9YAwoNE4KPrt9Iqx4GpEaigVJw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: wei.chen@xxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 31 May 2022 08:54:49 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 31.05.2022 05:12, Penny Zheng wrote:
> --- a/xen/common/memory.c
> +++ b/xen/common/memory.c
> @@ -245,6 +245,29 @@ static void populate_physmap(struct memop_args *a)
>  
>                  mfn = _mfn(gpfn);
>              }
> +            else if ( is_domain_using_staticmem(d) )
> +            {
> +                /*
> +                 * No easy way to guarantee the retrieved pages are 
> contiguous,
> +                 * so forbid non-zero-order requests here.
> +                 */
> +                if ( a->extent_order != 0 )
> +                {
> +                    gdprintk(XENLOG_WARNING,
> +                             "Cannot allocate static order-%u pages for 
> static %pd\n",
> +                             a->extent_order, d);
> +                    goto out;
> +                }
> +
> +                mfn = acquire_reserved_page(d, a->memflags);
> +                if ( mfn_eq(mfn, INVALID_MFN) )
> +                {
> +                    gdprintk(XENLOG_WARNING,
> +                             "%pd: failed to retrieve a reserved page\n",
> +                             d);
> +                    goto out;
> +                }
> +            }

I'm not convinced of having these gdprintk()s here. The adjacent
is_domain_direct_mapped() code is somewhat different - iirc only Dom0
can be direct-mapped, and Dom0 having a problem can certainly be worth
a log message.

> +/*
> + * Acquire a page from reserved page list(resv_page_list), when populating
> + * memory for static domain on runtime.
> + */
> +mfn_t acquire_reserved_page(struct domain *d, unsigned int memflags)
> +{
> +    struct page_info *page;
> +
> +    spin_lock(&d->page_alloc_lock);
> +    /* Acquire a page from reserved page list(resv_page_list). */
> +    page = page_list_remove_head(&d->resv_page_list);
> +    if ( unlikely(!page) )
> +        return INVALID_MFN;
> +    spin_unlock(&d->page_alloc_lock);

You want to drop the lock before returning.

Jan




 


Rackspace

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