2019-10-22 00:40:17

by Sean Christopherson

[permalink] [raw]
Subject: [PATCH v2 00/15] KVM: Dynamically size memslot arrays

The end goal of this series is to dynamically size the memslot array so
that KVM allocates memory based on the number of memslots in use, as
opposed to unconditionally allocating memory for the maximum number of
memslots. On x86, each memslot consumes 88 bytes, and so with 2 address
spaces of 512 memslots, each VM consumes ~90k bytes for the memslots.
E.g. given a VM that uses a total of 30 memslots, dynamic sizing reduces
the memory footprint from 90k to ~2.6k bytes.

The changes required to support dynamic sizing are relatively small,
e.g. are essentially contained in patches 12/13 and 13/13. Patches 1-11
clean up the memslot code, which has gotten quite crusy, especially
__kvm_set_memory_region(). The clean up is likely not strictly necessary
to switch to dynamic sizing, but I didn't have a remotely reasonable
level of confidence in the correctness of the dynamic sizing without first
doing the clean up.

Testing, especially non-x86 platforms, would be greatly appreciated. The
non-x86 changes are for all intents and purposes untested, e.g. I compile
tested pieces of the code by copying them into x86, but that's it. In
theory, the vast majority of the functional changes are arch agnostic, in
theory...

v2:
- Split "Drop kvm_arch_create_memslot()" into three patches to move
minor functional changes to standalone patches [Janosch].
- Rebase to latest kvm/queue (f0574a1cea5b, "KVM: x86: fix ...")
- Collect an Acked-by and a Reviewed-by

Sean Christopherson (15):
KVM: Reinstall old memslots if arch preparation fails
KVM: Don't free new memslot if allocation of said memslot fails
KVM: PPC: Move memslot memory allocation into prepare_memory_region()
KVM: x86: Allocate memslot resources during prepare_memory_region()
KVM: Drop kvm_arch_create_memslot()
KVM: Explicitly free allocated-but-unused dirty bitmap
KVM: Refactor error handling for setting memory region
KVM: Move setting of memslot into helper routine
KVM: Move memslot deletion to helper function
KVM: Simplify kvm_free_memslot() and all its descendents
KVM: Clean up local variable usage in __kvm_set_memory_region()
KVM: Provide common implementation for generic dirty log functions
KVM: Ensure validity of memslot with respect to kvm_get_dirty_log()
KVM: Terminate memslot walks via used_slots
KVM: Dynamically size memslot array based on number of used slots

arch/mips/include/asm/kvm_host.h | 2 +-
arch/mips/kvm/mips.c | 68 +---
arch/powerpc/include/asm/kvm_ppc.h | 14 +-
arch/powerpc/kvm/book3s.c | 22 +-
arch/powerpc/kvm/book3s_hv.c | 36 +-
arch/powerpc/kvm/book3s_pr.c | 20 +-
arch/powerpc/kvm/booke.c | 17 +-
arch/powerpc/kvm/powerpc.c | 13 +-
arch/s390/include/asm/kvm_host.h | 2 +-
arch/s390/kvm/kvm-s390.c | 21 +-
arch/x86/include/asm/kvm_page_track.h | 3 +-
arch/x86/kvm/page_track.c | 15 +-
arch/x86/kvm/x86.c | 100 ++---
include/linux/kvm_host.h | 48 +--
virt/kvm/arm/arm.c | 47 +--
virt/kvm/arm/mmu.c | 18 +-
virt/kvm/kvm_main.c | 546 ++++++++++++++++----------
17 files changed, 467 insertions(+), 525 deletions(-)

--
2.22.0


2019-10-22 00:40:25

by Sean Christopherson

[permalink] [raw]
Subject: [PATCH v2 04/15] KVM: x86: Allocate memslot resources during prepare_memory_region()

Allocate the various metadata structures associated with a memslot
during during kvm_arch_prepare_memory_region(), which paves the way for
removing kvm_arch_create_memslot() altogether. Moving x86's memory
allocation only changes the order of kernel memory allocations between
x86 and common KVM code.

No functional change intended.

Signed-off-by: Sean Christopherson <[email protected]>
---
arch/x86/kvm/x86.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index f26f8be4e621..fa80f07ba501 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -9601,6 +9601,12 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,

