diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2015-08-09 07:18:48 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2017-05-26 17:12:28 -0400 |
commit | 3baa55c19ffb567aa48568fa69dd17ad6f70d31d (patch) | |
tree | 7e79fd398705929f2db40ba239895cc60762f61f /litmus/trace.c | |
parent | cbe61859a233702ed8e6723b3b133d1f2ae1ae2c (diff) |
Add LITMUS^RT core implementation
This patch adds the core of LITMUS^RT:
- library functionality (heaps, rt_domain, prioritization, etc.)
- budget enforcement logic
- job management
- system call backends
- virtual devices (control page, etc.)
- scheduler plugin API (and dummy plugin)
This code compiles, but is not yet integrated with the rest of Linux.
Squashed changes:
LITMUS^RT Core: add get_current_budget() system call
Allow userspace to figure out the used-up and remaining budget
of a task.
Adds deadline field to control page and updates it when setting up jobs for release.
Adds control page deadline offset
ftdev: respect O_NONBLOCK flag in ftdev_read()
Don't block if userspace wants to go on doing something else.
Export job release time and job sequence number in ctrl page
Add alternate complete_job() default implementation
Let jobs sleep like regular Linux tasks by suspending and waking them
with a one-shot timer. Plugins can opt into using this implementation
instead of the classic complete_job() implementation (or custom
implementations).
Fix RCU locking in sys_get_rt_task_param()
sys_get_rt_task_param() is rarely used and apparently attracted some
bitrot.
Free before setting NULL to prevent memory leak
Add hrtimer_start_on() support
This patch replaces the previous implementation of hrtimer_start_on() by
now using smp_call_function_single_async() to arm hrtimers on remote
CPUs.
Expose LITMUS^RT system calls via control page ioctl()
Rationale: make LITMUS^RT ops available in a way that does not create
merge conflicts each time we rebase LITMUS^RT on top of a new kernel
version. This also helps with portability to different architectures,
as we no longer need to patch each architecture's syscall table.
Pick non-zero syscall ID start range
To avoid interfering with Linux's magic reserved IOCTL numbers
Don't preempt before time check in sleep_until_next_release()
Avoid preempting jobs that are about to go to sleep soon anyway.
LITMUS^RT proc: fix wrong memset()
TRACE(): add TRACE_WARN_ON() helper
Useful to replace BUG_ON() and WARN_ON() with a non-fatal
TRACE()-based equivalent.
Add void* plugin_state pointer to task_struct
LITMUS^RT: split task admission into two functions
Plugin interface: add fork_task() callback
LITMUS^RT: Enable plugins to permit RT tasks to fork
one-shot complete_job(): set completed flag
This could race with a SIGSTOP or some other forced suspension, but
we'll let plugins handle this, should they actually care.
FP: add list-based ready queue
LITMUS^RT core: add should_wait_for_stack() callback
Allow plugins to give up when waiting for a stack to become available.
LITMUS^RT core: add next_became_invalid() callback
LITMUS^RT core: add post-migration validation callback
LITMUS^RT core: be more careful when pull-migrating tasks
Close more race windows and give plugins a chance to validate
tasks after they have been migrated.
Add KConfig options for timer latency warnings
Add reservation creation API to plugin interface & syscalls
LITMUS^RT syscall: expose sys_reservation_create() via ioctl()
Add reservation configuration types to rt_param.h
Add basic generic reservation-based scheduling infrastructure
Switch to aligned quanta by default.
For first-time users, aligned quanta is likely what's expected.
LITMUS^RT core: keep track of time of last suspension
This information is needed to insert ST_COMPLETION records for
sporadic tasks.
add fields for clock_nanosleep() support
Need to communicate the intended wake-up time to the plugin wake-up handler.
LITMUS^RT core: add generic handler for sporadic job arrivals
In particular, check if a job arrival is triggered from a
clock_nanosleep() call.
add litmus->task_change_params() callback to plugin interface
Will be used by adaptive C-EDF.
Call litmus->task_change_params() from sys_set_rt_task_param()
Move trace point definition to litmus/litmus.c
If !CONFIG_SCHED_TASK_TRACE, but CONFIG_SCHED_LITMUS_TRACEPOINT, then
we still need to define the tracepoint structures.
This patch should be integrated with the earlier sched_task_trace.c
patches during one of the next major rebasing efforts.
LITMUS^RT scheduling class: mark enqueued task as present
Remove unistd_*.h
rebase fix: update to new hrtimer API
The new API is actually nicer and cleaner.
rebase fix: call lockdep_unpin_lock(&rq->lock, cookie)
The LITMUS^RT scheduling class should also do the LOCKDEP dance.
LITMUS^RT core: break out non-preemptive flag defs
Not every file including litmus.h needs to know this.
LITMUS^RT core: don't include debug_trace.h in litmus.h
Including debug_trace.h introduces the TRACE() macro, which causes
symbol clashes in some (rather obscure) drivers.
LITMUS^RT core: add litmus_preemption_in_progress flags
Used to communicate that a preemption is in progress. Set by the
scheduler; read by the plugins.
LITMUS^RT core: revise is_current_running() macro
Diffstat (limited to 'litmus/trace.c')
-rw-r--r-- | litmus/trace.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/litmus/trace.c b/litmus/trace.c index 7d698aac257d..0724e31a49ff 100644 --- a/litmus/trace.c +++ b/litmus/trace.c | |||
@@ -254,6 +254,19 @@ feather_callback void save_cpu_timestamp_irq(unsigned long event, | |||
254 | 0, RECORD_LOCAL_TIMESTAMP); | 254 | 0, RECORD_LOCAL_TIMESTAMP); |
255 | } | 255 | } |
256 | 256 | ||
257 | feather_callback void save_cpu_task_latency(unsigned long event, | ||
258 | unsigned long when_ptr) | ||
259 | { | ||
260 | lt_t now = litmus_clock(); | ||
261 | lt_t *when = (lt_t*) when_ptr; | ||
262 | lt_t delta = now - *when; | ||
263 | |||
264 | write_cpu_timestamp(event, TSK_RT, | ||
265 | 0, | ||
266 | 0, LOCAL_IRQ_COUNT, 0, | ||
267 | delta, DO_NOT_RECORD_TIMESTAMP); | ||
268 | } | ||
269 | |||
257 | /* Record to remote trace buffer */ | 270 | /* Record to remote trace buffer */ |
258 | feather_callback void msg_sent_to(unsigned long event, unsigned long to) | 271 | feather_callback void msg_sent_to(unsigned long event, unsigned long to) |
259 | { | 272 | { |
@@ -422,11 +435,13 @@ static int alloc_timestamp_buffer(struct ftdev* ftdev, unsigned int idx) | |||
422 | 435 | ||
423 | static void free_timestamp_buffer(struct ftdev* ftdev, unsigned int idx) | 436 | static void free_timestamp_buffer(struct ftdev* ftdev, unsigned int idx) |
424 | { | 437 | { |
438 | struct ft_buffer* tmp = ftdev->minor[idx].buf; | ||
439 | smp_rmb(); | ||
425 | ftdev->minor[idx].buf = NULL; | 440 | ftdev->minor[idx].buf = NULL; |
426 | /* Make sure all cores have actually seen buf == NULL before | 441 | /* Make sure all cores have actually seen buf == NULL before |
427 | * yanking out the mappings from underneath them. */ | 442 | * yanking out the mappings from underneath them. */ |
428 | smp_wmb(); | 443 | smp_wmb(); |
429 | free_ft_buffer(ftdev->minor[idx].buf); | 444 | free_ft_buffer(tmp); |
430 | } | 445 | } |
431 | 446 | ||
432 | static ssize_t write_timestamp_from_user(struct ft_buffer* buf, size_t len, | 447 | static ssize_t write_timestamp_from_user(struct ft_buffer* buf, size_t len, |