From: Jan Beulich <jbeulich@suse.com>
To: Juergen Gross <jgross@suse.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
stable@vger.kernel.org, xen-devel@lists.xenproject.org,
linux-kernel@vger.kernel.org, x86@kernel.org
Subject: Re: [PATCH 1/2] xen: fix setting of max_pfn in shared_info
Date: Wed, 16 Jun 2021 12:56:37 +0200 [thread overview]
Message-ID: <a5747064-cf3b-4ccb-5b46-3b6e069e7202@suse.com> (raw)
In-Reply-To: <97de842a-f095-3a12-ab16-beca0f97ba67@suse.com>
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: stable@vger.kernel.org
>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>
>> The code change is fine, so
>> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>>
>> 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
> variable?
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;
Jan
next prev parent reply other threads:[~2021-06-16 10:56 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 [this message]
2021-06-16 11:18 ` Juergen Gross
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
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=a5747064-cf3b-4ccb-5b46-3b6e069e7202@suse.com \
--to=jbeulich@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=sstabellini@kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).