Skip to contentSkip to conversation

Get x86_64 running with PREEMPT_RT

PATCH Applied Steven Rostedt 3 participants 6 messages May 26, 2006 Timekeeping, clocksource core, NTP, alarmtimer

lore
Share & tools
lore
#0 lore raw

cover Get x86_64 running with PREEMPT_RT

The following two patches get PREEMPT_RT running on x86_64. I'm currently writing this from my x86_64 box running 2.6.16-rt23.

The first patch probably only affected me, since it was caused by having clocksource=XXX in the command line.

The other patch simply fixes a bad condition in the default_idle which prevented the idle task from ever scheduling (that was bad!)

-- Steve

#1 lore raw

PATCH 1/2 Dont blindly turn on interrupts in boot_override_clocksource

The boot_override_clocksource currently blindly turns on interrupts with the releasing of the lock. But if you have clocksource=xxx in the command line, this function is called before interrupts are setup, and causes early exception errors.

kernel/time/clocksource.c +3 -2
Index: linux-2.6.16-rt23/kernel/time/clocksource.c
===================================================================
@@ -323,10 +323,11 @@ device_initcall(init_clocksource_sysfs);
  */
 static int __init boot_override_clocksource(char* str)
 {
-	spin_lock_irq(&clocksource_lock);
+	unsigned long flags;
+	spin_lock_irqsave(&clocksource_lock, flags);
 	if (str)
 		strlcpy(override_name, str, sizeof(override_name));
-	spin_unlock_irq(&clocksource_lock);
+	spin_unlock_irqrestore(&clocksource_lock, flags);
 	return 1;
 }
 

--

Applied
#2 lore raw

Re: [PATCH -rt 1/2] Dont blindly turn on interrupts in boot_override_clocksource

Quoted 4 lines · Steven Rostedt

The boot_override_clocksource currently blindly turns on interrupts with the releasing of the lock. But if you have clocksource=xxx in the command line, this function is called before interrupts are setup, and causes early exception errors.

thanks, applied.

Ingo

#3 lore raw

PATCH 2/2 Fix condition in default_idle

In reply to Steven Rostedt

The condition statement in default_idle had the conjunctions backwards. Instead of && it had || so the idle thread would never be preempted.

arch/x86_64/kernel/process.c +2 -2
Index: linux-2.6.16-rt23/arch/x86_64/kernel/process.c
===================================================================
@@ -120,9 +120,9 @@ void default_idle(void)
 
 	clear_thread_flag(TIF_POLLING_NRFLAG);
 	smp_mb__after_clear_bit();
-	while (!need_resched() || !need_resched_delayed()) {
+	while (!need_resched() && !need_resched_delayed()) {
 		local_irq_disable();
-		if (!need_resched() || !need_resched_delayed())
+		if (!need_resched() && !need_resched_delayed())
 			safe_halt();
 		else
 			local_irq_enable();

--

#4 lore raw

Re: [PATCH -rt 2/2] Fix condition in default_idle

arch/x86_64/kernel/process.c void default_idle(void) · line 125

Quoted 9 lines · Steven Rostedt

The condition statement in default_idle had the conjunctions backwards. Instead of && it had || so the idle thread would never be preempted.

arch/x86_64/kernel/process.c +2 -2
-	while (!need_resched() || !need_resched_delayed()) {
+	while (!need_resched() && !need_resched_delayed()) {
 		local_irq_disable();
-		if (!need_resched() || !need_resched_delayed())
+		if (!need_resched() && !need_resched_delayed())

doh! Good catch - applied.

Ingo

#5 lore raw
In reply to Steven Rostedt

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 8 lines · Steven Rostedt

The following two patches get PREEMPT_RT running on x86_64. I'm currently writing this from my x86_64 box running 2.6.16-rt23.

The first patch probably only affected me, since it was caused by having clocksource=XXX in the command line.

The other patch simply fixes a bad condition in the default_idle which prevented the idle task from ever scheduling (that was bad!)

Fixed my problem on Athlon64x2.

Thanks,
Clark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFEd0afHyuj/+TTEp0RAmMsAJ9Zf1n/GMHOB+SYXdI7fWGYfbkcVwCgrK6I I0pV042x2vtPj7750lzIXeM=
=eMDn
-----END PGP SIGNATURE-----