mcreboot: -h to indicate halting CPU in idle threads (e.g., in futex_wait())
This commit is contained in:
@@ -44,8 +44,9 @@ fi
|
|||||||
turbo=""
|
turbo=""
|
||||||
ihk_irq=""
|
ihk_irq=""
|
||||||
umask_old=`umask`
|
umask_old=`umask`
|
||||||
|
idle_halt=""
|
||||||
|
|
||||||
while getopts :tk:c:m:o:f:r:q:i:d:e: OPT
|
while getopts :tk:c:m:o:f:r:q:i:d:e:h OPT
|
||||||
do
|
do
|
||||||
case ${OPT} in
|
case ${OPT} in
|
||||||
f) facility=${OPTARG}
|
f) facility=${OPTARG}
|
||||||
@@ -70,6 +71,8 @@ do
|
|||||||
;;
|
;;
|
||||||
i) mon_interval=${OPTARG}
|
i) mon_interval=${OPTARG}
|
||||||
;;
|
;;
|
||||||
|
h) idle_halt="idle_halt"
|
||||||
|
;;
|
||||||
*) echo "invalid option -${OPT}" >&2
|
*) echo "invalid option -${OPT}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
esac
|
esac
|
||||||
@@ -408,7 +411,7 @@ if ! ${SBINDIR}/ihkosctl 0 load ${KERNDIR}/mckernel.img; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set kernel arguments
|
# Set kernel arguments
|
||||||
if ! ${SBINDIR}/ihkosctl 0 kargs "hidos $turbo dump_level=${DUMP_LEVEL} $extra_kopts"; then
|
if ! ${SBINDIR}/ihkosctl 0 kargs "hidos $turbo $idle_halt dump_level=${DUMP_LEVEL} $extra_kopts"; then
|
||||||
echo "error: setting kernel arguments" >&2
|
echo "error: setting kernel arguments" >&2
|
||||||
error_exit "os_created"
|
error_exit "os_created"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -673,9 +673,11 @@ static uint64_t futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q
|
|||||||
xchg4(&(cpu_local_var(current)->status), PS_INTERRUPTIBLE);
|
xchg4(&(cpu_local_var(current)->status), PS_INTERRUPTIBLE);
|
||||||
|
|
||||||
/* Indicate spin sleep */
|
/* Indicate spin sleep */
|
||||||
irqstate = ihk_mc_spinlock_lock(&thread->spin_sleep_lock);
|
if (!idle_halt) {
|
||||||
thread->spin_sleep = 1;
|
irqstate = ihk_mc_spinlock_lock(&thread->spin_sleep_lock);
|
||||||
ihk_mc_spinlock_unlock(&thread->spin_sleep_lock, irqstate);
|
thread->spin_sleep = 1;
|
||||||
|
ihk_mc_spinlock_unlock(&thread->spin_sleep_lock, irqstate);
|
||||||
|
}
|
||||||
|
|
||||||
queue_me(q, hb);
|
queue_me(q, hb);
|
||||||
|
|
||||||
|
|||||||
@@ -277,6 +277,7 @@ struct resource_set {
|
|||||||
|
|
||||||
extern struct list_head resource_set_list;
|
extern struct list_head resource_set_list;
|
||||||
extern mcs_rwlock_lock_t resource_set_lock;
|
extern mcs_rwlock_lock_t resource_set_lock;
|
||||||
|
extern int idle_halt;
|
||||||
|
|
||||||
struct process_hash {
|
struct process_hash {
|
||||||
struct list_head list[HASH_SIZE];
|
struct list_head list[HASH_SIZE];
|
||||||
|
|||||||
@@ -144,6 +144,12 @@ static void parse_kargs(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ihk_mc_set_dump_level(dump_level);
|
ihk_mc_set_dump_level(dump_level);
|
||||||
|
|
||||||
|
/* idle_halt option */
|
||||||
|
ptr = find_command_line("idle_halt");
|
||||||
|
if (ptr) {
|
||||||
|
idle_halt = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void ihk_mc_get_boot_time(unsigned long *tv_sec, unsigned long *tv_nsec);
|
extern void ihk_mc_get_boot_time(unsigned long *tv_sec, unsigned long *tv_nsec);
|
||||||
|
|||||||
@@ -100,6 +100,8 @@ extern void perf_reset(struct mc_perf_event *event);
|
|||||||
struct list_head resource_set_list;
|
struct list_head resource_set_list;
|
||||||
mcs_rwlock_lock_t resource_set_lock;
|
mcs_rwlock_lock_t resource_set_lock;
|
||||||
|
|
||||||
|
int idle_halt = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
init_process(struct process *proc, struct process *parent)
|
init_process(struct process *proc, struct process *parent)
|
||||||
{
|
{
|
||||||
@@ -3044,6 +3046,12 @@ void spin_sleep_or_schedule(void)
|
|||||||
int woken = 0;
|
int woken = 0;
|
||||||
long irqstate;
|
long irqstate;
|
||||||
|
|
||||||
|
/* Spinning disabled explicitly */
|
||||||
|
if (idle_halt) {
|
||||||
|
dkprintf("%s: idle_halt -> schedule()\n", __FUNCTION__);
|
||||||
|
goto out_schedule;
|
||||||
|
}
|
||||||
|
|
||||||
/* Try to spin sleep */
|
/* Try to spin sleep */
|
||||||
irqstate = ihk_mc_spinlock_lock(&thread->spin_sleep_lock);
|
irqstate = ihk_mc_spinlock_lock(&thread->spin_sleep_lock);
|
||||||
if (thread->spin_sleep == 0) {
|
if (thread->spin_sleep == 0) {
|
||||||
@@ -3092,6 +3100,7 @@ void spin_sleep_or_schedule(void)
|
|||||||
cpu_pause();
|
cpu_pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out_schedule:
|
||||||
schedule();
|
schedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user