mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>, Carsten Emde <cbe@osadl.org>
Subject: [patch-rt 1/5] commit 42ef73fe134732b2e91c0326df5fd568da17c4b2 Author: Peter Zijlstra <peterz@infradead.org> Date: Fri Jan 23 17:37:49 2009 +0100
Date: Fri, 30 Jan 2009 11:43:28 -0000	[thread overview]
Message-ID: <20090130114306.687072457@linutronix.de> (raw)
In-Reply-To: <20090130114230.100052140@linutronix.de>

[-- Attachment #1: x86-mm-fix-pte-free.patch --]
[-- Type: text/plain, Size: 2451 bytes --]

    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 <a.p.zijlsta@chello.nl>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
    Cc: <stable@kernel.org>

---
 include/asm-x86/pgalloc.h |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6.26.8/include/asm-x86/pgalloc.h
===================================================================
--- linux-2.6.26.8.orig/include/asm-x86/pgalloc.h
+++ 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);
 }
 



  reply	other threads:[~2009-01-30 11:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-30 11:43 [patch-rt 0/5] more 2.6.26-rt updates Thomas Gleixner
2009-01-30 11:43 ` Thomas Gleixner [this message]
2009-01-30 11:43 ` [patch-rt 2/5] commit 6626bff24578753808c8b5bd4f1619e14e980f0f Author: Thomas Gleixner <tglx@linutronix.de> Date: Sun Jan 25 11:31:36 2009 +0100 Thomas Gleixner
2009-01-30 11:43 ` [patch-rt 3/5] trace: fix typo in kernel/trace/Kconfig Thomas Gleixner
2009-01-30 11:43 ` [patch-rt 4/5] x86: remove redundant local_irq_enable() in handle_signal() Thomas Gleixner
2009-01-30 11:43 ` [patch-rt 5/5] trace: warn if irqs already enabled in irqs_off latency check Thomas Gleixner

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=20090130114306.687072457@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=cbe@osadl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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

Powered by JetHome