From e1b81e70c3af9d19d639bc8bdaa5a8fc13bf17a8 Mon Sep 17 00:00:00 2001 From: "Bjoern B. Brandenburg" Date: Fri, 28 Jan 2011 17:04:58 -0500 Subject: SRP: port to new generic locking API This re-enables SRP support under PSN-EDF and demonstrates how the new locking API should be used. --- include/litmus/litmus.h | 2 +- include/litmus/srp.h | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 include/litmus/srp.h (limited to 'include') diff --git a/include/litmus/litmus.h b/include/litmus/litmus.h index 4a774a9e7acc..8971b25f23e6 100644 --- a/include/litmus/litmus.h +++ b/include/litmus/litmus.h @@ -115,7 +115,7 @@ static inline lt_t litmus_clock(void) void preempt_if_preemptable(struct task_struct* t, int on_cpu); -#ifdef CONFIG_SRP +#ifdef CONFIG_LITMUS_LOCKING void srp_ceiling_block(void); #else #define srp_ceiling_block() /* nothing */ diff --git a/include/litmus/srp.h b/include/litmus/srp.h new file mode 100644 index 000000000000..c9a4552b2bf3 --- /dev/null +++ b/include/litmus/srp.h @@ -0,0 +1,28 @@ +#ifndef LITMUS_SRP_H +#define LITMUS_SRP_H + +struct srp_semaphore; + +struct srp_priority { + struct list_head list; + unsigned int priority; + pid_t pid; +}; +#define list2prio(l) list_entry(l, struct srp_priority, list) + +/* struct for uniprocessor SRP "semaphore" */ +struct srp_semaphore { + struct litmus_lock litmus_lock; + struct srp_priority ceiling; + struct task_struct* owner; + int cpu; /* cpu associated with this "semaphore" and resource */ +}; + +/* map a task to its SRP preemption level priority */ +typedef unsigned int (*srp_prioritization_t)(struct task_struct* t); +/* Must be updated by each plugin that uses SRP.*/ +extern srp_prioritization_t get_srp_prio; + +struct srp_semaphore* allocate_srp_semaphore(void); + +#endif -- cgit v1.2.2