From 44b2be2bd7b1985345bf855bc74dfc303c7c79cb Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Sun, 20 Jan 2013 18:25:51 +0100 Subject: TRACE_TASK(): accept NULL pointers Allow tracing of NULL tasks. Makes debugging a bit easier. --- include/litmus/debug_trace.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/litmus/debug_trace.h b/include/litmus/debug_trace.h index 48d086d5a44c..1266ac6a760c 100644 --- a/include/litmus/debug_trace.h +++ b/include/litmus/debug_trace.h @@ -28,8 +28,11 @@ extern atomic_t __log_seq_no; TRACE_ARGS, ## args) #define TRACE_TASK(t, fmt, args...) \ - TRACE("(%s/%d:%d) " fmt, (t)->comm, (t)->pid, \ - (t)->rt_param.job_params.job_no, ##args) + TRACE("(%s/%d:%d) " fmt, \ + t ? (t)->comm : "null", \ + t ? (t)->pid : 0, \ + t ? (t)->rt_param.job_params.job_no : 0, \ + ##args) #define TRACE_CUR(fmt, args...) \ TRACE_TASK(current, fmt, ## args) -- cgit v1.2.2 From 4bd4eacab5070ac3003925b50a3d03069ae15e4a Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Thu, 10 Jan 2013 12:47:01 +0100 Subject: FDSO: fail to build if some ops are missing Prevents out-of-bounds lookups. --- litmus/fdso.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/litmus/fdso.c b/litmus/fdso.c index 250377d184e7..c4b450be4509 100644 --- a/litmus/fdso.c +++ b/litmus/fdso.c @@ -31,6 +31,8 @@ static const struct fdso_ops* fdso_ops[] = { static int fdso_create(void** obj_ref, obj_type_t type, void* __user config) { + BUILD_BUG_ON(ARRAY_SIZE(fdso_ops) != MAX_OBJ_TYPE + 1); + if (fdso_ops[type]->create) return fdso_ops[type]->create(obj_ref, type, config); else -- cgit v1.2.2 From c7cd5432b98df518b05bc8978d34382797fd9a05 Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Fri, 11 Jan 2013 14:10:43 +0100 Subject: P-FP: fix BUG_ON releated to priority inheritance In some cases, the PCP priority inheritance code triggered a (defensive) BUG_ON() in fp_common.c. This shuffles the order of operations a bit to be compliant with the restriction that tasks are never compared against themselves. --- litmus/sched_pfp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/litmus/sched_pfp.c b/litmus/sched_pfp.c index 91e52391a173..0e875a3b5cba 100644 --- a/litmus/sched_pfp.c +++ b/litmus/sched_pfp.c @@ -182,7 +182,7 @@ static struct task_struct* pfp_schedule(struct task_struct * prev) np = exists && is_np(pfp->scheduled); sleep = exists && is_completed(pfp->scheduled); migrate = exists && get_partition(pfp->scheduled) != pfp->cpu; - preempt = migrate || fp_preemption_needed(&pfp->ready_queue, prev); + preempt = !blocks && (migrate || fp_preemption_needed(&pfp->ready_queue, prev)); /* If we need to preempt do so. * The following checks set resched to 1 in case of special @@ -1089,8 +1089,10 @@ static void pcp_priority_inheritance(void) fp_set_prio_inh(pfp, blocker, blocked); } - /* check if anything changed */ - if (fp_higher_prio(fp_prio_peek(&pfp->ready_queue), pfp->scheduled)) + /* Check if anything changed. If the blocked job is current, then it is + * just blocking and hence is going to call the scheduler anyway. */ + if (blocked != current && + fp_higher_prio(fp_prio_peek(&pfp->ready_queue), pfp->scheduled)) preempt(pfp); raw_spin_unlock_irqrestore(&pfp->slock, flags); @@ -1201,10 +1203,10 @@ static void pcp_lower_ceiling(struct pcp_semaphore* sem) TRACE_CUR("PCP released sem %p\n", sem); + pcp_priority_inheritance(); + /* Wake up all ceiling-blocked jobs that now pass the ceiling. */ pcp_resume_unblocked(); - - pcp_priority_inheritance(); } static void pcp_update_prio_ceiling(struct pcp_semaphore* sem, -- cgit v1.2.2