All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: "Juergen Gross" <jgross@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	linux-kernel@vger.kernel.org
Cc: xen-devel@lists.xenproject.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH] xen/p2m: fix extra memory regions accounting
Date: Thu, 3 Sep 2015 16:01:41 +0100	[thread overview]
Message-ID: <55E860D5.5050609__48760.8915580951$1441292572$gmane$org@citrix.com> (raw)
In-Reply-To: <55E85F52.9030708@suse.com>

On 03/09/15 15:55, Juergen Gross wrote:
> On 09/03/2015 04:52 PM, David Vrabel wrote:
>> On 03/09/15 15:45, David Vrabel wrote:
>>> On 03/09/15 15:38, Roger Pau Monné wrote:
>>>> El 03/09/15 a les 14.25, Juergen Gross ha escrit:
>>>>> On 09/03/2015 02:05 PM, Roger Pau Monne wrote:
>>>>>> On systems with memory maps with ranges that don't end at page
>>>>>> boundaries,
>>>>>> like:
>>>>>>
>>>>>> [...]
>>>>>> (XEN)  0000000000100000 - 00000000dfdf9c00 (usable)
>>>>>> (XEN)  00000000dfdf9c00 - 00000000dfe4bc00 (ACPI NVS)
>>>>>> [...]
>>>>>>
>>>>>> xen_add_extra_mem will create a protected range that ends up at
>>>>>> 0xdfdf9c00,
>>>>>> but the function used to check if a memory address is inside of a
>>>>>> protected
>>>>>> range works with pfns, which means that an attempt to map 0xdfdf9c00
>>>>>> will be
>>>>>> refused because the check is performed against 0xdfdf9000 instead of
>>>>>> 0xdfdf9c00.
>>>>>>
>>>>>> In order to fix this, make sure that the ranges that are added to the
>>>>>> xen_extra_mem array are aligned to page boundaries.
>>>>>>
>>>>>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>>>>>> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
>>>>>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>>>>>> Cc: David Vrabel <david.vrabel@citrix.com>
>>>>>> Cc: Juergen Gross <jgross@suse.com>
>>>>>> Cc: xen-devel@lists.xenproject.org
>>>>>> ---
>>>>>> AFAICT this patch needs to be backported to 3.19, 4.0, 4.1 and 4.2.
>>>>>> ---
>>>>>>    arch/x86/xen/setup.c | 6 ++++++
>>>>>>    1 file changed, 6 insertions(+)
>>>>>>
>>>>>> diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
>>>>>> index 55f388e..dcf5865 100644
>>>>>> --- a/arch/x86/xen/setup.c
>>>>>> +++ b/arch/x86/xen/setup.c
>>>>>> @@ -68,6 +68,9 @@ static void __init xen_add_extra_mem(phys_addr_t
>>>>>> start, phys_addr_t size)
>>>>>>    {
>>>>>>        int i;
>>>>>>
>>>>>> +    start = PAGE_ALIGN(start);
>>>>>> +    size &= PAGE_MASK;
>>>>>
>>>>> This is not correct. If start wasn't page aligned and size was, you'll
>>>>> add one additional page to xen_extra_mem.
>>>>
>>>> I'm not understanding this, let's put an example:
>>>>
>>>> start = 0x8c00
>>>> size = 0x1000
>>>>
>>>> After the fixup added above this would become:
>>>>
>>>> start = 0x9000
>>>> size = 0x1000
>>>>
>>>> So if anything, I'm adding one page less (because 0x8000 was partly
>>>> added, and with the fixup it is not added).
>>>
>>> We expand the reserved (i.e., non-RAM) areas down so they're fully
>>> covered with whole pages when we depopulate and 1:1 map them, we should
>>> add extra memory regions that cover these same areas.
>>
>> Ignore this.  This was nonsense.
>>
>> We expand the reserved (i.e., non-RAM) areas so they're fully covered
>> with whole pages when we depopulate and 1:1 map them, we should add the
>> extra memory such that it does not overlap with with expanded regions.
>> i.e., round up the start and round down the end (like Roger's patch
>> does).
> 
> Nearly. Roger's patch rounds up start and rounds down the size. It might
> add non-RAM partial pages to xen_extra_mem.

Yes.  You're right.

David

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2015-09-03 15:01 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-03 12:05 [PATCH] xen/p2m: fix extra memory regions accounting Roger Pau Monne
2015-09-03 12:15 ` Roger Pau Monné
2015-09-03 12:15 ` Roger Pau Monné
2015-09-03 12:26   ` Juergen Gross
2015-09-03 12:26   ` Juergen Gross
2015-09-03 12:25 ` Juergen Gross
2015-09-03 12:25 ` Juergen Gross
2015-09-03 14:38   ` Roger Pau Monné
2015-09-03 14:45     ` David Vrabel
2015-09-03 14:52       ` [Xen-devel] " David Vrabel
2015-09-03 14:55         ` Juergen Gross
2015-09-03 15:01           ` David Vrabel [this message]
2015-09-03 15:01           ` David Vrabel
2015-09-03 15:20             ` Juergen Gross
2015-09-03 15:20             ` [Xen-devel] " Juergen Gross
2015-09-03 15:39               ` Roger Pau Monné
2015-09-03 15:46                 ` Juergen Gross
2015-09-03 15:46                   ` Juergen Gross
2015-09-04  5:07                 ` Juergen Gross
2015-09-04  5:07                 ` [Xen-devel] " Juergen Gross
2015-09-04  7:37                   ` Roger Pau Monné
2015-09-04  7:47                     ` Juergen Gross
2015-09-04  7:57                       ` Roger Pau Monné
2015-09-04  7:57                       ` [Xen-devel] " Roger Pau Monné
2015-09-04  8:07                         ` Juergen Gross
2015-09-04  8:07                         ` Juergen Gross
2015-09-04  7:47                     ` Juergen Gross
2015-09-04  7:37                   ` Roger Pau Monné
2015-09-03 15:39               ` Roger Pau Monné
2015-09-03 14:55         ` Juergen Gross
2015-09-03 14:52       ` David Vrabel
2015-09-03 14:45     ` David Vrabel
2015-09-03 14:50     ` Juergen Gross
2015-09-03 14:50     ` Juergen Gross
2015-09-03 14:38   ` Roger Pau Monné
  -- strict thread matches above, loose matches on Subject: below --
2015-09-03 12:05 Roger Pau Monne
2015-09-03 12:03 Roger Pau Monne

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='55E860D5.5050609__48760.8915580951$1441292572$gmane$org@citrix.com' \
    --to=david.vrabel@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roger.pau@citrix.com \
    --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.