All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Helge Deller <deller@gmx.de>, Kyle McMartin <kyle@mcmartin.ca>
Subject: [patch 11/28] parisc: ensure broadcast tlb purge runs single threaded
Date: Thu, 13 Aug 2009 12:40:32 -0700	[thread overview]
Message-ID: <20090813194337.032252122@mini.kroah.org> (raw)
In-Reply-To: <20090813194554.GA13947@kroah.com>

[-- Attachment #1: parisc-ensure-broadcast-tlb-purge-runs-single-threaded.patch --]
[-- Type: text/plain, Size: 4944 bytes --]

2.6.27-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Helge Deller <deller@gmx.de>

commit e82a3b75127188f20c7780bec580e148beb29da7 upstream

parisc: ensure broadcast tlb purge runs single threaded
The TLB flushing functions on hppa, which causes PxTLB broadcasts on the system
bus, needs to be protected by irq-safe spinlocks to avoid irq handlers to deadlock
the kernel. The deadlocks only happened during I/O intensive loads and triggered
pretty seldom, which is why this bug went so long unnoticed.

Signed-off-by: Helge Deller <deller@gmx.de>
[edited to use spin_lock_irqsave on UP as well since we'd been locking there
  all this time anyway, --kyle]
Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/parisc/kernel/cache.c    |   23 +++++++++++++++--------
 arch/parisc/kernel/pci-dma.c  |   12 ++++++++----
 include/asm-parisc/tlbflush.h |   13 ++++++-------
 3 files changed, 29 insertions(+), 19 deletions(-)

--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -398,12 +398,13 @@ EXPORT_SYMBOL(flush_kernel_icache_range_
 
 void clear_user_page_asm(void *page, unsigned long vaddr)
 {
+	unsigned long flags;
 	/* This function is implemented in assembly in pacache.S */
 	extern void __clear_user_page_asm(void *page, unsigned long vaddr);
 
-	purge_tlb_start();
+	purge_tlb_start(flags);
 	__clear_user_page_asm(page, vaddr);
-	purge_tlb_end();
+	purge_tlb_end(flags);
 }
 
 #define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
@@ -444,20 +445,24 @@ extern void clear_user_page_asm(void *pa
 
 void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
 {
+	unsigned long flags;
+
 	purge_kernel_dcache_page((unsigned long)page);
-	purge_tlb_start();
+	purge_tlb_start(flags);
 	pdtlb_kernel(page);
-	purge_tlb_end();
+	purge_tlb_end(flags);
 	clear_user_page_asm(page, vaddr);
 }
 EXPORT_SYMBOL(clear_user_page);
 
 void flush_kernel_dcache_page_addr(void *addr)
 {
+	unsigned long flags;
+
 	flush_kernel_dcache_page_asm(addr);
-	purge_tlb_start();
+	purge_tlb_start(flags);
 	pdtlb_kernel(addr);
-	purge_tlb_end();
+	purge_tlb_end(flags);
 }
 EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
 
@@ -490,8 +495,10 @@ void __flush_tlb_range(unsigned long sid
 	if (npages >= 512)  /* 2MB of space: arbitrary, should be tuned */
 		flush_tlb_all();
 	else {
+		unsigned long flags;
+
 		mtsp(sid, 1);
-		purge_tlb_start();
+		purge_tlb_start(flags);
 		if (split_tlb) {
 			while (npages--) {
 				pdtlb(start);
@@ -504,7 +511,7 @@ void __flush_tlb_range(unsigned long sid
 				start += PAGE_SIZE;
 			}
 		}
-		purge_tlb_end();
+		purge_tlb_end(flags);
 	}
 }
 
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -90,12 +90,14 @@ static inline int map_pte_uncached(pte_t
 	if (end > PMD_SIZE)
 		end = PMD_SIZE;
 	do {
+		unsigned long flags;
+
 		if (!pte_none(*pte))
 			printk(KERN_ERR "map_pte_uncached: page already exists\n");
 		set_pte(pte, __mk_pte(*paddr_ptr, PAGE_KERNEL_UNC));
-		purge_tlb_start();
+		purge_tlb_start(flags);
 		pdtlb_kernel(orig_vaddr);
-		purge_tlb_end();
+		purge_tlb_end(flags);
 		vaddr += PAGE_SIZE;
 		orig_vaddr += PAGE_SIZE;
 		(*paddr_ptr) += PAGE_SIZE;
@@ -168,11 +170,13 @@ static inline void unmap_uncached_pte(pm
 	if (end > PMD_SIZE)
 		end = PMD_SIZE;
 	do {
+		unsigned long flags;
+
 		pte_t page = *pte;
 		pte_clear(&init_mm, vaddr, pte);
-		purge_tlb_start();
+		purge_tlb_start(flags);
 		pdtlb_kernel(orig_vaddr);
-		purge_tlb_end();
+		purge_tlb_end(flags);
 		vaddr += PAGE_SIZE;
 		orig_vaddr += PAGE_SIZE;
 		pte++;
--- a/include/asm-parisc/tlbflush.h
+++ b/include/asm-parisc/tlbflush.h
@@ -12,14 +12,12 @@
  * N class systems, only one PxTLB inter processor broadcast can be
  * active at any one time on the Merced bus.  This tlb purge
  * synchronisation is fairly lightweight and harmless so we activate
- * it on all SMP systems not just the N class.  We also need to have
- * preemption disabled on uniprocessor machines, and spin_lock does that
- * nicely.
+ * it on all systems not just the N class.
  */
 extern spinlock_t pa_tlb_lock;
 
-#define purge_tlb_start(x) spin_lock(&pa_tlb_lock)
-#define purge_tlb_end(x) spin_unlock(&pa_tlb_lock)
+#define purge_tlb_start(flags)	spin_lock_irqsave(&pa_tlb_lock, flags)
+#define purge_tlb_end(flags)	spin_unlock_irqrestore(&pa_tlb_lock, flags)
 
 extern void flush_tlb_all(void);
 extern void flush_tlb_all_local(void *);
@@ -63,14 +61,15 @@ static inline void flush_tlb_mm(struct m
 static inline void flush_tlb_page(struct vm_area_struct *vma,
 	unsigned long addr)
 {
+	unsigned long flags;
 	/* For one page, it's not worth testing the split_tlb variable */
 
 	mb();
 	mtsp(vma->vm_mm->context,1);
-	purge_tlb_start();
+	purge_tlb_start(flags);
 	pdtlb(addr);
 	pitlb(addr);
-	purge_tlb_end();
+	purge_tlb_end(flags);
 }
 
 void __flush_tlb_range(unsigned long sid,



  parent reply	other threads:[~2009-08-13 19:47 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090813194021.446758568@mini.kroah.org>
2009-08-13 19:45 ` [patch 00/28] 2.6.27.30-stable review Greg KH
2009-08-13 19:40   ` [patch 01/28] hugetlbfs: fix i_blocks accounting Greg KH
2009-08-13 19:40   ` [patch 02/28] hwmon: (smsc47m1) Differentiate between LPC47M233 and LPC47M292 Greg KH
2009-08-13 19:40   ` [patch 03/28] i2c/tsl2550: Fix lux value in dark environment Greg KH
2009-08-13 19:40   ` [patch 04/28] SCSI: libsas: reuse the original port when hotplugging phys in wide ports Greg KH
2009-08-13 19:40   ` [patch 05/28] Make SCSI SG v4 driver enabled by default and remove EXPERIMENTAL dependency, since udev depends on BSG Greg KH
2009-08-13 19:40   ` [patch 06/28] page-allocator: preserve PFN ordering when __GFP_COLD is set Greg KH
2009-08-13 19:40   ` [patch 07/28] sysfs: fix hardlink count on device_move Greg KH
2009-08-13 19:40   ` [patch 08/28] thinkpad-acpi: disable broken bay and dock subdrivers Greg KH
2009-08-13 19:40   ` [patch 09/28] USB: storage: raise timeout in usb_stor_Bulk_max_lun Greg KH
2009-08-13 19:40   ` [patch 10/28] x86: fix assembly constraints in native_save_fl() Greg KH
2009-08-13 19:40   ` Greg KH [this message]
2009-08-13 19:40   ` [patch 12/28] ieee1394: sbp2: add support for disks >2 TB (and 16 bytes long CDBs) Greg KH
2009-08-13 19:40   ` [patch 13/28] firewire: " Greg KH
2009-08-13 19:40   ` [patch 14/28] x86: enable GART-IOMMU only after setting up protection methods Greg KH
2009-08-13 19:40   ` [patch 15/28] asix: new device ids Greg KH
2009-08-13 19:40   ` [patch 16/28] compat_ioctl: hook up compat handler for FIEMAP ioctl Greg KH
2009-08-13 19:40   ` [patch 17/28] execve: must clear current->clear_child_tid Greg KH
2009-08-13 19:40   ` [patch 18/28] flat: fix uninitialized ptr with shared libs Greg KH
2009-08-13 19:40   ` [patch 19/28] USB: devio: Properly do access_ok() checks Greg KH
2009-08-13 19:40   ` [patch 20/28] USB: ftdi_sio: add vendor and product id for Bayer glucose meter serial converter cable Greg KH
2009-08-13 19:40   ` [patch 21/28] USB: ftdi_sio: add product_id for Marvell OpenRD Base, Client Greg KH
2009-08-13 19:40   ` [patch 22/28] USB: storage: include Prolific Technology USB drive in unusual_devs list Greg KH
2009-08-13 19:40   ` [patch 23/28] USB: usbfs: fix -ENOENT error code to be -ENODEV Greg KH
2009-08-13 19:40   ` [patch 24/28] mm_for_maps: simplify, use ptrace_may_access() Greg KH
2009-08-13 19:40   ` [patch 25/28] mm_for_maps: shift down_read(mmap_sem) to the caller Greg KH
2009-08-13 19:40   ` [patch 26/28] Make sock_sendpage() use kernel_sendpage() Greg KH
2009-08-13 19:40   ` [patch 27/28] ALSA: hda - Add missing vmaster initialization for ALC269 Greg KH
2009-08-13 19:59     ` Linus Torvalds
2009-08-13 20:12       ` Greg KH
2009-08-14  6:56         ` Takashi Iwai
2009-08-14 17:14           ` Greg KH
2009-08-13 19:40   ` [patch 28/28] NFS: Fix an O_DIRECT Oops Greg KH

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=20090813194337.032252122@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=deller@gmx.de \
    --cc=kyle@mcmartin.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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 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.