* [PATCH] parisc: Purge existing TLB entries in set_pte_at and ptep_set_wrprotect - take 2
@ 2013-01-15 0:45 John David Anglin
2013-01-15 9:05 ` James Bottomley
0 siblings, 1 reply; 4+ messages in thread
From: John David Anglin @ 2013-01-15 0:45 UTC (permalink / raw)
To: linux-parisc List; +Cc: Helge Deller, James E.J. Bottomley
[-- Attachment #1: Type: text/plain, Size: 206 bytes --]
Attached is new version of patch which no longer saves and restores
%sr1. Lightly tested with a GCC build
and a build of Debian gtk+3.0 package.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
[-- Attachment #2: purge_tlb.d.1.txt --]
[-- Type: text/plain, Size: 2286 bytes --]
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index ee99f23..2c6dedb 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -12,11 +12,10 @@
#include <linux/bitops.h>
#include <linux/spinlock.h>
+#include <linux/mm_types.h>
#include <asm/processor.h>
#include <asm/cache.h>
-struct vm_area_struct;
-
/*
* kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
* memory. For the return value to be meaningful, ADDR must be >=
@@ -40,7 +39,14 @@ struct vm_area_struct;
do{ \
*(pteptr) = (pteval); \
} while(0)
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+
+extern void purge_tlb_entries(struct mm_struct *, unsigned long);
+
+#define set_pte_at(mm,addr,ptep, pteval) \
+ do{ \
+ set_pte(ptep,pteval); \
+ purge_tlb_entries(mm,addr); \
+ } while(0)
#endif /* !__ASSEMBLY__ */
@@ -466,6 +472,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
old = pte_val(*ptep);
new = pte_val(pte_wrprotect(__pte (old)));
} while (cmpxchg((unsigned long *) ptep, old, new) != old);
+ purge_tlb_entries(mm, addr);
#else
pte_t old_pte = *ptep;
set_pte_at(mm, addr, ptep, pte_wrprotect(old_pte));
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index 48e16dc..1524fd8 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -419,6 +419,24 @@ void kunmap_parisc(void *addr)
EXPORT_SYMBOL(kunmap_parisc);
#endif
+void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
+{
+ unsigned long flags;
+
+ /* Note: purge_tlb_entries can be called at startup with
+ no context. */
+
+ /* Disable preemption while we play with %sr1. */
+ preempt_disable();
+ mtsp(mm->context,1);
+ purge_tlb_start(flags);
+ pdtlb(addr);
+ pitlb(addr);
+ purge_tlb_end(flags);
+ preempt_enable();
+}
+EXPORT_SYMBOL(purge_tlb_entries);
+
void __flush_tlb_range(unsigned long sid, unsigned long start,
unsigned long end)
{
[-- Attachment #3: Type: text/plain, Size: 51 bytes --]
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] parisc: Purge existing TLB entries in set_pte_at and ptep_set_wrprotect - take 2
2013-01-15 0:45 [PATCH] parisc: Purge existing TLB entries in set_pte_at and ptep_set_wrprotect - take 2 John David Anglin
@ 2013-01-15 9:05 ` James Bottomley
2013-01-16 21:44 ` Rolf Eike Beer
0 siblings, 1 reply; 4+ messages in thread
From: James Bottomley @ 2013-01-15 9:05 UTC (permalink / raw)
To: John David Anglin; +Cc: linux-parisc List, Helge Deller
On Mon, 2013-01-14 at 19:45 -0500, John David Anglin wrote:
> Attached is new version of patch which no longer saves and restores
> %sr1. Lightly tested with a GCC build
> and a build of Debian gtk+3.0 package.
I can merge it with your previous changelog, but for ease of git users,
the accepted format is
<patch description for git>
---
<Any other details you don't want in git>
git ignores everything after the three dashes on a single line.
So your preamble should be (I also added an explanation of why we think
the problem is occurring):
This patch goes a long way toward fixing the minifail bug, and
it significantly improves the stability of SMP machines such as
the rp3440. When write protecting a page for COW, we need to
purge the existing translation. Otherwise, the COW break
doesn't occur as expected because the TLB may still have a stale entry
which allows writes.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
---
v2: Attached is new version of patch which no longer saves and
restores %sr1. Lightly tested with a GCC build and a build of
Debian gtk+3.0 package.
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] parisc: Purge existing TLB entries in set_pte_at and ptep_set_wrprotect - take 2
2013-01-15 9:05 ` James Bottomley
@ 2013-01-16 21:44 ` Rolf Eike Beer
2013-01-16 22:18 ` Helge Deller
0 siblings, 1 reply; 4+ messages in thread
From: Rolf Eike Beer @ 2013-01-16 21:44 UTC (permalink / raw)
To: James Bottomley; +Cc: John David Anglin, linux-parisc List, Helge Deller
[-- Attachment #1: Type: text/plain, Size: 557 bytes --]
James Bottomley wrote:
> On Mon, 2013-01-14 at 19:45 -0500, John David Anglin wrote:
> > Attached is new version of patch which no longer saves and restores
> > %sr1. Lightly tested with a GCC build
> > and a build of Debian gtk+3.0 package.
>
> I can merge it with your previous changelog, but for ease of git users,
> the accepted format is
> v2: Attached is new version of patch which no longer saves and
> restores %sr1. Lightly tested with a GCC build and a build of
> Debian gtk+3.0 package.
Do we want that to go back into stable kernels?
Eike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] parisc: Purge existing TLB entries in set_pte_at and ptep_set_wrprotect - take 2
2013-01-16 21:44 ` Rolf Eike Beer
@ 2013-01-16 22:18 ` Helge Deller
0 siblings, 0 replies; 4+ messages in thread
From: Helge Deller @ 2013-01-16 22:18 UTC (permalink / raw)
To: Rolf Eike Beer; +Cc: James Bottomley, John David Anglin, linux-parisc List
Hi Rolf,
On 01/16/2013 10:44 PM, Rolf Eike Beer wrote:
> James Bottomley wrote:
>> On Mon, 2013-01-14 at 19:45 -0500, John David Anglin wrote:
>>> Attached is new version of patch which no longer saves and restores
>>> %sr1. Lightly tested with a GCC build
>>> and a build of Debian gtk+3.0 package.
>>
>> I can merge it with your previous changelog, but for ease of git users,
>> the accepted format is
>
>> v2: Attached is new version of patch which no longer saves and
>> restores %sr1. Lightly tested with a GCC build and a build of
>> Debian gtk+3.0 package.
>
> Do we want that to go back into stable kernels?
Short answer: Yes.
Long answer:
First we need those patches upstream - which is what did not happened yet.
Then I wanted to take a look what we can send to stable.
Helge
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-01-16 22:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 0:45 [PATCH] parisc: Purge existing TLB entries in set_pte_at and ptep_set_wrprotect - take 2 John David Anglin
2013-01-15 9:05 ` James Bottomley
2013-01-16 21:44 ` Rolf Eike Beer
2013-01-16 22:18 ` Helge Deller
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.