From: Jeff Dike <jdike@addtoit.com>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net,
"Paolo 'Blaisorblade' Giarrusso" <blaisorblade@yahoo.it>
Subject: [PATCH 5/9] UML - Add locking to xtime accesses
Date: Thu, 29 Jun 2006 17:36:32 -0400 [thread overview]
Message-ID: <200606292136.k5TLaXHZ010812@ccure.user-mode-linux.org> (raw)
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>
Index: linux-2.6.17/arch/um/kernel/time_kern.c
===================================================================
--- linux-2.6.17.orig/arch/um/kernel/time_kern.c 2006-06-29 10:37:16.000000000 -0400
+++ linux-2.6.17/arch/um/kernel/time_kern.c 2006-06-29 11:39:57.000000000 -0400
@@ -96,11 +96,15 @@ void time_init_kern(void)
void do_boot_timer_handler(struct sigcontext * sc)
{
+ unsigned long flags;
struct pt_regs regs;
CHOOSE_MODE((void) (UPT_SC(®s.regs) = sc),
(void) (regs.regs.skas.is_user = 0));
+
+ write_seqlock_irqsave(&xtime_lock, flags);
do_timer(®s);
+ write_sequnlock_irqrestore(&xtime_lock, flags);
}
static DEFINE_SPINLOCK(timer_spinlock);
@@ -125,15 +129,17 @@ irqreturn_t um_timer(int irq, void *dev,
unsigned long long nsecs;
unsigned long flags;
+ write_seqlock_irqsave(&xtime_lock, flags);
+
do_timer(regs);
- write_seqlock_irqsave(&xtime_lock, flags);
nsecs = get_time() + local_offset;
xtime.tv_sec = nsecs / NSEC_PER_SEC;
xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC;
+
write_sequnlock_irqrestore(&xtime_lock, flags);
- return(IRQ_HANDLED);
+ return IRQ_HANDLED;
}
long um_time(int __user *tloc)
reply other threads:[~2006-06-29 21:38 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200606292136.k5TLaXHZ010812@ccure.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=akpm@osdl.org \
--cc=blaisorblade@yahoo.it \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®