diff options
author | Christopher Kenna <cjk@cs.unc.edu> | 2012-05-01 17:59:18 -0400 |
---|---|---|
committer | Christopher Kenna <cjk@cs.unc.edu> | 2012-05-01 17:59:18 -0400 |
commit | 2f50cc66b3000d1c927990c4cf7a973ee9269014 (patch) | |
tree | 11ae690042e18e44bf1284cadc6899032f3d0a36 | |
parent | fc19a148b4b286dfe80bc0e0c2cfc193e1405059 (diff) |
Add the beginings of a SPARC port. Edit page-types to work on SPARC
-rw-r--r-- | Documentation/vm/page-types.c | 71 | ||||
-rw-r--r-- | arch/sparc/Kconfig | 9 | ||||
-rw-r--r-- | include/litmus/rt_param.h | 4 | ||||
-rw-r--r-- | litmus/color.c | 78 | ||||
-rw-r--r-- | litmus/color_dev.c | 7 | ||||
-rw-r--r-- | litmus/sched_litmus.c | 4 |
6 files changed, 115 insertions, 58 deletions
diff --git a/Documentation/vm/page-types.c b/Documentation/vm/page-types.c index 7445caa26d05..fe230def50d6 100644 --- a/Documentation/vm/page-types.c +++ b/Documentation/vm/page-types.c | |||
@@ -36,6 +36,8 @@ | |||
36 | #include <sys/statfs.h> | 36 | #include <sys/statfs.h> |
37 | #include "../../include/linux/magic.h" | 37 | #include "../../include/linux/magic.h" |
38 | 38 | ||
39 | #define COLOR_MASK 0x1fULL | ||
40 | |||
39 | 41 | ||
40 | #ifndef MAX_PATH | 42 | #ifndef MAX_PATH |
41 | # define MAX_PATH 256 | 43 | # define MAX_PATH 256 |
@@ -181,13 +183,13 @@ static pid_t opt_pid; /* process to walk */ | |||
181 | 183 | ||
182 | #define MAX_ADDR_RANGES 1024 | 184 | #define MAX_ADDR_RANGES 1024 |
183 | static int nr_addr_ranges; | 185 | static int nr_addr_ranges; |
184 | static unsigned long opt_offset[MAX_ADDR_RANGES]; | 186 | static unsigned long long opt_offset[MAX_ADDR_RANGES]; |
185 | static unsigned long opt_size[MAX_ADDR_RANGES]; | 187 | static unsigned long long opt_size[MAX_ADDR_RANGES]; |
186 | 188 | ||
187 | #define MAX_VMAS 10240 | 189 | #define MAX_VMAS 10240 |
188 | static int nr_vmas; | 190 | static int nr_vmas; |
189 | static unsigned long pg_start[MAX_VMAS]; | 191 | static unsigned long long pg_start[MAX_VMAS]; |
190 | static unsigned long pg_end[MAX_VMAS]; | 192 | static unsigned long long pg_end[MAX_VMAS]; |
191 | 193 | ||
192 | #define MAX_BIT_FILTERS 64 | 194 | #define MAX_BIT_FILTERS 64 |
193 | static int nr_bit_filters; | 195 | static int nr_bit_filters; |
@@ -259,21 +261,26 @@ static int checked_open(const char *pathname, int flags) | |||
259 | return fd; | 261 | return fd; |
260 | } | 262 | } |
261 | 263 | ||
264 | #define _LARGEFILE64_SOURCE | ||
265 | |||
262 | /* | 266 | /* |
263 | * pagemap/kpageflags routines | 267 | * pagemap/kpageflags routines |
264 | */ | 268 | */ |
265 | 269 | ||
266 | static unsigned long do_u64_read(int fd, char *name, | 270 | static unsigned long do_u64_read(int fd, char *name, |
267 | uint64_t *buf, | 271 | uint64_t *buf, |
268 | unsigned long index, | 272 | unsigned long long index, |
269 | unsigned long count) | 273 | unsigned long count) |
270 | { | 274 | { |
271 | long bytes; | 275 | long bytes; |
276 | long long lseek_ret; | ||
272 | 277 | ||
273 | if (index > ULONG_MAX / 8) | 278 | if (index > ULLONG_MAX / 8) |
274 | fatal("index overflow: %lu\n", index); | 279 | fatal("index overflow: %llu\n", index); |
275 | 280 | ||
276 | if (lseek(fd, index * 8, SEEK_SET) < 0) { | 281 | |
282 | lseek_ret = lseek64(fd, index * 8, SEEK_SET); | ||
283 | if (lseek_ret < 0) { | ||
277 | perror(name); | 284 | perror(name); |
278 | exit(EXIT_FAILURE); | 285 | exit(EXIT_FAILURE); |
279 | } | 286 | } |
@@ -290,14 +297,14 @@ static unsigned long do_u64_read(int fd, char *name, | |||
290 | } | 297 | } |
291 | 298 | ||
292 | static unsigned long kpageflags_read(uint64_t *buf, | 299 | static unsigned long kpageflags_read(uint64_t *buf, |
293 | unsigned long index, | 300 | unsigned long long index, |
294 | unsigned long pages) | 301 | unsigned long pages) |
295 | { | 302 | { |
296 | return do_u64_read(kpageflags_fd, PROC_KPAGEFLAGS, buf, index, pages); | 303 | return do_u64_read(kpageflags_fd, PROC_KPAGEFLAGS, buf, index, pages); |
297 | } | 304 | } |
298 | 305 | ||
299 | static unsigned long pagemap_read(uint64_t *buf, | 306 | static unsigned long pagemap_read(uint64_t *buf, |
300 | unsigned long index, | 307 | unsigned long long index, |
301 | unsigned long pages) | 308 | unsigned long pages) |
302 | { | 309 | { |
303 | return do_u64_read(pagemap_fd, "/proc/pid/pagemap", buf, index, pages); | 310 | return do_u64_read(pagemap_fd, "/proc/pid/pagemap", buf, index, pages); |
@@ -364,7 +371,7 @@ static char *page_flag_longname(uint64_t flags) | |||
364 | */ | 371 | */ |
365 | 372 | ||
366 | static void show_page_range(unsigned long voffset, | 373 | static void show_page_range(unsigned long voffset, |
367 | unsigned long offset, uint64_t flags) | 374 | unsigned long long offset, uint64_t flags) |
368 | { | 375 | { |
369 | static uint64_t flags0; | 376 | static uint64_t flags0; |
370 | static unsigned long voff; | 377 | static unsigned long voff; |
@@ -391,11 +398,11 @@ static void show_page_range(unsigned long voffset, | |||
391 | } | 398 | } |
392 | 399 | ||
393 | static void show_page(unsigned long voffset, | 400 | static void show_page(unsigned long voffset, |
394 | unsigned long offset, uint64_t flags) | 401 | unsigned long long offset, uint64_t flags) |
395 | { | 402 | { |
396 | if (opt_pid) | 403 | if (opt_pid) |
397 | printf("%lx\t", voffset); | 404 | printf("%lx\t", voffset); |
398 | printf("%lx\t%s\n", offset, page_flag_name(flags)); | 405 | printf("%llx (%llu)\t%s\n", offset, offset & COLOR_MASK, page_flag_name(flags)); |
399 | } | 406 | } |
400 | 407 | ||
401 | static void show_summary(void) | 408 | static void show_summary(void) |
@@ -640,7 +647,7 @@ static int hash_slot(uint64_t flags) | |||
640 | } | 647 | } |
641 | 648 | ||
642 | static void add_page(unsigned long voffset, | 649 | static void add_page(unsigned long voffset, |
643 | unsigned long offset, uint64_t flags) | 650 | unsigned long long offset, uint64_t flags) |
644 | { | 651 | { |
645 | flags = kpageflags_flags(flags); | 652 | flags = kpageflags_flags(flags); |
646 | 653 | ||
@@ -663,7 +670,7 @@ static void add_page(unsigned long voffset, | |||
663 | 670 | ||
664 | #define KPAGEFLAGS_BATCH (64 << 10) /* 64k pages */ | 671 | #define KPAGEFLAGS_BATCH (64 << 10) /* 64k pages */ |
665 | static void walk_pfn(unsigned long voffset, | 672 | static void walk_pfn(unsigned long voffset, |
666 | unsigned long index, | 673 | unsigned long long index, |
667 | unsigned long count) | 674 | unsigned long count) |
668 | { | 675 | { |
669 | uint64_t buf[KPAGEFLAGS_BATCH]; | 676 | uint64_t buf[KPAGEFLAGS_BATCH]; |
@@ -686,10 +693,10 @@ static void walk_pfn(unsigned long voffset, | |||
686 | } | 693 | } |
687 | 694 | ||
688 | #define PAGEMAP_BATCH (64 << 10) | 695 | #define PAGEMAP_BATCH (64 << 10) |
689 | static void walk_vma(unsigned long index, unsigned long count) | 696 | static void walk_vma(unsigned long long index, unsigned long count) |
690 | { | 697 | { |
691 | uint64_t buf[PAGEMAP_BATCH]; | 698 | uint64_t buf[PAGEMAP_BATCH]; |
692 | unsigned long batch; | 699 | unsigned long long batch; |
693 | unsigned long pages; | 700 | unsigned long pages; |
694 | unsigned long pfn; | 701 | unsigned long pfn; |
695 | unsigned long i; | 702 | unsigned long i; |
@@ -711,10 +718,10 @@ static void walk_vma(unsigned long index, unsigned long count) | |||
711 | } | 718 | } |
712 | } | 719 | } |
713 | 720 | ||
714 | static void walk_task(unsigned long index, unsigned long count) | 721 | static void walk_task(unsigned long long index, unsigned long long count) |
715 | { | 722 | { |
716 | const unsigned long end = index + count; | 723 | const unsigned long long end = index + count; |
717 | unsigned long start; | 724 | unsigned long long start; |
718 | int i = 0; | 725 | int i = 0; |
719 | 726 | ||
720 | while (index < end) { | 727 | while (index < end) { |
@@ -725,21 +732,21 @@ static void walk_task(unsigned long index, unsigned long count) | |||
725 | if (pg_start[i] >= end) | 732 | if (pg_start[i] >= end) |
726 | return; | 733 | return; |
727 | 734 | ||
728 | start = max_t(unsigned long, pg_start[i], index); | 735 | start = max_t(unsigned long long, pg_start[i], index); |
729 | index = min_t(unsigned long, pg_end[i], end); | 736 | index = min_t(unsigned long long, pg_end[i], end); |
730 | 737 | ||
731 | assert(start < index); | 738 | assert(start < index); |
732 | walk_vma(start, index - start); | 739 | walk_vma(start, index - start); |
733 | } | 740 | } |
734 | } | 741 | } |
735 | 742 | ||
736 | static void add_addr_range(unsigned long offset, unsigned long size) | 743 | static void add_addr_range(unsigned long long offset, unsigned long long size) |
737 | { | 744 | { |
738 | if (nr_addr_ranges >= MAX_ADDR_RANGES) | 745 | if (nr_addr_ranges >= MAX_ADDR_RANGES) |
739 | fatal("too many addr ranges\n"); | 746 | fatal("too many addr ranges\n"); |
740 | 747 | ||
741 | opt_offset[nr_addr_ranges] = offset; | 748 | opt_offset[nr_addr_ranges] = offset; |
742 | opt_size[nr_addr_ranges] = min_t(unsigned long, size, ULONG_MAX-offset); | 749 | opt_size[nr_addr_ranges] = min_t(unsigned long long, size, ULLONG_MAX-offset); |
743 | nr_addr_ranges++; | 750 | nr_addr_ranges++; |
744 | } | 751 | } |
745 | 752 | ||
@@ -750,7 +757,7 @@ static void walk_addr_ranges(void) | |||
750 | kpageflags_fd = checked_open(PROC_KPAGEFLAGS, O_RDONLY); | 757 | kpageflags_fd = checked_open(PROC_KPAGEFLAGS, O_RDONLY); |
751 | 758 | ||
752 | if (!nr_addr_ranges) | 759 | if (!nr_addr_ranges) |
753 | add_addr_range(0, ULONG_MAX); | 760 | add_addr_range(0, ULLONG_MAX); |
754 | 761 | ||
755 | for (i = 0; i < nr_addr_ranges; i++) | 762 | for (i = 0; i < nr_addr_ranges; i++) |
756 | if (!opt_pid) | 763 | if (!opt_pid) |
@@ -857,15 +864,15 @@ static void parse_pid(const char *str) | |||
857 | } | 864 | } |
858 | 865 | ||
859 | while (fgets(buf, sizeof(buf), file) != NULL) { | 866 | while (fgets(buf, sizeof(buf), file) != NULL) { |
860 | unsigned long vm_start; | 867 | unsigned long long vm_start; |
861 | unsigned long vm_end; | 868 | unsigned long long vm_end; |
862 | unsigned long long pgoff; | 869 | unsigned long long pgoff; |
863 | int major, minor; | 870 | int major, minor; |
864 | char r, w, x, s; | 871 | char r, w, x, s; |
865 | unsigned long ino; | 872 | unsigned long ino; |
866 | int n; | 873 | int n; |
867 | 874 | ||
868 | n = sscanf(buf, "%lx-%lx %c%c%c%c %llx %x:%x %lu", | 875 | n = sscanf(buf, "%llx-%llx %c%c%c%c %llx %x:%x %lu", |
869 | &vm_start, | 876 | &vm_start, |
870 | &vm_end, | 877 | &vm_end, |
871 | &r, &w, &x, &s, | 878 | &r, &w, &x, &s, |
@@ -892,8 +899,8 @@ static void parse_file(const char *name) | |||
892 | 899 | ||
893 | static void parse_addr_range(const char *optarg) | 900 | static void parse_addr_range(const char *optarg) |
894 | { | 901 | { |
895 | unsigned long offset; | 902 | unsigned long long offset; |
896 | unsigned long size; | 903 | unsigned long long size; |
897 | char *p; | 904 | char *p; |
898 | 905 | ||
899 | p = strchr(optarg, ','); | 906 | p = strchr(optarg, ','); |
@@ -906,12 +913,12 @@ static void parse_addr_range(const char *optarg) | |||
906 | } else if (p) { | 913 | } else if (p) { |
907 | offset = parse_number(optarg); | 914 | offset = parse_number(optarg); |
908 | if (p[1] == '\0') | 915 | if (p[1] == '\0') |
909 | size = ULONG_MAX; | 916 | size = ULLONG_MAX; |
910 | else { | 917 | else { |
911 | size = parse_number(p + 1); | 918 | size = parse_number(p + 1); |
912 | if (*p == ',') { | 919 | if (*p == ',') { |
913 | if (size < offset) | 920 | if (size < offset) |
914 | fatal("invalid range: %lu,%lu\n", | 921 | fatal("invalid range: %llu,%llu\n", |
915 | offset, size); | 922 | offset, size); |
916 | size -= offset; | 923 | size -= offset; |
917 | } | 924 | } |
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index 253986bd6bb6..6bc40d9e3007 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig | |||
@@ -606,3 +606,12 @@ source "security/Kconfig" | |||
606 | source "crypto/Kconfig" | 606 | source "crypto/Kconfig" |
607 | 607 | ||
608 | source "lib/Kconfig" | 608 | source "lib/Kconfig" |
609 | |||
610 | config ARCH_HAS_FEATHER_TRACE | ||
611 | def_bool n | ||
612 | |||
613 | # Probably add these later | ||
614 | config ARCH_HAS_SEND_PULL_TIMERS | ||
615 | def_bool n | ||
616 | |||
617 | source "litmus/Kconfig" | ||
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h index b0b99e814314..ed9b7d20a763 100644 --- a/include/litmus/rt_param.h +++ b/include/litmus/rt_param.h | |||
@@ -74,7 +74,11 @@ struct control_page { | |||
74 | 74 | ||
75 | #ifndef __KERNEL__ | 75 | #ifndef __KERNEL__ |
76 | /* XXX This is a terrible hack. */ | 76 | /* XXX This is a terrible hack. */ |
77 | #if defined(CONFIG_X86) | ||
77 | #define PAGE_SIZE 4096 | 78 | #define PAGE_SIZE 4096 |
79 | #elif defined(CONFIG_SPARC) || (ARCH == sparc64) | ||
80 | #define PAGE_SIZE 8192 | ||
81 | #endif /* X86/SPARC */ | ||
78 | #endif | 82 | #endif |
79 | typedef uint8_t color_t; | 83 | typedef uint8_t color_t; |
80 | #define COLORS_PER_CONTROL_PAGE (PAGE_SIZE / sizeof(color_t)) | 84 | #define COLORS_PER_CONTROL_PAGE (PAGE_SIZE / sizeof(color_t)) |
diff --git a/litmus/color.c b/litmus/color.c index 7b23703f6206..dad2f07b154a 100644 --- a/litmus/color.c +++ b/litmus/color.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/sysctl.h> | 6 | #include <linux/sysctl.h> |
7 | #include <linux/lockdep.h> | 7 | #include <linux/lockdep.h> |
8 | #include <linux/sched.h> /* required by litmus.h */ | 8 | #include <linux/sched.h> /* required by litmus.h */ |
9 | #include <asm/io.h> /* page_to_phys on SPARC */ | ||
9 | 10 | ||
10 | #include <litmus/color.h> | 11 | #include <litmus/color.h> |
11 | #include <litmus/litmus.h> /* for in_list(...) */ | 12 | #include <litmus/litmus.h> /* for in_list(...) */ |
@@ -37,7 +38,9 @@ static struct color_group *color_groups; | |||
37 | 38 | ||
38 | /* non-static: extern'ed in various files */ | 39 | /* non-static: extern'ed in various files */ |
39 | unsigned long nr_colors; | 40 | unsigned long nr_colors; |
41 | #ifdef CONFIG_X86 | ||
40 | struct color_cache_info color_cache_info; | 42 | struct color_cache_info color_cache_info; |
43 | #endif | ||
41 | int color_sysctl_add_pages_data; | 44 | int color_sysctl_add_pages_data; |
42 | int color_sysctl_reclaim_pages_data; | 45 | int color_sysctl_reclaim_pages_data; |
43 | 46 | ||
@@ -115,8 +118,14 @@ static int do_add_pages(void) | |||
115 | int ret = 0; | 118 | int ret = 0; |
116 | 119 | ||
117 | while (smallest_nr_pages() < PAGES_PER_COLOR) { | 120 | while (smallest_nr_pages() < PAGES_PER_COLOR) { |
121 | #if defined(CONFIG_X86) | ||
118 | page = alloc_page(GFP_HIGHUSER | __GFP_ZERO | | 122 | page = alloc_page(GFP_HIGHUSER | __GFP_ZERO | |
119 | __GFP_MOVABLE); | 123 | __GFP_MOVABLE); |
124 | #elif defined(CONFIG_SPARC) /* X86 */ | ||
125 | page = alloc_page(GFP_HIGHUSER | __GFP_MOVABLE); | ||
126 | #else | ||
127 | #error What architecture are you using? | ||
128 | #endif | ||
120 | if (unlikely(!page)) { | 129 | if (unlikely(!page)) { |
121 | printk(KERN_WARNING "Could not allocate pages.\n"); | 130 | printk(KERN_WARNING "Could not allocate pages.\n"); |
122 | ret = -ENOMEM; | 131 | ret = -ENOMEM; |
@@ -147,7 +156,11 @@ static int do_reclaim_pages(void) | |||
147 | ClearPageLRU(page); | 156 | ClearPageLRU(page); |
148 | add_page_to_color_list(page); | 157 | add_page_to_color_list(page); |
149 | nr_reclaimed++; | 158 | nr_reclaimed++; |
159 | TRACE_CUR("reclaiming page (pa:0x%10llx, pfn:%8lu, " | ||
160 | "color:%3lu)\n", page_to_phys(page), | ||
161 | page_to_pfn(page), page_color(page)); | ||
150 | } | 162 | } |
163 | |||
151 | } | 164 | } |
152 | spin_unlock(&alloced_pages.lock); | 165 | spin_unlock(&alloced_pages.lock); |
153 | TRACE_CUR("Reclaimed %lu pages.\n", nr_reclaimed); | 166 | TRACE_CUR("Reclaimed %lu pages.\n", nr_reclaimed); |
@@ -212,6 +225,7 @@ out: | |||
212 | * Initialization | 225 | * Initialization |
213 | ***********************************************************/ | 226 | ***********************************************************/ |
214 | 227 | ||
228 | #if defined(CONFIG_X86) | ||
215 | /* slowest possible way to find a log, but we only do this once on boot */ | 229 | /* slowest possible way to find a log, but we only do this once on boot */ |
216 | static unsigned int __init slow_log(unsigned int v) | 230 | static unsigned int __init slow_log(unsigned int v) |
217 | { | 231 | { |
@@ -221,9 +235,24 @@ static unsigned int __init slow_log(unsigned int v) | |||
221 | return r; | 235 | return r; |
222 | } | 236 | } |
223 | 237 | ||
224 | static void __init init_mask(void) | 238 | static int __init init_mask(void) |
225 | { | 239 | { |
226 | const unsigned int line_size_log = slow_log(color_cache_info.line_size); | 240 | unsigned int line_size_log = slow_log(color_cache_info.line_size); |
241 | int err = 0; | ||
242 | |||
243 | BUG_ON(color_cache_info.size <= 1048576 || | ||
244 | color_cache_info.ways < 15 || | ||
245 | color_cache_info.line_size != 64); | ||
246 | |||
247 | printk("Cache size: %lu line-size: %lu ways: %lu sets: %lu\n", | ||
248 | color_cache_info.size, color_cache_info.line_size, | ||
249 | color_cache_info.ways, color_cache_info.sets); | ||
250 | if (!color_cache_info.size) { | ||
251 | printk(KERN_WARNING "No cache information found.\n"); | ||
252 | err = -EINVAL; | ||
253 | goto out; | ||
254 | } | ||
255 | |||
227 | 256 | ||
228 | BUG_ON(color_cache_info.size / color_cache_info.line_size / | 257 | BUG_ON(color_cache_info.size / color_cache_info.line_size / |
229 | color_cache_info.ways != color_cache_info.sets); | 258 | color_cache_info.ways != color_cache_info.sets); |
@@ -231,21 +260,31 @@ static void __init init_mask(void) | |||
231 | color_mask = ((color_cache_info.sets << line_size_log) - 1) ^ | 260 | color_mask = ((color_cache_info.sets << line_size_log) - 1) ^ |
232 | (PAGE_SIZE - 1); | 261 | (PAGE_SIZE - 1); |
233 | nr_colors = (color_mask >> PAGE_SHIFT) + 1; | 262 | nr_colors = (color_mask >> PAGE_SHIFT) + 1; |
234 | printk("Color mask: 0x%lx Total colors: %lu\n", color_mask, | 263 | out: |
235 | nr_colors); | 264 | return err; |
236 | BUG_ON(LOCKDEP_MAX_NR_COLORS < nr_colors); | 265 | } |
266 | #elif defined(CONFIG_SPARC) /* X86 */ | ||
267 | static int __init init_mask(void) | ||
268 | { | ||
269 | /* bits 17:13 */ | ||
270 | color_mask = 0x3e000UL; | ||
271 | nr_colors = (1 << hweight_long(color_mask)); | ||
272 | return 0; | ||
237 | } | 273 | } |
274 | #endif /* SPARC/X86 */ | ||
275 | |||
276 | |||
238 | 277 | ||
239 | static int __init init_color_groups(void) | 278 | static int __init init_color_groups(void) |
240 | { | 279 | { |
241 | struct color_group *cgroup; | 280 | struct color_group *cgroup; |
242 | unsigned long i; | 281 | unsigned long i; |
243 | int ret = 0; | 282 | int err = 0; |
244 | 283 | ||
245 | color_groups = kmalloc(nr_colors * sizeof(struct color_group), GFP_KERNEL); | 284 | color_groups = kmalloc(nr_colors * sizeof(struct color_group), GFP_KERNEL); |
246 | if (!color_groups) { | 285 | if (!color_groups) { |
247 | printk(KERN_WARNING "Could not allocate color groups.\n"); | 286 | printk(KERN_WARNING "Could not allocate color groups.\n"); |
248 | ret = -ENOMEM; | 287 | err = -ENOMEM; |
249 | goto out; | 288 | goto out; |
250 | } | 289 | } |
251 | 290 | ||
@@ -258,33 +297,24 @@ static int __init init_color_groups(void) | |||
258 | cgroup->_lock_name, "color%lu", i); | 297 | cgroup->_lock_name, "color%lu", i); |
259 | } | 298 | } |
260 | out: | 299 | out: |
261 | return ret; | 300 | return err; |
262 | } | 301 | } |
263 | 302 | ||
264 | static int __init init_color(void) | 303 | static int __init init_color(void) |
265 | { | 304 | { |
266 | int ret = 0; | 305 | int err = 0; |
267 | printk("Initializing LITMUS^RT cache coloring.\n"); | 306 | printk("Initializing LITMUS^RT cache coloring.\n"); |
268 | 307 | ||
269 | BUG_ON(color_cache_info.size <= 1048576 || | ||
270 | color_cache_info.ways < 15 || | ||
271 | color_cache_info.line_size != 64); | ||
272 | INIT_LIST_HEAD(&alloced_pages.list); | 308 | INIT_LIST_HEAD(&alloced_pages.list); |
273 | spin_lock_init(&alloced_pages.lock); | 309 | spin_lock_init(&alloced_pages.lock); |
274 | 310 | ||
275 | printk("Cache size: %lu line-size: %lu ways: %lu sets: %lu\n", | 311 | err = init_mask(); |
276 | color_cache_info.size, color_cache_info.line_size, | 312 | printk("PAGE_SIZE: %lu Color mask: 0x%lx Total colors: %lu\n", |
277 | color_cache_info.ways, color_cache_info.sets); | 313 | PAGE_SIZE, color_mask, nr_colors); |
278 | if (!color_cache_info.size) { | ||
279 | printk(KERN_WARNING "No cache information found.\n"); | ||
280 | ret = -EINVAL; | ||
281 | goto out; | ||
282 | } | ||
283 | 314 | ||
284 | init_mask(); | 315 | BUG_ON(LOCKDEP_MAX_NR_COLORS < nr_colors); |
285 | ret = init_color_groups(); | 316 | err = init_color_groups(); |
286 | out: | 317 | return err; |
287 | return ret; | ||
288 | } | 318 | } |
289 | 319 | ||
290 | module_init(init_color); | 320 | module_init(init_color); |
diff --git a/litmus/color_dev.c b/litmus/color_dev.c index e1404142c18a..10ab1e6b1161 100644 --- a/litmus/color_dev.c +++ b/litmus/color_dev.c | |||
@@ -4,6 +4,8 @@ | |||
4 | #include <linux/miscdevice.h> | 4 | #include <linux/miscdevice.h> |
5 | #include <linux/spinlock.h> | 5 | #include <linux/spinlock.h> |
6 | #include <linux/module.h> | 6 | #include <linux/module.h> |
7 | #include <linux/highmem.h> | ||
8 | #include <asm/io.h> /* page_to_phys on SPARC */ | ||
7 | 9 | ||
8 | #include <litmus/litmus.h> | 10 | #include <litmus/litmus.h> |
9 | #include <litmus/color.h> | 11 | #include <litmus/color.h> |
@@ -168,8 +170,12 @@ static int do_map_colored_pages(struct vm_area_struct *vma) | |||
168 | TRACE_CUR(ALLOC_NAME ": Could not get page with " | 170 | TRACE_CUR(ALLOC_NAME ": Could not get page with " |
169 | " color %lu.\n", this_color); | 171 | " color %lu.\n", this_color); |
170 | /* TODO unmap mapped pages */ | 172 | /* TODO unmap mapped pages */ |
173 | err = -ENOMEM; | ||
171 | break; | 174 | break; |
172 | } | 175 | } |
176 | #ifdef CONFIG_SPARC | ||
177 | clear_user_highpage(page, addr); | ||
178 | #endif | ||
173 | TRACE_CUR(ALLOC_NAME ": insert page (pa:0x%10llx, pfn:%8lu, " | 179 | TRACE_CUR(ALLOC_NAME ": insert page (pa:0x%10llx, pfn:%8lu, " |
174 | "color:%3lu) at 0x%lx\n", page_to_phys(page), | 180 | "color:%3lu) at 0x%lx\n", page_to_phys(page), |
175 | page_to_pfn(page), this_color, addr); | 181 | page_to_pfn(page), this_color, addr); |
@@ -178,6 +184,7 @@ static int do_map_colored_pages(struct vm_area_struct *vma) | |||
178 | TRACE_CUR(ALLOC_NAME ": vm_insert_page() failed " | 184 | TRACE_CUR(ALLOC_NAME ": vm_insert_page() failed " |
179 | "(%d)\n", err); | 185 | "(%d)\n", err); |
180 | /* TODO unmap mapped pages */ | 186 | /* TODO unmap mapped pages */ |
187 | err = -EINVAL; | ||
181 | break; | 188 | break; |
182 | } | 189 | } |
183 | add_page_to_alloced_list(page); | 190 | add_page_to_alloced_list(page); |
diff --git a/litmus/sched_litmus.c b/litmus/sched_litmus.c index 5a15ce938984..6553948407de 100644 --- a/litmus/sched_litmus.c +++ b/litmus/sched_litmus.c | |||
@@ -102,9 +102,9 @@ litmus_schedule(struct rq *rq, struct task_struct *prev) | |||
102 | } | 102 | } |
103 | } | 103 | } |
104 | #ifdef __ARCH_WANT_UNLOCKED_CTXSW | 104 | #ifdef __ARCH_WANT_UNLOCKED_CTXSW |
105 | if (next->oncpu) | 105 | if (next->on_cpu) |
106 | TRACE_TASK(next, "waiting for !oncpu"); | 106 | TRACE_TASK(next, "waiting for !oncpu"); |
107 | while (next->oncpu) { | 107 | while (next->on_cpu) { |
108 | cpu_relax(); | 108 | cpu_relax(); |
109 | mb(); | 109 | mb(); |
110 | } | 110 | } |