tools: acrn-manager: print more debug information

Print more information at acrnd_add_work(), query_state()
try_do_works() and handle_acrnd_resume()

Tracked-On: #2306
Signed-off-by: Tao Yuhong <yuhong.tao@intel.com>
Acked-by: Yan, Like <like.yan@intel.com>
This commit is contained in:
yuhong.tao@intel.com 2019-01-08 14:41:59 +00:00 committed by wenlingz
parent 8b9100b15d
commit 838d40c9c2
2 changed files with 15 additions and 4 deletions

View File

@ -75,11 +75,14 @@ static int query_state(const char *name)
req.timestamp = time(NULL);
ret = send_msg(name, &req, &ack);
if (ret)
return ret;
if (ack.data.state < 0)
if (ret) {
pdebug();
return ret;
}
if (ack.data.state < 0) {
fprintf(stderr, "%s ack.data.state:%d\n", __FUNCTION__, ack.data.state);
}
return ack.data.state;
}
@ -178,6 +181,8 @@ static void _scan_alive_vm(void)
vm->state = VM_SUSPENDED;
break;
default:
fprintf(stderr, "Warnning: unknow vm state:0x%lx\n",
vm->state);
vm->state = VM_STATE_UNKNOWN;
}
vm->update = update_count;

View File

@ -81,6 +81,8 @@ int acrnd_add_work(void (*func) (struct work_arg *arg),
pthread_mutex_lock(&work_mutex);
LIST_INSERT_HEAD(&work_head, work, list);
pthread_mutex_unlock(&work_mutex);
printf("%s added, work->expire:%lx\n", __FUNCTION__, work->expire);
return 0;
}
@ -101,6 +103,8 @@ static void try_do_works(void)
pthread_mutex_lock(&work_mutex);
list_foreach_safe(work, &work_head, list, twork) {
if (current >= work->expire) {
printf("Run expired work(%lu), current time(%lu)\n",
work->expire, current);
work->func(&work->arg);
LIST_REMOVE(work, list);
free(work);
@ -582,11 +586,13 @@ void handle_acrnd_resume(struct mngr_msg *msg, int client_fd, void *param)
wakeup_reason = get_sos_wakeup_reason();
if (wakeup_reason & CBC_WK_RSN_RTC) {
printf("Resumed UOS, by RTC timer, reason(%x)!\n", wakeup_reason);
/* wakeup by RTC timer */
if (!stat(ACRN_CONF_TIMER_LIST, &st)
&& S_ISREG(st.st_mode)) {
ack.data.err = load_timer_list();
if (ack.data.err == 0) {
printf("Resumed UOS by RTC timer, try do works!\n");
/* load timers successfully */
try_do_works();
goto reply_ack;