| .. | .. |
|---|
| 38 | 38 | #include <linux/io.h> |
|---|
| 39 | 39 | #include <linux/kdebug.h> |
|---|
| 40 | 40 | #include <linux/syscalls.h> |
|---|
| 41 | +#include <linux/highmem.h> |
|---|
| 41 | 42 | |
|---|
| 42 | 43 | #include <asm/pgtable.h> |
|---|
| 43 | 44 | #include <asm/ldt.h> |
|---|
| .. | .. |
|---|
| 205 | 206 | } |
|---|
| 206 | 207 | EXPORT_SYMBOL_GPL(start_thread); |
|---|
| 207 | 208 | |
|---|
| 209 | +#ifdef CONFIG_PREEMPT_RT_FULL |
|---|
| 210 | +static void switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p) |
|---|
| 211 | +{ |
|---|
| 212 | + int i; |
|---|
| 213 | + |
|---|
| 214 | + /* |
|---|
| 215 | + * Clear @prev's kmap_atomic mappings |
|---|
| 216 | + */ |
|---|
| 217 | + for (i = 0; i < prev_p->kmap_idx; i++) { |
|---|
| 218 | + int idx = i + KM_TYPE_NR * smp_processor_id(); |
|---|
| 219 | + pte_t *ptep = kmap_pte - idx; |
|---|
| 220 | + |
|---|
| 221 | + kpte_clear_flush(ptep, __fix_to_virt(FIX_KMAP_BEGIN + idx)); |
|---|
| 222 | + } |
|---|
| 223 | + /* |
|---|
| 224 | + * Restore @next_p's kmap_atomic mappings |
|---|
| 225 | + */ |
|---|
| 226 | + for (i = 0; i < next_p->kmap_idx; i++) { |
|---|
| 227 | + int idx = i + KM_TYPE_NR * smp_processor_id(); |
|---|
| 228 | + |
|---|
| 229 | + if (!pte_none(next_p->kmap_pte[i])) |
|---|
| 230 | + set_pte(kmap_pte - idx, next_p->kmap_pte[i]); |
|---|
| 231 | + } |
|---|
| 232 | +} |
|---|
| 233 | +#else |
|---|
| 234 | +static inline void |
|---|
| 235 | +switch_kmaps(struct task_struct *prev_p, struct task_struct *next_p) { } |
|---|
| 236 | +#endif |
|---|
| 237 | + |
|---|
| 208 | 238 | |
|---|
| 209 | 239 | /* |
|---|
| 210 | 240 | * switch_to(x,y) should switch tasks from x to y. |
|---|
| .. | .. |
|---|
| 274 | 304 | |
|---|
| 275 | 305 | switch_to_extra(prev_p, next_p); |
|---|
| 276 | 306 | |
|---|
| 307 | + switch_kmaps(prev_p, next_p); |
|---|
| 308 | + |
|---|
| 277 | 309 | /* |
|---|
| 278 | 310 | * Leave lazy mode, flushing any hypercalls made here. |
|---|
| 279 | 311 | * This must be done before restoring TLS segments so |
|---|