aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/mm/migrate_32.S
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2012-03-27 15:40:20 -0400
committerChris Metcalf <cmetcalf@tilera.com>2012-05-25 12:48:20 -0400
commit51007004f44c9588d70ffb77e1f52479bd5b0e37 (patch)
treeddf8dd2f83554ecbe9de0c690cfab3889308397b /arch/tile/mm/migrate_32.S
parent76e10d158efb6d4516018846f60c2ab5501900bc (diff)
arch/tile: use interrupt critical sections less
In general we want to avoid ever touching memory while within an interrupt critical section, since the page fault path goes through a different path from the hypervisor when in an interrupt critical section, and we carefully decided with tilegx that we didn't need to support this path in the kernel. (On tilepro we did implement that path as part of supporting atomic instructions in software.) In practice we always need to touch the kernel stack, since that's where we store the interrupt state before releasing the critical section, but this change cleans up a few things. The IRQ_ENABLE macro is split up so that when we want to enable interrupts in a deferred way (e.g. for cpu_idle or for interrupt return) we can read the per-cpu enable mask before entering the critical section. The cache-migration code is changed to use interrupt masking instead of interrupt critical sections. And, the interrupt-entry code is changed so that we defer loading "tp" from per-cpu data until after we have released the interrupt critical section. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile/mm/migrate_32.S')
-rw-r--r--arch/tile/mm/migrate_32.S36
1 files changed, 8 insertions, 28 deletions
diff --git a/arch/tile/mm/migrate_32.S b/arch/tile/mm/migrate_32.S
index ac01a7cdf77f..5305814bf187 100644
--- a/arch/tile/mm/migrate_32.S
+++ b/arch/tile/mm/migrate_32.S
@@ -40,8 +40,7 @@
40#define FRAME_R32 16 40#define FRAME_R32 16
41#define FRAME_R33 20 41#define FRAME_R33 20
42#define FRAME_R34 24 42#define FRAME_R34 24
43#define FRAME_R35 28 43#define FRAME_SIZE 28
44#define FRAME_SIZE 32
45 44
46 45
47 46
@@ -66,12 +65,11 @@
66#define r_my_cpumask r5 65#define r_my_cpumask r5
67 66
68/* Locals (callee-save); must not be more than FRAME_xxx above. */ 67/* Locals (callee-save); must not be more than FRAME_xxx above. */
69#define r_save_ics r30 68#define r_context_lo r30
70#define r_context_lo r31 69#define r_context_hi r31
71#define r_context_hi r32 70#define r_access_lo r32
72#define r_access_lo r33 71#define r_access_hi r33
73#define r_access_hi r34 72#define r_asid r34
74#define r_asid r35
75 73
76STD_ENTRY(flush_and_install_context) 74STD_ENTRY(flush_and_install_context)
77 /* 75 /*
@@ -104,11 +102,7 @@ STD_ENTRY(flush_and_install_context)
104 sw r_tmp, r33 102 sw r_tmp, r33
105 addi r_tmp, sp, FRAME_R34 103 addi r_tmp, sp, FRAME_R34
106 } 104 }
107 { 105 sw r_tmp, r34
108 sw r_tmp, r34
109 addi r_tmp, sp, FRAME_R35
110 }
111 sw r_tmp, r35
112 106
113 /* Move some arguments to callee-save registers. */ 107 /* Move some arguments to callee-save registers. */
114 { 108 {
@@ -121,13 +115,6 @@ STD_ENTRY(flush_and_install_context)
121 } 115 }
122 move r_asid, r_asid_in 116 move r_asid, r_asid_in
123 117
124 /* Disable interrupts, since we can't use our stack. */
125 {
126 mfspr r_save_ics, INTERRUPT_CRITICAL_SECTION
127 movei r_tmp, 1
128 }
129 mtspr INTERRUPT_CRITICAL_SECTION, r_tmp
130
131 /* First, flush our L2 cache. */ 118 /* First, flush our L2 cache. */
132 { 119 {
133 move r0, zero /* cache_pa */ 120 move r0, zero /* cache_pa */
@@ -163,7 +150,7 @@ STD_ENTRY(flush_and_install_context)
163 } 150 }
164 { 151 {
165 move r4, r_asid 152 move r4, r_asid
166 movei r5, HV_CTX_DIRECTIO 153 moveli r5, HV_CTX_DIRECTIO | CTX_PAGE_FLAG
167 } 154 }
168 jal hv_install_context 155 jal hv_install_context
169 bnz r0, .Ldone 156 bnz r0, .Ldone
@@ -175,9 +162,6 @@ STD_ENTRY(flush_and_install_context)
175 } 162 }
176 163
177.Ldone: 164.Ldone:
178 /* Reset interrupts back how they were before. */
179 mtspr INTERRUPT_CRITICAL_SECTION, r_save_ics
180
181 /* Restore the callee-saved registers and return. */ 165 /* Restore the callee-saved registers and return. */
182 addli lr, sp, FRAME_SIZE 166 addli lr, sp, FRAME_SIZE
183 { 167 {
@@ -202,10 +186,6 @@ STD_ENTRY(flush_and_install_context)
202 } 186 }
203 { 187 {
204 lw r34, r_tmp 188 lw r34, r_tmp
205 addli r_tmp, sp, FRAME_R35
206 }
207 {
208 lw r35, r_tmp
209 addi sp, sp, FRAME_SIZE 189 addi sp, sp, FRAME_SIZE
210 } 190 }
211 jrp lr 191 jrp lr