From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FaP1D-0006jn-IB for qemu-devel@nongnu.org; Sun, 30 Apr 2006 23:24:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FaP19-0006e8-Vy for qemu-devel@nongnu.org; Sun, 30 Apr 2006 23:24:15 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FaP19-0006e3-QF for qemu-devel@nongnu.org; Sun, 30 Apr 2006 23:24:11 -0400 Received: from [64.233.162.200] (helo=nz-out-0102.google.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FaP4s-0000pT-Of for qemu-devel@nongnu.org; Sun, 30 Apr 2006 23:28:02 -0400 Received: by nz-out-0102.google.com with SMTP id o1so2306935nzf for ; Sun, 30 Apr 2006 20:24:10 -0700 (PDT) Message-ID: Date: Sun, 30 Apr 2006 20:24:10 -0700 From: "Ed Swierk" Sender: eswierk@gmail.com MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_8996_13251693.1146453850745" Subject: [Qemu-devel] [PATCH] Fix qemu hang when i386 Linux host resumes from suspend Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org ------=_Part_8996_13251693.1146453850745 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: base64 Content-Disposition: inline cWVtdSBoYW5ncyB3aGVuIGFuIGkzODYgTGludXggaG9zdCByZXN1bWVzIGZyb20gc3VzcGVuZCAo c3dzdXNwMiksCmJlY2F1c2UgdGhlIGhvc3QncyBUU0MgaXMgcmVzZXQgdG8gYSB2YWx1ZSBsb3dl ciB0aGFuIGl0IHdhcyBiZWZvcmUKdGhlIHN1c3BlbmQuCgpBbHRob3VnaCB0aGlzIGlzIGEgYnVn IGluIHRoZSBob3N0IE9TLCB0aGUgYXR0YWNoZWQgcGF0Y2ggKG9yaWdpbmFsbHkKZnJvbSBKb2hu IENvaW5lcikgaXMgc2ltcGxlIGFuZCBtYWtlcyBxZW11IG1vcmUgcmVzaWxpZW50IHRvIHdlaXJk Cmhvc3QgdGljayBjb3VudGVyIGJlaGF2aW9yLgoKLS1FZAo= ------=_Part_8996_13251693.1146453850745 Content-Type: text/x-patch; name=qemu-nondecreasing-ticks.patch; charset=us-ascii Content-Transfer-Encoding: 7bit X-Attachment-Id: f_emo904da Content-Disposition: attachment; filename="qemu-nondecreasing-ticks.patch" diff -BurN qemu-snapshot-2006-03-27_23.orig/vl.c qemu-snapshot-2006-03-27_23/vl.c --- qemu-snapshot-2006-03-27_23.orig/vl.c 2006-04-01 18:38:27.000000000 +0000 +++ qemu-snapshot-2006-03-27_23/vl.c 2006-04-01 18:41:36.000000000 +0000 @@ -579,14 +579,21 @@ #error unsupported CPU #endif -static int64_t cpu_ticks_offset; -static int cpu_ticks_enabled; +static int64_t cpu_ticks_prev; +static int64_t cpu_ticks_offset; +static int cpu_ticks_enabled; static inline int64_t cpu_get_ticks(void) { if (!cpu_ticks_enabled) { return cpu_ticks_offset; } else { + int64_t ticks; + ticks = cpu_get_real_ticks(); + if (cpu_ticks_prev > ticks) { + cpu_ticks_offset += cpu_ticks_prev - ticks; + } + cpu_ticks_prev = ticks; - return cpu_get_real_ticks() + cpu_ticks_offset; + return ticks + cpu_ticks_offset; } } ------=_Part_8996_13251693.1146453850745--