int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
unsigned long npages)
+{
+ return 0;
+}
+
+static int kvm_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
+ unsigned long npages)
{
int i;

@@ -9678,6 +9684,9 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
const struct kvm_userspace_memory_region *mem,
enum kvm_mr_change change)
{
+ if (change == KVM_MR_CREATE)
+ return kvm_create_memslot(kvm, memslot,
+ mem->memory_size >> PAGE_SHIFT);
return 0;
}

--
2.22.0

2019-10-22 00:40:30

by Sean Christopherson

[permalink] [raw]
Subject: [PATCH v2 03/15] KVM: PPC: Move memslot memory allocation into prepare_memory_region()

Allocate the rmap array during kvm_arch_prepare_memory_region() to pave
the way for removing kvm_arch_create_memslot() altogether. Moving PPC's
memory allocation only changes the order of kernel memory allocations
between PPC and common KVM code.

No functional change intended.

Acked-by: Paul Mackerras <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>
---
arch/powerpc/include/asm/kvm_ppc.h | 8 ++------
arch/powerpc/kvm/book3s.c | 12 ++++--------
arch/powerpc/kvm/book3s_hv.c | 25 ++++++++++++-------------
arch/powerpc/kvm/book3s_pr.c | 11 ++---------
arch/powerpc/kvm/booke.c | 9 ++-------
arch/powerpc/kvm/powerpc.c | 4 ++--
6 files changed, 24 insertions(+), 45 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index ee62776e5433..495901ae0070 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -203,9 +203,6 @@ extern void kvmppc_core_destroy_vm(struct kvm *kvm);
extern void kvmppc_core_free_memslot(struct kvm *kvm,
struct kvm_memory_slot *free,
struct kvm_memory_slot *dont);
-extern int kvmppc_core_create_memslot(struct kvm *kvm,
- struct kvm_memory_slot *slot,
- unsigned long npages);
extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot,
const struct kvm_userspace_memory_region *mem);
@@ -280,7 +277,8 @@ struct kvmppc_ops {
void (*flush_memslot)(struct kvm *kvm, struct kvm_memory_slot *memslot);
int (*prepare_memory_region)(struct kvm *kvm,
struct kvm_memory_slot *memslot,
- const struct kvm_userspace_memory_region *mem);
+ const struct kvm_userspace_memory_region *mem,
+ enum kvm_mr_change change);
void (*commit_memory_region)(struct kvm *kvm,
const struct kvm_userspace_memory_region *mem,
const struct kvm_memory_slot *old,
@@ -294,8 +292,6 @@ struct kvmppc_ops {
void (*mmu_destroy)(struct kvm_vcpu *vcpu);
void (*free_memslot)(struct kvm_memory_slot *free,
struct kvm_memory_slot *dont);
- int (*create_memslot)(struct kvm_memory_slot *slot,
- unsigned long npages);
int (*init_vm)(struct kvm *kvm);
void (*destroy_vm)(struct kvm *kvm);
int (*get_smmu_info)(struct kvm *kvm, struct kvm_ppc_smmu_info *info);
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index ec2547cc5ecb..111b39a5250d 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -840,12 +840,6 @@ void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
kvm->arch.kvm_ops->free_memslot(free, dont);
}

-int kvmppc_core_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
- unsigned long npages)
-{
- return kvm->arch.kvm_ops->create_memslot(slot, npages);
-}
-
void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot)
{
kvm->arch.kvm_ops->flush_memslot(kvm, memslot);
@@ -853,9 +847,11 @@ void kvmppc_core_flush_memslot(struct kvm *kvm, struct kvm_memory_slot *memslot)

int kvmppc_core_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot,
- const struct kvm_userspace_memory_region *mem)
+ const struct kvm_userspace_memory_region *mem,
+ enum kvm_mr_change change)
{
- return kvm->arch.kvm_ops->prepare_memory_region(kvm, memslot, mem);
+ return kvm->arch.kvm_ops->prepare_memory_region(kvm, memslot, mem,
+ change);
}

void kvmppc_core_commit_memory_region(struct kvm *kvm,
diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 709cf1fd4cf4..4e5664379329 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -4461,20 +4461,20 @@ static void kvmppc_core_free_memslot_hv(struct kvm_memory_slot *free,
}
}

