Commit 8dd99413 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

evl/thread: track count of remote wakeups



Having to trigger a rescheduling on a remote CPU for waking up an EVL
thread may be the sign of a misconfiguration.

Track the number of times this happens on a per-thread basis and
export this information via /sysfs and EVL_THRIOC_GET_STATE.
Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <rpm@xenomai.org>
parent f93d495f
......@@ -119,6 +119,7 @@ struct evl_thread {
struct evl_counter isw; /* in-band switches */
struct evl_counter csw; /* context switches */
struct evl_counter sc; /* OOB syscalls */
struct evl_counter rwa; /* remote wakeups */
struct evl_counter pf; /* Number of page faults */
struct evl_account account; /* Execution time accounting entity */
struct evl_account lastperiod; /* Interval marker for execution time reports */
......
......@@ -10,7 +10,7 @@
#include <linux/types.h>
#include <uapi/evl/sched.h>
#define EVL_ABI_LEVEL 9
#define EVL_ABI_LEVEL 10
#define EVL_CONTROL_DEV "/dev/evl/control"
......
......@@ -87,6 +87,7 @@ struct evl_thread_state {
__u32 isw;
__u32 csw;
__u32 sc;
__u32 rwa;
__u64 xtime;
};
......
......@@ -546,6 +546,8 @@ bool evl_wakeup_thread(struct evl_thread *thread, int mask, int info)
evl_enqueue_thread(thread);
thread->state |= T_READY;
evl_set_resched(rq);
if (rq != this_evl_rq())
evl_inc_counter(&thread->stat.rwa);
}
}
......@@ -645,6 +647,8 @@ void evl_release_thread(struct evl_thread *thread, int mask, int info)
ready:
thread->state |= T_READY;
evl_set_resched(rq);
if (rq != this_evl_rq())
evl_inc_counter(&thread->stat.rwa);
out:
xnlock_put_irqrestore(&nklock, flags);
......@@ -2019,6 +2023,7 @@ void evl_get_thread_state(struct evl_thread *thread,
statebuf->isw = evl_get_counter(&thread->stat.isw);
statebuf->csw = evl_get_counter(&thread->stat.csw);
statebuf->sc = evl_get_counter(&thread->stat.sc);
statebuf->rwa = evl_get_counter(&thread->stat.rwa);
statebuf->xtime = ktime_to_ns(evl_get_account_total(
&thread->stat.account));
xnlock_put_irqrestore(&nklock, flags);
......@@ -2417,10 +2422,11 @@ static ssize_t stats_show(struct device *dev,
} else
usage = 0;
ret = snprintf(buf, PAGE_SIZE, "%lu %lu %lu %Lu %d\n",
ret = snprintf(buf, PAGE_SIZE, "%lu %lu %lu %lu %Lu %d\n",
thread->stat.isw.counter,
thread->stat.csw.counter,
thread->stat.sc.counter,
thread->stat.rwa.counter,
ktime_to_ns(thread->stat.account.total),
usage);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment