Skip to contentSkip to conversation

more 2.6.26-rt updates

PATCH New Thomas Gleixner 1 participant 6 messages Jan 30, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover more 2.6.26-rt updates

Steven,

the following patches are needed to make 2.6.26-rt usable.

Thanks,

tglx

#1 lore raw

PATCH 1/5 commit 42ef73fe134732b2e91c0326df5fd568da17c4b2 Author: Peter Zijlstra <[email protected]> Date: Fri Jan 23 17:37:49 2009 +0100

    x86, mm: fix pte_free()
    
    On -rt we were seeing spurious bad page states like:
    
    Bad page state in process 'firefox'
    page:c1bc2380 flags:0x40000000 mapping:c1bc2390 mapcount:0 count:0
    Trying to fix it up, but a reboot is needed
    Backtrace:
    Pid: 503, comm: firefox Not tainted 2.6.26.8-rt13 #3
    [<c043d0f3>] ? printk+0x14/0x19
    [<c0272d4e>] bad_page+0x4e/0x79
    [<c0273831>] free_hot_cold_page+0x5b/0x1d3
    [<c02739f6>] free_hot_page+0xf/0x11
    [<c0273a18>] __free_pages+0x20/0x2b
    [<c027d170>] __pte_alloc+0x87/0x91
    [<c027d25e>] handle_mm_fault+0xe4/0x733
    [<c043f680>] ? rt_mutex_down_read_trylock+0x57/0x63
    [<c043f680>] ? rt_mutex_down_read_trylock+0x57/0x63
    [<c0218875>] do_page_fault+0x36f/0x88a
    
    This is the case where a concurrent fault already installed the PTE and
    we get to free the newly allocated one.
    
    This is due to pgtable_page_ctor() doing the spin_lock_init(&page->ptl)
    which is overlaid with the {private, mapping} struct.
    
    union {
        struct {
            unsigned long private;
            struct address_space *mapping;
        };
        spinlock_t ptl;
        struct kmem_cache *slab;
        struct page *first_page;
    };
    
    Normally the spinlock is small enough to not stomp on page->mapping, but
    PREEMPT_RT=y has huge 'spin'locks.
    
    But lockdep kernels should also be able to trigger this splat, as the
    lock tracking code grows the spinlock to cover page->mapping.
    
    The obvious fix is calling pgtable_page_dtor() like the regular pte free
    path __pte_free_tlb() does.
    
    It seems all architectures except x86 and nm10300 already do this, and
    nm10300 doesn't seem to use pgtable_page_ctor(), which suggests it
    doesn't do SMP or simply doesnt do MMU at all or something.
    
    Signed-off-by: Peter Zijlstra <[email protected]>
    Signed-off-by: Ingo Molnar <[email protected]>
    Cc: <[email protected]>
---
 include/asm-x86/pgalloc.h |    1 +
 1 file changed, 1 insertion(+)
include/asm-x86/pgalloc.h +1 -0
Index: linux-2.6.26.8/include/asm-x86/pgalloc.h
===================================================================
@@ -38,6 +38,7 @@ static inline void pte_free_kernel(struc
 
 static inline void pte_free(struct mm_struct *mm, struct page *pte)
 {
+	pgtable_page_dtor(pte);
 	__free_page(pte);
 }
 
#2 lore raw

PATCH 2/5 commit 6626bff24578753808c8b5bd4f1619e14e980f0f Author: Thomas Gleixner <[email protected]> Date: Sun Jan 25 11:31:36 2009 +0100

In reply to Thomas Gleixner

hrtimer: prevent negative expiry value after clock_was_set()

Impact: prevent false positive WARN_ON() in clockevents_program_event()

clock_was_set() changes the base->offset of CLOCK_REALTIME and enforces the reprogramming of the clockevent device to expire timers which are based on CLOCK_REALTIME. If the clock change is large enough then the subtraction of the timer expiry value and base->offset can become negative which triggers the warning in clockevents_program_event().

Check the subtraction result and set a negative value to 0.

---
 kernel/hrtimer.c |    7 +++++++
 1 file changed, 7 insertions(+)
kernel/hrtimer.c +7 -0
Index: linux-2.6.26.8/kernel/hrtimer.c
===================================================================
@@ -520,6 +520,13 @@ static void hrtimer_force_reprogram(stru
 			continue;
 		timer = rb_entry(base->first, struct hrtimer, node);
 		expires = ktime_sub(timer->expires, base->offset);
+		/*
+		 * clock_was_set() has changed base->offset so the
+		 * result might be negative. Fix it up to prevent a
+		 * false positive in clockevents_program_event()
+		 */
+		if (expires.tv64 < 0)
+			expires.tv64 = 0;
 		if (expires.tv64 < cpu_base->expires_next.tv64)
 			cpu_base->expires_next = expires;
 	}
#3 lore raw

PATCH 3/5 trace: fix typo in kernel/trace/Kconfig

In reply to Thomas Gleixner

Fixed confusing Kconfig label of WAKEUP_LATENCY_HIST

kernel/trace/Kconfig renamed from kernel/trace/Kconfig-orig +1 -1
@@ -183,7 +183,7 @@
 	  preemption off timings to create a histogram of latencies.
 
 config WAKEUP_LATENCY_HIST
-	bool "Interrupts off critical timings histogram"
+	bool "Wakeup latency histogram"
 	select TRACING
 	select MARKERS
 	help
#4 lore raw

PATCH 4/5 x86: remove redundant local_irq_enable() in handle_signal()

In reply to Thomas Gleixner

IRQs are already enabled when handle_signal() is called.

---
 arch/x86/kernel/signal_32.c |    7 -------
 1 file changed, 7 deletions(-)
arch/x86/kernel/signal_32.c +0 -7
Index: linux-2.6.26.8/arch/x86/kernel/signal_32.c
===================================================================
@@ -529,13 +529,6 @@ handle_signal(unsigned long sig, siginfo
 		}
 	}
 
-#ifdef CONFIG_PREEMPT_RT
-	/*
-	 * Fully-preemptible kernel does not need interrupts disabled:
-	 */
-	local_irq_enable();
-	preempt_check_resched();
-#endif
 	/*
 	 * If TF is set due to a debugger (TIF_FORCED_TF), clear the TF
 	 * flag so that register information in the sigcontext is correct.
#5 lore raw

PATCH 5/5 trace: warn if irqs already enabled in irqs_off latency check

In reply to Thomas Gleixner

Be consistent: Warn if irqs are already enabled in irqs_off latency processing, same as in preempt_off and in irqs_off && preempt_off. This warning can now safely be inserted, after a problem was fixed that caused false positives.

---
 kernel/trace/trace_hist.c |    1 +
 1 file changed, 1 insertion(+)
kernel/trace/trace_hist.c +1 -0
Index: linux-2.6.26.8/kernel/trace/trace_hist.c
===================================================================
@@ -356,6 +356,7 @@ notrace void tracing_hist_preempt_stop(i
 #ifdef CONFIG_INTERRUPT_OFF_HIST
 	if (irqs_on &&
 	    per_cpu(hist_irqsoff_tracing, cpu)) {
+		WARN_ON(!irqs_disabled());
 		stop = ftrace_now(cpu);
 		stop_set++;
 		start = per_cpu(hist_irqsoff_start, cpu);