From: Kevin Cernekee <cernekee@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org,
Maksim Rayskiy <maksim.rayskiy@gmail.com>,
Kevin D. Kissell <kevink@paralogos.com>,
Sergey Shtylyov <sshtylyov@mvista.com>
Subject: [PATCH RESEND 1/9] MIPS: Add local_flush_tlb_all_mm to clear all mm contexts on calling cpu
Date: Sat, 05 Nov 2011 14:21:10 -0700 [thread overview]
Message-ID: <c2c8833593cb8eeef5c102468e105497@localhost> (raw)
From: Maksim Rayskiy <maksim.rayskiy@gmail.com>
When hotplug removing a cpu, all mm context TLB entries must be cleared
to avoid ASID conflict when cpu is restarted. New functions
local_flush_tlb_all_mm() and all-cpu version flush_tlb_all_mm() are
added. To function properly, local_flush_tlb_all_mm() must be called
when mm_cpumask for all mm context on given cpu is cleared.
Signed-off-by: Maksim Rayskiy <maksim.rayskiy@gmail.com>
Tested-by: Kevin Cernekee <cernekee@gmail.com>
---
arch/mips/include/asm/tlbflush.h | 4 ++++
arch/mips/kernel/smp.c | 10 ++++++++++
arch/mips/mm/tlb-r4k.c | 13 +++++++++++++
3 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/arch/mips/include/asm/tlbflush.h b/arch/mips/include/asm/tlbflush.h
index 86b21de..d7b75e6 100644
--- a/arch/mips/include/asm/tlbflush.h
+++ b/arch/mips/include/asm/tlbflush.h
@@ -8,12 +8,14 @@
*
* - flush_tlb_all() flushes all processes TLB entries
* - flush_tlb_mm(mm) flushes the specified mm context TLB entries
+ * - flush_tlb_all_mm() flushes all mm context TLB entries
* - flush_tlb_page(vma, vmaddr) flushes one page
* - flush_tlb_range(vma, start, end) flushes a range of pages
* - flush_tlb_kernel_range(start, end) flushes a range of kernel pages
*/
extern void local_flush_tlb_all(void);
extern void local_flush_tlb_mm(struct mm_struct *mm);
+extern void local_flush_tlb_all_mm(void);
extern void local_flush_tlb_range(struct vm_area_struct *vma,
unsigned long start, unsigned long end);
extern void local_flush_tlb_kernel_range(unsigned long start,
@@ -26,6 +28,7 @@ extern void local_flush_tlb_one(unsigned long vaddr);
extern void flush_tlb_all(void);
extern void flush_tlb_mm(struct mm_struct *);
+extern void flush_tlb_all_mm(void);
extern void flush_tlb_range(struct vm_area_struct *vma, unsigned long,
unsigned long);
extern void flush_tlb_kernel_range(unsigned long, unsigned long);
@@ -36,6 +39,7 @@ extern void flush_tlb_one(unsigned long vaddr);
#define flush_tlb_all() local_flush_tlb_all()
#define flush_tlb_mm(mm) local_flush_tlb_mm(mm)
+#define flush_tlb_all_mm() local_flush_tlb_all_mm()
#define flush_tlb_range(vma, vmaddr, end) local_flush_tlb_range(vma, vmaddr, end)
#define flush_tlb_kernel_range(vmaddr,end) \
local_flush_tlb_kernel_range(vmaddr, end)
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 32c1e95..78ca04c 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -269,6 +269,16 @@ void flush_tlb_all(void)
on_each_cpu(flush_tlb_all_ipi, NULL, 1);
}
+static void flush_tlb_all_mm_ipi(void *info)
+{
+ local_flush_tlb_all_mm();
+}
+
+void flush_tlb_all_mm(void)
+{
+ on_each_cpu(flush_tlb_all_mm_ipi, NULL, 1);
+}
+
static void flush_tlb_mm_ipi(void *mm)
{
local_flush_tlb_mm((struct mm_struct *)mm);
diff --git a/arch/mips/mm/tlb-r4k.c b/arch/mips/mm/tlb-r4k.c
index 0d394e0..908fbe9 100644
--- a/arch/mips/mm/tlb-r4k.c
+++ b/arch/mips/mm/tlb-r4k.c
@@ -66,6 +66,19 @@ extern void build_tlb_refill_handler(void);
#endif
+/* This function will clear all mm contexts on calling cpu
+ * To produce desired effect it must be called
+ * when mm_cpumask for all mm contexts is cleared
+ */
+void local_flush_tlb_all_mm(void)
+{
+ struct task_struct *p;
+
+ for_each_process(p)
+ if (p->mm)
+ local_flush_tlb_mm(p->mm);
+}
+
void local_flush_tlb_all(void)
{
unsigned long flags;
--
1.7.6.3
next reply other threads:[~2011-11-05 21:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-05 21:21 Kevin Cernekee [this message]
2011-11-05 21:21 ` [PATCH 2/9] MIPS: BMIPS: Fix up Kconfig settings Kevin Cernekee
2011-11-05 21:21 ` [PATCH 3/9] MIPS: BMIPS: Add XKS01 feature flag to Kconfig Kevin Cernekee
2011-11-08 15:49 ` Ralf Baechle
2011-11-05 21:21 ` [PATCH 4/9] MIPS: Clean up whitespace warning in hazards.h Kevin Cernekee
2011-11-05 21:21 ` [PATCH 5/9] MIPS: BMIPS: Add CFLAGS, Makefile entries for BMIPS Kevin Cernekee
2011-11-05 21:21 ` [PATCH 6/9] MIPS: BMIPS: Add set/clear CP0 macros for BMIPS operations Kevin Cernekee
2011-11-05 21:21 ` [PATCH 7/9] MIPS: BMIPS: Introduce bmips.h Kevin Cernekee
2011-11-08 15:03 ` Ralf Baechle
2011-11-05 21:21 ` [PATCH 8/9] MIPS: Add board_* hooks for ebase and NMI Kevin Cernekee
2011-11-08 15:23 ` Ralf Baechle
2011-11-05 21:21 ` [PATCH 9/9] MIPS: BMIPS: Add SMP support code for BMIPS43xx/BMIPS5000 Kevin Cernekee
2011-11-08 15:56 ` Ralf Baechle
2011-11-08 16:47 ` [PATCH RESEND 1/9] MIPS: Add local_flush_tlb_all_mm to clear all mm contexts on calling cpu Ralf Baechle
2011-11-08 19:40 ` Kevin Cernekee
2011-11-09 5:33 ` Kevin Cernekee
2011-11-09 13:11 ` Ralf Baechle
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=c2c8833593cb8eeef5c102468e105497@localhost \
--to=cernekee@gmail.com \
--cc=kevink@paralogos.com \
--cc=linux-mips@linux-mips.org \
--cc=maksim.rayskiy@gmail.com \
--cc=ralf@linux-mips.org \
--cc=sshtylyov@mvista.com \
/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