KVM: move gfn_to_page out of kmap/unmap pars
RFC 4/8 KVM: move gfn_to_page out of kmap/unmap pars
gfn_to_page might sleep with swap support. Move it out of the kmap calls.
--- drivers/kvm/kvm.h | 2 - drivers/kvm/kvm_main.c | 9 ++--- drivers/kvm/mmu.c | 2 - drivers/kvm/paging_tmpl.h | 80 +++++++++++++++++++++++++++------------------- 4 files changed, 54 insertions(+), 39 deletions(-)
drivers/kvm/kvm.h +1 -1
@@ -616,7 +616,7 @@ int kvm_write_guest(struct kvm_vcpu *vcpunsigned long segment_base (u16 selector);void kvm_mmu_pte_write (struct kvm_vcpu *vcpu,gpa_t gpa, -const u8 *old,const u8 *new,int bytes); +const u8 *new,int bytes);int kvm_mmu_unprotect_page_virt (struct kvm_vcpu *vcpu,gva_t gva);void kvm_mmu_free_some_pages (struct kvm_vcpu *vcpu);int kvm_mmu_load (struct kvm_vcpu *vcpu);
drivers/kvm/kvm_main.c +5 -4
@@ -1123,7 +1123,6 @@ static int emulator_write_phys(struct kv {struct page *page;void *virt; -unsigned offset =offset_in_page (gpa);if (((gpa + bytes -1 ) >>PAGE_SHIFT ) != (gpa >>PAGE_SHIFT ))return 0 ;
@@ -1133,7 +1132,9 @@ static int emulator_write_phys(struct kvmark_page_dirty (vcpu->kvm, gpa >>PAGE_SHIFT ); virt =kmap_atomic (page,KM_USER0 );if (memcmp (virt +offset_in_page (gpa), val, bytes)) { -kvm_mmu_pte_write (vcpu, gpa, virt + offset, val, bytes); +kunmap_atomic (virt,KM_USER0 ); +kvm_mmu_pte_write (vcpu, gpa, val, bytes); + virt =kmap_atomic (page,KM_USER0 );memcpy (virt +offset_in_page (gpa), val, bytes); }kunmap_atomic (virt,KM_USER0 );
@@ -1483,7 +1484,7 @@ static int vcpu_register_para(struct kvmmark_page_dirty (vcpu->kvm, para_state_gpa >>PAGE_SHIFT ); para_state_page =pfn_to_page (para_state_hpa >>PAGE_SHIFT ); - para_state =kmap_atomic (para_state_page,KM_USER0 ); + para_state =kmap (para_state_page);printk (KERN_DEBUG ".... guest version: %d\n" , para_state->guest_version);printk (KERN_DEBUG ".... size: %d\n" , para_state->size);
@@ -1519,7 +1520,7 @@ static int vcpu_register_para(struct kvm para_state->ret =0 ; err_kunmap_skip: -kunmap_atomic (para_state,KM_USER0 ); +kunmap (para_state_page);return 0 ; err_gp:return 1 ;
drivers/kvm/mmu.c +1 -1
@@ -1112,7 +1112,7 @@ static void mmu_pte_write_new_pte(struct }void kvm_mmu_pte_write (struct kvm_vcpu *vcpu,gpa_t gpa, -const u8 *old,const u8 *new,int bytes) +const u8 *new,int bytes) {gfn_t gfn = gpa >>PAGE_SHIFT ;struct kvm_mmu_page *page;
drivers/kvm/paging_tmpl.h +47 -33
227 lines not on this page · raw message
-------------------------------------------------------------------------
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/
Quoted 3 lines · Shaohua Li
gfn_to_pagemight sleep with swap support. Move it out of the kmap calls.
I'd like to apply this to the kvm.git master branch so we don't have to maintain it. Was this tested on a highmem machine? If not, I can do it.
Signature · 1 line
error compiling committee.c: too many arguments to function
2007/7/24, Avi Kivity <avi-atKUWr5tajBWk0Htik3J/[email protected]>:
Quoted 7 lines
Quoted 3 lines · Shaohua Li
gfn_to_pagemight sleep with swap support. Move it out of the kmap calls.I'd like to apply this to the kvm.git master branch so we don't have to maintain it. Was this tested on a highmem machine? If not, I can do it.
My test system has 1G memory, so it should work. I only tested 32bit system, better check a x64 build.
Thanks,
Shaohua
-------------------------------------------------------------------------
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/
Quoted 7 lines · Shaohua Li
2007/7/24, Avi Kivity <avi-atKUWr5tajBWk0Htik3J/[email protected]>:
Quoted 6 lines
Quoted 1 line · Shaohua Li
gfn_to_pagemight sleep with swap support. Move it out of the kmapcalls.
Quoted 2 lines
Quoted 6 lines
Quoted 3 lines
I'd like to apply this to the kvm.git master branch so we don't have to maintain it. Was this tested on a highmem machine? If not, I can do it.
My test system has 1G memory, so it should work. I only tested 32bit system, better check a x64 build.
This is now in, after minor merge fixups.
Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic. ------------------------------------------------------------------------- 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/