diff options
author | Christopher Kenna <cjk@cs.unc.edu> | 2012-12-04 14:53:13 -0500 |
---|---|---|
committer | Christopher Kenna <cjk@cs.unc.edu> | 2012-12-04 14:56:57 -0500 |
commit | cf1644594e8faa0f8bb4cd8656fc01e27f4e6e8e (patch) | |
tree | 368d31ff7d0836cbf1293c7523d775c3ff2d4748 /litmus | |
parent | b79beb1d09d98d8f8606e9bba40880d32f744265 (diff) |
Remove the uncached-control page code.
Diffstat (limited to 'litmus')
-rw-r--r-- | litmus/ctrldev.c | 86 | ||||
-rw-r--r-- | litmus/litmus.c | 15 |
2 files changed, 0 insertions, 101 deletions
diff --git a/litmus/ctrldev.c b/litmus/ctrldev.c index 1d19e208ecd4..65d36b92d952 100644 --- a/litmus/ctrldev.c +++ b/litmus/ctrldev.c | |||
@@ -19,20 +19,12 @@ static struct workqueue_struct *wq_litmus_dealloc; | |||
19 | struct litmus_dealloc_work { | 19 | struct litmus_dealloc_work { |
20 | struct work_struct work_struct; | 20 | struct work_struct work_struct; |
21 | void *ctrl_page_mem; | 21 | void *ctrl_page_mem; |
22 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
23 | void *ctrl_page_unmap; | ||
24 | #endif | ||
25 | }; | 22 | }; |
26 | 23 | ||
27 | static void litmus_dealloc(struct work_struct *work_in) | 24 | static void litmus_dealloc(struct work_struct *work_in) |
28 | { | 25 | { |
29 | struct litmus_dealloc_work *work = container_of(work_in, | 26 | struct litmus_dealloc_work *work = container_of(work_in, |
30 | struct litmus_dealloc_work, work_struct); | 27 | struct litmus_dealloc_work, work_struct); |
31 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
32 | TRACE("vunmap() control page %p.\n", work->ctrl_page_unmap); | ||
33 | vunmap(work->ctrl_page_unmap); | ||
34 | |||
35 | #endif | ||
36 | TRACE("freeing ctrl_page %p\n", work->ctrl_page_mem); | 28 | TRACE("freeing ctrl_page %p\n", work->ctrl_page_mem); |
37 | free_page((unsigned long) work->ctrl_page_mem); | 29 | free_page((unsigned long) work->ctrl_page_mem); |
38 | 30 | ||
@@ -54,70 +46,14 @@ void litmus_schedule_deallocation(struct task_struct *t) | |||
54 | 46 | ||
55 | INIT_WORK(&work->work_struct, litmus_dealloc); | 47 | INIT_WORK(&work->work_struct, litmus_dealloc); |
56 | 48 | ||
57 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
58 | work->ctrl_page_mem = tsk_rt(t)->ctrl_page_orig; | ||
59 | work->ctrl_page_unmap = tsk_rt(t)->ctrl_page; | ||
60 | #else | ||
61 | work->ctrl_page_mem = tsk_rt(t)->ctrl_page; | 49 | work->ctrl_page_mem = tsk_rt(t)->ctrl_page; |
62 | #endif | ||
63 | queue_work(wq_litmus_dealloc, &work->work_struct); | 50 | queue_work(wq_litmus_dealloc, &work->work_struct); |
64 | } | 51 | } |
65 | 52 | ||
66 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
67 | /* | ||
68 | * remap_noncached - creates a non-cached memory "shadow mapping" | ||
69 | * @addr: memory base virtual address | ||
70 | * @len: length to remap | ||
71 | * | ||
72 | * The caller should vunmap(addr) when the mapping is no longer needed. | ||
73 | * The caller should also save the original @addr to free it later. | ||
74 | */ | ||
75 | void * remap_noncached(void *addr, size_t len) | ||
76 | { | ||
77 | void *vaddr; | ||
78 | int nr_pages = DIV_ROUND_UP(offset_in_page(addr) + len, PAGE_SIZE); | ||
79 | struct page **pages = kmalloc(nr_pages * sizeof(*pages), GFP_KERNEL); | ||
80 | void *page_addr = (void *)((unsigned long)addr & PAGE_MASK); | ||
81 | int i; | ||
82 | |||
83 | if (NULL == pages) { | ||
84 | TRACE_CUR("No memory!\n"); | ||
85 | return ERR_PTR(-ENOMEM); | ||
86 | } | ||
87 | |||
88 | for (i = 0; i < nr_pages; i++) { | ||
89 | if (is_vmalloc_or_module_addr(page_addr)) { | ||
90 | kfree(pages); | ||
91 | TRACE_CUR("Remapping vmalloc or module memory?\n"); | ||
92 | return ERR_PTR(-EINVAL); | ||
93 | } | ||
94 | |||
95 | pages[i] = virt_to_page(page_addr); | ||
96 | if (NULL == pages[i]) { | ||
97 | kfree(pages); | ||
98 | TRACE_CUR("Bad virtual address.\n"); | ||
99 | return ERR_PTR(-EINVAL); | ||
100 | } | ||
101 | page_addr += PAGE_SIZE; | ||
102 | } | ||
103 | |||
104 | vaddr = vmap(pages, nr_pages, VM_MAP, pgprot_noncached(PAGE_KERNEL)); | ||
105 | kfree(pages); | ||
106 | if (NULL == vaddr) { | ||
107 | TRACE_CUR("vmap() failed.\n"); | ||
108 | return ERR_PTR(-ENOMEM); | ||
109 | } | ||
110 | return vaddr + offset_in_page(addr); | ||
111 | } | ||
112 | #endif | ||
113 | |||
114 | /* allocate t->rt_param.ctrl_page*/ | 53 | /* allocate t->rt_param.ctrl_page*/ |
115 | static int alloc_ctrl_page(struct task_struct *t) | 54 | static int alloc_ctrl_page(struct task_struct *t) |
116 | { | 55 | { |
117 | void *mem; | 56 | void *mem; |
118 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
119 | void *mem_remap; | ||
120 | #endif | ||
121 | int err = 0; | 57 | int err = 0; |
122 | 58 | ||
123 | /* only allocate if the task doesn't have one yet */ | 59 | /* only allocate if the task doesn't have one yet */ |
@@ -128,20 +64,7 @@ static int alloc_ctrl_page(struct task_struct *t) | |||
128 | goto out; | 64 | goto out; |
129 | } | 65 | } |
130 | 66 | ||
131 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
132 | mem_remap = remap_noncached(mem, PAGE_SIZE); | ||
133 | if (IS_ERR(mem_remap)) { | ||
134 | err = PTR_ERR(mem_remap); | ||
135 | free_page((unsigned long) mem); | ||
136 | goto out; | ||
137 | } | ||
138 | tsk_rt(t)->ctrl_page_orig = mem; | ||
139 | tsk_rt(t)->ctrl_page = mem_remap; | ||
140 | TRACE_TASK(t, "ctrl_page_orig = %p\n", | ||
141 | tsk_rt(t)->ctrl_page_orig); | ||
142 | #else | ||
143 | tsk_rt(t)->ctrl_page = mem; | 67 | tsk_rt(t)->ctrl_page = mem; |
144 | #endif | ||
145 | 68 | ||
146 | /* will get de-allocated in task teardown */ | 69 | /* will get de-allocated in task teardown */ |
147 | TRACE_TASK(t, "%s ctrl_page = %p\n", __FUNCTION__, | 70 | TRACE_TASK(t, "%s ctrl_page = %p\n", __FUNCTION__, |
@@ -156,12 +79,7 @@ static int map_ctrl_page(struct task_struct *t, struct vm_area_struct* vma) | |||
156 | struct page *ctrl; | 79 | struct page *ctrl; |
157 | int err; | 80 | int err; |
158 | 81 | ||
159 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
160 | /* vm_insert_page() using the "real" vaddr, not the shadow mapping. */ | ||
161 | ctrl = virt_to_page(tsk_rt(t)->ctrl_page_orig); | ||
162 | #else | ||
163 | ctrl = virt_to_page(tsk_rt(t)->ctrl_page); | 82 | ctrl = virt_to_page(tsk_rt(t)->ctrl_page); |
164 | #endif | ||
165 | 83 | ||
166 | TRACE_CUR(CTRL_NAME | 84 | TRACE_CUR(CTRL_NAME |
167 | ": mapping %p (pfn:%lx) to 0x%lx (prot:%lx)\n", | 85 | ": mapping %p (pfn:%lx) to 0x%lx (prot:%lx)\n", |
@@ -234,11 +152,7 @@ static int litmus_ctrl_mmap(struct file* filp, struct vm_area_struct* vma) | |||
234 | * don't care if it was touched or not. __S011 means RW access, but not | 152 | * don't care if it was touched or not. __S011 means RW access, but not |
235 | * execute, and avoids copy-on-write behavior. | 153 | * execute, and avoids copy-on-write behavior. |
236 | * See protection_map in mmap.c. */ | 154 | * See protection_map in mmap.c. */ |
237 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
238 | vma->vm_page_prot = pgprot_noncached(__S011); | ||
239 | #else | ||
240 | vma->vm_page_prot = __S011; | 155 | vma->vm_page_prot = __S011; |
241 | #endif | ||
242 | 156 | ||
243 | err = alloc_ctrl_page(current); | 157 | err = alloc_ctrl_page(current); |
244 | if (!err) | 158 | if (!err) |
diff --git a/litmus/litmus.c b/litmus/litmus.c index 23c09a2e58b0..3de9252b3223 100644 --- a/litmus/litmus.c +++ b/litmus/litmus.c | |||
@@ -391,9 +391,6 @@ static void reinit_litmus_state(struct task_struct* p, int restore) | |||
391 | struct rt_task user_config = {}; | 391 | struct rt_task user_config = {}; |
392 | void* ctrl_page = NULL; | 392 | void* ctrl_page = NULL; |
393 | struct list_head color_page_info_list; | 393 | struct list_head color_page_info_list; |
394 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
395 | void * ctrl_page_orig = NULL; | ||
396 | #endif | ||
397 | 394 | ||
398 | TRACE_CUR("restore: %d\n", restore); | 395 | TRACE_CUR("restore: %d\n", restore); |
399 | 396 | ||
@@ -402,9 +399,6 @@ static void reinit_litmus_state(struct task_struct* p, int restore) | |||
402 | * and allocated page. */ | 399 | * and allocated page. */ |
403 | user_config = p->rt_param.task_params; | 400 | user_config = p->rt_param.task_params; |
404 | ctrl_page = p->rt_param.ctrl_page; | 401 | ctrl_page = p->rt_param.ctrl_page; |
405 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
406 | ctrl_page_orig = p->rt_param.ctrl_page_orig; | ||
407 | #endif | ||
408 | color_page_info_list.next = | 402 | color_page_info_list.next = |
409 | p->rt_param.color_page_info_list.next; | 403 | p->rt_param.color_page_info_list.next; |
410 | color_page_info_list.prev = | 404 | color_page_info_list.prev = |
@@ -424,9 +418,6 @@ static void reinit_litmus_state(struct task_struct* p, int restore) | |||
424 | if (restore) { | 418 | if (restore) { |
425 | p->rt_param.task_params = user_config; | 419 | p->rt_param.task_params = user_config; |
426 | p->rt_param.ctrl_page = ctrl_page; | 420 | p->rt_param.ctrl_page = ctrl_page; |
427 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
428 | p->rt_param.ctrl_page_orig = ctrl_page_orig; | ||
429 | #endif | ||
430 | p->rt_param.color_page_info_list.next = | 421 | p->rt_param.color_page_info_list.next = |
431 | color_page_info_list.next; | 422 | color_page_info_list.next; |
432 | p->rt_param.color_page_info_list.prev = | 423 | p->rt_param.color_page_info_list.prev = |
@@ -579,9 +570,6 @@ void litmus_fork(struct task_struct* p) | |||
579 | } else { | 570 | } else { |
580 | /* non-rt tasks might have ctrl_page set */ | 571 | /* non-rt tasks might have ctrl_page set */ |
581 | tsk_rt(p)->ctrl_page = NULL; | 572 | tsk_rt(p)->ctrl_page = NULL; |
582 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
583 | tsk_rt(p)->ctrl_page_orig = NULL; | ||
584 | #endif | ||
585 | } | 573 | } |
586 | 574 | ||
587 | /* od tables are never inherited across a fork */ | 575 | /* od tables are never inherited across a fork */ |
@@ -600,9 +588,6 @@ void litmus_exec(void) | |||
600 | WARN_ON(p->rt_param.inh_task); | 588 | WARN_ON(p->rt_param.inh_task); |
601 | litmus_schedule_deallocation(p); | 589 | litmus_schedule_deallocation(p); |
602 | tsk_rt(p)->ctrl_page = NULL; | 590 | tsk_rt(p)->ctrl_page = NULL; |
603 | #ifdef CONFIG_ARCH_NEEDS_UNCACHED_CONTROL_PAGE | ||
604 | tsk_rt(p)->ctrl_page_orig = NULL; | ||
605 | #endif | ||
606 | } | 591 | } |
607 | } | 592 | } |
608 | 593 | ||