From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: carsteno-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
"Zhang,
Xiantao" <xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH][1/3] Move kvm_vcpu_iotcl_get_dirty_log to arch
Date: Mon, 19 Nov 2007 16:52:18 +0200 [thread overview]
Message-ID: <4741A322.8040201@qumranet.com> (raw)
In-Reply-To: <4741A011.2080405-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
Carsten Otte wrote:
> Zhang, Xiantao wrote:
>> Move kvm_vcpu_ioctl_get_dirty_log to arch, and still keep the interface
>> in common.
>
> diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
> index 45b18e1..3400265 100644
> --- a/drivers/kvm/kvm_main.c
> +++ b/drivers/kvm/kvm_main.c
> @@ -419,19 +419,14 @@ int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
> return kvm_set_memory_region(kvm, mem, user_alloc);
> }
>
> -/*
> - * Get (and clear) the dirty memory log for a memory slot.
> - */
> -static int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
> - struct kvm_dirty_log *log)
> +int kvm_get_dirty_log(struct kvm *kvm,
> + struct kvm_dirty_log *log, int *is_dirty)
>
> Any reason to remove that comment? It looks helpful to me.
>
>
> {
> struct kvm_memory_slot *memslot;
> int r, i;
> int n;
> unsigned long any = 0;
>
> - mutex_lock(&kvm->lock);
> -
> r = -EINVAL;
> if (log->slot >= KVM_MEMORY_SLOTS)
> goto out;
> @@ -450,17 +445,11 @@ static int kvm_vm_ioctl_get_dirty_log(struct kvm
> *kvm,
> if (copy_to_user(log->dirty_bitmap, memslot->dirty_bitmap, n))
> goto out;
>
> - /* If nothing is dirty, don't bother messing with page tables. */
> - if (any) {
> - kvm_mmu_slot_remove_write_access(kvm, log->slot);
> - kvm_flush_remote_tlbs(kvm);
> - memset(memslot->dirty_bitmap, 0, n);
> - }
> + if (any)
> + *is_dirty = 1;
>
> r = 0;
> -
> out:
> - mutex_unlock(&kvm->lock);
> return r;
> }
>
> This split won't work on s390. I think kvm_get_dirty_log should be
> arch dependent alltogether: we're not going to have a dirty bitmap on
> s390, we rather rely on our hardware support to update our storage
> keys accordingly without guest/host intervention required. We'd want
> to use that, and thus this implementation of kvm_get_dirty_log makes
> no sense for us. On the other hand, I'd really want to keep the ioctl
> common, so that guest migration code in userland can be common for all
> archs.
On the other hand, it will work for all others IIUC. Duplicating it in
all other archs is not a good idea.
We can special case it using #ifdef ARCH_HAS_KVM_GUEST_DIRTY_BITMAP or
something.
(hides from the #ifdef police)
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2007-11-19 14:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-19 5:35 [PATCH][1/3] Move kvm_vcpu_iotcl_get_dirty_log to arch Zhang, Xiantao
[not found] ` <42DFA526FC41B1429CE7279EF83C6BDC9A0A7D-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-11-19 14:39 ` Carsten Otte
[not found] ` <4741A011.2080405-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-11-19 14:52 ` Avi Kivity [this message]
[not found] ` <4741A322.8040201-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-11-19 14:55 ` Carsten Otte
[not found] ` <4741A3FE.70908-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
2007-11-19 14:59 ` Carsten Otte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4741A322.8040201@qumranet.com \
--to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
--cc=carsteno-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
--cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=xiantao.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.