* [PATCH] KVM: reuse memslot in kvm_write_guest_page
@ 2015-04-10 19:47 Radim Krčmář
2015-04-11 13:09 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Radim Krčmář @ 2015-04-10 19:47 UTC (permalink / raw)
To: linux-kernel; +Cc: kvm, Paolo Bonzini
Saves one O(log N) search.
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
---
I'm still not sure how to bridge the gap between the code we have and
the code I want, but all routes so far contained this change. Notice
that we use '_memslot' and '_in_slot' suffix for the same meaning ...
(And the completely useless 'kvm' parameter for page dirtying.)
virt/kvm/kvm_main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 91a36e21c0fb..09cf409b0389 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1589,15 +1589,17 @@ int kvm_write_guest_page(struct kvm *kvm, gfn_t gfn, const void *data,
int offset, int len)
{
int r;
+ struct kvm_memory_slot *memslot;
unsigned long addr;
- addr = gfn_to_hva(kvm, gfn);
+ memslot = gfn_to_memslot(kvm, gfn);
+ addr = gfn_to_hva_memslot(memslot, gfn);
if (kvm_is_error_hva(addr))
return -EFAULT;
r = __copy_to_user((void __user *)addr + offset, data, len);
if (r)
return -EFAULT;
- mark_page_dirty(kvm, gfn);
+ mark_page_dirty_in_slot(kvm, memslot, gfn);
return 0;
}
EXPORT_SYMBOL_GPL(kvm_write_guest_page);
--
2.3.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: reuse memslot in kvm_write_guest_page
2015-04-10 19:47 [PATCH] KVM: reuse memslot in kvm_write_guest_page Radim Krčmář
@ 2015-04-11 13:09 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2015-04-11 13:09 UTC (permalink / raw)
To: Radim Krčmář, KVM list
On 10/04/2015 21:47, Radim Krčmář wrote:
> Saves one O(log N) search.
>
> Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
> ---
> I'm still not sure how to bridge the gap between the code we have and
> the code I want, but all routes so far contained this change. Notice
> that we use '_memslot' and '_in_slot' suffix for the same meaning ...
> (And the completely useless 'kvm' parameter for page dirtying.)
I have the same patch (plus exporting mark_dirty_page_in_slot and
removing the extra 'kvm' parameter :)) in my SMM queue. I'll replace it
with yours.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-11 13:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-10 19:47 [PATCH] KVM: reuse memslot in kvm_write_guest_page Radim Krčmář
2015-04-11 13:09 ` Paolo Bonzini
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.