From: Anthony Liguori <anthony@codemonkey.ws>
To: Andrea Arcangeli <andrea@qumranet.com>
Cc: Muli Ben-Yehuda <muli@il.ibm.com>,
Ben-Ami Yassour1 <BENAMI@il.ibm.com>,
Han Weidong <weidong.han@intel.com>,
"Kay, Allen M" <allen.m.kay@intel.com>,
Amit Shah <amit.shah@qumranet.com>,
kvm@vger.kernel.org, avi@qumranet.com,
Dave Hansen <haveblue@us.ibm.com>
Subject: Re: [PATCH] Handle vma regions with no backing page
Date: Wed, 04 Jun 2008 14:41:20 -0500 [thread overview]
Message-ID: <4846EFE0.5090304@codemonkey.ws> (raw)
In-Reply-To: <20080604193402.GO21613@duo.random>
Andrea Arcangeli wrote:
> On Wed, Jun 04, 2008 at 07:17:55PM +0300, Muli Ben-Yehuda wrote:
>
>> On Wed, Jun 04, 2008 at 06:09:24PM +0300, Ben-Ami Yassour1 wrote:
>>
>>
>>>>> We noticed that pfn_valid does not always works as expected by
>>>>> this patch to indicate that a pfn has a backing page. We have
>>>>> seen a case where CONFIG_NUMA was not set and then where
>>>>> pfn_valid returned 1 for an mmio pfn. We then changed the
>>>>> config file with CONFIG_NUMA set and it worked fine as expected
>>>>> (since a different implementation of pfn_valid was used).
>>>>>
>>>>> How should we overcome this issue?
>>>>>
>>>> There's a page_is_ram() too, but that's the e820 map check and it
>>>> means it's RAM not that there's a page backing store. Certainly if
>>>> it's not ram we should go ahead with just the pfn but it'd be a
>>>> workaround.
>>>>
>>>> I really think it'd be better off to fix pfn_valid to work for
>>>> NUMA.
>>>>
>>> It does work for NUMA, it does not work without the NUMA option.
>>>
>> Andrea, how would you suggest to fix pfn_valid for the CONFIG_NUMA
>> disabled case?
>>
>
> I'm very surprised that this is broken for non-numa.
>
> To be sure I understand, what exactly means that "pfn has not a
> backing page"?
>
The pfn does have a backing page. When using CONFIG_FLATMEM,
pfn_valid() is simply:
#ifdef CONFIG_FLATMEM
#define pfn_valid(pfn) ((pfn) < end_pfn)
#endif
And this is true, pfn_valid() just indicates whether there is a space in
mem_map[], and there certainly is. Note this only happens when there is
a valid PFN that's greater than the PCI memory (using 4GB+ of memory).
> I think we must fix pfn_valid, so that when it returns true,
> pfn_to_page returns an entry that is contained inside some mem_map
> array allocated by mm/page_alloc.c. pfn_valid is totally right to
> return true on mmio regions, as long as a 'struct page' exists. Like
> for example the 640k-1M area. It'd be a waste to pay the price of a
> discontiguous array to save a few struct pages (or perhaps these days
> they're inefficiently using 4k tlb entries to map struct page dunno, I
> surely prefer to waste a few struct pages and stay with 2M tlb).
>
> As long as a 'struct page' exists and pfn_to_page returns a 'struct
> page' checking PageReserved() should be enough to know if it's
> pageable RAM owned by the VM or an mmio region. I don't know why but
> when I did reserved-ram patch, the PageReserved check wasn't returning
> true on the reserved-ram. Perhaps it's because it was ram, dunno, so I
> had to use the page_count() hack. But for mmio !pfn_valid ||
> PageReserved should work.
Dave mentioned that SetPageReserved() doesn't necessarily get called for
zones with bad alignment.
Regards,
Anthony Liguori
> Said that this mem_map code tends to change
> all the time for whatever reason, so I wouldn't be shocked if
> PageReserved doesn't actually work either. But mixing pfn_valid and
> PageReserved sounds the right objective.
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2008-06-04 19:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-03 11:17 [PATCH] Handle vma regions with no backing page Ben-Ami Yassour
2008-06-03 11:39 ` Andrea Arcangeli
2008-06-04 15:09 ` Ben-Ami Yassour
2008-06-04 16:17 ` Muli Ben-Yehuda
2008-06-04 19:34 ` Andrea Arcangeli
2008-06-04 19:41 ` Anthony Liguori [this message]
2008-06-04 19:51 ` Andrea Arcangeli
2008-06-04 19:59 ` Dave Hansen
2008-06-04 9:48 ` Avi Kivity
2008-06-04 16:48 ` Anthony Liguori
-- strict thread matches above, loose matches on Subject: below --
2008-04-29 14:32 Anthony Liguori
2008-04-29 14:54 ` Andrea Arcangeli
2008-04-29 15:14 ` Anthony Liguori
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=4846EFE0.5090304@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=BENAMI@il.ibm.com \
--cc=allen.m.kay@intel.com \
--cc=amit.shah@qumranet.com \
--cc=andrea@qumranet.com \
--cc=avi@qumranet.com \
--cc=haveblue@us.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=muli@il.ibm.com \
--cc=weidong.han@intel.com \
/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.