diff options
author | Jeff Dike <jdike@addtoit.com> | 2006-06-30 04:55:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-30 14:25:37 -0400 |
commit | 572e614750c3ed27da1ec6b75dc486066a11fffd (patch) | |
tree | 50459d715a5145e43c7da1e0d87a85582258ca94 /arch/um | |
parent | 6edb08620fbeeeba81ab63c7129a51cdb3acd8b3 (diff) |
[PATCH] uml: add locking to xtime accesses
do_timer must be called with xtime_lock held. I'm not sure boot_timer_handler
needs this, however I don't think it hurts: it simply disables irq and takes a
spinlock.
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/kernel/time_kern.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c index 87cdbc560d36..08dd727e79e4 100644 --- a/arch/um/kernel/time_kern.c +++ b/arch/um/kernel/time_kern.c | |||
@@ -96,11 +96,15 @@ void time_init_kern(void) | |||
96 | 96 | ||
97 | void do_boot_timer_handler(struct sigcontext * sc) | 97 | void do_boot_timer_handler(struct sigcontext * sc) |
98 | { | 98 | { |
99 | unsigned long flags; | ||
99 | struct pt_regs regs; | 100 | struct pt_regs regs; |
100 | 101 | ||
101 | CHOOSE_MODE((void) (UPT_SC(®s.regs) = sc), | 102 | CHOOSE_MODE((void) (UPT_SC(®s.regs) = sc), |
102 | (void) (regs.regs.skas.is_user = 0)); | 103 | (void) (regs.regs.skas.is_user = 0)); |
104 | |||
105 | write_seqlock_irqsave(&xtime_lock, flags); | ||
103 | do_timer(®s); | 106 | do_timer(®s); |
107 | write_sequnlock_irqrestore(&xtime_lock, flags); | ||
104 | } | 108 | } |
105 | 109 | ||
106 | static DEFINE_SPINLOCK(timer_spinlock); | 110 | static DEFINE_SPINLOCK(timer_spinlock); |
@@ -125,15 +129,17 @@ irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs) | |||
125 | unsigned long long nsecs; | 129 | unsigned long long nsecs; |
126 | unsigned long flags; | 130 | unsigned long flags; |
127 | 131 | ||
132 | write_seqlock_irqsave(&xtime_lock, flags); | ||
133 | |||
128 | do_timer(regs); | 134 | do_timer(regs); |
129 | 135 | ||
130 | write_seqlock_irqsave(&xtime_lock, flags); | ||
131 | nsecs = get_time() + local_offset; | 136 | nsecs = get_time() + local_offset; |
132 | xtime.tv_sec = nsecs / NSEC_PER_SEC; | 137 | xtime.tv_sec = nsecs / NSEC_PER_SEC; |
133 | xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC; | 138 | xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC; |
139 | |||
134 | write_sequnlock_irqrestore(&xtime_lock, flags); | 140 | write_sequnlock_irqrestore(&xtime_lock, flags); |
135 | 141 | ||
136 | return(IRQ_HANDLED); | 142 | return IRQ_HANDLED; |
137 | } | 143 | } |
138 | 144 | ||
139 | long um_time(int __user *tloc) | 145 | long um_time(int __user *tloc) |