From d5b35aa785f54d5cfd204edd01f27b85e540adf6 Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Mon, 18 Mar 2019 12:10:15 +0800 Subject: [PATCH] acrn-dm: revert the change which apply realtime schedule to vcpu0 Applying realtime scheduler to vcpu0 thread could trigger stability issue. So revert it here. Tracked-On: #2717 Signed-off-by: Yin Fengwei --- devicemodel/core/main.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index 9fcc4ec02..cebe7d9d3 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -252,37 +252,6 @@ high_bios_size(void) return roundup2(size, 2 * MB); } -static void -adjust_schedule_policy(int policy, int prio) -{ - char tid_str[MAXLOGNAME]; - ssize_t written; - int error, cg_task_fd; - struct sched_param sched_param; - - error = snprintf(tid_str, MAXLOGNAME, "%ld", syscall(SYS_gettid)); - if (error >= MAXLOGNAME) { - fprintf(stderr, "tid string overflow\r\n"); - return; - } - - cg_task_fd = open("/sys/fs/cgroup/cpu/tasks", O_RDWR); - if (cg_task_fd > 0) { - written = write(cg_task_fd, tid_str, strnlen(tid_str, MAXLOGNAME)); - if (written < 0) { - fprintf(stderr, "can't add thread%s to cgroup\r\n", tid_str); - } - } else { - fprintf(stderr, "can't open cgroup task file\r\n"); - } - - sched_param.sched_priority = prio; - error = pthread_setschedparam(pthread_self(), policy, &sched_param); - if (error != 0) { - fprintf(stderr, "set vm_loop to SCHED_FIFO failed\r\n"); - } -} - static void * start_thread(void *param) { @@ -296,8 +265,6 @@ start_thread(void *param) snprintf(tname, sizeof(tname), "vcpu %d", vcpu); pthread_setname_np(mtp->mt_thr, tname); - adjust_schedule_policy(SCHED_FIFO, 10); - vm_loop(mtp->mt_ctx); /* reset or halt */