clv: Change no_preempt from int to ihk_atomic_t.
Fix the issue where the value of no_preempt gets unexpected value (-1, 1, 2 etc.) after process ends when running the UTI tests. Change-Id: I7d9c08b754a171ea3fdec20ab2e635df3b607cbd
This commit is contained in:
committed by
Masamichi Takagi
parent
1070387ed2
commit
eba2131f34
10
kernel/cls.c
10
kernel/cls.c
@@ -66,15 +66,15 @@ void preempt_enable(void)
|
|||||||
{
|
{
|
||||||
#ifndef ENABLE_FUGAKU_HACKS
|
#ifndef ENABLE_FUGAKU_HACKS
|
||||||
if (cpu_local_var_initialized)
|
if (cpu_local_var_initialized)
|
||||||
--cpu_local_var(no_preempt);
|
ihk_atomic_dec(&cpu_local_var(no_preempt));
|
||||||
#else
|
#else
|
||||||
if (cpu_local_var_initialized) {
|
if (cpu_local_var_initialized) {
|
||||||
--cpu_local_var(no_preempt);
|
ihk_atomic_dec(&cpu_local_var(no_preempt));
|
||||||
|
|
||||||
if (cpu_local_var(no_preempt) < 0) {
|
if (ihk_atomic_read(&cpu_local_var(no_preempt)) < 0) {
|
||||||
//cpu_disable_interrupt();
|
//cpu_disable_interrupt();
|
||||||
|
|
||||||
__kprintf("%s: %d\n", __func__, cpu_local_var(no_preempt));
|
__kprintf("%s: %d\n", __func__, ihk_atomic_read(&cpu_local_var(no_preempt)));
|
||||||
__kprintf("TID: %d, call stack from builtin frame (most recent first):\n",
|
__kprintf("TID: %d, call stack from builtin frame (most recent first):\n",
|
||||||
cpu_local_var(current)->tid);
|
cpu_local_var(current)->tid);
|
||||||
__show_context_stack(cpu_local_var(current), (uintptr_t)&preempt_enable,
|
__show_context_stack(cpu_local_var(current), (uintptr_t)&preempt_enable,
|
||||||
@@ -93,7 +93,7 @@ void preempt_enable(void)
|
|||||||
void preempt_disable(void)
|
void preempt_disable(void)
|
||||||
{
|
{
|
||||||
if (cpu_local_var_initialized) {
|
if (cpu_local_var_initialized) {
|
||||||
++cpu_local_var(no_preempt);
|
ihk_atomic_inc(&cpu_local_var(no_preempt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ struct cpu_local_var {
|
|||||||
struct list_head migq;
|
struct list_head migq;
|
||||||
int in_interrupt;
|
int in_interrupt;
|
||||||
int in_page_fault;
|
int in_page_fault;
|
||||||
int no_preempt;
|
ihk_atomic_t no_preempt;
|
||||||
int timer_enabled;
|
int timer_enabled;
|
||||||
unsigned long nr_ctx_switches;
|
unsigned long nr_ctx_switches;
|
||||||
int kmalloc_initialized;
|
int kmalloc_initialized;
|
||||||
|
|||||||
@@ -19,8 +19,10 @@
|
|||||||
|
|
||||||
#define kmalloc(size, flag) ({\
|
#define kmalloc(size, flag) ({\
|
||||||
void *r = _kmalloc(size, flag, __FILE__, __LINE__);\
|
void *r = _kmalloc(size, flag, __FILE__, __LINE__);\
|
||||||
if(r == NULL){\
|
if (r == NULL) {\
|
||||||
kprintf("kmalloc: out of memory %s:%d no_preempt=%d\n", __FILE__, __LINE__, cpu_local_var(no_preempt)); \
|
kprintf("kmalloc: out of memory %s:%d no_preempt=%d\n", \
|
||||||
|
__FILE__, __LINE__, \
|
||||||
|
ihk_atomic_read(&cpu_local_var(no_preempt))); \
|
||||||
}\
|
}\
|
||||||
r;\
|
r;\
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3726,9 +3726,9 @@ void schedule(void)
|
|||||||
int prevpid;
|
int prevpid;
|
||||||
unsigned long irqstate = 0;
|
unsigned long irqstate = 0;
|
||||||
|
|
||||||
if (cpu_local_var(no_preempt)) {
|
if (ihk_atomic_read(&cpu_local_var(no_preempt))) {
|
||||||
kprintf("%s: WARNING can't schedule() while no preemption, cnt: %d\n",
|
kprintf("%s: WARNING can't schedule() while no preemption, cnt: %d\n",
|
||||||
__func__, cpu_local_var(no_preempt));
|
__func__, ihk_atomic_read(&cpu_local_var(no_preempt)));
|
||||||
|
|
||||||
irqstate = cpu_disable_interrupt_save();
|
irqstate = cpu_disable_interrupt_save();
|
||||||
ihk_mc_spinlock_lock_noirq(
|
ihk_mc_spinlock_lock_noirq(
|
||||||
|
|||||||
@@ -260,7 +260,8 @@ long do_syscall(struct syscall_request *req, int cpu)
|
|||||||
cpu_pause();
|
cpu_pause();
|
||||||
|
|
||||||
/* Spin if not preemptable */
|
/* Spin if not preemptable */
|
||||||
if (cpu_local_var(no_preempt) || !thread->tid) {
|
if (ihk_atomic_read(&cpu_local_var(no_preempt))
|
||||||
|
|| !thread->tid) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user