[Xen-ia64-devel] PATCH: [resent] cleanup + fph handling

2006-04-24 Thread Tristan Gingold
Hi,


this patch moves switch_to macro from xensystem.h and put its body directly in 
context_switch.  FP saved and restore is slighly optimized: fph is *still* 
enabled and not anymore disabled.

Misc cleanup.

Note: not enabling fph before saving fph in context switch does not work.  I 
will look on this issue.  However,  I think it is worth adding this patch.

Tested by boot+halt of dom0+domU.

Tristan.
# HG changeset patch
# User [EMAIL PROTECTED]
# Node ID 80dca45d10905f8513e4bd2c77a7642833308db3
# Parent  de0c04ed4ab7b9c4572c42df2de838e2b243a8e2
Move contents of switch_to macro from xensystem.h to context_switch function.
Let fph enabled after context switch.
Cleanup (unused function/variables, debug printf...)
vmx_ia64_switch_to removed (was unused).

Signed-off-by: Tristan Gingold [EMAIL PROTECTED]

diff -r de0c04ed4ab7 -r 80dca45d1090 xen/arch/ia64/linux-xen/setup.c
--- a/xen/arch/ia64/linux-xen/setup.c	Fri Apr 21 16:40:17 2006
+++ b/xen/arch/ia64/linux-xen/setup.c	Mon Apr 24 04:04:00 2006
@@ -384,7 +384,9 @@
 {
 	unw_init();
 
+#ifndef XEN
 	ia64_patch_vtop((u64) __start___vtop_patchlist, (u64) __end___vtop_patchlist);
+#endif
 
 	*cmdline_p = __va(ia64_boot_param-command_line);
 #ifndef XEN
@@ -931,9 +933,11 @@
 #endif
 }
 
+#ifndef XEN
 void
 check_bugs (void)
 {
 	ia64_patch_mckinley_e9((unsigned long) __start___mckinley_e9_bundles,
 			   (unsigned long) __end___mckinley_e9_bundles);
 }
+#endif
diff -r de0c04ed4ab7 -r 80dca45d1090 xen/arch/ia64/vmx/vmx_entry.S
--- a/xen/arch/ia64/vmx/vmx_entry.S	Fri Apr 21 16:40:17 2006
+++ b/xen/arch/ia64/vmx/vmx_entry.S	Mon Apr 24 04:04:00 2006
@@ -36,48 +36,6 @@
 #include asm/vhpt.h
 #include asm/vmmu.h
 #include vmx_minstate.h
-
-/*
- * prev_task - vmx_ia64_switch_to(struct task_struct *next)
- *	With Ingo's new scheduler, interrupts are disabled when this routine gets
- *	called.  The code starting at .map relies on this.  The rest of the code
- *	doesn't care about the interrupt masking status.
- *
- * Since we allocate domain stack in xenheap, there's no need to map new
- * domain's stack since all xenheap is mapped by TR. Another different task
- * for vmx_ia64_switch_to is to switch to bank0 and change current pointer.
- */
-GLOBAL_ENTRY(vmx_ia64_switch_to)
-	.prologue
-	alloc r16=ar.pfs,1,0,0,0
-	DO_SAVE_SWITCH_STACK
-	.body
-
-	bsw.0	// Switch to bank0, because bank0 r21 is current pointer
-	;;
-	adds r22=IA64_TASK_THREAD_KSP_OFFSET,r13
-	movl r25=init_task
-	adds r26=IA64_TASK_THREAD_KSP_OFFSET,in0
-	;;
-	st8 [r22]=sp			// save kernel stack pointer of old task
-	;;
-	/*
-	 * TR always mapped this task's page, we can skip doing it again.
-	 */
-	ld8 sp=[r26]			// load kernel stack pointer of new task
-	mov r21=in0			// update current application register
-	mov r8=r13			// return pointer to previously running task
-	mov r13=in0			// set current pointer
-	;;
-	bsw.1
-	;;
-	DO_LOAD_SWITCH_STACK
-
-#ifdef CONFIG_SMP
-	sync.i// ensure fcs done by this CPU are visible on other CPUs
-#endif
-	br.ret.sptk.many rp		// boogie on out in new context
-END(vmx_ia64_switch_to)
 
 GLOBAL_ENTRY(ia64_leave_nested)
 	rsm psr.i
diff -r de0c04ed4ab7 -r 80dca45d1090 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Fri Apr 21 16:40:17 2006
+++ b/xen/arch/ia64/xen/domain.c	Mon Apr 24 04:04:00 2006
@@ -70,11 +70,8 @@
 #define IS_XEN_ADDRESS(d,a) ((a = d-xen_vastart)  (a = d-xen_vaend))
 
 /* FIXME: where these declarations should be there ? */
-extern void domain_pend_keyboard_interrupt(int);
 extern long platform_is_hp_ski(void);
-extern void sync_split_caches(void);
 extern void serial_input_init(void);
-
 static void init_switch_stack(struct vcpu *v);
 void build_physmap_table(struct domain *d);
 
