xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Jan Beulich <JBeulich@suse.com>
Cc: tim@xen.org, xen-devel@lists.xen.org, keir@xen.org,
	ian.jackson@eu.citrix.com, ian.campbell@citrix.com
Subject: Re: [PATCH] expand x86 arch_shared_info to support >3 level p2m tree
Date: Tue, 09 Sep 2014 11:45:36 +0200	[thread overview]
Message-ID: <540ECC40.6060205@suse.com> (raw)
In-Reply-To: <540ECA06.9070300@citrix.com>

On 09/09/2014 11:36 AM, Andrew Cooper wrote:
> On 09/09/14 10:28, Jan Beulich wrote:
>>>>> On 08.09.14 at 18:11, <JGross@suse.com> wrote:
>>> On 09/08/2014 03:59 PM, Andrew Cooper wrote:
>>>> On 08/09/14 14:48, Juergen Gross wrote:
>>>>> The x86 struct arch_shared_info field pfn_to_mfn_frame_list_list
>>>>> currently contains the mfn of the top level page frame of the 3 level
>>>>> p2m tree, which is used by the Xen tools during saving and restoring
>>>>> (and live migration) of pv domains. With three levels of the p2m tree
>>>>> it is possible to support up to 512 GB of RAM for a pv domain.
>>>> Specifically only 64bit PV domains have the 512GB limit.
>>>>
>>>> 32bit PV domains have a far larger supported RAM as they can fit twice
>>>> as many mfns in each p2m page.
>>>>
>>>>>    To be
>>>>> able to support more RAM an additional level is to be added.
>>>>>
>>>>> This patch expands struct arch_shared_info with a new p2m tree root
>>>>> and the number of levels of the p2m tree. The new information is
>>>>> indicated by the domain to be valid by storing ~0UL into
>>>>> pfn_to_mfn_frame_list_list (this should be done only if more than
>>>>> three levels are needed, of course).
>>>>>
>>>>> Signed-off-by: Juergen Gross <jgross@suse.com>
>>>>> ---
>>>>>    xen/include/public/arch-x86/xen.h | 8 +++++++-
>>>>>    1 file changed, 7 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/xen/include/public/arch-x86/xen.h
>>> b/xen/include/public/arch-x86/xen.h
>>>>> index f35804b..b7fa2b6 100644
>>>>> --- a/xen/include/public/arch-x86/xen.h
>>>>> +++ b/xen/include/public/arch-x86/xen.h
>>>>> @@ -224,7 +224,13 @@ struct arch_shared_info {
>>>>>        /* Frame containing list of mfns containing list of mfns containing
>>> p2m. */
>>>>>        xen_pfn_t     pfn_to_mfn_frame_list_list;
>>>>>        unsigned long nmi_reason;
>>>>> -    uint64_t pad[32];
>>>>> +    /*
>>>>> +     * Following two fields are valid if pfn_to_mfn_frame_list_list
>>> contains
>>>>> +     * ~0UL.
>>>>> +     */
>>>>> +    unsigned long p2m_levels;   /* number of levels of p2m tree */
>>>>> +    xen_pfn_t     p2m_root;     /* p2m tree top level mfn */
>>>>> +    uint64_t pad[30];
>>>> This padding is now wrong, as unsigned long is only 4 bytes in 32bit,
>>>> and it is adjacent to another unsigned long.
>>> The padding in this case is a nightmare.
>>>
>>> For 32 bits arch_shared_info_t is 64 bit aligned due to uint64_t pad[].
>> No - uint64_t is 4-byte aligned on 32-bit.
>>
>>> This enforces a 4 byte hole before the structure (there are 3 4-byte
>>> fields before it in shared_info_t). And before pad[] there is another
>>> 4-byte hole.
>>>
>>> And don't forget: on 32 bits xen_pfn_t is 4 bytes, too. I could either
>>> align each new variable explicitly to 8 bytes or I could use a union.
>>>
>>> As arch_shared_info_t is at the end of shared_info_t I could just ignore
>>> the alignment/padding ...
>>>
>>> What is your preference?
>> As I view it, the exact padding size here doesn't really matter: The
>> shared info lives in a separate page anyway.
>>
>> Jan
>>
>
> Which begs the question why the padding exists in the first place?
>
> arch_shared_info is the final field in shared_info, and shared_info is
> explicitly documented not to necessarily have a consistent size across
> different versions of Xen.
>
> Frankly, I think the padding can just be removed.  It serves no purpose,
> and attempting to maintain it correctly is proving very difficult.

Okay. I'll remove the padding.


Juergen

  reply	other threads:[~2014-09-09  9:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-08 13:48 [PATCH 0/1] support >3 level p2m tree Juergen Gross
2014-09-08 13:48 ` [PATCH] expand x86 arch_shared_info to " Juergen Gross
2014-09-08 13:59   ` Andrew Cooper
2014-09-08 16:11     ` Juergen Gross
2014-09-09  9:28       ` Jan Beulich
2014-09-09  9:36         ` Andrew Cooper
2014-09-09  9:45           ` Juergen Gross [this message]
2014-09-09  9:55           ` 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=540ECC40.6060205@suse.com \
    --to=jgross@suse.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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).