public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: add KVM_SYNC_SHADOW_WITH_USER ioctl (v2)
@ 2008-01-09 18:17 Marcelo Tosatti
  2008-01-12 19:59 ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Marcelo Tosatti @ 2008-01-09 18:17 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel


Export nukeing of shadow MMU pages through an ioctl, required for
consistency on balloon inflate.

Changes:
- Move to x86-specific kvm_arch_vm_ioctl() 
- Grab mmap_sem

Index: kvm.quilt/arch/x86/kvm/x86.c
===================================================================
--- kvm.quilt.orig/arch/x86/kvm/x86.c
+++ kvm.quilt/arch/x86/kvm/x86.c
@@ -680,6 +680,7 @@ int kvm_dev_ioctl_check_extension(long e
 	case KVM_CAP_USER_MEMORY:
 	case KVM_CAP_SET_TSS_ADDR:
 	case KVM_CAP_EXT_CPUID:
+	case KVM_CAP_SYNC_SHADOW_WITH_USER:
 		r = 1;
 		break;
 	case KVM_CAP_VAPIC:
@@ -1505,6 +1506,13 @@ long kvm_arch_vm_ioctl(struct file *filp
 		r = 0;
 		break;
 	}
+	case KVM_SYNC_SHADOW_WITH_USER: {
+		r = 0;
+		down_read(&current->mm->mmap_sem);
+		kvm_mmu_zap_all(kvm);
+		up_read(&current->mm->mmap_sem);
+		break;
+	}
 	default:
 		;
 	}
Index: kvm.quilt/include/linux/kvm.h
===================================================================
--- kvm.quilt.orig/include/linux/kvm.h
+++ kvm.quilt/include/linux/kvm.h
@@ -249,6 +249,7 @@ struct kvm_vapic_addr {
 #define KVM_CAP_SET_TSS_ADDR 4
 #define KVM_CAP_EXT_CPUID 5
 #define KVM_CAP_VAPIC 6
+#define KVM_CAP_SYNC_SHADOW_WITH_USER 7
 
 /*
  * ioctls for VM fds
@@ -267,6 +268,7 @@ struct kvm_vapic_addr {
 #define KVM_GET_DIRTY_LOG         _IOW(KVMIO, 0x42, struct kvm_dirty_log)
 #define KVM_SET_MEMORY_ALIAS      _IOW(KVMIO, 0x43, struct kvm_memory_alias)
 #define KVM_GET_SUPPORTED_CPUID   _IOWR(KVMIO, 0x48, struct kvm_cpuid2)
+#define KVM_SYNC_SHADOW_WITH_USER _IO(KVMIO, 0x49)
 /* Device model IOC */
 #define KVM_CREATE_IRQCHIP	  _IO(KVMIO,  0x60)
 #define KVM_IRQ_LINE		  _IOW(KVMIO, 0x61, struct kvm_irq_level)

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: add KVM_SYNC_SHADOW_WITH_USER ioctl (v2)
  2008-01-09 18:17 [PATCH] KVM: add KVM_SYNC_SHADOW_WITH_USER ioctl (v2) Marcelo Tosatti
@ 2008-01-12 19:59 ` Avi Kivity
       [not found]   ` <47891C10.8060803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2008-01-12 19:59 UTC (permalink / raw)
  To: Marcelo Tosatti; +Cc: kvm-devel

Marcelo Tosatti wrote:
> Export nukeing of shadow MMU pages through an ioctl, required for
> consistency on balloon inflate.
>
>   

With mmu notifiers (posted two minutes after this) shadow is implicitly 
synced with userspace.  Since it seems to be progressing rapidly, I 
won't apply this patch in the hope that mmu notifiers can be ready for 
2.6.25.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: add KVM_SYNC_SHADOW_WITH_USER ioctl (v2)
       [not found]   ` <47891C10.8060803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2008-01-12 20:28     ` Anthony Liguori
       [not found]       ` <47892303.6030602-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony Liguori @ 2008-01-12 20:28 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Marcelo Tosatti, kvm-devel

Avi Kivity wrote:
> Marcelo Tosatti wrote:
>> Export nukeing of shadow MMU pages through an ioctl, required for
>> consistency on balloon inflate.
>>
>>   
>
> With mmu notifiers (posted two minutes after this) shadow is 
> implicitly synced with userspace.  Since it seems to be progressing 
> rapidly, I won't apply this patch in the hope that mmu notifiers can 
> be ready for 2.6.25.

Does that mean that we'll only support ballooning on host kernels > 
2.6.25 are you going to do judo with debug registers to implement it for 
older kernels?

Regards,

Anthony Liguori


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] KVM: add KVM_SYNC_SHADOW_WITH_USER ioctl (v2)
       [not found]       ` <47892303.6030602-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2008-01-12 20:57         ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2008-01-12 20:57 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Marcelo Tosatti, kvm-devel

Anthony Liguori wrote:
>>>   
>>
>> With mmu notifiers (posted two minutes after this) shadow is 
>> implicitly synced with userspace.  Since it seems to be progressing 
>> rapidly, I won't apply this patch in the hope that mmu notifiers can 
>> be ready for 2.6.25.
>
> Does that mean that we'll only support ballooning on host kernels > 
> 2.6.25 are you going to do judo with debug registers to implement it 
> for older kernels?

Good question.  We may choose not to support it (distros may backport it 
if they wish), or do some evil hackery, or apply 
KVM_SYNC_SHADOW_WITH_USER _only_ to the external module.

-- 
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-12 20:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-09 18:17 [PATCH] KVM: add KVM_SYNC_SHADOW_WITH_USER ioctl (v2) Marcelo Tosatti
2008-01-12 19:59 ` Avi Kivity
     [not found]   ` <47891C10.8060803-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-12 20:28     ` Anthony Liguori
     [not found]       ` <47892303.6030602-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2008-01-12 20:57         ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox