From: Alexander Graf <agraf@suse.de>
To: Mel Gorman <mgorman@suse.com>
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>,
paulus@samba.org, linuxppc-dev@lists.ozlabs.org,
kvm-ppc@vger.kernel.org
Subject: Re: [PATCH v2] Use the POWER8 Micro Partition Prefetch Engine in KVM HV on POWER8
Date: Thu, 10 Jul 2014 13:17:16 +0000 [thread overview]
Message-ID: <53BE925C.2030401@suse.de> (raw)
In-Reply-To: <20140710130716.GQ25275@novell.com>
On 10.07.14 15:07, Mel Gorman wrote:
> On Thu, Jul 10, 2014 at 01:05:47PM +0200, Alexander Graf wrote:
>> On 09.07.14 00:59, Stewart Smith wrote:
>>> Hi!
>>>
>>> Thanks for review, much appreciated!
>>>
>>> Alexander Graf <agraf@suse.de> writes:
>>>> On 08.07.14 07:06, Stewart Smith wrote:
>>>>> @@ -1528,6 +1535,7 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
>>>>> int i, need_vpa_update;
>>>>> int srcu_idx;
>>>>> struct kvm_vcpu *vcpus_to_update[threads_per_core];
>>>>> + phys_addr_t phy_addr, tmp;
>>>> Please put the variable declarations into the if () branch so that the
>>>> compiler can catch potential leaks :)
>>> ack. will fix.
>>>
>>>>> @@ -1590,9 +1598,48 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
>>>>> srcu_idx = srcu_read_lock(&vc->kvm->srcu);
>>>>> + /* If we have a saved list of L2/L3, restore it */
>>>>> + if (cpu_has_feature(CPU_FTR_ARCH_207S) && vc->mpp_buffer) {
>>>>> + phy_addr = virt_to_phys((void *)vc->mpp_buffer);
>>>>> +#if defined(CONFIG_PPC_4K_PAGES)
>>>>> + phy_addr = (phy_addr + 8*4096) & ~(8*4096);
>>>> get_free_pages() is automatically aligned to the order, no?
>>> That's what Paul reckoned too, and then we've attempted to find anywhere
>>> that documents that behaviour. Happen to be able to point to docs/source
>>> that say this is part of API?
>> Phew - it's probably buried somewhere. I could only find this
>> document saying that we always get order-aligned allocations:
>>
>> http://www.thehackademy.net/madchat/ebooks/Mem_virtuelle/linux-mm/zonealloc.html
>>
>> Mel, do you happen to have any pointer to something that explicitly
>> (or even properly implicitly) says that get_free_pages() returns
>> order-aligned memory?
>>
> I did not read the whole thread so I lack context and will just answer
> this part.
>
> There is no guarantee that pages are returned in PFN order for multiple
> requests to the page allocator. This is the relevant comment in
> rmqueue_bulk
>
> /*
> * Split buddy pages returned by expand() are received here
> * in physical page order. The page is added to the callers and
> * list and the list head then moves forward. From the callers
> * perspective, the linked list is ordered by page number in
> * some conditions. This is useful for IO devices that can
> * merge IO requests if the physical pages are ordered
> * properly.
> */
>
> It will probably be true early in the lifetime of the system but the milage
> will vary on systems with a lot of uptime. If you depend on this behaviour
> for correctness then you will have a bad day.
>
> High-order page requests to the page allocator are guaranteed to be in physical
> order. However, this does not apply to vmalloc() where allocations are
> only guaranteed to be virtually contiguous.
Hrm, ok to be very concrete:
Does __get_free_pages(..., 4); on a 4k page size system give me a 64k
aligned pointer? :)
Alex
WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: Mel Gorman <mgorman@suse.com>
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>,
paulus@samba.org, linuxppc-dev@lists.ozlabs.org,
kvm-ppc@vger.kernel.org
Subject: Re: [PATCH v2] Use the POWER8 Micro Partition Prefetch Engine in KVM HV on POWER8
Date: Thu, 10 Jul 2014 15:17:16 +0200 [thread overview]
Message-ID: <53BE925C.2030401@suse.de> (raw)
In-Reply-To: <20140710130716.GQ25275@novell.com>
On 10.07.14 15:07, Mel Gorman wrote:
> On Thu, Jul 10, 2014 at 01:05:47PM +0200, Alexander Graf wrote:
>> On 09.07.14 00:59, Stewart Smith wrote:
>>> Hi!
>>>
>>> Thanks for review, much appreciated!
>>>
>>> Alexander Graf <agraf@suse.de> writes:
>>>> On 08.07.14 07:06, Stewart Smith wrote:
>>>>> @@ -1528,6 +1535,7 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
>>>>> int i, need_vpa_update;
>>>>> int srcu_idx;
>>>>> struct kvm_vcpu *vcpus_to_update[threads_per_core];
>>>>> + phys_addr_t phy_addr, tmp;
>>>> Please put the variable declarations into the if () branch so that the
>>>> compiler can catch potential leaks :)
>>> ack. will fix.
>>>
>>>>> @@ -1590,9 +1598,48 @@ static void kvmppc_run_core(struct kvmppc_vcore *vc)
>>>>> srcu_idx = srcu_read_lock(&vc->kvm->srcu);
>>>>> + /* If we have a saved list of L2/L3, restore it */
>>>>> + if (cpu_has_feature(CPU_FTR_ARCH_207S) && vc->mpp_buffer) {
>>>>> + phy_addr = virt_to_phys((void *)vc->mpp_buffer);
>>>>> +#if defined(CONFIG_PPC_4K_PAGES)
>>>>> + phy_addr = (phy_addr + 8*4096) & ~(8*4096);
>>>> get_free_pages() is automatically aligned to the order, no?
>>> That's what Paul reckoned too, and then we've attempted to find anywhere
>>> that documents that behaviour. Happen to be able to point to docs/source
>>> that say this is part of API?
>> Phew - it's probably buried somewhere. I could only find this
>> document saying that we always get order-aligned allocations:
>>
>> http://www.thehackademy.net/madchat/ebooks/Mem_virtuelle/linux-mm/zonealloc.html
>>
>> Mel, do you happen to have any pointer to something that explicitly
>> (or even properly implicitly) says that get_free_pages() returns
>> order-aligned memory?
>>
> I did not read the whole thread so I lack context and will just answer
> this part.
>
> There is no guarantee that pages are returned in PFN order for multiple
> requests to the page allocator. This is the relevant comment in
> rmqueue_bulk
>
> /*
> * Split buddy pages returned by expand() are received here
> * in physical page order. The page is added to the callers and
> * list and the list head then moves forward. From the callers
> * perspective, the linked list is ordered by page number in
> * some conditions. This is useful for IO devices that can
> * merge IO requests if the physical pages are ordered
> * properly.
> */
>
> It will probably be true early in the lifetime of the system but the milage
> will vary on systems with a lot of uptime. If you depend on this behaviour
> for correctness then you will have a bad day.
>
> High-order page requests to the page allocator are guaranteed to be in physical
> order. However, this does not apply to vmalloc() where allocations are
> only guaranteed to be virtually contiguous.
Hrm, ok to be very concrete:
Does __get_free_pages(..., 4); on a 4k page size system give me a 64k
aligned pointer? :)
Alex
next prev parent reply other threads:[~2014-07-10 13:17 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-04 1:23 [PATCH] Use the POWER8 Micro Partition Prefetch Engine in KVM HV on POWER8 Stewart Smith
2014-07-08 5:06 ` [PATCH v2] " Stewart Smith
2014-07-08 5:06 ` Stewart Smith
2014-07-08 10:41 ` Alexander Graf
2014-07-08 10:41 ` Alexander Graf
2014-07-08 22:59 ` Stewart Smith
2014-07-08 22:59 ` Stewart Smith
2014-07-10 11:05 ` Alexander Graf
2014-07-10 11:05 ` Alexander Graf
2014-07-10 13:07 ` Mel Gorman
2014-07-10 13:07 ` Mel Gorman
2014-07-10 13:17 ` Alexander Graf [this message]
2014-07-10 13:17 ` Alexander Graf
2014-07-10 13:30 ` Mel Gorman
2014-07-10 13:30 ` Mel Gorman
2014-07-10 13:30 ` Alexander Graf
2014-07-10 13:30 ` Alexander Graf
2014-07-17 3:19 ` [PATCH v3] " Stewart Smith
2014-07-17 3:19 ` Stewart Smith
2014-07-17 7:55 ` Alexander Graf
2014-07-17 7:55 ` Alexander Graf
2014-07-18 4:10 ` Stewart Smith
2014-07-18 4:10 ` Stewart Smith
2014-07-28 12:30 ` Alexander Graf
2014-07-28 12:30 ` Alexander Graf
2014-07-17 23:52 ` Paul Mackerras
2014-07-17 23:52 ` Paul Mackerras
2014-07-18 4:10 ` Stewart Smith
2014-07-18 4:10 ` Stewart Smith
2014-07-18 4:18 ` [PATCH v4 0/2] Use the POWER8 Micro Partition Prefetch Engine in KVM HV Stewart Smith
2014-07-18 4:18 ` Stewart Smith
2014-07-18 4:18 ` [PATCH v4 1/2] Split out struct kvmppc_vcore creation to separate function Stewart Smith
2014-07-18 4:18 ` Stewart Smith
2014-07-18 7:47 ` Paul Mackerras
2014-07-18 7:47 ` Paul Mackerras
2014-07-18 4:18 ` [PATCH v4 2/2] Use the POWER8 Micro Partition Prefetch Engine in KVM HV on POWER8 Stewart Smith
2014-07-18 4:18 ` Stewart Smith
2014-07-18 7:48 ` Paul Mackerras
2014-07-18 7:48 ` Paul Mackerras
2014-07-28 12:34 ` [PATCH v4 0/2] Use the POWER8 Micro Partition Prefetch Engine in KVM HV Alexander Graf
2014-07-28 12:34 ` Alexander Graf
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=53BE925C.2030401@suse.de \
--to=agraf@suse.de \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mgorman@suse.com \
--cc=paulus@samba.org \
--cc=stewart@linux.vnet.ibm.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.