-static int kvmppc_core_create_memslot_hv(struct kvm_memory_slot *slot,
- unsigned long npages)
-{
- slot->arch.rmap = vzalloc(array_size(npages, sizeof(*slot->arch.rmap)));
- if (!slot->arch.rmap)
- return -ENOMEM;
-
- return 0;
-}
-
static int kvmppc_core_prepare_memory_region_hv(struct kvm *kvm,
- struct kvm_memory_slot *memslot,
- const struct kvm_userspace_memory_region *mem)
+ struct kvm_memory_slot *slot,
+ const struct kvm_userspace_memory_region *mem,
+ enum kvm_mr_change change)
{
+ unsigned long npages = mem->memory_size >> PAGE_SHIFT;
+
+ if (change == KVM_MR_CREATE) {
+ slot->arch.rmap = vzalloc(array_size(npages,
+ sizeof(*slot->arch.rmap)));
+ if (!slot->arch.rmap)
+ return -ENOMEM;
+ }
+
return 0;
}

@@ -5416,7 +5416,6 @@ static struct kvmppc_ops kvm_ops_hv = {
.set_spte_hva = kvm_set_spte_hva_hv,
.mmu_destroy = kvmppc_mmu_destroy_hv,
.free_memslot = kvmppc_core_free_memslot_hv,
- .create_memslot = kvmppc_core_create_memslot_hv,
.init_vm = kvmppc_core_init_vm_hv,
.destroy_vm = kvmppc_core_destroy_vm_hv,
.get_smmu_info = kvm_vm_ioctl_get_smmu_info_hv,
diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index cc65af8fe6f7..5fceb1da5fde 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1903,7 +1903,8 @@ static void kvmppc_core_flush_memslot_pr(struct kvm *kvm,

static int kvmppc_core_prepare_memory_region_pr(struct kvm *kvm,
struct kvm_memory_slot *memslot,
- const struct kvm_userspace_memory_region *mem)
+ const struct kvm_userspace_memory_region *mem,
+ enum kvm_mr_change change)
{
return 0;
}
@@ -1923,13 +1924,6 @@ static void kvmppc_core_free_memslot_pr(struct kvm_memory_slot *free,
return;
}

-static int kvmppc_core_create_memslot_pr(struct kvm_memory_slot *slot,
- unsigned long npages)
-{
- return 0;
-}
-
-
#ifdef CONFIG_PPC64
static int kvm_vm_ioctl_get_smmu_info_pr(struct kvm *kvm,
struct kvm_ppc_smmu_info *info)
@@ -2073,7 +2067,6 @@ static struct kvmppc_ops kvm_ops_pr = {
.set_spte_hva = kvm_set_spte_hva_pr,
.mmu_destroy = kvmppc_mmu_destroy_pr,
.free_memslot = kvmppc_core_free_memslot_pr,
- .create_memslot = kvmppc_core_create_memslot_pr,
.init_vm = kvmppc_core_init_vm_pr,
.destroy_vm = kvmppc_core_destroy_vm_pr,
.get_smmu_info = kvm_vm_ioctl_get_smmu_info_pr,
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index be9a45874194..cf2845e147c5 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1806,15 +1806,10 @@ void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
{
}

-int kvmppc_core_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
- unsigned long npages)
-{
- return 0;
-}
-
int kvmppc_core_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot,
- const struct kvm_userspace_memory_region *mem)
+ const struct kvm_userspace_memory_region *mem,
+ enum kvm_mr_change change)
{
return 0;
}
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 3a77bb643452..95b4a766b6cb 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -690,7 +690,7 @@ void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
unsigned long npages)
{
- return kvmppc_core_create_memslot(kvm, slot, npages);
+ return 0;
}

int kvm_arch_prepare_memory_region(struct kvm *kvm,
@@ -698,7 +698,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
const struct kvm_userspace_memory_region *mem,
enum kvm_mr_change change)
{
- return kvmppc_core_prepare_memory_region(kvm, memslot, mem);
+ return kvmppc_core_prepare_memory_region(kvm, memslot, mem, change);
}

void kvm_arch_commit_memory_region(struct kvm *kvm,
--
2.22.0

2019-10-22 14:11:49

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] KVM: Dynamically size memslot arrays

