Skip to contentSkip to conversation

paravirt repo rebased to 2.6.21-rc6-mm1

DISCUSSION Jeremy Fitzhardinge 3 participants 7 messages Apr 10, 2007 – Apr 12, 2007 virtio core

lore
Share & tools
lore
#0 lore raw

Seems to work OK for native and Xen. I had to play a bit with the paravirt-sched-clock patch to deal with the VMI changes. Zach, can you check that it still works?

Thanks,
J

#1 lore raw
Quoted 4 lines · Jeremy Fitzhardinge

Seems to work OK for native and Xen. I had to play a bit with the paravirt-sched-clock patch to deal with the VMI changes. Zach, can you check that it still works?

I'm on it.

Zach

#2 lore raw
Quoted 6 lines · * Zachary Amsden ([email protected]) wrote:
Quoted 3 lines · Jeremy Fitzhardinge

Seems to work OK for native and Xen. I had to play a bit with the paravirt-sched-clock patch to deal with the VMI changes. Zach, can you check that it still works?

I'm on it.

Not sure about cycles_2_ns...

arch/i386/kernel/built-in.o: In function `activate_vmi':
/home/chrisw/hg/xen/linux-2.6-pv/arch/i386/kernel/vmi.c:894: undefined reference to `vmi_sched_clock'

arch/i386/kernel/vmiclock.c +4 -4
diff -r a5e50a2e914a arch/i386/kernel/vmiclock.c
@@ -64,10 +64,10 @@ int vmi_set_wallclock(unsigned long now)
 	return 0;
 }
 
-/* paravirt_ops.get_scheduled_cycles = vmi_get_sched_cycles */
-unsigned long long vmi_get_sched_cycles(void)
-{
-	return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_AVAILABLE);
+unsigned long long vmi_sched_clock(void)
+{
+	cycle_t cycles = vmi_timer_ops.get_cycle_counter(VMI_CYCLES_AVAILABLE);
+	return cycles_2_ns(cycles);
 }
 
 /* paravirt_ops.get_cpu_khz = vmi_cpu_khz */
#3 lore raw
In reply to Jeremy Fitzhardinge
Quoted 6 lines · Jeremy Fitzhardinge

Seems to work OK for native and Xen. I had to play a bit with the paravirt-sched-clock patch to deal with the VMI changes. Zach, can you check that it still works?

Thanks,

Thanks, btw.

Zach

#4 lore raw
In reply to Jeremy Fitzhardinge
Quoted 3 lines · * Jeremy Fitzhardinge ([email protected]) wrote:

Seems to work OK for native and Xen. I had to play a bit with the paravirt-sched-clock patch to deal with the VMI changes. Zach, can you check that it still works?

Cool, thanks for the rebase. Here's some small fixes.

Minor issue with CONFIG_STACK_UNWIND in -mm vs. pda-to-percpu:

include/asm-i386/unwind.h +1 -1
diff -r a5e50a2e914a include/asm-i386/unwind.h
@@ -71,7 +71,7 @@ static inline void arch_unw_init_blocked
 	info->regs.xss = __KERNEL_DS;
 	info->regs.xds = __USER_DS;
 	info->regs.xes = __USER_DS;
