kvm_vm_ioctl_get_dirty_log doesn't need any, probably doesn't want any
PATCH 1/1 kvm_vm_ioctl_get_dirty_log doesn't need any, probably doesn't want any
I'm not sure what "any" was for: some optimization which got trimmed, I imagine. But neither "any" nor "i" are used later in the function, so I've excised it.
drivers/kvm/kvm_main.c +2 -8
@@ -830,9 +830,7 @@ static int kvm_vm_ioctl_get_dirty_log(st struct kvm_dirty_log *log) {struct kvm_memory_slot *memslot; -int r, i; -int n; -unsigned long any =0 ; +int r, n;spin_lock (&kvm->lock);
@@ -851,11 +849,7 @@ static int kvm_vm_ioctl_get_dirty_log(stif (!memslot->dirty_bitmap) goto out; - n =ALIGN (memslot->npages,BITS_PER_LONG ) /8 ; - -for (i =0 ; !any && i < n/sizeof (long ); ++i) - any = memslot->dirty_bitmap[i]; - + n =BITS_TO_LONGS (memslot->npages) *sizeof (long ); r = -EFAULT ;if (copy_to_user (log->dirty_bitmap, memslot->dirty_bitmap, n)) goto out;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 1185798696.6131.44.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Quoted 5 lines · Rusty Russell
I'm not sure what "any" was for: some optimization which got trimmed, I imagine. But neither "any" nor "i" are used later in the function, so I've excised it.
Looks like it was used to guard kvm_mmu_slot_remove_write_access(); optimizing the case where the guest just leaves the screen alone (which it usually does, especially in benchmarks).
I'd rather reinstate that optimization. See 66d8a4e4d4bd470216028daabb9d887b73259c96 where the damage was done.
Quoted 32 lines
Signed-off-by Rusty Russell <rusty-8n+1lVoiYb80n/[email protected]>diff -r
a17d7fe2b240drivers/kvm/kvm_main.cdrivers/kvm/kvm_main.c +2
-8@@ -830,9 +830,7 @@ static int kvm_vm_ioctl_get_dirty_log(st struct kvm_dirty_log *log) {struct kvm_memory_slot *memslot; -int r, i; -int n; -unsigned long any =0 ; +int r, n;spin_lock (&kvm->lock);@@ -851,11 +849,7 @@ static int kvm_vm_ioctl_get_dirty_log(stif (!memslot->dirty_bitmap) goto out; - n =ALIGN (memslot->npages,BITS_PER_LONG ) /8 ; - -for (i =0 ; !any && i < n/sizeof (long ); ++i) - any = memslot->dirty_bitmap[i]; - + n =BITS_TO_LONGS (memslot->npages) *sizeof (long ); r = -EFAULT ;if (copy_to_user (log->dirty_bitmap, memslot->dirty_bitmap, n)) goto out;
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 46ADDC16.2090801-atKUWr5tajBWk0Htik3J/[email protected]
PATCH 1/1 kvm_vm_ioctl_get_dirty_log restore "nothing dirty" optimization
kvm_vm_ioctl_get_dirty_log scans bitmap to see it it's all zero, but doesn't use that information.
Avi says:
Looks like it was used to guard kvm_mmu_slot_remove_write_access();
optimizing the case where the guest just leaves the screen alone (which it usually does, especially in benchmarks).
I'd rather reinstate that optimization. See 66d8a4e4d4bd470216028daabb9d887b73259c96 where the damage was done.
It's pretty simple: if the bitmap is all zero, we don't need to do anything to clean it.
drivers/kvm/kvm_main.c +7 -5
@@ -838,11 +838,13 @@ static int kvm_vm_ioctl_get_dirty_log(stif (copy_to_user (log->dirty_bitmap, memslot->dirty_bitmap, n)) goto out; -spin_lock (&kvm->lock); -kvm_mmu_slot_remove_write_access (kvm, log->slot); -kvm_flush_remote_tlbs (kvm); -memset (memslot->dirty_bitmap,0 , n); -spin_unlock (&kvm->lock); +if (any) { +spin_lock (&kvm->lock); +kvm_mmu_slot_remove_write_access (kvm, log->slot); +kvm_flush_remote_tlbs (kvm); +memset (memslot->dirty_bitmap,0 , n); +spin_unlock (&kvm->lock); + } r =0 ;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 1185801694.6131.46.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Re: [PATCH] kvm_vm_ioctl_get_dirty_log restore "nothing dirty" optimization
Quoted 26 lines · Rusty Russell
kvm_vm_ioctl_get_dirty_logscans bitmap to see it it's all zero, but doesn't use that information.Avi says:
Looks like it was used to guardkvm_mmu_slot_remove_write_access();
optimizing the case where the guest just leaves the screen alone (which it usually does, especially in benchmarks).I'd rather reinstate that optimization. See
66d8a4e4d4bd470216028daabb9d887b73259c96where the damage was done.It's pretty simple: if the bitmap is all zero, we don't need to do anything to clean it.
Signed-off-by Rusty Russell <rusty-8n+1lVoiYb80n/[email protected]>diff -r
66566cf6b576drivers/kvm/kvm_main.cdrivers/kvm/kvm_main.c +0
-3@@ -838,11 +838,13 @@ static int kvm_vm_ioctl_get_dirty_log(stif (copy_to_user (log->dirty_bitmap, memslot->dirty_bitmap, n)) goto out; -spin_lock (&kvm->lock); -kvm_mmu_slot_remove_write_access (kvm, log->slot); -kvm_flush_remote_tlbs (kvm);
drivers/kvm/kvm_main.c static int kvm_vm_ioctl_get_dirty_log(st · line 848
Quoted 10 lines
drivers/kvm/kvm_main.c +7
-2-memset (memslot->dirty_bitmap,0 , n); -spin_unlock (&kvm->lock); +if (any) { +spin_lock (&kvm->lock); +kvm_mmu_slot_remove_write_access (kvm, log->slot); +kvm_flush_remote_tlbs (kvm); +memset (memslot->dirty_bitmap,0 , n); +spin_unlock (&kvm->lock); + }
spin_lock()? my, that's so last week. kvm->lock is a mutex.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 46ADE78A.7080406-atKUWr5tajBWk0Htik3J/[email protected]
PATCH 1/1 kvm_vm_ioctl_get_dirty_log restore "nothing dirty" optimization
kvm_vm_ioctl_get_dirty_log scans bitmap to see it it's all zero, but doesn't use that information.
Avi says:
Looks like it was used to guard kvm_mmu_slot_remove_write_access();
optimizing the case where the guest just leaves the screen alone (which it usually does, especially in benchmarks).
I'd rather reinstate that optimization. See 66d8a4e4d4bd470216028daabb9d887b73259c96 where the damage was done.
It's pretty simple: if the bitmap is all zero, we don't need to do anything to clean it.
drivers/kvm/kvm_main.c +8 -5
@@ -803,11 +803,14 @@ static int kvm_vm_ioctl_get_dirty_log(stif (copy_to_user (log->dirty_bitmap, memslot->dirty_bitmap, n)) goto out; -mutex_lock (&kvm->lock); -kvm_mmu_slot_remove_write_access (kvm, log->slot); -kvm_flush_remote_tlbs (kvm); -memset (memslot->dirty_bitmap,0 , n); -mutex_unlock (&kvm->lock); +/* If nothing is dirty, don't bother messing with page tables. */ +if (any) { +mutex_lock (&kvm->lock); +kvm_mmu_slot_remove_write_access (kvm, log->slot); +kvm_flush_remote_tlbs (kvm); +memset (memslot->dirty_bitmap,0 , n); +mutex_unlock (&kvm->lock); + } r =0 ;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
A message that is not in the archive (sent off-list or not yet received): 1185875867.6131.76.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]
Avi Kivity
AppliedRe: [PATCH] kvm_vm_ioctl_get_dirty_log restore "nothing dirty" optimization
Quoted 8 lines · Rusty Russell
kvm_vm_ioctl_get_dirty_logscans bitmap to see it it's all zero, but doesn't use that information.Avi says:
Looks like it was used to guardkvm_mmu_slot_remove_write_access();
optimizing the case where the guest just leaves the screen alone (which it usually does, especially in benchmarks).
Quoted 7 lines
I'd rather reinstate that optimization. See
66d8a4e4d4bd470216028daabb9d887b73259c96where the damage was done.It's pretty simple: if the bitmap is all zero, we don't need to do anything to clean it.
Applied; thanks.
Signature · 8 lines
error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/