Fix arguments passed to SHADOW_PRINTK
PATCH 1/1 Fix arguments passed to SHADOW_PRINTK
Hi.
When I compiled xen-3.3-testing with DEBUG_TRACE_DUMP in xen/include/xen/lib.h turned on, I got some errors at SHADOW_PRINTK.
The following patch will fix the arguments passed to SHADOW_PRINTK in xen/arch/x86/mm/shadow/common.c and xen/arch/x86/mm/shadow/multi.c.
Although I haven't tested, it is the same for xen-unstable.hg
Thanks,
Yoshi
xen/arch/x86/mm/shadow/common.c +4 -2
@@ -701,7 +701,8 @@ static void _sh_resync(struct vcpu *v, mASSERT (!sh_page_has_multiple_shadows (mfn_to_page (gmfn)));SHADOW_PRINTK ("d=%d, v=%d, gmfn=%05lx, va=%lx\n" , - v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), va); + v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), +sh_map_domain_page (gmfn));/* Need to pull write access so the page *stays* in sync. */ if (oos_remove_write_access (v, gmfn, fixup) )
@@ -953,7 +954,8 @@ int sh_unsync(struct vcpu *v, mfn_t gmfnASSERT (shadow_locked_by_me (v->domain));SHADOW_PRINTK ("d=%d, v=%d, gmfn=%05lx va %lx\n" , - v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), va); + v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), +sh_map_domain_page (gmfn)); pg =mfn_to_page (gmfn);
xen/arch/x86/mm/shadow/multi.c +5 -0
@@ -3041,9 +3041,14 @@ static int sh_page_fault(struct vcpu *v,int fast_emul =0 ;#endif +#ifdef __x86_64__SHADOW_PRINTK ("d:v=%u:%u va=%#lx err=%u, rip=%lx\n" , v->domain->domain_id, v->vcpu_id, va, regs->error_code, regs->rip); +#elif defined(__i386__) +SHADOW_PRINTK ("d:v=%u:%u va=%#lx err=%u\n" , + v->domain->domain_id, v->vcpu_id, va, regs->error_code); +#endif /* __i386__ */ perfc_incr (shadow_fault);
Signature · 10 lines
TAMURA, Yoshiaki NTT Cyber Space Labs OSS Computing Project Kernel Group E-mail: [email protected] TEL: +81-46-859-2771 FAX: +81-46-855-1152 Address: 1-1 Hikarinooka, Yokosuka Kanagawa 239-0847 JAPAN
Hi,
Quoted 6 lines · Yoshiaki Tamura
Hi.
When I compiled xen-3.3-testing with
DEBUG_TRACE_DUMPinxen/include/xen/lib.hturned on, I got some errors atSHADOW_PRINTK.
The following patch will fix the arguments passed toSHADOW_PRINTKinxen/arch/x86/mm/shadow/common.candxen/arch/x86/mm/shadow/multi.c.
My fault, the va argument was removed with recent changes in the OOS code and it is unneeded now.
Quoted 8 lines
SHADOW_PRINTK("d=%d, v=%d, gmfn=%05lx, va=%lx\n",xen/arch/x86/mm/shadow/common.c +2
-1- v->domain->domain_id, v->vcpu_id, mfn_x(gmfn), va); + v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), + sh_map_domain_page(gmfn));/* Need to pull write access so the page *stays* in sync. */ if (oos_remove_write_access (v, gmfn, fixup) )
xen/arch/x86/mm/shadow/common.c int sh_unsync(struct vcpu *v, mfn_t gmfn · line 958
Quoted 6 lines
xen/arch/x86/mm/shadow/common.c +2
-1@@ -953,7 +954,8 @@ int sh_unsync(struct vcpu *v, mfn_t gmfnASSERT (shadow_locked_by_me (v->domain));SHADOW_PRINTK ("d=%d, v=%d, gmfn=%05lx va %lx\n" , - v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), va); + v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), +sh_map_domain_page (gmfn));
These will likely break Xen in 32 bit, since you should unmap the gmfn in those architecture. As I said, the va argument is unneeded now, so you should remove it.
Thanks,
Gianluca
Quoted 6 lines · Yoshiaki Tamura
When I compiled xen-3.3-testing with
DEBUG_TRACE_DUMPinxen/include/xen/lib.hturned on, I got some errors atSHADOW_PRINTK.
The following patch will fix the arguments passed toSHADOW_PRINTKinxen/arch/x86/mm/shadow/common.candxen/arch/x86/mm/shadow/multi.c.Although I haven't tested, it is the same for xen-unstable.hg
First chunks of patch: If there is no longer a va to print, then don't manufacture one to print; just remove it entirely from the printk. Apart from anything else, using sh_map_domain_page() without sh_unmap_domain_page() will leak mappings. And the va printed will not be useful anyway.
Final chunk of patch: print regs->eip? That should work on both x86_64 and i386.
Please fix and re-send.
Thanks,
Keir
Keir and Gianluca,
Quoted 7 lines · Keir Fraser
Quoted 5 lines · Yoshiaki Tamura
When I compiled xen-3.3-testing with
DEBUG_TRACE_DUMPinxen/include/xen/lib.hturned on, I got some errors atSHADOW_PRINTK.
The following patch will fix the arguments passed toSHADOW_PRINTKinxen/arch/x86/mm/shadow/common.candxen/arch/x86/mm/shadow/multi.c.
Quoted 7 lines
Quoted 1 line
Although I haven't tested, it is the same for xen-unstable.hg
First chunks of patch: If there is no longer a va to print, then don't manufacture one to print; just remove it entirely from the printk. Apart from anything else, using
sh_map_domain_page()withoutsh_unmap_domain_page()will leak mappings. And the va printed will not be useful anyway.
Sorry, that was my mistake.
Quoted 2 lines
Final chunk of patch: print
regs->eip? That should work on bothx86_64and i386.
When I compiled xen-3.3-testing with DEBUG_TRACE_DUMP turned on, I got the following errors. Would you please tell me how to work around?
multi.c: In function 'sh_page_fault__guest_2':
multi.c:3045: error: 'struct cpu_user_regs' has no member named 'rip' multi.c: In function 'sh_page_fault__guest_3':
multi.c:3045: error: 'struct cpu_user_regs' has no member named 'rip' make[6]: *** [guest_3.o] Error 1
make[6]: *** Waiting for unfinished jobs....
make[6]: *** [guest_2.o] Error 1
make[5]: *** [shadow/built_in.o] Error 2
make[4]: *** [mm/built_in.o] Error 2
make[3]: *** [/home/tamura/Developer/kemari-v1-devel.hg/xen/arch/x86/built_in.o] Error 2 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [/home/tamura/Developer/kemari-v1-devel.hg/xen/xen] Error 2 make[1]: *** [install] Error 2
make: *** [install-xen] Error 2
Quoted 15 lines
Please fix and re-send.
Thanks,
Keir_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 10 lines
TAMURA, Yoshiaki NTT Cyber Space Labs OSS Computing Project Kernel Group E-mail: [email protected] TEL: +81-46-859-2771 FAX: +81-46-855-1152 Address: 1-1 Hikarinooka, Yokosuka Kanagawa 239-0847 JAPAN
Quoted 7 lines · Yoshiaki Tamura
Keir and Gianluca,
When I compiled xen-3.3-testing with
DEBUG_TRACE_DUMPturned on, I got the following errors. Would you please tell me how to work around?
multi.c: In function 'sh_page_fault__guest_2':
multi.c:3045: error: 'structcpu_user_regs' has no member named 'rip'
Using regs->eip should work both on 32 and 64 bit.
Thanks,
Gianluca
Gianluca,
Thanks for your comment.
The following is the fixed patch.
Thanks,
Yoshi
xen/arch/x86/mm/shadow/common.c +4 -4
@@ -700,8 +700,8 @@ static void _sh_resync(struct vcpu *v, m & ~SHF_L1_ANY));ASSERT (!sh_page_has_multiple_shadows (mfn_to_page (gmfn))); -SHADOW_PRINTK ("d=%d, v=%d, gmfn=%05lx, va=%lx\n" , - v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), va); +SHADOW_PRINTK ("d=%d, v=%d, gmfn=%05lx\n" , + v->domain->domain_id, v->vcpu_id,mfn_x (gmfn));/* Need to pull write access so the page *stays* in sync. */ if (oos_remove_write_access (v, gmfn, fixup) )
@@ -952,8 +952,8 @@ int sh_unsync(struct vcpu *v, mfn_t gmfnASSERT (shadow_locked_by_me (v->domain)); -SHADOW_PRINTK ("d=%d, v=%d, gmfn=%05lx va %lx\n" , - v->domain->domain_id, v->vcpu_id,mfn_x (gmfn), va); +SHADOW_PRINTK ("d=%d, v=%d, gmfn=%05lx\n" , + v->domain->domain_id, v->vcpu_id,mfn_x (gmfn)); pg =mfn_to_page (gmfn);
xen/arch/x86/mm/shadow/multi.c +2 -2
@@ -3041,9 +3041,9 @@ static int sh_page_fault(struct vcpu *v,int fast_emul =0 ;#endif -SHADOW_PRINTK ("d:v=%u:%u va=%#lx err=%u, rip=%lx\n" , +SHADOW_PRINTK ("d:v=%u:%u va=%#lx err=%u, eip=%lx\n" , v->domain->domain_id, v->vcpu_id, va, regs->error_code, - regs->rip); + regs->eip);perfc_incr (shadow_fault);
Quoted 24 lines · Gianluca Guida
Quoted 7 lines · Yoshiaki Tamura
Keir and Gianluca,
When I compiled xen-3.3-testing with
DEBUG_TRACE_DUMPturned on, I got the following errors. Would you please tell me how to work around?
multi.c: In function 'sh_page_fault__guest_2':
multi.c:3045: error: 'structcpu_user_regs' has no member named 'rip'Using
regs->eipshould work both on 32 and 64 bit.Thanks,
Gianluca_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 10 lines
TAMURA, Yoshiaki NTT Cyber Space Labs OSS Computing Project Kernel Group E-mail: [email protected] TEL: +81-46-859-2771 FAX: +81-46-855-1152 Address: 1-1 Hikarinooka, Yokosuka Kanagawa 239-0847 JAPAN