From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cK07s-0000D1-Kz for qemu-devel@nongnu.org; Thu, 22 Dec 2016 04:57:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cK07p-0006dJ-JO for qemu-devel@nongnu.org; Thu, 22 Dec 2016 04:57:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33864) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cK07p-0006cr-D8 for qemu-devel@nongnu.org; Thu, 22 Dec 2016 04:57:25 -0500 References: <85250fb0450b5b95232b39c82ab310a0632fd23f.1482164622.git.vpalatin@chromium.org> From: Paolo Bonzini Message-ID: Date: Thu, 22 Dec 2016 10:57:20 +0100 MIME-Version: 1.0 In-Reply-To: <85250fb0450b5b95232b39c82ab310a0632fd23f.1482164622.git.vpalatin@chromium.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 3/4] Plumb the HAXM-based hardware acceleration support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vincent Palatin , qemu-devel Cc: Yu Ning , Stefan Weil , "Michael S . Tsirkin" , Eduardo Habkost , Marcelo Tosatti On 19/12/2016 17:24, Vincent Palatin wrote: > #else /* _WIN32 */ > - abort(); > + if (!qemu_cpu_is_self(cpu)) { > + CONTEXT context; > + if (SuspendThread(cpu->hThread) =3D=3D (DWORD)(-1)) { > + fprintf(stderr, "qemu:%s: GetLastError:%lu\n", __func__, > + GetLastError()); > + exit(1); > + } > + > + /* On multi-core systems, we are not sure that the thread is a= ctually > + * suspended until we can get the context. > + */ > + context.ContextFlags =3D CONTEXT_CONTROL; > + while (GetThreadContext(cpu->hThread, &context) !=3D 0) { > + continue; > + } > + > + if (hax_enabled()) { > + cpu->exit_request =3D 1; > + } As mentioned in the reply to patch 4, please leave the cpu->exit_request =3D 1 assignment to the caller. Apart from the above change, can you check if there are some less heavyeight methods to force an exit? I can think of QueueUserAPC with an empty pfnAPC here, and SleepEx(0, TRUE) in qemu_hax_cpu_thread_fn before qemu_wait_io_event_common. > + if (ResumeThread(cpu->hThread) =3D=3D (DWORD)(-1)) { > + fprintf(stderr, "qemu:%s: GetLastError:%lu\n", __func__, > + GetLastError()); > + exit(1); > + } > + } [...] >=20 > + /* > + * In Hax, the qemu allocate the virtual address, and HAX = kernel > + * populate the memory with physical memory. Currently we = have no > + * paging, so user should make sure enough free memory in = advance > + */ > + if (hax_enabled()) { > + int ret; > + ret =3D hax_populate_ram((uint64_t)(uintptr_t)new_bloc= k->host, > + new_block->max_length); > + if (ret < 0) { > + error_setg(errp, "Hax failed to populate ram"); > + return; > + } > + } > + Can you check if the interface at http://marc.info/?l=3Dqemu-devel&m=3D148225154320642&q=3Draw would be goo= d for your purposes, and if so include that patch in your v6? Otherwise looks great, so I'm confident we can add this in QEMU 2.9. Paolo