From 44f61e6c269e0a85b6cac608c6ee29d3dbbf21ad Mon Sep 17 00:00:00 2001 From: Jonathan Herman Date: Mon, 18 Feb 2013 11:58:44 -0500 Subject: Clean this commit --- arch/arm/kernel/kgdb.c | 4 ++ arch/arm/kernel/traps.c | 3 +- drivers/ata/ahci-tegra.c | 1 + include/litmus/clock.h | 1 + include/litmus/color_queue.h | 3 ++ include/litmus/debug_trace.h | 18 ++++++--- include/litmus/lockdown.h | 2 + include/litmus/sched_trace.h | 79 ++++++++++++++++++++------------------- kernel/debug/debug_core.c | 31 +++++++++++++++- kernel/debug/gdbstub.c | 2 + litmus/Kconfig | 2 +- litmus/color.c | 13 +++++++ litmus/color_queue.c | 34 +++++++++++++++++ litmus/dgl.c | 88 ++++++++++++++++++++++++++++---------------- litmus/lockdown.c | 34 ++++++++++++++--- litmus/sched_mc.c | 7 +++- litmus/sched_trace.c | 13 ++++++- litmus/way_tracker.c | 3 ++ 18 files changed, 250 insertions(+), 88 deletions(-) diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c index 778c2f7024f..33a807aef59 100644 --- a/arch/arm/kernel/kgdb.c +++ b/arch/arm/kernel/kgdb.c @@ -118,6 +118,8 @@ int kgdb_arch_handle_exception(int exception_vector, int signo, unsigned long addr; char *ptr; + printk(KERN_WARNING "Handling exception dog\n"); + switch (remcom_in_buffer[0]) { case 'D': case 'k': @@ -144,6 +146,7 @@ int kgdb_arch_handle_exception(int exception_vector, int signo, static int kgdb_brk_fn(struct pt_regs *regs, unsigned int instr) { + printk(KERN_WARNING "SW break\n"); kgdb_handle_exception(1, SIGTRAP, 0, regs); return 0; @@ -151,6 +154,7 @@ static int kgdb_brk_fn(struct pt_regs *regs, unsigned int instr) static int kgdb_compiled_brk_fn(struct pt_regs *regs, unsigned int instr) { + printk(KERN_WARNING "Compiled break\n"); compiled_break = 1; kgdb_handle_exception(1, SIGTRAP, 0, regs); diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 4ef9f0d04e5..c1b04735229 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -710,7 +711,7 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs) void __attribute__((noreturn)) __bug(const char *file, int line) { - printk(KERN_CRIT"kernel BUG at %s:%d!\n", file, line); + printk(KERN_CRIT"kernel BUG you got this arch at %s:%d!\n", file, line); *(int *)0 = 0; /* Avoid "noreturn function does return" */ diff --git a/drivers/ata/ahci-tegra.c b/drivers/ata/ahci-tegra.c index 52b5820ac05..49a5bd14614 100644 --- a/drivers/ata/ahci-tegra.c +++ b/drivers/ata/ahci-tegra.c @@ -797,6 +797,7 @@ static void tegra_ahci_controller_remove(struct platform_device *pdev) { struct ata_host *host = dev_get_drvdata(&pdev->dev); struct tegra_ahci_host_priv *tegra_hpriv; + u32 status; #ifdef CONFIG_PM /* call tegra_ahci_controller_suspend() to power-down the SATA */ diff --git a/include/litmus/clock.h b/include/litmus/clock.h index 9b285db7f60..bb493e73d50 100644 --- a/include/litmus/clock.h +++ b/include/litmus/clock.h @@ -2,6 +2,7 @@ #define _LITMUS_CLOCK_H_ #if defined(CONFIG_EXYNOS_MCT) + /* * Only used if we are using the EXYNOS MCT clock. */ diff --git a/include/litmus/color_queue.h b/include/litmus/color_queue.h index 95dd395c0b9..7a49afedf92 100644 --- a/include/litmus/color_queue.h +++ b/include/litmus/color_queue.h @@ -60,4 +60,7 @@ int color_queue_enqueue_flush(struct task_struct *ts); void cleanup_color_page_infos(struct list_head *head); +int color_cache_task(struct task_struct *t); +int color_uncache_task(struct task_struct *t); + #endif diff --git a/include/litmus/debug_trace.h b/include/litmus/debug_trace.h index ee4a7b4844c..2808bf66f55 100644 --- a/include/litmus/debug_trace.h +++ b/include/litmus/debug_trace.h @@ -17,10 +17,22 @@ extern atomic_t __log_seq_no; #define TRACE_ARGS atomic_add_return(1, &__log_seq_no), \ raw_smp_processor_id(), \ __FUNCTION__, __FILE__, __LINE__ +#define STRACE(fmt, args...) \ + sched_trace_log_message("%d P%d [%s@%s:%d]: " fmt, \ + TRACE_ARGS, ## args) +#define STRACE2(fmt, args...) \ + sched_trace_log_message("%d P%d [%s@%s:%d]: " fmt, \ + TRACE_ARGS, ## args) #else #define TRACE_PREFIX "%d P%d: " #define TRACE_ARGS atomic_add_return(1, &__log_seq_no), \ raw_smp_processor_id() +#define STRACE(fmt, args...) \ + sched_trace_log_message("%d P%d : " fmt, \ + TRACE_ARGS, ## args) +#define STRACE2(fmt, args...) \ + sched_trace_log_message("%d P%d : " fmt, \ + TRACE_ARGS, ## args) #endif #define TRACE(fmt, args...) \ @@ -33,12 +45,6 @@ extern atomic_t __log_seq_no; #define TRACE_CUR(fmt, args...) \ TRACE_TASK(current, fmt, ## args) -#define STRACE(fmt, args...) \ - sched_trace_log_message("%d P%d [%s@%s:%d]: " fmt, \ - TRACE_ARGS, ## args) -#define STRACE2(fmt, args...) \ - sched_trace_log_message("%d P%d [%s@%s:%d]: " fmt, \ - TRACE_ARGS, ## args) diff --git a/include/litmus/lockdown.h b/include/litmus/lockdown.h index 78cd9c85657..ddd50accd2c 100644 --- a/include/litmus/lockdown.h +++ b/include/litmus/lockdown.h @@ -4,8 +4,10 @@ #include #define UNLOCK_ALL 0x00000000 /* allocation in any way */ +#define LOCK_ALL (~UNLOCK_ALL) u32 color_read_in_mem(u32 lock_val, u32 unlock_val, void *start, void *end); +u32 color_read_in_mem_lock(u32 lock_val, u32 unlock_val, void *start, void *end); void set_lockdown(u32 lockdown_state); diff --git a/include/litmus/sched_trace.h b/include/litmus/sched_trace.h index cb8758f8aeb..0580340d017 100644 --- a/include/litmus/sched_trace.h +++ b/include/litmus/sched_trace.h @@ -51,6 +51,7 @@ struct st_switch_away_data { /* A process was switched away from on a given CPU. u64 exec_time; }; +/* changed: like everything */ struct st_completion_data { /* A job completed. */ u32 exec; u16 flush_work; @@ -76,8 +77,8 @@ struct st_resume_data { /* A task resumes. */ struct st_action_data { u64 when; - u32 action; - u8 __unused[4]; + u8 action; + u8 __unused[7]; }; struct st_sys_release_data { @@ -85,11 +86,13 @@ struct st_sys_release_data { u64 release; }; +/* changed: easy enough to remove */ struct st_task_exit_data { u64 avg_exec_time; u64 max_exec_time; }; +/* changed: calculate yoself */ struct st_task_tardy_data { u64 total_tardy; u32 max_tardy; @@ -232,26 +235,26 @@ feather_callback void do_sched_trace_task_tardy(unsigned long id, trace_litmus_task_param(t); \ } while (0) -#define sched_trace_task_release(t)/* \ */ - /* do { \ */ - /* SCHED_TRACE(SCHED_TRACE_BASE_ID + 3, \ */ - /* do_sched_trace_task_release, t); \ */ - /* trace_litmus_task_release(t); \ */ - /* } while (0) */ - -#define sched_trace_task_switch_to(t)/* \ */ - /* do { \ */ - /* SCHED_TRACE(SCHED_TRACE_BASE_ID + 4, \ */ - /* do_sched_trace_task_switch_to, t); \ */ - /* trace_litmus_switch_to(t); \ */ - /* } while (0) */ - -#define sched_trace_task_switch_away(t)/* \ */ - /* do { \ */ - /* SCHED_TRACE(SCHED_TRACE_BASE_ID + 5, \ */ - /* do_sched_trace_task_switch_away, t); \ */ - /* trace_litmus_switch_away(t); \ */ - /* } while (0) */ +#define sched_trace_task_release(t) \ + do { \ + SCHED_TRACE(SCHED_TRACE_BASE_ID + 3, \ + do_sched_trace_task_release, t); \ + trace_litmus_task_release(t); \ + } while (0) + +#define sched_trace_task_switch_to(t) \ + do { \ + SCHED_TRACE(SCHED_TRACE_BASE_ID + 4, \ + do_sched_trace_task_switch_to, t); \ + trace_litmus_switch_to(t); \ + } while (0) + +#define sched_trace_task_switch_away(t) \ + do { \ + SCHED_TRACE(SCHED_TRACE_BASE_ID + 5, \ + do_sched_trace_task_switch_away, t); \ + trace_litmus_switch_away(t); \ + } while (0) #define sched_trace_task_completion(t, forced) \ do { \ @@ -261,30 +264,30 @@ feather_callback void do_sched_trace_task_tardy(unsigned long id, trace_litmus_task_completion(t, forced); \ } while (0) -#define sched_trace_task_block_on(t, i)/* \ */ - /* do { \ */ - /* SCHED_TRACE(SCHED_TRACE_BASE_ID + 7, \ */ - /* do_sched_trace_task_block, t); \ */ - /* trace_litmus_task_block(t, i); \ */ - /* } while (0) */ +#define sched_trace_task_block_on(t, i) \ + do { \ + SCHED_TRACE(SCHED_TRACE_BASE_ID + 7, \ + do_sched_trace_task_block, t); \ + trace_litmus_task_block(t, i); \ + } while (0) #define sched_trace_task_block(t) \ sched_trace_task_block_on(t, 0) -#define sched_trace_task_resume_on(t, i)/* \ */ - /* do { \ */ - /* SCHED_TRACE(SCHED_TRACE_BASE_ID + 8, \ */ - /* do_sched_trace_task_resume, t); \ */ - /* trace_litmus_task_resume(t, i); \ */ - /* } while (0) */ +#define sched_trace_task_resume_on(t, i) \ + do { \ + SCHED_TRACE(SCHED_TRACE_BASE_ID + 8, \ + do_sched_trace_task_resume, t); \ + trace_litmus_task_resume(t, i); \ + } while (0) #define sched_trace_task_resume(t) \ sched_trace_task_resume_on(t, 0) -#define sched_trace_resource_acquire(t, i)/* \ */ - /* do { \ */ - /* trace_litmus_resource_acquire(t, i); \ */ - /* } while (0) */ +#define sched_trace_resource_acquire(t, i) \ + do { \ + trace_litmus_resource_acquire(t, i); \ + } while (0) #define sched_trace_resource_released(t, i) \ do { \ diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c index 0d7c08784ef..25c2c64f668 100644 --- a/kernel/debug/debug_core.c +++ b/kernel/debug/debug_core.c @@ -465,9 +465,13 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs, int trace_on = 0; int online_cpus = num_online_cpus(); + //printk(KERN_WARNING "Cpu enter\n"); + kgdb_info[ks->cpu].enter_kgdb++; kgdb_info[ks->cpu].exception_state |= exception_state; + + if (exception_state == DCPU_WANT_MASTER) atomic_inc(&masters_in_kgdb); else @@ -477,6 +481,7 @@ static int kgdb_cpu_enter(struct kgdb_state *ks, struct pt_regs *regs, arch_kgdb_ops.disable_hw_break(regs); acquirelock: + //printk(KERN_WARNING "acquirelock\n"); /* * Interrupts will be restored by the 'trap return' code, except when * single stepping. @@ -495,6 +500,7 @@ acquirelock: if (exception_level == 1) { if (raw_spin_trylock(&dbg_master_lock)) atomic_xchg(&kgdb_active, cpu); + goto cpu_master_loop; } @@ -504,6 +510,7 @@ acquirelock: */ while (1) { cpu_loop: + //printk(KERN_WARNING "cpu loop\n"); if (kgdb_info[cpu].exception_state & DCPU_NEXT_MASTER) { kgdb_info[cpu].exception_state &= ~DCPU_NEXT_MASTER; goto cpu_master_loop; @@ -517,6 +524,7 @@ cpu_loop: goto return_normal; } else { return_normal: + //printk(KERN_WARNING "return normal\n"); /* Return to normal operation by executing any * hw breakpoint fixup. */ @@ -536,6 +544,8 @@ return_normal: cpu_relax(); } + //printk(KERN_WARNING "out of 1\n"); + /* * For single stepping, try to only enter on the processor * that was single stepping. To guard against a deadlock, the @@ -555,14 +565,17 @@ return_normal: if (!kgdb_io_ready(1)) { kgdb_info[cpu].ret_state = 1; + //printk(KERN_WARNING "io not ready\n"); goto kgdb_restore; /* No I/O connection, resume the system */ } /* * Don't enter if we have hit a removed breakpoint. */ - if (kgdb_skipexception(ks->ex_vector, ks->linux_regs)) + if (kgdb_skipexception(ks->ex_vector, ks->linux_regs)) { + //printk(KERN_WARNING "skipping\n"); goto kgdb_restore; + } /* Call the I/O driver's pre_exception routine */ if (dbg_io_ops->pre_exception) @@ -577,8 +590,11 @@ return_normal: #ifdef CONFIG_SMP /* Signal the other CPUs to enter kgdb_wait() */ - if ((!kgdb_single_step) && kgdb_do_roundup) + if ((!kgdb_single_step) && kgdb_do_roundup) { + printk(KERN_WARNING "Rounding up cpus...\n"); kgdb_roundup_cpus(flags); + printk(KERN_WARNING "Rounded up\n"); + } #endif /* @@ -587,6 +603,7 @@ return_normal: while (kgdb_do_roundup && (atomic_read(&masters_in_kgdb) + atomic_read(&slaves_in_kgdb)) != online_cpus) cpu_relax(); + //printk(KERN_WARNING "Waited\n"); /* * At this point the primary processor is completely @@ -602,7 +619,9 @@ return_normal: while (1) { cpu_master_loop: + //printk(KERN_WARNING "master loop\n"); if (dbg_kdb_mode) { + //printk(KERN_WARNING "kdb mode\n"); kgdb_connected = 1; error = kdb_stub(ks); if (error == -1) @@ -636,6 +655,7 @@ cpu_master_loop: } kgdb_restore: + //printk(KERN_WARNING "restore\n"); if (atomic_read(&kgdb_cpu_doing_single_step) != -1) { int sstep_cpu = atomic_read(&kgdb_cpu_doing_single_step); if (kgdb_info[sstep_cpu].task) @@ -675,6 +695,8 @@ kgdb_handle_exception(int evector, int signo, int ecode, struct pt_regs *regs) struct kgdb_state kgdb_var; struct kgdb_state *ks = &kgdb_var; + printk(KERN_WARNING "enter exception thing\n"); + ks->cpu = raw_smp_processor_id(); ks->ex_vector = evector; ks->signo = signo; @@ -954,11 +976,16 @@ int dbg_io_get_char(void) */ void kgdb_breakpoint(void) { + printk(KERN_WARNING "Doin this\n"); atomic_inc(&kgdb_setting_breakpoint); + printk(KERN_WARNING "Doin this1\n"); wmb(); /* Sync point before breakpoint */ + printk(KERN_WARNING "Doin this2\n"); arch_kgdb_breakpoint(); wmb(); /* Sync point after breakpoint */ + printk(KERN_WARNING "Doin this\n"); atomic_dec(&kgdb_setting_breakpoint); + printk(KERN_WARNING "Doin this\n"); } EXPORT_SYMBOL_GPL(kgdb_breakpoint); diff --git a/kernel/debug/gdbstub.c b/kernel/debug/gdbstub.c index 34872482315..e0134e3cc5e 100644 --- a/kernel/debug/gdbstub.c +++ b/kernel/debug/gdbstub.c @@ -941,6 +941,8 @@ int gdb_serial_stub(struct kgdb_state *ks) int error = 0; int tmp; + printk(KERN_WARNING "Serial stub\n"); + /* Initialize comm buffer and globals. */ memset(remcom_out_buffer, 0, sizeof(remcom_out_buffer)); kgdb_usethread = kgdb_info[ks->cpu].task; diff --git a/litmus/Kconfig b/litmus/Kconfig index e71f7a332f2..1ba3a1368f6 100644 --- a/litmus/Kconfig +++ b/litmus/Kconfig @@ -39,7 +39,7 @@ config PLUGIN_PFAIR config MERGE_TIMERS bool "Timer-merging Support" depends on HIGH_RES_TIMERS - default y + default n help Include support for merging timers. diff --git a/litmus/color.c b/litmus/color.c index 26f800e785a..c9826dd48ec 100644 --- a/litmus/color.c +++ b/litmus/color.c @@ -16,7 +16,9 @@ #include #include /* for in_list(...) */ #include +#ifndef CONFIG_CACHE_PL310 #include +#endif #include #include @@ -222,7 +224,13 @@ void reclaim_pages(struct vm_area_struct *vma) int color_sched_in_task(struct task_struct *t) { color_page_info_take_ways(t); + +#ifdef CONFIG_CACHE_PL310 + return color_cache_task(t); +#else return color_queue_enqueue_read(t); +#endif + } /* @@ -231,7 +239,12 @@ int color_sched_in_task(struct task_struct *t) int color_sched_out_task(struct task_struct *t) { color_page_info_release_ways(t); + +#ifdef CONFIG_CACHE_PL310 + return color_uncache_task(t); +#else return color_queue_enqueue_flush(t); +#endif } asmlinkage long sys_set_color_page_info(struct color_ctrl_page __user *user_color_ctrl) diff --git a/litmus/color_queue.c b/litmus/color_queue.c index 0b87217a931..913b2f317c1 100644 --- a/litmus/color_queue.c +++ b/litmus/color_queue.c @@ -456,6 +456,40 @@ out_free: return ret; } +int color_cache_task(struct task_struct *t) +{ + struct color_page_info *info; + int npages = 0; + + list_for_each_entry(info, &tsk_rt(t)->color_page_info_list, list) { + u32 lvalue = unlocked_way[info->way]; + color_read_in_mem_lock(lvalue, LOCK_ALL, + info->vaddr, info->vaddr + PAGE_SIZE); + ++npages; + } + + return npages; +} + +int color_uncache_task(struct task_struct *t) +{ + struct color_page_info *info; + int npages = 0; + + + list_for_each_entry(info, &tsk_rt(t)->color_page_info_list, list) { + u32 lvalue = unlocked_way[info->way]; + void *vaddr = flusher_pages[info->way][info->color]; + + color_read_in_mem_lock(lvalue, LOCK_ALL, + vaddr, vaddr + PAGE_SIZE); + + ++npages; + } + + return npages; +} + static int __init init_color_queue(void) { struct cpu_entry *cpu_entry; diff --git a/litmus/dgl.c b/litmus/dgl.c index f9cede7ef54..3d6d3201928 100644 --- a/litmus/dgl.c +++ b/litmus/dgl.c @@ -9,12 +9,10 @@ #ifdef DEBUG_DGL #define TRACE(fmt, args...) STRACE(fmt, ## args) -#define STRACE2(fmt, args...) STRACE(fmt, ## args) #define TRACE_GREQ(greq, fmt, args...) \ TRACE("(greq-%s/%llu) " fmt, (greq->task ? greq->task->comm : "greq"), \ (greq->task ? greq->task->pid : (unsigned long long)greq), ## args) #else -#define STRACE2(fmt, args...) printk(KERN_ERR fmt, ## args) #define TRACE(fmt, args...) #define TRACE_GREQ(greq, fmt, args...) #endif @@ -72,53 +70,62 @@ static int arr_to_bool(struct dgl *dgl, unsigned long *arr) return (ret != 0); } -static void print_queue(struct dgl *dgl, struct list_head *list) +#ifdef DEBUG_DGL +#define DEBUG_BUF_LEN 10000 +DEFINE_PER_CPU(char *, debug_buf); + +static char* print_queue(char *buf, struct dgl *dgl, struct list_head *list) { struct dgl_req *pos; struct dgl_group_req *greq; list_for_each_entry(pos, list, list) { greq = pos->greq; - sched_trace_log_message("(%s-%d:r%d-p%x-b%x)->", greq->task->comm, + buf += sprintf(buf, "(%s/%d:r%d-p%x-b%x)->", greq->task->comm, greq->task->pid, pos->replicas, - greq->need_prio[0], - greq->blocked[0]); + greq->need_prio[0], greq->blocked[0]); } - sched_trace_log_message("\n"); + buf += sprintf(buf, "\n"); + + return buf; } -static void print_resource(struct dgl *dgl, struct dgl_resource *resource) +static char* print_resource(char *buf, struct dgl *dgl, + struct dgl_resource *resource) { - STRACE2("\tResource %d, real_free: %d, goal_free: %d\n", + buf += sprintf(buf, "\tResource %d, real_free: %d, goal_free: %d\n", resource_id(dgl, resource), resource->real_free, resource->goal_free); - STRACE2("\t acquired: "); - print_queue(dgl, &resource->acquired); - STRACE2("\t will_acquire:"); - print_queue(dgl, &resource->will_acquire); - STRACE2("\t waiting:"); - print_queue(dgl, &resource->waiting); - STRACE2("\t will_wait:"); - print_queue(dgl, &resource->will_wait); + buf += sprintf(buf, "\t acquired:"); + buf = print_queue(buf, dgl, &resource->acquired); + buf += sprintf(buf, "\t will_acquire:"); + buf = print_queue(buf, dgl, &resource->will_acquire); + buf += sprintf(buf, "\t waiting:"); + buf = print_queue(buf, dgl, &resource->waiting); + buf += sprintf(buf, "\t will_wait:"); + buf = print_queue(buf, dgl, &resource->will_wait); + return buf; } + /* * Print stats and queues of every resource to the trace log. */ static void print_state(struct dgl *dgl) { int i; + char *buf, *start; struct dgl_resource *resource; - sched_trace_log_message("\n"); - STRACE2("\t\tDGL: requests: %d\n", dgl->requests); + start = __get_cpu_var(debug_buf); + buf = start + sprintf(start, "\n\t\tDGL: requests: %d\n", dgl->requests); for (i = 0; i < dgl->num_resources; ++i) { resource = &dgl->resources[i]; if (!resource) { - STRACE2("\tResource %d is null!\n", i); + buf += sprintf(buf, "\tResource %d is null!\n", i); } if (!list_empty(&resource->waiting) || @@ -126,14 +133,16 @@ static void print_state(struct dgl *dgl) !list_empty(&resource->acquired) || !list_empty(&resource->will_acquire)) { - print_resource(dgl, resource); + buf = print_resource(buf, dgl, resource); } } - STRACE2("Dump complete\n"); - sched_trace_log_message("\n"); + + buf += sprintf(buf, "Dump complete\n\n"); + + BUG_ON(buf - start > DEBUG_BUF_LEN); + sched_trace_log_message(start); } -#ifdef DEBUG_DGL #define BUG_DUMP(dgl, cond) \ do { \ if (cond) { \ @@ -142,10 +151,9 @@ static void print_state(struct dgl *dgl) BUG(); \ }} while(0) #else -#define BUG_DUMP(dgl, cond) +#define BUG_DUMP(dgl, cond) BUG_ON(cond) #endif - static int higher_prio(struct dgl_group_req *a, struct dgl_group_req *b) { return (a->priority < b->priority || @@ -223,14 +231,14 @@ static int get_lp_replicas(struct dgl *dgl, struct dgl_group_req *greq, * Add @req to @list in priority order. * @reverse Reverse priority */ -static void add_request(struct list_head *list, struct dgl_req *req, - int reverse) +static void add_request(struct dgl *dgl, struct list_head *list, + struct dgl_req *req, int reverse) { struct list_head *last; struct dgl_req *acquired; struct dgl_group_req *greqa, *greqb; - BUG_ON(in_list(&req->list)); + BUG_DUMP(dgl, in_list(&req->list)); last = list; list_for_each_entry(acquired, list, list) { @@ -255,7 +263,7 @@ static void add_request(struct list_head *list, struct dgl_req *req, static void add_waiting(struct dgl *dgl, struct list_head *list, struct dgl_req *req) { BUG_DUMP(dgl, !arr_to_bool(dgl, req->greq->need_prio)); - add_request(list, req, 0); + add_request(dgl, list, req, 0); } /* @@ -264,7 +272,7 @@ static void add_waiting(struct dgl *dgl, struct list_head *list, struct dgl_req static void add_acquired(struct dgl *dgl, struct list_head *list, struct dgl_req *req) { BUG_DUMP(dgl, arr_to_bool(dgl, req->greq->need_prio)); - add_request(list, req, 1); + add_request(dgl, list, req, 1); } /* @@ -888,3 +896,21 @@ void dgl_group_req_free(struct dgl_group_req *greq) kfree(greq->need_prio); kfree(greq->requests); } + +#ifdef DEBUG_DGL +static int __init init_dgl_debug(void) +{ + int cpu; + char **buf; + + for_each_online_cpu(cpu) { + buf = &per_cpu(debug_buf, cpu); + *buf = kmalloc(DEBUG_BUF_LEN * sizeof(char), GFP_ATOMIC); + } + + return 0; +} + +module_init(init_dgl_debug); + +#endif diff --git a/litmus/lockdown.c b/litmus/lockdown.c index 8e10bc66b86..a718ffc9c9b 100644 --- a/litmus/lockdown.c +++ b/litmus/lockdown.c @@ -79,6 +79,7 @@ void litmus_setup_lockdown(void __iomem *base, u32 id) extern void v7_flush_kern_dcache_area(void *, size_t); static void __iomem *cache_base; + static void __iomem *lockreg_d; static void __iomem *lockreg_i; static raw_spinlock_t prefetch_lock; @@ -115,7 +116,11 @@ u32 color_read_in_mem(u32 lock_val, u32 unlock_val, void *start, void *end) : [addr] "+r" (start), [val] "+r" (v) : [end] "r" (end), +#ifdef CONFIG_CACHE_PL310 + [cachereg] "r" (ld_d_reg(raw_smp_processor_id())), +#else [cachereg] "r" (lockreg_d), +#endif [lockval] "r" (lock_val) : "cc"); @@ -139,7 +144,10 @@ u32 color_read_in_mem_lock(u32 lock_val, u32 unlock_val, void *start, void *end) unsigned long flags; u32 v = 0; +#ifndef CONFIG_CACHE_PL310 raw_spin_lock_irqsave(&prefetch_lock, flags); +#endif + __asm__ __volatile__ ( " .align 5\n" " str %[lockval], [%[cachereg]]\n" @@ -150,11 +158,18 @@ u32 color_read_in_mem_lock(u32 lock_val, u32 unlock_val, void *start, void *end) : [addr] "+r" (start), [val] "+r" (v) : [end] "r" (end), +#ifdef CONFIG_CACHE_PL310 + [cachereg] "r" (ld_d_reg(raw_smp_processor_id())), +#else [cachereg] "r" (lockreg_d), +#endif [lockval] "r" (lock_val), [unlockval] "r" (unlock_val) : "cc"); + +#ifndef CONFIG_CACHE_PL310 raw_spin_unlock_irqrestore(&prefetch_lock, flags); +#endif return v; } @@ -334,9 +349,16 @@ int litmus_lockdown_proc_handler(struct ctl_table *table, int write, #define TRIALS 1000 +static void sleep_ns(int ns) +{ + int i; + lt_t start = litmus_clock(); + for (i = 0; litmus_clock() - start < ns;i++); +} + static int test_get_cycles_overhead(void) { - u64 sum = 0, min = (u64)-1, max = 0; + u64 avg = 0, min = (u64)-1, max = 0; unsigned long flags; cycles_t a, b; int i; @@ -346,6 +368,7 @@ static int test_get_cycles_overhead(void) local_irq_save(flags); preempt_disable(); a = litmus_get_cycles(); + sleep_ns(15000); b = litmus_get_cycles(); preempt_enable(); local_irq_restore(flags); @@ -354,10 +377,11 @@ static int test_get_cycles_overhead(void) max = diff; if (diff < min) min = diff; - sum += diff; + avg += div64_u64(diff, TRIALS); } - printk("cycle test: avg: %llu min: %llu max: %llu\n", - div64_u64(sum, TRIALS), min, max); + printk("cycle test 15us: avg: %llu min: %llu max: %llu\n", + avg, min, max); + return 0; } @@ -665,7 +689,7 @@ int litmus_test_prefetch_proc_handler(struct ctl_table *table, int write, free_page((unsigned long)vaddr); - //test_get_cycles_overhead(); + test_get_cycles_overhead(); test_read_in(); return 0; diff --git a/litmus/sched_mc.c b/litmus/sched_mc.c index 64de4ef9c46..6edf86935a2 100644 --- a/litmus/sched_mc.c +++ b/litmus/sched_mc.c @@ -30,7 +30,7 @@ #include #include #include - +#warning "MUST ADD CHECK FOR MAX WAYS" struct mc_signal { int update:1; int preempt:1; @@ -58,6 +58,10 @@ struct cpu_entry { #endif }; +#ifndef CONFIG_NP_SECTION +#error "Need NP section for coloring!" +#endif + static struct dgl group_lock; static raw_spinlock_t dgl_lock; @@ -97,7 +101,6 @@ static int acquire_resources(struct task_struct *t) BUG_ON(tsk_rt(t)->linked_on == NO_CPU); - raw_spin_lock(&dgl_lock); cpu = tsk_rt(t)->linked_on; diff --git a/litmus/sched_trace.c b/litmus/sched_trace.c index f4171fddbbb..5acb4a48fb6 100644 --- a/litmus/sched_trace.c +++ b/litmus/sched_trace.c @@ -26,7 +26,7 @@ /* Max length for one write --- by TRACE() --- to the buffer. This is used to * allocate a per-cpu buffer for printf() formatting. */ -#define MSG_SIZE 255 +#define MSG_SIZE 10000 static DEFINE_MUTEX(reader_mutex); @@ -35,7 +35,7 @@ static DEFINE_KFIFO(debug_buffer, char, LITMUS_TRACE_BUF_SIZE); static DEFINE_RAW_SPINLOCK(log_buffer_lock); -static DEFINE_PER_CPU(char[MSG_SIZE], fmt_buffer); +static DEFINE_PER_CPU(char*, fmt_buffer); /* * sched_trace_log_message - Write to the trace buffer (log_buffer) @@ -230,8 +230,17 @@ static struct sysrq_key_op sysrq_dump_trace_buffer_op = { static int __init init_sched_trace(void) { + int cpu; + char **buf; + + printk("Initializing TRACE() device\n"); + for_each_online_cpu(cpu) { + buf = &per_cpu(fmt_buffer, cpu); + *buf = kmalloc(MSG_SIZE * sizeof(char), GFP_ATOMIC); + } + #ifdef CONFIG_MAGIC_SYSRQ /* offer some debugging help */ if (!register_sysrq_key('y', &sysrq_dump_trace_buffer_op)) diff --git a/litmus/way_tracker.c b/litmus/way_tracker.c index a9e8ef62f37..ff392ab09c4 100644 --- a/litmus/way_tracker.c +++ b/litmus/way_tracker.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -38,7 +39,9 @@ static int take_next_way(unsigned int color) clear_bit(idx, &ways[color]); TRACE("Took, now %lu free of color %d\n", hweight_long(ways[color]), color); } else { + printk(KERN_WARNING "Vury bad\n"); /* Seriously bad. */ + kgdb_breakpoint(); BUG(); } raw_spin_unlock(&lock); -- cgit v1.2.2