All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Penny Zheng <penny.zheng@arm.com>
Cc: Bertrand.Marquis@arm.com, Wei.Chen@arm.com, nd@arm.com,
	xen-devel@lists.xenproject.org, sstabellini@kernel.org,
	julien@xen.org
Subject: Re: [PATCH V3 04/10] xen: introduce mark_page_free
Date: Mon, 19 Jul 2021 10:13:35 +0200	[thread overview]
Message-ID: <d6962e4d-4121-206a-a60c-00c9074d898f@suse.com> (raw)
In-Reply-To: <20210715051819.3073628-5-penny.zheng@arm.com>

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@arm.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
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



  reply	other threads:[~2021-07-19  8:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15  5:18 [PATCH V3 00/10] Domain on Static Allocation Penny Zheng
2021-07-15  5:18 ` [PATCH V3 01/10] xen/arm: introduce domain " Penny Zheng
2021-07-15  5:18 ` [PATCH V3 02/10] xen/arm: introduce new helper device_tree_get_meminfo Penny Zheng
2021-07-15  5:18 ` [PATCH V3 03/10] xen/arm: handle static memory in dt_unreserved_regions Penny Zheng
2021-07-15  5:18 ` [PATCH V3 04/10] xen: introduce mark_page_free Penny Zheng
2021-07-19  8:13   ` Jan Beulich [this message]
2021-07-15  5:18 ` [PATCH V3 05/10] xen/arm: static memory initialization Penny Zheng
2021-07-19  8:20   ` Jan Beulich
2021-07-21  3:07     ` Penny Zheng
2021-07-21  8:15       ` Jan Beulich
2021-07-19  8:25   ` Jan Beulich
2021-07-15  5:18 ` [PATCH V3 06/10] xen/arm: introduce PGC_reserved Penny Zheng
2021-07-15  5:18 ` [PATCH V3 07/10] xen: re-define assign_pages and introduce assign_page Penny Zheng
2021-07-19  8:41   ` Jan Beulich
2021-07-21  5:53     ` Penny Zheng
2021-07-15  5:18 ` [PATCH V3 08/10] xen/arm: introduce acquire_staticmem_pages and acquire_domstatic_pages Penny Zheng
2021-07-19  9:26   ` Jan Beulich
2021-07-19 10:00     ` Julien Grall
2021-07-21  7:52       ` Penny Zheng
2021-07-21  7:37     ` Penny Zheng
2021-07-15  5:18 ` [PATCH V3 09/10] xen/arm: check "xen,static-mem" property during domain construction Penny Zheng
2021-07-15  5:18 ` [PATCH V3 10/10] xen/arm: introduce allocate_static_memory Penny Zheng
2021-07-27  3:44   ` Penny Zheng
2021-07-27  6:18     ` Penny Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6962e4d-4121-206a-a60c-00c9074d898f@suse.com \
    --to=jbeulich@suse.com \
    --cc=Bertrand.Marquis@arm.com \
    --cc=Wei.Chen@arm.com \
    --cc=julien@xen.org \
    --cc=nd@arm.com \
    --cc=penny.zheng@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.