Commit bc761d8c authored by Philippe Gerum's avatar Philippe Gerum
Browse files

cobalt/kernel: distinguish u/k/i latencies in Kconfig

parent 9bb68d39
......@@ -173,19 +173,6 @@ config XENO_OPT_AUTOTUNE
adjusting the core timing services to the intrinsic latency of
the platform.
config XENO_OPT_TIMING_SCHEDLAT
int "Scheduling latency (ns)"
default 0
help
Scheduling latency is the time between the termination of an
interrupt handler and the execution of the first instruction
of the real-time thread this handler resumes. A default value
of 0 (recommended) will cause a pre-calibrated value to be
used.
If the auto-tuner is enabled, this value will be used as the
factory default when running "autotune --reset".
config XENO_OPT_SCALABLE_SCHED
bool "O(1) scheduler"
help
......@@ -344,6 +331,53 @@ config XENO_OPT_DEBUG_TRACE_LOGSZ
endmenu
menu "Latency settings"
config XENO_OPT_TIMING_SCHEDLAT
int "User scheduling latency (ns)"
default 0
help
The user scheduling latency is the time between the
termination of an interrupt handler and the execution of the
first instruction of the real-time application thread this
handler resumes. A default value of 0 (recommended) will cause
a pre-calibrated value to be used.
If the auto-tuner is enabled, this value will be used as the
factory default when running "autotune --reset".
config XENO_OPT_TIMING_KSCHEDLAT
int "Intra-kernel scheduling latency (ns)"
default 0
help
The intra-kernel scheduling latency is the time between the
termination of an interrupt handler and the execution of the
first instruction of the RTDM kernel thread this handler
resumes. A default value of 0 (recommended) will cause a
pre-calibrated value to be used.
Intra-kernel latency is usually significantly lower than user
scheduling latency on MMU-enabled platforms, due to CPU cache
latency.
If the auto-tuner is enabled, this value will be used as the
factory default when running "autotune --reset".
config XENO_OPT_TIMING_IRQLAT
int "Interrupt latency (ns)"
default 0
help
The interrupt latency is the time between the occurrence of an
IRQ and the first instruction of the interrupt handler which
will service it. A default value of 0 (recommended) will cause
a pre-calibrated value to be used.
If the auto-tuner is enabled, this value will be used as the
factory default when running "autotune --reset".
endmenu
menuconfig XENO_OPT_DEBUG
depends on XENO_OPT_VFILE
bool "Debug support"
......
......@@ -22,30 +22,34 @@
#ifndef _COBALT_ARM_ASM_CALIBRATION_H
#define _COBALT_ARM_ASM_CALIBRATION_H
extern unsigned omap_rev(void);
unsigned int omap_rev(void);
#define cpu_is_omap44xx() ((omap_rev() & 0xff) == 0x44)
static inline unsigned long xnarch_get_sched_latency (void)
static inline void xnarch_get_latencies(struct xnclock_gravity *p)
{
unsigned int ulat;
#if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0
return CONFIG_XENO_OPT_TIMING_SCHEDLAT;
#else
#if defined(CONFIG_ARCH_AT91RM9200)
return 8500;
ulat = CONFIG_XENO_OPT_TIMING_SCHEDLAT;
#elif defined(CONFIG_ARCH_AT91RM9200)
ulat = 8500;
#elif defined(CONFIG_ARCH_AT91SAM9263)
return 11000;
ulat = 11000;
#elif defined(CONFIG_SOC_IMX6Q)
ulat = 6000;
#elif defined(CONFIG_ARCH_MX51)
return 5000;
ulat = 5000;
#elif defined(CONFIG_ARCH_MX53)
return 5000;
ulat = 5000;
#elif defined(CONFIG_ARCH_MX6)
return 2000;
ulat = 2000;
#elif defined(CONFIG_ARCH_OMAP)
return cpu_is_omap44xx() ? 2500 : 5000;
ulat = cpu_is_omap44xx() ? 2500 : 5000;
#else
return 9500; /* XXX sane ? */
#endif
ulat = 9500; /* XXX sane? */
#endif
p->user = xnclock_ns_to_ticks(&nkclock, ulat);
p->kernel = xnclock_ns_to_ticks(&nkclock, CONFIG_XENO_OPT_TIMING_KSCHEDLAT);
p->irq = xnclock_ns_to_ticks(&nkclock, CONFIG_XENO_OPT_TIMING_IRQLAT);
}
#endif /* !_COBALT_ARM_ASM_CALIBRATION_H */
......@@ -19,13 +19,11 @@
#ifndef _COBALT_BLACKFIN_ASM_CALIBRATION_H
#define _COBALT_BLACKFIN_ASM_CALIBRATION_H
static inline unsigned long xnarch_get_sched_latency (void)
static inline void xnarch_get_latencies(struct xnclock_gravity *p)
{
#if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0
#define __sched_latency CONFIG_XENO_OPT_TIMING_SCHEDLAT
#else
#ifdef CONFIG_BF533
#elif defined(CONFIG_BF533)
#define __sched_latency 5000
#elif defined(CONFIG_BF537)
#define __sched_latency 4800
......@@ -48,9 +46,9 @@ static inline unsigned long xnarch_get_sched_latency (void)
#else
#error "unsupported Blackfin processor"
#endif
#endif /* CONFIG_XENO_OPT_TIMING_SCHEDLAT */
return __sched_latency;
p->user = __sched_latency;
p->kernel = CONFIG_XENO_OPT_TIMING_KSCHEDLAT;
p->irq = CONFIG_XENO_OPT_TIMING_IRQLAT;
}
#undef __sched_latency
......
......@@ -19,21 +19,20 @@
#ifndef _COBALT_NIOS2_ASM_CALIBRATION_H
#define _COBALT_NIOS2_ASM_CALIBRATION_H
static inline unsigned long xnarch_get_sched_latency (void)
static inline void xnarch_get_latencies(struct xnclock_gravity *p)
{
#if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0
#define __sched_latency CONFIG_XENO_OPT_TIMING_SCHEDLAT
#else
#ifdef CONFIG_ALTERA_DE2
#elif defined(CONFIG_ALTERA_DE2)
#define __sched_latency 10000
#elif CONFIG_NEEK
#elif defined(CONFIG_NEEK)
#define __sched_latency 10000
#else
#error "unsupported NIOS2 platform"
#endif
#endif /* CONFIG_XENO_OPT_TIMING_SCHEDLAT */
return __sched_latency;
p->user = __sched_latency;
p->kernel = CONFIG_XENO_OPT_TIMING_KSCHEDLAT;
p->irq = CONFIG_XENO_OPT_TIMING_IRQLAT;
}
#undef __sched_latency
......
......@@ -22,12 +22,11 @@
#ifndef _COBALT_POWERPC_ASM_CALIBRATION_H
#define _COBALT_POWERPC_ASM_CALIBRATION_H
static inline unsigned long xnarch_get_sched_latency(void)
static inline void xnarch_get_latencies(struct xnclock_gravity *p)
{
#if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0
#define __sched_latency CONFIG_XENO_OPT_TIMING_SCHEDLAT
#else
#if defined(CONFIG_PPC_PASEMI)
#elif defined(CONFIG_PPC_PASEMI)
#define __sched_latency 1000
#elif defined(CONFIG_WALNUT)
#define __sched_latency 11000
......@@ -99,10 +98,9 @@ static inline unsigned long xnarch_get_sched_latency(void)
#define __sched_latency 4000
#endif
#endif
#endif /* CONFIG_XENO_OPT_TIMING_SCHEDLAT */
return __sched_latency;
p->user = xnclock_ns_to_ticks(&nkclock, __sched_latency);
p->kernel = xnclock_ns_to_ticks(&nkclock, CONFIG_XENO_OPT_TIMING_KSCHEDLAT);
p->irq = xnclock_ns_to_ticks(&nkclock, CONFIG_XENO_OPT_TIMING_IRQLAT);
}
#undef __sched_latency
......
......@@ -19,19 +19,18 @@
#ifndef _COBALT_SH_ASM_CALIBRATION_H
#define _COBALT_SH_ASM_CALIBRATION_H
static inline unsigned long xnarch_get_sched_latency (void)
static inline void xnarch_get_latencies(struct xnclock_gravity *p)
{
#if CONFIG_XENO_OPT_TIMING_SCHEDLAT != 0
#define __sched_latency CONFIG_XENO_OPT_TIMING_SCHEDLAT
#else
#ifdef CONFIG_SH_ST_MB442
#elif defined(CONFIG_SH_ST_MB442)
#define __sched_latency 5000
#else
#define __sched_latency 7000
#endif
#endif /* CONFIG_XENO_OPT_TIMING_SCHEDLAT */
return __sched_latency;
p->user = __sched_latency;
p->kernel = CONFIG_XENO_OPT_TIMING_KSCHEDLAT;
p->irq = CONFIG_XENO_OPT_TIMING_IRQLAT;
}
#undef __sched_latency
......
......@@ -21,7 +21,12 @@
#include <asm/processor.h>
static inline unsigned long xnarch_get_sched_latency (void)
static inline unsigned long __get_bogomips(void)
{
return this_cpu_read(cpu_info.loops_per_jiffy)/(500000/HZ);
}
static inline void xnarch_get_latencies(struct xnclock_gravity *p)
{
unsigned long sched_latency;
......@@ -48,19 +53,18 @@ static inline unsigned long xnarch_get_sched_latency (void)
sched_latency = 1000;
#endif /* !SMP */
} else {
#define __bogomips (this_cpu_read(cpu_info.loops_per_jiffy)/(500000/HZ))
sched_latency = (__bogomips < 250 ? 17000 :
__bogomips < 2500 ? 4200 :
sched_latency = (__get_bogomips() < 250 ? 17000 :
__get_bogomips() < 2500 ? 4200 :
3500);
#undef __bogomips
#ifdef CONFIG_SMP
sched_latency += 1000;
#endif /* CONFIG_SMP */
}
#endif /* !CONFIG_XENO_OPT_TIMING_SCHEDLAT */
return sched_latency;
p->user = sched_latency;
p->kernel = CONFIG_XENO_OPT_TIMING_KSCHEDLAT;
p->irq = CONFIG_XENO_OPT_TIMING_IRQLAT;
}
#endif /* !_COBALT_X86_ASM_CALIBRATION_H */
......@@ -786,12 +786,14 @@ static int set_core_clock_gravity(struct xnclock *clock,
static void reset_core_clock_gravity(struct xnclock *clock)
{
xnticks_t schedlat = xnarch_get_sched_latency();
struct xnclock_gravity gravity;
gravity.user = xnclock_ns_to_ticks(&nkclock, schedlat) + nktimerlat;
gravity.kernel = gravity.user;
gravity.irq = nktimerlat;
xnarch_get_latencies(&gravity);
gravity.user += nktimerlat;
if (gravity.kernel == 0)
gravity.kernel = gravity.user;
if (gravity.irq == 0)
gravity.irq = nktimerlat;
set_core_clock_gravity(clock, &gravity);
}
......
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