From: Andreas Sandberg Date: Mon, 3 Jun 2013 11:38:59 +0000 (+0200) Subject: kvm: Add handling of EAGAIN when creating timers X-Git-Tag: stable_2013_10_14~70 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=15f81b6ed9a2bc9821c90a4058b7b528e001a10f;p=gem5.git kvm: Add handling of EAGAIN when creating timers timer_create can apparently return -1 and set errno to EAGAIN if the kernel suffered a temporary failure when allocating a timer. This happens from time to time, so we need to handle it. --- diff --git a/src/cpu/kvm/timer.cc b/src/cpu/kvm/timer.cc index e1f74a552..03cdea6fb 100644 --- a/src/cpu/kvm/timer.cc +++ b/src/cpu/kvm/timer.cc @@ -59,8 +59,11 @@ PosixKvmTimer::PosixKvmTimer(int signo, clockid_t clockID, sev.sigev_notify = SIGEV_SIGNAL; sev.sigev_signo = signo; sev.sigev_value.sival_ptr = NULL; - if (timer_create(clockID, &sev, &timer) == -1) - panic("timer_create"); + + while (timer_create(clockID, &sev, &timer) == -1) { + if (errno != EAGAIN) + panic("timer_create: %i", errno); + } } PosixKvmTimer::~PosixKvmTimer()