diff mbox

[RFC,v4,8/8] oslib-posix: Align to permit transparent hugepages on ARM Linux

Message ID 1353418270-23881-9-git-send-email-peter.maydell@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Maydell Nov. 20, 2012, 1:31 p.m. UTC
ARM Linux (like x86-64 Linux) can use transparent hugepages for
KVM if memory blocks are 2MiB aligned; set QEMU_VMALLOC_ALIGN
accordingly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 oslib-posix.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alexander Graf Nov. 20, 2012, 1:54 p.m. UTC | #1
On 11/20/2012 02:31 PM, Peter Maydell wrote:
> ARM Linux (like x86-64 Linux) can use transparent hugepages for
> KVM if memory blocks are 2MiB aligned; set QEMU_VMALLOC_ALIGN
> accordingly.
>
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
>   oslib-posix.c |    2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/oslib-posix.c b/oslib-posix.c
> index 9db9c3d..d25b52a 100644
> --- a/oslib-posix.c
> +++ b/oslib-posix.c
> @@ -35,7 +35,7 @@
>   extern int daemon(int, int);
>   #endif
>
> -#if defined(__linux__)&&  defined(__x86_64__)
> +#if defined(__linux__)&&  (defined(__x86_64__) || defined(__arm__))

Why not just drop the arch specific bit?


Alex

--
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
Christoffer Dall Nov. 20, 2012, 1:55 p.m. UTC | #2
On Tue, Nov 20, 2012 at 8:54 AM, Alexander Graf <agraf@suse.de> wrote:
> On 11/20/2012 02:31 PM, Peter Maydell wrote:
>>
>> ARM Linux (like x86-64 Linux) can use transparent hugepages for
>> KVM if memory blocks are 2MiB aligned; set QEMU_VMALLOC_ALIGN
>> accordingly.
>>
>> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
>> ---
>>   oslib-posix.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/oslib-posix.c b/oslib-posix.c
>> index 9db9c3d..d25b52a 100644
>> --- a/oslib-posix.c
>> +++ b/oslib-posix.c
>> @@ -35,7 +35,7 @@
>>   extern int daemon(int, int);
>>   #endif
>>
>> -#if defined(__linux__)&&  defined(__x86_64__)
>> +#if defined(__linux__)&&  (defined(__x86_64__) || defined(__arm__))
>
>
> Why not just drop the arch specific bit?
>
>
other archs have other alignment requirements, iirc.
--
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
Alexander Graf Nov. 20, 2012, 2:37 p.m. UTC | #3
On 11/20/2012 02:55 PM, Christoffer Dall wrote:
> On Tue, Nov 20, 2012 at 8:54 AM, Alexander Graf<agraf@suse.de>  wrote:
>> On 11/20/2012 02:31 PM, Peter Maydell wrote:
>>> ARM Linux (like x86-64 Linux) can use transparent hugepages for
>>> KVM if memory blocks are 2MiB aligned; set QEMU_VMALLOC_ALIGN
>>> accordingly.
>>>
>>> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
>>> ---
>>>    oslib-posix.c |    2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/oslib-posix.c b/oslib-posix.c
>>> index 9db9c3d..d25b52a 100644
>>> --- a/oslib-posix.c
>>> +++ b/oslib-posix.c
>>> @@ -35,7 +35,7 @@
>>>    extern int daemon(int, int);
>>>    #endif
>>>
>>> -#if defined(__linux__)&&   defined(__x86_64__)
>>> +#if defined(__linux__)&&   (defined(__x86_64__) || defined(__arm__))
>>
>> Why not just drop the arch specific bit?
>>
>>
> other archs have other alignment requirements, iirc.

Ah, sorry, missed the rest of the lines around this one :). Yeah, should 
be ok then.


Alex

--
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
Peter Maydell Nov. 20, 2012, 2:48 p.m. UTC | #4
On 20 November 2012 14:37, Alexander Graf <agraf@suse.de> wrote:
> On 11/20/2012 02:55 PM, Christoffer Dall wrote:
>> On Tue, Nov 20, 2012 at 8:54 AM, Alexander Graf<agraf@suse.de>  wrote:
>>> On 11/20/2012 02:31 PM, Peter Maydell wrote:
>>>> ARM Linux (like x86-64 Linux) can use transparent hugepages for
>>>> KVM if memory blocks are 2MiB aligned; set QEMU_VMALLOC_ALIGN
>>>> accordingly.

>>>> -#if defined(__linux__)&&   defined(__x86_64__)
>>>> +#if defined(__linux__)&&   (defined(__x86_64__) || defined(__arm__))
>>>
>>>
>>> Why not just drop the arch specific bit?

>> other archs have other alignment requirements, iirc.
>
> Ah, sorry, missed the rest of the lines around this one :).
> Yeah, should be ok then.

Yeah. Ideally the kernel would provide a mechanism so we can
ask at runtime what the preferred alignment is. (Or it could
just automatically provide it for suitably large allocations.)
In the absence of that this is just following along with the
current style.

-- PMM
--
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
diff mbox

Patch

diff --git a/oslib-posix.c b/oslib-posix.c
index 9db9c3d..d25b52a 100644
--- a/oslib-posix.c
+++ b/oslib-posix.c
@@ -35,7 +35,7 @@ 
 extern int daemon(int, int);
 #endif
 
-#if defined(__linux__) && defined(__x86_64__)
+#if defined(__linux__) && (defined(__x86_64__) || defined(__arm__))
    /* Use 2 MiB alignment so transparent hugepages can be used by KVM.
       Valgrind does not support alignments larger than 1 MiB,
       therefore we need special code which handles running on Valgrind. */