[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5571BFE3.109@redhat.com>
Date: Fri, 05 Jun 2015 17:27:31 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Radim Krčmář <rkrcmar@...hat.com>
CC: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
guangrong.xiao@...ux.intel.com, bdas@...hat.com
Subject: Re: [PATCH v2 07/13] KVM: add vcpu-specific functions to read/write/translate
GFNs
On 05/06/2015 17:13, Radim Krčmář wrote:
> 2015-06-05 14:46+0200, Paolo Bonzini:
>> On 05/06/2015 14:10, Radim Krčmář wrote:
>>> + ret = __kvm_write_guest_page(__gfn_to_memslot(slots, gfn), gfn,
>>> + data, offset, seg);
>>
>> Even better, let's pass memslots to all the __ functions.
>
> Yeah, while scoping it, I noticed a bug in the series ...
> makes me wish that C had a useful type system.
>
> A quick fix would be to replace gpa with gfn in calls to
> __kvm_read_guest_atomic(). I presume you'd prefer a new patch to
> rebasing, so it's below.
Since it was pushed only for 15 minutes or so, and the fix is two lines:
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 30425ce6a4a4..848af90b8091 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1669,7 +1669,7 @@ int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn);
int offset = offset_in_page(gpa);
- return __kvm_read_guest_atomic(slot, gpa, data, offset, len);
+ return __kvm_read_guest_atomic(slot, gfn, data, offset, len);
}
EXPORT_SYMBOL_GPL(kvm_read_guest_atomic);
@@ -1680,7 +1680,7 @@ int kvm_vcpu_read_guest_atomic(struct kvm_vcpu *vcpu, gpa_t gpa,
struct kvm_memory_slot *slot = kvm_vcpu_gfn_to_memslot(vcpu, gfn);
int offset = offset_in_page(gpa);
- return __kvm_read_guest_atomic(slot, gpa, data, offset, len);
+ return __kvm_read_guest_atomic(slot, gfn, data, offset, len);
}
EXPORT_SYMBOL_GPL(kvm_vcpu_read_guest_atomic);
I just force-pushed kvm/next.
The patch is good, but I prefer to do minimal changes before fleeing
on holiday.
Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists