KVM: arm64: Fixes to KVM struct allocation
Oliver Upton
maintainercover KVM: arm64: Fixes to KVM struct allocation
Small fix to drop __GFP_HIGHMEM from KVM struct allocation GFP flags, which was always completely pointless and now trips a WARN for passing such an unsupported flag to vmalloc().
Oliver Upton (2):
KVM: arm64: Drop useless __GFP_HIGHMEM from kvm struct allocation
KVM: arm64: Use kvzalloc() for kvm struct allocation
arch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
base-commit: dcb6fa37fd7bc9c3d2b066329b0d27dedf8becaa
Signature · 1 line
2.47.3
Oliver Upton
maintainerPATCH 1/2 KVM: arm64: Drop useless __GFP_HIGHMEM from kvm struct allocation
A recent change on the receiving end of vmalloc() started warning about unsupported GFP flags passed by the caller. Nathan reports that this warning fires in kvm_arch_alloc_vm(), owing to the fact that KVM is passing a meaningless __GFP_HIGHMEM.
Do as the warning says and fix the code.
--- arch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/arm.c +1 -1
@@ -440,7 +440,7 @@ struct kvm *kvm_arch_alloc_vm(void)if (!has_vhe ())return kzalloc (sz,GFP_KERNEL_ACCOUNT ); -return __vmalloc (sz,GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM | __GFP_ZERO); +return __vmalloc (sz,GFP_KERNEL_ACCOUNT | __GFP_ZERO); }int kvm_arch_vcpu_precreate (struct kvm *kvm,unsigned int id)
Signature · 1 line
2.47.3
Oliver Upton
maintainerPATCH 2/2 KVM: arm64: Use kvzalloc() for kvm struct allocation
In reply to Oliver UptonPhysically-allocated KVM structs aren't necessary when in VHE mode as there's no need to share with the hyp's address space. Of course, there can still be a performance benefit from physical allocations.
Use kvzalloc() for opportunistic physical allocations.
--- arch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kvm/arm.c +1 -1
@@ -440,7 +440,7 @@ struct kvm *kvm_arch_alloc_vm(void)if (!has_vhe ())return kzalloc (sz,GFP_KERNEL_ACCOUNT ); -return __vmalloc (sz,GFP_KERNEL_ACCOUNT | __GFP_ZERO); +return kvzalloc (sz,GFP_KERNEL_ACCOUNT ); }int kvm_arch_vcpu_precreate (struct kvm *kvm,unsigned int id)
Signature · 1 line
2.47.3
Quoted 8 lines · Oliver Upton
Small fix to drop
__GFP_HIGHMEMfrom KVM struct allocation GFP flags, which was always completely pointless and now trips a WARN for passing such an unsupported flag tovmalloc().Oliver Upton (2):
KVM: arm64: Drop useless__GFP_HIGHMEMfrom kvm struct allocation
KVM: arm64: Usekvzalloc()for kvm struct allocation
Quoted 5 lines
arch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)base-commit:
dcb6fa37fd7bc9c3d2b066329b0d27dedf8becaa
Also nice to drop a usage of a __-prefixed function.
Quoted 3 lines
Signature · 1 line
2.47.3
Quoted 11 lines · Oliver Upton
Small fix to drop
__GFP_HIGHMEMfrom KVM struct allocation GFP flags, which was always completely pointless and now trips a WARN for passing such an unsupported flag tovmalloc().Oliver Upton (2):
KVM: arm64: Drop useless__GFP_HIGHMEMfrom kvm struct allocation
KVM: arm64: Usekvzalloc()for kvm struct allocationarch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Seems sensible. FWIW:
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Quoted 10 lines · Oliver Upton
Small fix to drop
__GFP_HIGHMEMfrom KVM struct allocation GFP flags, which was always completely pointless and now trips a WARN for passing such an unsupported flag tovmalloc().Oliver Upton (2):
KVM: arm64: Drop useless__GFP_HIGHMEMfrom kvm struct allocation
KVM: arm64: Usekvzalloc()for kvm struct allocationarch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
For the series:
Quoted 9 lines · Oliver Upton
Small fix to drop
__GFP_HIGHMEMfrom KVM struct allocation GFP flags, which was always completely pointless and now trips a WARN for passing such an unsupported flag tovmalloc().Oliver Upton (2):
KVM: arm64: Drop useless__GFP_HIGHMEMfrom kvm struct allocation
KVM: arm64: Usekvzalloc()for kvm struct allocation[...]
Applied to next, thanks!
[1/2] KVM: arm64: Drop useless __GFP_HIGHMEM from kvm struct allocation
https://git.kernel.org/kvmarm/kvmarm/c/297877069bc2 [2/2] KVM: arm64: Use kvzalloc() for kvm struct allocation https://git.kernel.org/kvmarm/kvmarm/c/cb17d79ff51d
--
Best,
Oliver
Re: [PATCH 1/2] KVM: arm64: Drop useless __GFP_HIGHMEM from kvm struct allocation
In reply to Oliver UptonQuoted 11 lines · Oliver Upton
A recent change on the receiving end of
vmalloc()started warning about unsupported GFP flags passed by the caller. Nathan reports that this warning fires inkvm_arch_alloc_vm(), owing to the fact that KVM is passing a meaningless__GFP_HIGHMEM.Do as the warning says and fix the code.
Cc Vishal Moola (Oracle) <[email protected]>Reported-by Nathan Chancellor <[email protected]>Signed-off-by Oliver Upton <[email protected]>
Thanks for the patch!
Quoted 20 lines
--- arch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm64/kvm/arm.c +1
-1@@ -440,7 +440,7 @@ struct kvm *kvm_arch_alloc_vm(void)if (!has_vhe ())return kzalloc (sz,GFP_KERNEL_ACCOUNT ); -return __vmalloc (sz,GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM | __GFP_ZERO); +return __vmalloc (sz,GFP_KERNEL_ACCOUNT | __GFP_ZERO); }int kvm_arch_vcpu_precreate (struct kvm *kvm,unsigned int id)Signature · 1 line
2.47.3