All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kvmtool: ARM: madvise mergeable and hugepage separately
@ 2016-08-08  7:01 Stefan Agner
  2016-08-08 16:11 ` Andre Przywara
  2016-08-25 11:01 ` Suzuki K Poulose
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Agner @ 2016-08-08  7:01 UTC (permalink / raw)
  To: kvmarm, kvm; +Cc: Marc.Zyngier, will.deacon, penberg, Stefan Agner

The madvise behavior is not a bit field and hence can not be or'ed.
Also madvise_behavior_valid checks the flag using a case statement
hence only one behavior is supposed to be supplied. Call madvise
twice, once for MERGEABLE and once for HUGEPAGE.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 arm/kvm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arm/kvm.c b/arm/kvm.c
index ce40897..3cfa90a 100644
--- a/arm/kvm.c
+++ b/arm/kvm.c
@@ -80,7 +80,10 @@ void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
 					SZ_2M);
 
 	madvise(kvm->arch.ram_alloc_start, kvm->arch.ram_alloc_size,
-		MADV_MERGEABLE | MADV_HUGEPAGE);
+		MADV_MERGEABLE);
+
+	madvise(kvm->arch.ram_alloc_start, kvm->arch.ram_alloc_size,
+		MADV_HUGEPAGE);
 
 	/* Create the virtual GIC. */
 	if (gic__create(kvm, kvm->cfg.arch.irqchip))
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvmtool: ARM: madvise mergeable and hugepage separately
  2016-08-08  7:01 [PATCH] kvmtool: ARM: madvise mergeable and hugepage separately Stefan Agner
@ 2016-08-08 16:11 ` Andre Przywara
  2016-08-25 11:01 ` Suzuki K Poulose
  1 sibling, 0 replies; 3+ messages in thread
From: Andre Przywara @ 2016-08-08 16:11 UTC (permalink / raw)
  To: Stefan Agner, kvmarm, kvm; +Cc: Marc.Zyngier, penberg, will.deacon

Hi,

On 08/08/16 08:01, Stefan Agner wrote:
> The madvise behavior is not a bit field and hence can not be or'ed.
> Also madvise_behavior_valid checks the flag using a case statement
> hence only one behavior is supposed to be supplied. Call madvise
> twice, once for MERGEABLE and once for HUGEPAGE.

thanks for that catch! Indeed we are only setting HUGEPAGE right now,
dropping MERGEABLE due to the OR'ing.

Acked-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre.

> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  arm/kvm.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arm/kvm.c b/arm/kvm.c
> index ce40897..3cfa90a 100644
> --- a/arm/kvm.c
> +++ b/arm/kvm.c
> @@ -80,7 +80,10 @@ void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
>  					SZ_2M);
>  
>  	madvise(kvm->arch.ram_alloc_start, kvm->arch.ram_alloc_size,
> -		MADV_MERGEABLE | MADV_HUGEPAGE);
> +		MADV_MERGEABLE);
> +
> +	madvise(kvm->arch.ram_alloc_start, kvm->arch.ram_alloc_size,
> +		MADV_HUGEPAGE);
>  
>  	/* Create the virtual GIC. */
>  	if (gic__create(kvm, kvm->cfg.arch.irqchip))
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kvmtool: ARM: madvise mergeable and hugepage separately
  2016-08-08  7:01 [PATCH] kvmtool: ARM: madvise mergeable and hugepage separately Stefan Agner
  2016-08-08 16:11 ` Andre Przywara
@ 2016-08-25 11:01 ` Suzuki K Poulose
  1 sibling, 0 replies; 3+ messages in thread
From: Suzuki K Poulose @ 2016-08-25 11:01 UTC (permalink / raw)
  To: Stefan Agner, kvmarm, kvm; +Cc: Marc.Zyngier, penberg, will.deacon

On 08/08/16 08:01, Stefan Agner wrote:
> The madvise behavior is not a bit field and hence can not be or'ed.
> Also madvise_behavior_valid checks the flag using a case statement
> hence only one behavior is supposed to be supplied. Call madvise
> twice, once for MERGEABLE and once for HUGEPAGE.
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
>  arm/kvm.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arm/kvm.c b/arm/kvm.c
> index ce40897..3cfa90a 100644
> --- a/arm/kvm.c
> +++ b/arm/kvm.c
> @@ -80,7 +80,10 @@ void kvm__arch_init(struct kvm *kvm, const char *hugetlbfs_path, u64 ram_size)
>  					SZ_2M);
>
>  	madvise(kvm->arch.ram_alloc_start, kvm->arch.ram_alloc_size,
> -		MADV_MERGEABLE | MADV_HUGEPAGE);
> +		MADV_MERGEABLE);
> +
> +	madvise(kvm->arch.ram_alloc_start, kvm->arch.ram_alloc_size,
> +		MADV_HUGEPAGE);

Should we also do a MADV_DONTDUMP for guest RAM pages ? This is a security option
to strip off any guest data in case of crash in kvmtool. This could also help
to reduce the size of the kvmtool core dumps. I think Qemu does this already.

Suzuki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-25 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-08  7:01 [PATCH] kvmtool: ARM: madvise mergeable and hugepage separately Stefan Agner
2016-08-08 16:11 ` Andre Przywara
2016-08-25 11:01 ` Suzuki K Poulose

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.