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

Re: [PATCH V3 04/10] xen: introduce mark_page_free


  • To: Penny Zheng <penny.zheng@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 19 Jul 2021 10:13:35 +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-SenderADCheck; bh=7wlrryVl5oMfC6OIKOxs/bZX6cHhJMtnOvHKqsGhxas=; b=Ofdv5vZM/8VqscCvDZx3j0qWYhd2k0YJZGa6Z3C0d/MHbnGobn1SgFR76qenyv4Gwbvio/I+BI2hvhn74nt4ihvwhu39wWBCB6df3w15ApZimsnilWhzdjdnZqyw5PHGZYrhoGRZOl7sERAi7qsxcaFI3BH1RrAvfte5nDxnf9alCm0zKywQLteq6i+4PTdDHOci6paC3bFexXt+xulZ1BNWVfp7N097Qe7PB8FiAhdDzTE6NvLg9Bu4BchDagnmVzyGk1ZYLf698fAn3+lXIPFMKPIhC5+2mgWh+YrFgyYsXTRjAjhx3vIQ/mTGpC2weIg2K8leARB2N2gPi6kJOQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jlx9H5j7n2J1hQyXllB3mtPc4whUSB2ulBPMHREtHdjAO+SY/sK/a+SA9KD9ltdFTPZ0R/rKqVgk1Juc+wsiwmdQWP4hXA77sdQX/l6TcWxYBZT4+j4XH+xrV4aNDnZTk4PpGyISIkrpZS9iUoC3WIu50L/BVds/Ag4tyWWiiHiTLwGMLXb/bNdp1zuTQ5XU8X+QlCsRm9CkTLjKcADc48EjBi9TGWEvn6qIN1R07ffjcdmBhKhvNeo58WDocakd0e+mrWgG/PcsbVGiGTRwEg4Ri+x4aklKlvKQncY4TO6d3S/GfTrJ15sutl8RIXq3I1A3YnmoNaXNNDt1L1hMFw==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Bertrand.Marquis@xxxxxxx, Wei.Chen@xxxxxxx, nd@xxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, julien@xxxxxxx
  • Delivery-date: Mon, 19 Jul 2021 08:13:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.07.2021 07:18, Penny Zheng wrote:
> This commit defines a new helper mark_page_free to extract common code,
> like following the same cache/TLB coherency policy, between free_heap_pages
> and the new function free_staticmem_pages, which will be introduced later.
> 
> Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
with ...

> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -1376,6 +1376,53 @@ bool scrub_free_pages(void)
>      return node_to_scrub(false) != NUMA_NO_NODE;
>  }
>  
> +static void mark_page_free(struct page_info *pg, mfn_t mfn)
> +{
> +    ASSERT(mfn_x(mfn) == mfn_x(page_to_mfn(pg)));
> +
> +    /*
> +     * Cannot assume that count_info == 0, as there are some corner cases
> +     * where it isn't the case and yet it isn't a bug:
> +     *  1. page_get_owner() is NULL
> +     *  2. page_get_owner() is a domain that was never accessible by
> +     *     its domid (e.g., failed to fully construct the domain).
> +     *  3. page was never addressable by the guest (e.g., it's an
> +     *     auto-translate-physmap guest and the page was never included
> +     *     in its pseudophysical address space).
> +     * In all the above cases there can be no guest mappings of this page.
> +     */
> +    switch ( pg->count_info & PGC_state )
> +    {
> +    case PGC_state_inuse:
> +        BUG_ON(pg->count_info & PGC_broken);
> +        pg->count_info = PGC_state_free;
> +        break;
> +
> +    case PGC_state_offlining:
> +        pg->count_info = (pg->count_info & PGC_broken) |
> +                           PGC_state_offlined;

... indentation here not screwed up (it was correct originally).

> +        tainted = 1;
> +        break;
> +
> +    default:
> +        printk(XENLOG_ERR
> +               "pg MFN %"PRI_mfn" c=%#lx o=%u v=%#lx t=%#x\n",
> +               mfn_x(mfn),
> +               pg->count_info, pg->v.free.order,
> +               pg->u.free.val, pg->tlbflush_timestamp);

Just as a remark: Let's hope that the lost piece of information here
(the caller's induction variable) won't cause us trouble later on.

Jan




 


Rackspace

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