On 22/10/19 02:35, Sean Christopherson wrote:
> The end goal of this series is to dynamically size the memslot array so
> that KVM allocates memory based on the number of memslots in use, as
> opposed to unconditionally allocating memory for the maximum number of
> memslots. On x86, each memslot consumes 88 bytes, and so with 2 address
> spaces of 512 memslots, each VM consumes ~90k bytes for the memslots.
> E.g. given a VM that uses a total of 30 memslots, dynamic sizing reduces
> the memory footprint from 90k to ~2.6k bytes.
>
> The changes required to support dynamic sizing are relatively small,
> e.g. are essentially contained in patches 12/13 and 13/13. Patches 1-11
> clean up the memslot code, which has gotten quite crusy, especially
> __kvm_set_memory_region(). The clean up is likely not strictly necessary
> to switch to dynamic sizing, but I didn't have a remotely reasonable
> level of confidence in the correctness of the dynamic sizing without first
> doing the clean up.
>
> Testing, especially non-x86 platforms, would be greatly appreciated. The
> non-x86 changes are for all intents and purposes untested, e.g. I compile
> tested pieces of the code by copying them into x86, but that's it. In
> theory, the vast majority of the functional changes are arch agnostic, in
> theory...
>
> v2:
> - Split "Drop kvm_arch_create_memslot()" into three patches to move
> minor functional changes to standalone patches [Janosch].
> - Rebase to latest kvm/queue (f0574a1cea5b, "KVM: x86: fix ...")
> - Collect an Acked-by and a Reviewed-by
>
> Sean Christopherson (15):
> KVM: Reinstall old memslots if arch preparation fails
> KVM: Don't free new memslot if allocation of said memslot fails
> KVM: PPC: Move memslot memory allocation into prepare_memory_region()
> KVM: x86: Allocate memslot resources during prepare_memory_region()
> KVM: Drop kvm_arch_create_memslot()
> KVM: Explicitly free allocated-but-unused dirty bitmap
> KVM: Refactor error handling for setting memory region
> KVM: Move setting of memslot into helper routine
> KVM: Move memslot deletion to helper function
> KVM: Simplify kvm_free_memslot() and all its descendents
> KVM: Clean up local variable usage in __kvm_set_memory_region()
> KVM: Provide common implementation for generic dirty log functions
> KVM: Ensure validity of memslot with respect to kvm_get_dirty_log()
> KVM: Terminate memslot walks via used_slots
> KVM: Dynamically size memslot array based on number of used slots
>
> arch/mips/include/asm/kvm_host.h | 2 +-
> arch/mips/kvm/mips.c | 68 +---
> arch/powerpc/include/asm/kvm_ppc.h | 14 +-
> arch/powerpc/kvm/book3s.c | 22 +-
> arch/powerpc/kvm/book3s_hv.c | 36 +-
> arch/powerpc/kvm/book3s_pr.c | 20 +-
> arch/powerpc/kvm/booke.c | 17 +-
> arch/powerpc/kvm/powerpc.c | 13 +-
> arch/s390/include/asm/kvm_host.h | 2 +-
> arch/s390/kvm/kvm-s390.c | 21 +-
> arch/x86/include/asm/kvm_page_track.h | 3 +-
> arch/x86/kvm/page_track.c | 15 +-
> arch/x86/kvm/x86.c | 100 ++---
> include/linux/kvm_host.h | 48 +--
> virt/kvm/arm/arm.c | 47 +--
> virt/kvm/arm/mmu.c | 18 +-
> virt/kvm/kvm_main.c | 546 ++++++++++++++++----------
> 17 files changed, 467 insertions(+), 525 deletions(-)
>

Christian, Marc, Paul, can you help testing patches 1-13?

Thanks,

2019-10-22 15:59:52

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] KVM: Dynamically size memslot arrays

