Hi Isaku,
> To be honest I didn't test the mca patch().
> Kazuhiro, Could you please review and test it?
I tested this, but it caused system hang.
I have some questions and comments as follows.
> diff -r 8558c0017136 -r e532cad65b1c xen/arch/ia64/linux-xen/mca_asm.S
> --- a/xen/arch/ia64/linux-xen/mca_asm.S Tue Dec 18 15:38:46 2007 +0900
> +++ b/xen/arch/ia64/linux-xen/mca_asm.S Thu Dec 20 14:53:49 2007 +0900
> @@ -479,14 +479,26 @@ ia64_reload_tr:
> ;;
> // 4. Reload DTR for stack.
> #ifdef XEN
> - // avoid overlapping with kernel TR
> - movl r17=KERNEL_START
> + // avoid overlapping with xenheap TR
> + mov r17=ip
> + ;;
> + tpa r17=r17
It is necessary to delete this line, because ip contains physical address.
> + ;;
> + dep r17=0,r17,0,KERNEL_TR_PAGE_SHIFT
> + ;;
> + shr.u r17=r17,IA64_GRANULE_SHIFT
> + ;;
> GET_THIS_PADDR(r2,cpu_kr);;
> add r2=IA64_KR_CURRENT_OFFSET,r2;;
Is it IA64_KR_CURRENT_STACK_OFFSET?
I think that [cpu_kr + IA64_KR_CURRENT_STACK_OFFSET] contains
(physical address >> IA64_GRANULE_SHIFT).
> ld8 r16=[r2];;
> ;;
> - dep r16=0,r16,0,KERNEL_TR_PAGE_SHIFT
> - ;;
> +#if KERNEL_TR_PAGE_SHIFT < IA64_GRANULE_SHIFT
> +# error "KERNEL_TR_PAGE_SHIFT < IA64_GRANULE_SHIFT shouldn't happen"
> +#endif
> +#if KERNEL_TR_PAGE_SHIFT > IA64_GRANULE_SHIFT
> + dep r16=0,r16,0,KERNEL_TR_PAGE_SHIFT-IA64_GRANULE_SHIFT
> + ;;
> +#endif
> cmp.eq p7,p0=r17,r16
> (p7) br.cond.sptk .reload_vhpt
>
> @@ -522,6 +534,25 @@ ia64_reload_tr:
> // 5. VHPT
> #if VHPT_ENABLED
> GET_VA_VCPU_VHPT_MADDR(r2,r3);;
dep r2=0,r2,60,4;;
This line should be inserted here, because
GET_VA_VCPU_VHPT_MADDR(r2,r3) emulates the virtual address of
vcpu_vhpt_maddr.
> + dep r3=0,r2,0,KERNEL_TR_PAGE_SHIFT
> + ;;
> + shr.u r3=r3,IA64_GRANULE_SHIFT
> + ;;
> + cmp.eq p7,p0=r3,r17
> +(p7) br.cond.sptk .overlap_vhpt
> + ;;
> +
> + // avoid overlapping with stack TR
> + shr.u r17=r2,IA64_GRANULE_SHIFT
> + GET_THIS_PADDR(r3, cpu_kr);;
> + add r3=IA64_KR_CURRENT_STACK_OFFSET,r3
> + ;;
> + ld8 r3=[r3]
> + ;;
> + cmp.eq p7,p0=r3,r17
> +(p7) br.cond.sptk .overlap_vhpt
> + ;;
> +
> dep r16=0,r2,0,IA64_GRANULE_SHIFT
> movl r20=PAGE_KERNEL
> ;;
> @@ -538,6 +569,7 @@ ia64_reload_tr:
> ;;
> srlz.d
> ;;
> +.overlap_vhpt:
> #endif
> #endif
> br.sptk.many done_tlb_purge_and_reload
I attached modified patch, and I confirmed this worked.
Thanks.
KAZ
Signed-off-by: Kazuhiro Suzuki <kaz@xxxxxxxxxxxxxx>
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Subject: [PATCH 0/12] various fixes related the xen relocation
Date: Thu, 20 Dec 2007 16:37:04 +0900
>
> When Xen was made relocatable, some code are broken.
> This patch set addresses on it.
>
> I went little further. Some of the assembler functions related to
> context switch maps stack, others doesn't. It isn't consistent.
> So there were two choice for consistency. My choice is mapping stacks.
> After that, it isn't necessary that stack is allocated from xenheap.
> Allocate stack from domheap, thus memory pressure on xenheap was
> reduced.
>
> To be honest I didn't test the mca patch().
> Kazuhiro, Could you please review and test it?
>
> thanks
diff -u xen/arch/ia64/linux-xen/mca_asm.S.orig xen/arch/ia64/linux-xen/mca_asm.S
--- xen/arch/ia64/linux-xen/mca_asm.S.orig 2007-12-21 18:11:11.000000000
+0900
+++ xen/arch/ia64/linux-xen/mca_asm.S 2007-12-21 18:21:30.000000000 +0900
@@ -482,32 +482,26 @@
// avoid overlapping with xenheap TR
mov r17=ip
;;
- tpa r17=r17
- ;;
dep r17=0,r17,0,KERNEL_TR_PAGE_SHIFT
;;
shr.u r17=r17,IA64_GRANULE_SHIFT
;;
- GET_THIS_PADDR(r2,cpu_kr);;
- add r2=IA64_KR_CURRENT_OFFSET,r2;;
- ld8 r16=[r2];;
+ // Kernel registers are saved in a per_cpu cpu_kr_ia64_t
+ // to allow the kernel registers themselves to be used by domains.
+ GET_THIS_PADDR(r2, cpu_kr);;
+ add r2=IA64_KR_CURRENT_STACK_OFFSET,r2
+ ;;
+ ld8 r16=[r2]
;;
#if KERNEL_TR_PAGE_SHIFT < IA64_GRANULE_SHIFT
# error "KERNEL_TR_PAGE_SHIFT < IA64_GRANULE_SHIFT shouldn't happen"
#endif
#if KERNEL_TR_PAGE_SHIFT > IA64_GRANULE_SHIFT
- dep r16=0,r16,0,KERNEL_TR_PAGE_SHIFT-IA64_GRANULE_SHIFT
+ dep r18=0,r16,0,KERNEL_TR_PAGE_SHIFT-IA64_GRANULE_SHIFT
;;
#endif
- cmp.eq p7,p0=r17,r16
+ cmp.eq p7,p0=r17,r18
(p7) br.cond.sptk .reload_vhpt
-
- // Kernel registers are saved in a per_cpu cpu_kr_ia64_t
- // to allow the kernel registers themselves to be used by domains.
- GET_THIS_PADDR(r2, cpu_kr);;
- add r2=IA64_KR_CURRENT_STACK_OFFSET,r2
- ;;
- ld8 r16=[r2]
#else
mov r16=IA64_KR(CURRENT_STACK)
#endif
@@ -535,6 +529,9 @@
#if VHPT_ENABLED
GET_VA_VCPU_VHPT_MADDR(r2,r3);;
dep r3=0,r2,0,KERNEL_TR_PAGE_SHIFT
+ ;;
+ dep r3=0,r3,60,4 // physical address of
+ // va_vhpt & ~(KERNEL_TR_PAGE_SHIFT - 1)
;;
shr.u r3=r3,IA64_GRANULE_SHIFT
;;
_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
|