-	info->regs.xfs = __KERNEL_PDA;
+	info->regs.xfs = __KERNEL_PERCPU;
 }
 
 extern asmlinkage int arch_unwind_init_running(struct unwind_frame_info *,

Another issue when !SMP from xen-smp.patch. leave_mm was SMP only before, it basically still is except for one call from xen_exit_mmap(). This is the simplest sol'n.

include/asm-i386/mmu_context.h +2 -0
diff -r a5e50a2e914a include/asm-i386/mmu_context.h
@@ -41,9 +41,11 @@ static inline void enter_lazy_tlb(struct
  */
 static inline void leave_mm (unsigned long cpu)
 {
+#ifdef CONFIG_SMP
 	if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
 		BUG();
 	cpu_clear(cpu, per_cpu(cpu_tlbstate, cpu).active_mm->cpu_vm_mask);
+#endif
 	load_cr3(swapper_pg_dir);
 }
 
#5 lore raw
In reply to Jeremy Fitzhardinge
Quoted 3 lines · * Jeremy Fitzhardinge ([email protected]) wrote:

Seems to work OK for native and Xen. I had to play a bit with the paravirt-sched-clock patch to deal with the VMI changes. Zach, can you check that it still works?

Here's what's working for me on UP. The boot cpu on UP is never getting the GDT loaded. Also __KERNEL_PERCPU is a bad selector on UP (ifdef was Jeremy's idea, I was just hacking entry.S to get things to boot ;-).

arch/i386/kernel/cpu/common.c +13 -0
diff -r cde7063e34bd arch/i386/kernel/cpu/common.c
@@ -644,6 +644,18 @@ struct pt_regs * __devinit idle_regs(str
 	return regs;
 }
 
+/* Current gdt points %fs at the "master" per-cpu area: after this,
+ * it's on the real one. */
+void switch_to_new_gdt(void)
+{
+	struct Xgt_desc_struct gdt_descr;
+
+	gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id());
+	gdt_descr.size = GDT_SIZE - 1;
+	load_gdt(&gdt_descr);
+	asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory");
+}
+
 /*
  * cpu_init() initializes state that is per-CPU. Some data is already
  * initialized (naturally) in the bootstrap process, such as the GDT
@@ -674,6 +688,7 @@ void __cpuinit cpu_init(void)
 	}
 
 	load_idt(&idt_descr);
+	switch_to_new_gdt();
 
 	/*
 	 * Set up and load the per-CPU TSS and LDT
arch/i386/kernel/smpboot.c +0 -12
diff -r cde7063e34bd arch/i386/kernel/smpboot.c
@@ -1176,18 +1176,6 @@ void __init native_smp_prepare_cpus(unsi
 	smp_boot_cpus(max_cpus);
 }
 
-/* Current gdt points %fs at the "master" per-cpu area: after this,
- * it's on the real one. */
-static inline void switch_to_new_gdt(void)
-{
-	struct Xgt_desc_struct gdt_descr;
-
-	gdt_descr.address = (long)get_cpu_gdt_table(smp_processor_id());
-	gdt_descr.size = GDT_SIZE - 1;
-	load_gdt(&gdt_descr);
-	asm("mov %0, %%fs" : : "r" (__KERNEL_PERCPU) : "memory");
-}
-
 void __init native_smp_prepare_boot_cpu(void)
 {
 	unsigned int cpu = smp_processor_id();
include/asm-i386/processor.h +1 -0
diff -r cde7063e34bd include/asm-i386/processor.h
@@ -777,6 +777,7 @@ extern int sysenter_setup(void);
 extern int sysenter_setup(void);
 
 extern void cpu_set_gdt(int);
+extern void switch_to_new_gdt(void);
 extern void cpu_init(void);
 
 #endif /* __ASM_I386_PROCESSOR_H */
include/asm-i386/segment.h +4 -0
diff -r cde7063e34bd include/asm-i386/segment.h
@@ -75,7 +75,11 @@
 #define __ESPFIX_SS (GDT_ENTRY_ESPFIX_SS * 8)
 
 #define GDT_ENTRY_PERCPU			(GDT_ENTRY_KERNEL_BASE + 15)
+#ifdef CONFIG_SMP
 #define __KERNEL_PERCPU (GDT_ENTRY_PERCPU * 8)
+#else
+#define __KERNEL_PERCPU 0
+#endif
 
 #define GDT_ENTRY_DOUBLEFAULT_TSS	31
 
#6 lore raw
Quoted 6 lines · Chris Wright
Quoted 4 lines · * Jeremy Fitzhardinge ([email protected]) wrote:

Seems to work OK for native and Xen. I had to play a bit with the paravirt-sched-clock patch to deal with the VMI changes. Zach, can you check that it still works?

I'm working off the same tree as Jeremy, so I'm not seeing any problems or failures to apply cleanly. As long as sched_clock units match (cycles vs. ns), it should be ok. And even if they are off, it would be very hard to tell by observation.

Zach