On 22/10/19 02:35, Sean Christopherson wrote:
> The end goal of this series is to dynamically size the memslot array so
> that KVM allocates memory based on the number of memslots in use, as
> opposed to unconditionally allocating memory for the maximum number of
> memslots. On x86, each memslot consumes 88 bytes, and so with 2 address
> spaces of 512 memslots, each VM consumes ~90k bytes for the memslots.
> E.g. given a VM that uses a total of 30 memslots, dynamic sizing reduces
> the memory footprint from 90k to ~2.6k bytes.
>
> The changes required to support dynamic sizing are relatively small,
> e.g. are essentially contained in patches 12/13 and 13/13. Patches 1-11
> clean up the memslot code, which has gotten quite crusy, especially
> __kvm_set_memory_region(). The clean up is likely not strictly necessary
> to switch to dynamic sizing, but I didn't have a remotely reasonable
> level of confidence in the correctness of the dynamic sizing without first
> doing the clean up.
>
> Testing, especially non-x86 platforms, would be greatly appreciated. The
> non-x86 changes are for all intents and purposes untested, e.g. I compile
> tested pieces of the code by copying them into x86, but that's it. In
> theory, the vast majority of the functional changes are arch agnostic, in
> theory...
>
> v2:
> - Split "Drop kvm_arch_create_memslot()" into three patches to move
> minor functional changes to standalone patches [Janosch].
> - Rebase to latest kvm/queue (f0574a1cea5b, "KVM: x86: fix ...")
> - Collect an Acked-by and a Reviewed-by

I only have some cosmetic changes on patches 14-15. Let's wait for
testing results.

Paolo

2019-10-23 09:41:22

by Christoffer Dall

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] KVM: Dynamically size memslot arrays

On Mon, Oct 21, 2019 at 05:35:22PM -0700, Sean Christopherson wrote:
> The end goal of this series is to dynamically size the memslot array so
> that KVM allocates memory based on the number of memslots in use, as
> opposed to unconditionally allocating memory for the maximum number of
> memslots. On x86, each memslot consumes 88 bytes, and so with 2 address
> spaces of 512 memslots, each VM consumes ~90k bytes for the memslots.
> E.g. given a VM that uses a total of 30 memslots, dynamic sizing reduces
> the memory footprint from 90k to ~2.6k bytes.
>
> The changes required to support dynamic sizing are relatively small,
> e.g. are essentially contained in patches 12/13 and 13/13. Patches 1-11
> clean up the memslot code, which has gotten quite crusy, especially
> __kvm_set_memory_region(). The clean up is likely not strictly necessary
> to switch to dynamic sizing, but I didn't have a remotely reasonable
> level of confidence in the correctness of the dynamic sizing without first
> doing the clean up.
>
> Testing, especially non-x86 platforms, would be greatly appreciated. The
> non-x86 changes are for all intents and purposes untested, e.g. I compile
> tested pieces of the code by copying them into x86, but that's it. In
> theory, the vast majority of the functional changes are arch agnostic, in
> theory...

I've built this for arm/arm64, and I've ran my usual set of tests which
pass fine. I've also run the selftest framework's tests for the dirty
logging and the migration loop test for arm64, and they pass fine.

You can add my (for arm64):

Tested-by: Christoffer Dall <[email protected]>

2019-10-24 09:20:16

by Christian Borntraeger

[permalink] [raw]
Subject: Re: [PATCH v2 00/15] KVM: Dynamically size memslot arrays



