From: Juergen Gross <email@example.com>
To: Jan Beulich <firstname.lastname@example.org>
Cc: Boris Ostrovsky <email@example.com>,
Stefano Stabellini <firstname.lastname@example.org>,
Thomas Gleixner <email@example.com>,
Ingo Molnar <firstname.lastname@example.org>, Borislav Petkov <email@example.com>,
"H. Peter Anvin" <firstname.lastname@example.org>,
Subject: Re: [PATCH 1/2] xen: fix setting of max_pfn in shared_info
Date: Wed, 16 Jun 2021 13:18:26 +0200 [thread overview]
Message-ID: <email@example.com> (raw)
[-- Attachment #1.1.1: Type: text/plain, Size: 2381 bytes --]
On 16.06.21 12:56, Jan Beulich wrote:
> On 16.06.2021 12:37, Juergen Gross wrote:
>> On 16.06.21 11:52, Jan Beulich wrote:
>>> On 16.06.2021 09:30, Juergen Gross wrote:
>>>> Xen PV guests are specifying the highest used PFN via the max_pfn
>>>> field in shared_info. This value is used by the Xen tools when saving
>>>> or migrating the guest.
>>>> Unfortunately this field is misnamed, as in reality it is specifying
>>>> the number of pages (including any memory holes) of the guest, so it
>>>> is the highest used PFN + 1. Renaming isn't possible, as this is a
>>>> public Xen hypervisor interface which needs to be kept stable.
>>>> The kernel will set the value correctly initially at boot time, but
>>>> when adding more pages (e.g. due to memory hotplug or ballooning) a
>>>> real PFN number is stored in max_pfn. This is done when expanding the
>>>> p2m array, and the PFN stored there is even possibly wrong, as it
>>>> should be the last possible PFN of the just added P2M frame, and not
>>>> one which led to the P2M expansion.
>>>> Fix that by setting shared_info->max_pfn to the last possible PFN + 1.
>>>> Fixes: 98dd166ea3a3c3 ("x86/xen/p2m: hint at the last populated P2M entry")
>>>> Cc: firstname.lastname@example.org
>>>> Signed-off-by: Juergen Gross <email@example.com>
>>> The code change is fine, so
>>> Reviewed-by: Jan Beulich <firstname.lastname@example.org>
>>> But I think even before the rename you would want to clarify the comment
>>> next to the variable's definition, to make clear what it really holds.
>> It already says: "Number of valid entries in the p2m table(s) ..."
>> What do you think is unclear about that? Or do you mean another
> I mean the variable the value of which the patch corrects, i.e.
> xen_p2m_last_pfn. What I see in current source is
> * Hint at last populated PFN.
> * Used to set HYPERVISOR_shared_info->arch.max_pfn so the toolstack
> * can avoid scanning the whole P2M (which may be sized to account for
> * hotplugged memory).
> static unsigned long xen_p2m_last_pfn;
I think only changing the comment without renaming the variable isn't
the way to go.
In order to keep the to be backported patch small I'd rather do the
comment adjustment and variable renaming in the followup patch.
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
next prev parent reply other threads:[~2021-06-16 11:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-16 7:30 [PATCH 0/2] xen: fix max_pfn handling for pv guests Juergen Gross
2021-06-16 7:30 ` [PATCH 1/2] xen: fix setting of max_pfn in shared_info Juergen Gross
2021-06-16 9:52 ` Jan Beulich
2021-06-16 10:37 ` Juergen Gross
2021-06-16 10:56 ` Jan Beulich
2021-06-16 11:18 ` Juergen Gross [this message]
2021-06-16 7:30 ` [PATCH 2/2] xen: rename wrong named pfn related variables Juergen Gross
2021-06-16 9:56 ` Jan Beulich
2021-06-16 10:43 ` Juergen Gross
2021-06-16 11:01 ` Jan Beulich
2021-07-30 9:00 ` Juergen Gross
2021-08-03 10:42 ` Jan Beulich
2021-08-16 5:25 ` Juergen Gross
2021-08-16 12:57 ` Jan Beulich
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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.