Get rid of mandatory huge page defines
Subsystems (10)
cover Get rid of mandatory huge page defines
The current KVM code relies on a number of definitions to exist for each architecture:
KVM_HPAGE_GFN_SHIFT
KVM_NR_HPAGE_SIZES
KVM_PAGES_PER_HPAGE
However, these defines are only used in the gfn_to_index function, which is only used in the x86 code. This series moves the gfn_to_index function from the generic KVM code into the x86 world and gets rid of the definitions from archiectures that don't use them. s390 actually uses these values in other code, so we leave that part untouched.
Patches based on kvm/next and available here:git://git.linaro.org/people/cdall/linux-kvm-arm.git kvm-pagesize-cleanup
Christoffer Dall (6):
KVM: Move gfn_to_index to x86 specific code
KVM: ARM: Get rid of KVM_HPAGE defines
KVM: arm64: Get rid of KVM_HPAGE defines
KVM: mips: Get rid of KVM_HPAGE defines
KVM: ia64: Get rid of KVM_HPAGE defines
KVM: PPC: Get rid of KVM_HPAGE defines
arch/arm/include/asm/kvm_host.h | 5 ----- arch/arm64/include/asm/kvm_host.h | 5 ----- arch/ia64/include/asm/kvm_host.h | 4 ---- arch/mips/include/asm/kvm_host.h | 7 ------- arch/powerpc/include/asm/kvm_host.h | 5 ----- arch/x86/include/asm/kvm_host.h | 7 +++++++ include/linux/kvm_host.h | 7 ------- 7 files changed, 7 insertions(+), 33 deletions(-)
Signature · 1 line
1.7.10.4
PATCH 1/6 KVM: Move gfn_to_index to x86 specific code
The gfn_to_index function relies on huge page defines which either may not make sense on systems that don't support huge pages or are defined in an unconvenient way for other architectures. Since this is x86-specific, move the function to arch/x86/include/asm/kvm_host.h.
--- arch/x86/include/asm/kvm_host.h | 7 +++++++ include/linux/kvm_host.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
arch/x86/include/asm/kvm_host.h +7 -0
@@ -79,6 +79,13 @@#define KVM_HPAGE_MASK (x) (~(KVM_HPAGE_SIZE(x) - 1))#define KVM_PAGES_PER_HPAGE (x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) +static inline gfn_t gfn_to_index (gfn_t gfn,gfn_t base_gfn,int level) +{ +/* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */ +return (gfn >>KVM_HPAGE_GFN_SHIFT (level)) - + (base_gfn >>KVM_HPAGE_GFN_SHIFT (level)); +} +#define SELECTOR_TI_MASK (1 << 2)#define SELECTOR_RPL_MASK 0x03
include/linux/kvm_host.h +0 -7
@@ -841,13 +841,6 @@ static inline int memslot_id(struct kvm *kvm, gfn_t gfn)return gfn_to_memslot (kvm, gfn)->id; } -static inline gfn_t gfn_to_index (gfn_t gfn,gfn_t base_gfn,int level) -{ -/* KVM_HPAGE_GFN_SHIFT(PT_PAGE_TABLE_LEVEL) must be 0. */ -return (gfn >>KVM_HPAGE_GFN_SHIFT (level)) - - (base_gfn >>KVM_HPAGE_GFN_SHIFT (level)); -} -static inline gfn_t hva_to_gfn_memslot (unsigned long hva,struct kvm_memory_slot *slot) {
Signature · 1 line
1.7.10.4
PATCH 2/6 KVM: ARM: Get rid of KVM_HPAGE defines
In reply to Christoffer DallThe KVM_HPAGE_DEFINES are a little artificial on ARM, since the huge page size is statically defined at compile time and there is only a single huge page size.
Now when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these.
--- arch/arm/include/asm/kvm_host.h | 5 ----- 1 file changed, 5 deletions(-)
arch/arm/include/asm/kvm_host.h +0 -5
@@ -38,11 +38,6 @@#define KVM_VCPU_MAX_FEATURES 1 -/* We don't currently support large pages. */ -#define KVM_HPAGE_GFN_SHIFT (x) 0 -#define KVM_NR_PAGE_SIZES 1 -#define KVM_PAGES_PER_HPAGE (x) (1UL<<31) -#include <kvm/arm_vgic.h> struct kvm_vcpu ;
Signature · 1 line
1.7.10.4
PATCH 3/6 KVM: arm64: Get rid of KVM_HPAGE defines
In reply to Christoffer DallNow when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these.
--- arch/arm64/include/asm/kvm_host.h | 5 ----- 1 file changed, 5 deletions(-)
arch/arm64/include/asm/kvm_host.h +0 -5
@@ -36,11 +36,6 @@#define KVM_VCPU_MAX_FEATURES 2 -/* We don't currently support large pages. */ -#define KVM_HPAGE_GFN_SHIFT (x) 0 -#define KVM_NR_PAGE_SIZES 1 -#define KVM_PAGES_PER_HPAGE (x) (1UL<<31) -struct kvm_vcpu ;int kvm_target_cpu (void );int kvm_reset_vcpu (struct kvm_vcpu *vcpu);
Signature · 1 line
1.7.10.4
PATCH 4/6 KVM: mips: Get rid of KVM_HPAGE defines
In reply to Christoffer DallNow when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these.
--- arch/mips/include/asm/kvm_host.h | 7 ------- 1 file changed, 7 deletions(-)
arch/mips/include/asm/kvm_host.h +0 -7
@@ -27,13 +27,6 @@#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 -/* Don't support huge pages */ -#define KVM_HPAGE_GFN_SHIFT (x) 0 - -/* We don't currently support large pages. */ -#define KVM_NR_PAGE_SIZES 1 -#define KVM_PAGES_PER_HPAGE (x) 1 -/* Special address that contains the comm page, used for reducing # of traps */
Signature · 1 line
1.7.10.4
PATCH 5/6 KVM: ia64: Get rid of KVM_HPAGE defines
In reply to Christoffer DallNow when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these.
--- arch/ia64/include/asm/kvm_host.h | 4 ---- 1 file changed, 4 deletions(-)
arch/ia64/include/asm/kvm_host.h +0 -4
@@ -234,10 +234,6 @@ struct kvm_vm_data {#define KVM_REQ_PTC_G 32#define KVM_REQ_RESUME 33 -#define KVM_HPAGE_GFN_SHIFT (x) 0 -#define KVM_NR_PAGE_SIZES 1 -#define KVM_PAGES_PER_HPAGE (x) 1 -struct kvm ;struct kvm_vcpu ;
Signature · 1 line
1.7.10.4
PATCH 6/6 KVM: PPC: Get rid of KVM_HPAGE defines
In reply to Christoffer DallNow when the main kvm code relying on these defines has been moved to the x86 specific part of the world, we can get rid of these.
--- arch/powerpc/include/asm/kvm_host.h | 5 ----- 1 file changed, 5 deletions(-)
arch/powerpc/include/asm/kvm_host.h +0 -5
@@ -63,11 +63,6 @@ extern void kvm_set_spte_hva(struct kvm *kvm, unsigned long hva, pte_t pte);#endif -/* We don't currently support large pages. */ -#define KVM_HPAGE_GFN_SHIFT (x) 0 -#define KVM_NR_PAGE_SIZES 1 -#define KVM_PAGES_PER_HPAGE (x) (1UL<<31) -#define HPTEG_CACHE_NUM (1 << 15)#define HPTEG_HASH_BITS_PTE 13#define HPTEG_HASH_BITS_PTE_LONG 12
Signature · 1 line
1.7.10.4
Quoted 15 lines · Christoffer Dall
The current KVM code relies on a number of definitions to exist for each architecture:
KVM_HPAGE_GFN_SHIFT
KVM_NR_HPAGE_SIZES
KVM_PAGES_PER_HPAGEHowever, these defines are only used in the
gfn_to_indexfunction, which is only used in the x86 code. This series moves thegfn_to_indexfunction from the generic KVM code into the x86 world and gets rid of the definitions from archiectures that don't use them. s390 actually uses these values in other code, so we leave that part untouched.Patches based on kvm/next and available here:
git://git.linaro.org/people/cdall/linux-kvm-arm.gitkvm-pagesize-cleanup
Quoted 8 lines
Christoffer Dall (6):
KVM: Movegfn_to_indexto x86 specific code
KVM: ARM: Get rid ofKVM_HPAGEdefines
KVM: arm64: Get rid ofKVM_HPAGEdefines
KVM: mips: Get rid ofKVM_HPAGEdefines
KVM: ia64: Get rid ofKVM_HPAGEdefines
KVM: PPC: Get rid ofKVM_HPAGEdefines
Any comments on this one? I'd very much like to merge huge page support for KVM/ARM during the next merge window and it depends on this series.
Thanks!
-Christoffer
Quoted 25 lines · Christoffer Dall
Quoted 15 lines · Christoffer Dall
The current KVM code relies on a number of definitions to exist for each architecture:
KVM_HPAGE_GFN_SHIFT
KVM_NR_HPAGE_SIZES
KVM_PAGES_PER_HPAGEHowever, these defines are only used in the
gfn_to_indexfunction, which is only used in the x86 code. This series moves thegfn_to_indexfunction from the generic KVM code into the x86 world and gets rid of the definitions from archiectures that don't use them. s390 actually uses these values in other code, so we leave that part untouched.Patches based on kvm/next and available here:
git://git.linaro.org/people/cdall/linux-kvm-arm.gitkvm-pagesize-cleanupQuoted 8 lines
Christoffer Dall (6):
KVM: Movegfn_to_indexto x86 specific code
KVM: ARM: Get rid ofKVM_HPAGEdefines
KVM: arm64: Get rid ofKVM_HPAGEdefines
KVM: mips: Get rid ofKVM_HPAGEdefines
KVM: ia64: Get rid ofKVM_HPAGEdefines
KVM: PPC: Get rid ofKVM_HPAGEdefines
Quoted 4 lines
Any comments on this one? I'd very much like to merge huge page support for KVM/ARM during the next merge window and it depends on this series.
Looks fine to me, but why have you skipped s390?
--
Gleb.
Quoted 26 lines · Gleb Natapov
Quoted 25 lines · Christoffer Dall
Quoted 23 lines · Christoffer Dall
The current KVM code relies on a number of definitions to exist for each architecture:
KVM_HPAGE_GFN_SHIFT
KVM_NR_HPAGE_SIZES
KVM_PAGES_PER_HPAGEHowever, these defines are only used in the
gfn_to_indexfunction, which is only used in the x86 code. This series moves thegfn_to_indexfunction from the generic KVM code into the x86 world and gets rid of the definitions from archiectures that don't use them. s390 actually uses these values in other code, so we leave that part untouched.Patches based on kvm/next and available here:
git://git.linaro.org/people/cdall/linux-kvm-arm.gitkvm-pagesize-cleanupChristoffer Dall (6):
KVM: Movegfn_to_indexto x86 specific code
KVM: ARM: Get rid ofKVM_HPAGEdefines
KVM: arm64: Get rid ofKVM_HPAGEdefines
KVM: mips: Get rid ofKVM_HPAGEdefines
KVM: ia64: Get rid ofKVM_HPAGEdefines
KVM: PPC: Get rid ofKVM_HPAGEdefines
Quoted 6 lines
Quoted 4 lines
Any comments on this one? I'd very much like to merge huge page support for KVM/ARM during the next merge window and it depends on this series.
Looks fine to me, but why have you skipped s390?
Because the defines are actually used in their code, see above:
"... s390 actually uses these values in other code, so we leave that part untouched."
Will you apply these from the mailing list or should I send you a pull request?
Thanks,
-Christoffer
Quoted 31 lines · Christoffer Dall
Quoted 30 lines · Gleb Natapov
Quoted 29 lines · Christoffer Dall
Quoted 15 lines · Christoffer Dall
The current KVM code relies on a number of definitions to exist for each architecture:
KVM_HPAGE_GFN_SHIFT
KVM_NR_HPAGE_SIZES
KVM_PAGES_PER_HPAGEHowever, these defines are only used in the
gfn_to_indexfunction, which is only used in the x86 code. This series moves thegfn_to_indexfunction from the generic KVM code into the x86 world and gets rid of the definitions from archiectures that don't use them. s390 actually uses these values in other code, so we leave that part untouched.Patches based on kvm/next and available here:
git://git.linaro.org/people/cdall/linux-kvm-arm.gitkvm-pagesize-cleanupQuoted 8 lines
Christoffer Dall (6):
KVM: Movegfn_to_indexto x86 specific code
KVM: ARM: Get rid ofKVM_HPAGEdefines
KVM: arm64: Get rid ofKVM_HPAGEdefines
KVM: mips: Get rid ofKVM_HPAGEdefines
KVM: ia64: Get rid ofKVM_HPAGEdefines
KVM: PPC: Get rid ofKVM_HPAGEdefinesAny comments on this one? I'd very much like to merge huge page support for KVM/ARM during the next merge window and it depends on this series.
Quoted 8 lines
Quoted 2 lines
Looks fine to me, but why have you skipped s390?
Because the defines are actually used in their code, see above:
"... s390 actually uses these values in other code, so we leave that part untouched."
It does? Where? I actually removed then and the code still build.
Quoted 3 lines
Will you apply these from the mailing list or should I send you a pull request?
I will apply them from the mailing list.
--
Gleb.
Quoted 35 lines · Gleb Natapov
Quoted 34 lines · Christoffer Dall
Quoted 32 lines · Gleb Natapov
Quoted 25 lines · Christoffer Dall
Quoted 15 lines · Christoffer Dall
The current KVM code relies on a number of definitions to exist for each architecture:
KVM_HPAGE_GFN_SHIFT
KVM_NR_HPAGE_SIZES
KVM_PAGES_PER_HPAGEHowever, these defines are only used in the
gfn_to_indexfunction, which is only used in the x86 code. This series moves thegfn_to_indexfunction from the generic KVM code into the x86 world and gets rid of the definitions from archiectures that don't use them. s390 actually uses these values in other code, so we leave that part untouched.Patches based on kvm/next and available here:
git://git.linaro.org/people/cdall/linux-kvm-arm.gitkvm-pagesize-cleanupQuoted 8 lines
Christoffer Dall (6):
KVM: Movegfn_to_indexto x86 specific code
KVM: ARM: Get rid ofKVM_HPAGEdefines
KVM: arm64: Get rid ofKVM_HPAGEdefines
KVM: mips: Get rid ofKVM_HPAGEdefines
KVM: ia64: Get rid ofKVM_HPAGEdefines
KVM: PPC: Get rid ofKVM_HPAGEdefinesQuoted 4 lines
Any comments on this one? I'd very much like to merge huge page support for KVM/ARM during the next merge window and it depends on this series.
Looks fine to me, but why have you skipped s390?
Quoted 7 lines
Quoted 5 lines
Because the defines are actually used in their code, see above:
"... s390 actually uses these values in other code, so we leave that part untouched."
It does? Where? I actually removed then and the code still build.
Eh, I can't find them either. I must have messed something up, sorry about that. Missing patch following!
Quoted 5 lines
Quoted 3 lines
Will you apply these from the mailing list or should I send you a pull request?
I will apply them from the mailing list.
Thanks!
-Christoffer
Gleb Natapov
AppliedQuoted 38 lines · Christoffer Dall
Quoted 37 lines · Gleb Natapov
Quoted 36 lines · Christoffer Dall
Quoted 26 lines · Gleb Natapov
Quoted 25 lines · Christoffer Dall
Quoted 23 lines · Christoffer Dall
The current KVM code relies on a number of definitions to exist for each architecture:
KVM_HPAGE_GFN_SHIFT
KVM_NR_HPAGE_SIZES
KVM_PAGES_PER_HPAGEHowever, these defines are only used in the
gfn_to_indexfunction, which is only used in the x86 code. This series moves thegfn_to_indexfunction from the generic KVM code into the x86 world and gets rid of the definitions from archiectures that don't use them. s390 actually uses these values in other code, so we leave that part untouched.Patches based on kvm/next and available here:
git://git.linaro.org/people/cdall/linux-kvm-arm.gitkvm-pagesize-cleanupChristoffer Dall (6):
KVM: Movegfn_to_indexto x86 specific code
KVM: ARM: Get rid ofKVM_HPAGEdefines
KVM: arm64: Get rid ofKVM_HPAGEdefines
KVM: mips: Get rid ofKVM_HPAGEdefines
KVM: ia64: Get rid ofKVM_HPAGEdefines
KVM: PPC: Get rid ofKVM_HPAGEdefinesQuoted 6 lines
Quoted 4 lines
Any comments on this one? I'd very much like to merge huge page support for KVM/ARM during the next merge window and it depends on this series.
Looks fine to me, but why have you skipped s390?
Because the defines are actually used in their code, see above:
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
"... s390 actually uses these values in other code, so we leave that part untouched."
It does? Where? I actually removed then and the code still build.
Eh, I can't find them either. I must have messed something up, sorry about that. Missing patch following!
Thanks, applied all to queue.
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
Will you apply these from the mailing list or should I send you a pull request?
I will apply them from the mailing list.
Thanks!
-Christoffer
--
Gleb.