On 22.10.19 15:59, Paolo Bonzini wrote:
> On 22/10/19 02:35, Sean Christopherson wrote:
>> The end goal of this series is to dynamically size the memslot array so
>> that KVM allocates memory based on the number of memslots in use, as
>> opposed to unconditionally allocating memory for the maximum number of
>> memslots. On x86, each memslot consumes 88 bytes, and so with 2 address
>> spaces of 512 memslots, each VM consumes ~90k bytes for the memslots.
>> E.g. given a VM that uses a total of 30 memslots, dynamic sizing reduces
>> the memory footprint from 90k to ~2.6k bytes.
>>
>> The changes required to support dynamic sizing are relatively small,
>> e.g. are essentially contained in patches 12/13 and 13/13. Patches 1-11
>> clean up the memslot code, which has gotten quite crusy, especially
>> __kvm_set_memory_region(). The clean up is likely not strictly necessary
>> to switch to dynamic sizing, but I didn't have a remotely reasonable
>> level of confidence in the correctness of the dynamic sizing without first
>> doing the clean up.
>>
>> Testing, especially non-x86 platforms, would be greatly appreciated. The
>> non-x86 changes are for all intents and purposes untested, e.g. I compile
>> tested pieces of the code by copying them into x86, but that's it. In
>> theory, the vast majority of the functional changes are arch agnostic, in
>> theory...
>>
>> v2:
>> - Split "Drop kvm_arch_create_memslot()" into three patches to move
>> minor functional changes to standalone patches [Janosch].
>> - Rebase to latest kvm/queue (f0574a1cea5b, "KVM: x86: fix ...")
>> - Collect an Acked-by and a Reviewed-by
>>
>> Sean Christopherson (15):
>> KVM: Reinstall old memslots if arch preparation fails
>> KVM: Don't free new memslot if allocation of said memslot fails
>> KVM: PPC: Move memslot memory allocation into prepare_memory_region()
>> KVM: x86: Allocate memslot resources during prepare_memory_region()
>> KVM: Drop kvm_arch_create_memslot()
>> KVM: Explicitly free allocated-but-unused dirty bitmap
>> KVM: Refactor error handling for setting memory region
>> KVM: Move setting of memslot into helper routine
>> KVM: Move memslot deletion to helper function
>> KVM: Simplify kvm_free_memslot() and all its descendents
>> KVM: Clean up local variable usage in __kvm_set_memory_region()
>> KVM: Provide common implementation for generic dirty log functions
>> KVM: Ensure validity of memslot with respect to kvm_get_dirty_log()
>> KVM: Terminate memslot walks via used_slots
>> KVM: Dynamically size memslot array based on number of used slots
>>
>> arch/mips/include/asm/kvm_host.h | 2 +-
>> arch/mips/kvm/mips.c | 68 +---
>> arch/powerpc/include/asm/kvm_ppc.h | 14 +-
>> arch/powerpc/kvm/book3s.c | 22 +-
>> arch/powerpc/kvm/book3s_hv.c | 36 +-
>> arch/powerpc/kvm/book3s_pr.c | 20 +-
>> arch/powerpc/kvm/booke.c | 17 +-
>> arch/powerpc/kvm/powerpc.c | 13 +-
>> arch/s390/include/asm/kvm_host.h | 2 +-
>> arch/s390/kvm/kvm-s390.c | 21 +-
>> arch/x86/include/asm/kvm_page_track.h | 3 +-
>> arch/x86/kvm/page_track.c | 15 +-
>> arch/x86/kvm/x86.c | 100 ++---
>> include/linux/kvm_host.h | 48 +--
>> virt/kvm/arm/arm.c | 47 +--
>> virt/kvm/arm/mmu.c | 18 +-
>> virt/kvm/kvm_main.c | 546 ++++++++++++++++----------
>> 17 files changed, 467 insertions(+), 525 deletions(-)
>>
>
> Christian, Marc, Paul, can you help testing patches 1-13?

I see no obvious breakage on s390, but I will do some more testing in the next days.

2019-10-25 11:21:40

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 03/15] KVM: PPC: Move memslot memory allocation into prepare_memory_region()

Hi Sean,

I love your patch! Yet something to improve:

[auto build test ERROR on kvm/linux-next]
[cannot apply to v5.4-rc4 next-20191024]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Sean-Christopherson/KVM-Dynamically-size-memslot-arrays/20191024-144336
base: https://git.kernel.org/pub/scm/virt/kvm/kvm.git linux-next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

arch/powerpc/kvm/powerpc.c: In function 'kvm_arch_prepare_memory_region':
>> arch/powerpc/kvm/powerpc.c:701:9: error: too many arguments to function 'kvmppc_core_prepare_memory_region'
return kvmppc_core_prepare_memory_region(kvm, memslot, mem, change);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/powerpc/kvm/powerpc.c:24:0:
arch/powerpc/include/asm/kvm_ppc.h:206:12: note: declared here
extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
>> arch/powerpc/kvm/book3s.c:848:5: error: conflicting types for 'kvmppc_core_prepare_memory_region'
int kvmppc_core_prepare_memory_region(struct kvm *kvm,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/powerpc/kvm/book3s.c:30:0:
arch/powerpc/include/asm/kvm_ppc.h:206:12: note: previous declaration of 'kvmppc_core_prepare_memory_region' was here
extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/kvmppc_core_prepare_memory_region +701 arch/powerpc/kvm/powerpc.c

695
696 int kvm_arch_prepare_memory_region(struct kvm *kvm,
697 struct kvm_memory_slot *memslot,
698 const struct kvm_userspace_memory_region *mem,
699 enum kvm_mr_change change)
700 {
> 701 return kvmppc_core_prepare_memory_region(kvm, memslot, mem, change);
702 }
703

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.64 kB)
.config.gz (24.83 kB)
Download all attachments