aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Spliet <rspliet@mpi-sws.org>2013-11-28 12:15:16 -0500
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-11-30 03:01:55 -0500
commit5b50be03ba9b9515e24924cc07f8c58d9baa0960 (patch)
tree85314c651504982da7d539d253ddd9692046c6ae
parent1c37b770a1898b1d95468aee69c443cfc04d21e1 (diff)
litmus/ctrldev: Fix stale readouts on ARMv7
For ARMv7 __S011 only declares the access bits, not the caching policy. As a result the userspace mapping would bypass the cache, causing the kernel to occasionally read stale entries from the cache. Switch to using PAGE_SHARED instead, which assumes correct caching defaults. [With kind assistance by Alexander Zuepke <alexander.zuepke@hs-rm.de>, who pointed out the correct direction to look for the caching bug.] Signed-off-by: Roy Spliet <rspliet@mpi-sws.org>
-rw-r--r--litmus/ctrldev.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/litmus/ctrldev.c b/litmus/ctrldev.c
index 3e2ac2b3fbe8..877f2786b4c8 100644
--- a/litmus/ctrldev.c
+++ b/litmus/ctrldev.c
@@ -97,14 +97,14 @@ static int litmus_ctrl_mmap(struct file* filp, struct vm_area_struct* vma)
97 vma->vm_ops = &litmus_ctrl_vm_ops; 97 vma->vm_ops = &litmus_ctrl_vm_ops;
98 /* This mapping should not be kept across forks, 98 /* This mapping should not be kept across forks,
99 * cannot be expanded, and is not a "normal" page. */ 99 * cannot be expanded, and is not a "normal" page. */
100 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_IO; 100 vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND | VM_READ | VM_WRITE;
101 101
102 /* We don't want the first write access to trigger a "minor" page fault 102 /* We don't want the first write access to trigger a "minor" page fault
103 * to mark the page as dirty. This is transient, private memory, we 103 * to mark the page as dirty. This is transient, private memory, we
104 * don't care if it was touched or not. __S011 means RW access, but not 104 * don't care if it was touched or not. PAGE_SHARED means RW access, but
105 * execute, and avoids copy-on-write behavior. 105 * not execute, and avoids copy-on-write behavior.
106 * See protection_map in mmap.c. */ 106 * See protection_map in mmap.c. */
107 vma->vm_page_prot = __S011; 107 vma->vm_page_prot = PAGE_SHARED;
108 108
109 err = alloc_ctrl_page(current); 109 err = alloc_ctrl_page(current);
110 if (!err) 110 if (!err)