@@ -302,7 +299,6 @@
 {
 	struct pt_regs *regs = vcpu_regs (v);
 
-	printf(arch_getdomaininfo_ctxt\n);
 	c-regs = *regs;
 	c-vcpu.evtchn_vector = v-vcpu_info-arch.evtchn_vector;
 
@@ -314,7 +310,6 @@
 	struct pt_regs *regs = vcpu_regs (v);
 	struct domain *d = v-domain;
 
-	printf(arch_set_info_guest\n);
 	if ( test_bit(_VCPUF_initialised, v-vcpu_flags) )
 return 0;
 	if (c-flags  VGCF_VMX_GUEST) {
@@ -866,9 +861,8 @@
 	dom0_start = alloc_boot_pages(dom0_size  PAGE_SHIFT, dom0_align  PAGE_SHIFT);
 	dom0_start = PAGE_SHIFT;
 	if (!dom0_start) {
-	printf(alloc_dom0: can't allocate contiguous memory size=%lu\n,
+	  panic(alloc_dom0: can't allocate contiguous memory size=%lu\n,
 		dom0_size);
-	while(1);
 	}
 	printf(alloc_dom0: dom0_start=0x%lx\n, dom0_start);
 #else
@@ -1133,17 +1127,6 @@
 	while(1);
 }
 
-
-#if 0
-void switch_to(struct vcpu *prev, struct vcpu *next)
-{
- 	struct vcpu *last;
-
-	__switch_to(prev,next,last);
-	//set_current(next);
-}
-#endif
-
 void domain_pend_keyboard_interrupt(int irq)
 {
 	vcpu_pend_interrupt(dom0-vcpu[0],irq);
@@ -1154,10 +1137,6 @@
 	ia64_save_fpu(v-arch._thread.fph);
 	if (VMX_DOMAIN(v))
 		vmx_save_state(v);
-	else {
-		if (IA64_HAS_EXTRA_STATE(v))
-			ia64_save_extra(v);
-	}
 	// FIXME SMP: Anything else 

RE: [Xen-ia64-devel] PATCH: [resent] cleanup + fph handling

2006-04-24 Thread Tian, Kevin
From: Tristan Gingold
Sent: 2006年4月24日 16:40
Hi,


this patch moves switch_to macro from xensystem.h and put its body
directly in
context_switch.  FP saved and restore is slighly optimized: fph is *still*
enabled and not anymore disabled.

Misc cleanup.

Note: not enabling fph before saving fph in context switch does not work.
I
will look on this issue.  However,  I think it is worth adding this patch.


If you failed at the first context switch, the possible cause is in head.S 
where psr.dfh is initialized as disabled for idle domain. Then the first 
time when you switch from idle to domain0, disabled fp fault occurs 
unless you explicitly enable psr.dfh like in your patch. This is one place
where psr value doesn't get from hardware exception.

Linux is immune because it always touches fph only for the one 
owning the that high area.

Thanks,
Kevin

___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


Re: [Xen-ia64-devel] PATCH: [resent] cleanup + fph handling

2006-04-24 Thread Tristan Gingold
Le Lundi 24 Avril 2006 11:51, Tristan Gingold a écrit :
 Le Lundi 24 Avril 2006 11:06, Tian, Kevin a écrit :
  From: Tristan Gingold
 
  Sent: 2006年4月24日 16:40
  Hi,
  
  
  this patch moves switch_to macro from xensystem.h and put its body
  directly in
  context_switch.  FP saved and restore is slighly optimized: fph is
   *still* enabled and not anymore disabled.
  
  Misc cleanup.
  
  Note: not enabling fph before saving fph in context switch does not
   work. I
  will look on this issue.  However,  I think it is worth adding this
   patch.
 
  If you failed at the first context switch, the possible cause is in
  head.S where psr.dfh is initialized as disabled for idle domain. Then the
  first time when you switch from idle to domain0, disabled fp fault occurs
  unless you explicitly enable psr.dfh like in your patch. This is one
  place where psr value doesn't get from hardware exception.

 Oops, this may be correct for all the AP cpus!
This now works.

Thank you Kevin, you were on the right way!

Tristan.


___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel


RE: [Xen-ia64-devel] PATCH: [resent] cleanup + fph handling

2006-04-24 Thread Tian, Kevin
From: Tristan Gingold [mailto:[EMAIL PROTECTED]
Sent: 2006年4月24日 18:03

Le Lundi 24 Avril 2006 11:51, Tristan Gingold a écrit :
 Le Lundi 24 Avril 2006 11:06, Tian, Kevin a écrit :
  From: Tristan Gingold
 
  Sent: 2006年4月24日 16:40
  Hi,
  
  
  this patch moves switch_to macro from xensystem.h and put its
body
  directly in
  context_switch.  FP saved and restore is slighly optimized: fph is
   *still* enabled and not anymore disabled.
  
  Misc cleanup.
  
  Note: not enabling fph before saving fph in context switch does not
   work. I
  will look on this issue.  However,  I think it is worth adding this
   patch.
 
  If you failed at the first context switch, the possible cause is in
  head.S where psr.dfh is initialized as disabled for idle domain. Then
the
  first time when you switch from idle to domain0, disabled fp fault
occurs
  unless you explicitly enable psr.dfh like in your patch. This is one
  place where psr value doesn't get from hardware exception.

 Oops, this may be correct for all the AP cpus!
This now works.

Thank you Kevin, you were on the right way!

Tristan.

Nice to know it working now. Actually I didn't realize it as an 
AP-only issue and you gave it a final shoot. :-)

Thanks,
Kevin

___
Xen-ia64-devel mailing list
Xen-ia64-devel@lists.xensource.com
http://lists.xensource.com/xen-ia64-devel