Annotation of /trunk/kernel26-xen/patches-2.6.25-r1/1019-2.6.25-xen-patch-2.6.18.patch
Parent Directory | Revision Log
Revision 609 -
(hide annotations)
(download)
Fri May 23 17:35:37 2008 UTC (16 years, 4 months ago) by niro
File size: 6834 byte(s)
Fri May 23 17:35:37 2008 UTC (16 years, 4 months ago) by niro
File size: 6834 byte(s)
-using opensuse xen patchset, updated kernel configs
1 | niro | 609 | From: www.kernel.org |
2 | Subject: Linux 2.6.18 | ||
3 | Patch-mainline: 2.6.18 | ||
4 | |||
5 | Automatically created from "patches.kernel.org/patch-2.6.18" by xen-port-patches.py | ||
6 | |||
7 | Acked-by: jbeulich@novell.com | ||
8 | |||
9 | --- | ||
10 | arch/x86/Kconfig | 1 | ||
11 | arch/x86/kernel/Makefile | 2 | ||
12 | arch/x86/kernel/entry_32-xen.S | 2 | ||
13 | arch/x86/kernel/time_32-xen.c | 104 ++++++++++++++++++++++++++-- | ||
14 | include/asm-x86/mach-xen/asm/processor_32.h | 2 | ||
15 | include/asm-x86/thread_info_32.h | 4 + | ||
16 | 6 files changed, 106 insertions(+), 9 deletions(-) | ||
17 | |||
18 | --- a/arch/x86/Kconfig | ||
19 | +++ b/arch/x86/Kconfig | ||
20 | @@ -42,7 +42,6 @@ | ||
21 | |||
22 | config GENERIC_TIME | ||
23 | def_bool y | ||
24 | - depends on !X86_XEN | ||
25 | |||
26 | config GENERIC_CMOS_UPDATE | ||
27 | def_bool y | ||
28 | --- a/arch/x86/kernel/Makefile | ||
29 | +++ b/arch/x86/kernel/Makefile | ||
30 | @@ -104,5 +104,5 @@ | ||
31 | pci-dma_64-$(CONFIG_XEN) += pci-dma_32.o | ||
32 | endif | ||
33 | |||
34 | -disabled-obj-$(CONFIG_XEN) := i8259_$(BITS).o reboot.o smpboot_$(BITS).o | ||
35 | +disabled-obj-$(CONFIG_XEN) := i8253.o i8259_$(BITS).o reboot.o smpboot_$(BITS).o tsc_$(BITS).o | ||
36 | %/head_$(BITS).o %/head_$(BITS).s: $(if $(CONFIG_XEN),EXTRA_AFLAGS,dummy) := | ||
37 | --- a/arch/x86/kernel/entry_32-xen.S | ||
38 | +++ b/arch/x86/kernel/entry_32-xen.S | ||
39 | @@ -388,8 +388,10 @@ | ||
40 | movl %ebp,12(%esp) | ||
41 | movl $__USER_CS,4(%esp) | ||
42 | addl $4,%esp | ||
43 | + CFI_ADJUST_CFA_OFFSET -4 | ||
44 | /* +5*4 is SS:ESP,EFLAGS,CS:EIP. +8 is esp0 setting. */ | ||
45 | pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp) | ||
46 | + CFI_ADJUST_CFA_OFFSET 4 | ||
47 | /* | ||
48 | * Load the potential sixth argument from user stack. | ||
49 | * Careful about security. | ||
50 | --- a/arch/x86/kernel/time_32-xen.c | ||
51 | +++ b/arch/x86/kernel/time_32-xen.c | ||
52 | @@ -76,8 +76,13 @@ | ||
53 | |||
54 | #if defined (__i386__) | ||
55 | #include <asm/i8259.h> | ||
56 | +#include <asm/i8253.h> | ||
57 | +DEFINE_SPINLOCK(i8253_lock); | ||
58 | +EXPORT_SYMBOL(i8253_lock); | ||
59 | #endif | ||
60 | |||
61 | +#define XEN_SHIFT 22 | ||
62 | + | ||
63 | int pit_latch_buggy; /* extern */ | ||
64 | |||
65 | #if defined(__x86_64__) | ||
66 | @@ -97,10 +102,6 @@ | ||
67 | DEFINE_SPINLOCK(rtc_lock); | ||
68 | EXPORT_SYMBOL(rtc_lock); | ||
69 | |||
70 | -extern struct init_timer_opts timer_tsc_init; | ||
71 | -extern struct timer_opts timer_tsc; | ||
72 | -#define timer_none timer_tsc | ||
73 | - | ||
74 | /* These are peridically updated in shared_info, and then copied here. */ | ||
75 | struct shadow_time_info { | ||
76 | u64 tsc_timestamp; /* TSC at last update of time vals. */ | ||
77 | @@ -248,6 +249,7 @@ | ||
78 | return scale_delta(delta, shadow->tsc_to_nsec_mul, shadow->tsc_shift); | ||
79 | } | ||
80 | |||
81 | +#ifdef CONFIG_X86_64 | ||
82 | static unsigned long get_usec_offset(struct shadow_time_info *shadow) | ||
83 | { | ||
84 | u64 now, delta; | ||
85 | @@ -255,6 +257,7 @@ | ||
86 | delta = now - shadow->tsc_timestamp; | ||
87 | return scale_delta(delta, shadow->tsc_to_usec_mul, shadow->tsc_shift); | ||
88 | } | ||
89 | +#endif | ||
90 | |||
91 | static void __update_wallclock(time_t sec, long nsec) | ||
92 | { | ||
93 | @@ -364,6 +367,8 @@ | ||
94 | } | ||
95 | EXPORT_SYMBOL(rtc_cmos_write); | ||
96 | |||
97 | +#ifdef CONFIG_X86_64 | ||
98 | + | ||
99 | /* | ||
100 | * This version of gettimeofday has microsecond resolution | ||
101 | * and better than microsecond precision on fast x86 machines with TSC. | ||
102 | @@ -498,6 +503,8 @@ | ||
103 | |||
104 | EXPORT_SYMBOL(do_settimeofday); | ||
105 | |||
106 | +#endif | ||
107 | + | ||
108 | static void sync_xen_wallclock(unsigned long dummy); | ||
109 | static DEFINE_TIMER(sync_xen_wallclock_timer, sync_xen_wallclock, 0, 0); | ||
110 | static void sync_xen_wallclock(unsigned long dummy) | ||
111 | @@ -549,11 +556,15 @@ | ||
112 | return retval; | ||
113 | } | ||
114 | |||
115 | +#ifdef CONFIG_X86_64 | ||
116 | /* monotonic_clock(): returns # of nanoseconds passed since time_init() | ||
117 | * Note: This function is required to return accurate | ||
118 | * time even in the absence of multiple timer ticks. | ||
119 | */ | ||
120 | unsigned long long monotonic_clock(void) | ||
121 | +#else | ||
122 | +unsigned long long sched_clock(void) | ||
123 | +#endif | ||
124 | { | ||
125 | unsigned int cpu = get_cpu(); | ||
126 | struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu); | ||
127 | @@ -573,9 +584,9 @@ | ||
128 | |||
129 | return time; | ||
130 | } | ||
131 | +#ifdef CONFIG_X86_64 | ||
132 | EXPORT_SYMBOL(monotonic_clock); | ||
133 | |||
134 | -#ifdef __x86_64__ | ||
135 | unsigned long long sched_clock(void) | ||
136 | { | ||
137 | return monotonic_clock(); | ||
138 | @@ -745,6 +756,87 @@ | ||
139 | return IRQ_HANDLED; | ||
140 | } | ||
141 | |||
142 | +#ifndef CONFIG_X86_64 | ||
143 | + | ||
144 | +void tsc_init(void) | ||
145 | +{ | ||
146 | + init_cpu_khz(); | ||
147 | + printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n", | ||
148 | + cpu_khz / 1000, cpu_khz % 1000); | ||
149 | + | ||
150 | + use_tsc_delay(); | ||
151 | +} | ||
152 | + | ||
153 | +#include <linux/clocksource.h> | ||
154 | + | ||
155 | +void mark_tsc_unstable(void) | ||
156 | +{ | ||
157 | +#ifndef CONFIG_XEN /* XXX Should tell the hypervisor about this fact. */ | ||
158 | + tsc_unstable = 1; | ||
159 | +#endif | ||
160 | +} | ||
161 | +EXPORT_SYMBOL_GPL(mark_tsc_unstable); | ||
162 | + | ||
163 | +static cycle_t xen_clocksource_read(void) | ||
164 | +{ | ||
165 | + cycle_t ret = sched_clock(); | ||
166 | + | ||
167 | +#ifdef CONFIG_SMP | ||
168 | + for (;;) { | ||
169 | + static cycle_t last_ret; | ||
170 | +#ifndef CONFIG_64BIT | ||
171 | + cycle_t last = cmpxchg64(&last_ret, 0, 0); | ||
172 | +#else | ||
173 | + cycle_t last = last_ret; | ||
174 | +#define cmpxchg64 cmpxchg | ||
175 | +#endif | ||
176 | + | ||
177 | + if ((s64)(ret - last) < 0) { | ||
178 | + if (last - ret > permitted_clock_jitter | ||
179 | + && printk_ratelimit()) { | ||
180 | + unsigned int cpu = get_cpu(); | ||
181 | + struct shadow_time_info *shadow = &per_cpu(shadow_time, cpu); | ||
182 | + | ||
183 | + printk(KERN_WARNING "clocksource/%u: " | ||
184 | + "Time went backwards: " | ||
185 | + "ret=%Lx delta=%Ld shadow=%Lx offset=%Lx\n", | ||
186 | + cpu, ret, ret - last, | ||
187 | + shadow->system_timestamp, | ||
188 | + get_nsec_offset(shadow)); | ||
189 | + put_cpu(); | ||
190 | + } | ||
191 | + ret = last; | ||
192 | + } | ||
193 | + if (cmpxchg64(&last_ret, last, ret) == last) | ||
194 | + break; | ||
195 | + } | ||
196 | +#endif | ||
197 | + | ||
198 | + return ret; | ||
199 | +} | ||
200 | + | ||
201 | +static struct clocksource clocksource_xen = { | ||
202 | + .name = "xen", | ||
203 | + .rating = 400, | ||
204 | + .read = xen_clocksource_read, | ||
205 | + .mask = CLOCKSOURCE_MASK(64), | ||
206 | + .mult = 1 << XEN_SHIFT, /* time directly in nanoseconds */ | ||
207 | + .shift = XEN_SHIFT, | ||
208 | + .is_continuous = 1, | ||
209 | +}; | ||
210 | + | ||
211 | +static int __init init_xen_clocksource(void) | ||
212 | +{ | ||
213 | + clocksource_xen.mult = clocksource_khz2mult(cpu_khz, | ||
214 | + clocksource_xen.shift); | ||
215 | + | ||
216 | + return clocksource_register(&clocksource_xen); | ||
217 | +} | ||
218 | + | ||
219 | +module_init(init_xen_clocksource); | ||
220 | + | ||
221 | +#endif | ||
222 | + | ||
223 | static void init_missing_ticks_accounting(unsigned int cpu) | ||
224 | { | ||
225 | struct vcpu_register_runstate_memory_area area; | ||
226 | @@ -933,11 +1025,11 @@ | ||
227 | |||
228 | update_wallclock(); | ||
229 | |||
230 | +#ifdef CONFIG_X86_64 | ||
231 | init_cpu_khz(); | ||
232 | printk(KERN_INFO "Xen reported: %u.%03u MHz processor.\n", | ||
233 | cpu_khz / 1000, cpu_khz % 1000); | ||
234 | |||
235 | -#if defined(__x86_64__) | ||
236 | vxtime.mode = VXTIME_TSC; | ||
237 | vxtime.quot = (1000000L << 32) / vxtime_hz; | ||
238 | vxtime.tsc_quot = (1000L << 32) / cpu_khz; | ||
239 | --- a/include/asm-x86/mach-xen/asm/processor_32.h | ||
240 | +++ b/include/asm-x86/mach-xen/asm/processor_32.h | ||
241 | @@ -23,7 +23,7 @@ | ||
242 | #include <xen/interface/physdev.h> | ||
243 | |||
244 | /* flag for disabling the tsc */ | ||
245 | -extern int tsc_disable; | ||
246 | +#define tsc_disable 0 | ||
247 | |||
248 | struct desc_struct { | ||
249 | unsigned long a,b; | ||
250 | --- a/include/asm-x86/thread_info_32.h | ||
251 | +++ b/include/asm-x86/thread_info_32.h | ||
252 | @@ -170,11 +170,15 @@ | ||
253 | #define _TIF_ALLWORK_MASK (0x0000FFFF & ~_TIF_SECCOMP) | ||
254 | |||
255 | /* flags to check in __switch_to() */ | ||
256 | +#ifndef CONFIG_XEN | ||
257 | #define _TIF_WORK_CTXSW \ | ||
258 | (_TIF_IO_BITMAP | _TIF_NOTSC | _TIF_DEBUGCTLMSR | \ | ||
259 | _TIF_DS_AREA_MSR | _TIF_BTS_TRACE_TS) | ||
260 | #define _TIF_WORK_CTXSW_PREV _TIF_WORK_CTXSW | ||
261 | #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW | _TIF_DEBUG) | ||
262 | +#else | ||
263 | +#define _TIF_WORK_CTXSW _TIF_DEBUG | ||
264 | +#endif | ||
265 | |||
266 | |||
267 | /* |