From: Jan Kiszka <jan.kiszka@domain.hid>
To: Xenomai-core@domain.hid
Subject: [Xenomai-core] [PATCH] Fix cleanup race in xnpod_disable_timesource
Date: Sun, 27 Jan 2008 16:04:35 +0100 [thread overview]
Message-ID: <479C9D83.1060409@domain.hid> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 487 bytes --]
CPU n (n!=0)
------------
xnpod_disable_timesource()
for (cpu = 0..x)
rthal_timer_release(cpu=0)
ipipe_release_tickdev(cpu=0)
rthal_timer_set_oneshot(0)
rthal_trigger_irq(RTHAL_HOST_TICK_IRQ)
...
lapic_next_event(...)
xnarch_next_htick_shot(...)
...
rthal_timer_release(cpu=n)
ipipe_release_tickdev(cpu=n)
And dead it is, the lapic on this CPU. Attached patch fixes the issue
(and gets rid off multiple RTHAL_BCAST_TICK_IRQ deregistrations).
Jan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: fix-timesource-cleanup-race.patch --]
[-- Type: text/x-patch; name="fix-timesource-cleanup-race.patch", Size: 2183 bytes --]
---
ChangeLog | 5 +++++
ksrc/arch/x86/hal-common.c | 18 +++++++++++-------
2 files changed, 16 insertions(+), 7 deletions(-)
Index: b/ChangeLog
===================================================================
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-01-27 Jan Kiszka <jan.kiszka@domain.hid>
+
+ * ksrc/arch/x86/hal-common.c: Fix race when starting the cleanup
+ on CPU > 0. Avoid multiple RTHAL_BCAST_TICK_IRQ releases.
+
2008-01-26 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
* configure.in: Fix --enable-linux-build for latest arch/x86
Index: b/ksrc/arch/x86/hal-common.c
===================================================================
--- a/ksrc/arch/x86/hal-common.c
+++ b/ksrc/arch/x86/hal-common.c
@@ -120,6 +120,8 @@ DECLARE_LINUX_IRQ_HANDLER(rthal_broadcas
return IRQ_HANDLED;
}
+static int cpu_timers_requested;
+
#ifdef CONFIG_GENERIC_CLOCKEVENTS
int rthal_timer_request(
@@ -179,7 +181,7 @@ int rthal_timer_request(
* The rest of the initialization should only be performed
* once by a single CPU.
*/
- if (cpu > 0)
+ if (cpu_timers_requested++ > 0)
goto out;
err = rthal_irq_request(RTHAL_APIC_TIMER_IPI,
@@ -219,7 +221,7 @@ int rthal_timer_request(void (*tick_hand
* The rest of the initialization should only be performed
* once by a single CPU.
*/
- if (cpu > 0)
+ if (cpu_timers_requested++ > 0)
goto out;
err = rthal_irq_request(RTHAL_APIC_TIMER_IPI,
@@ -252,18 +254,20 @@ void rthal_timer_release(int cpu)
{
#ifdef CONFIG_GENERIC_CLOCKEVENTS
ipipe_release_tickdev(cpu);
-#else
- rthal_irq_host_release(RTHAL_BCAST_TICK_IRQ,
- &rthal_broadcast_to_local_timers);
#endif
/*
* The rest of the cleanup work should only be performed once
- * by a single CPU.
+ * by the last releasing CPU.
*/
- if (cpu > 0)
+ if (--cpu_timers_requested > 0)
return;
+#ifndef CONFIG_GENERIC_CLOCKEVENTS
+ rthal_irq_host_release(RTHAL_BCAST_TICK_IRQ,
+ &rthal_broadcast_to_local_timers);
+#endif
+
rthal_nmi_release();
rthal_irq_release(RTHAL_APIC_TIMER_IPI);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 254 bytes --]
reply other threads:[~2008-01-27 15:04 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=479C9D83.1060409@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=Xenomai-core@domain.hid \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.