Received: from eggs.gnu.org ([2001:4830:134:3::10]:48917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnPiw-0004e9-NG for qemu-devel@nongnu.org; Mon, 02 Dec 2013 04:23:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnPip-0003VQ-Ry for qemu-devel@nongnu.org; Mon, 02 Dec 2013 04:23:26 -0500 Received: from mail-lb0-x22c.google.com ([2a00:1450:4010:c04::22c]:62810) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnPip-0003RZ-8Y for qemu-devel@nongnu.org; Mon, 02 Dec 2013 04:23:19 -0500 Received: by mail-lb0-f172.google.com with SMTP id z5so8387950lbh.3 for ; Mon, 02 Dec 2013 01:23:18 -0800 (PST) Received: from dhcp-10-30-23-32.sw.ru (swsoft-msk-nat.sw.ru. [195.214.232.10]) by mx.google.com with ESMTPSA id ld10sm8917612lab.8.2013.12.02.01.23.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Dec 2013 01:23:16 -0800 (PST) From: Anna Melekhova Content-Type: multipart/alternative; boundary="Apple-Mail=_3B04D676-D733-4970-ABA8-FC219EA5C808" Date: Mon, 2 Dec 2013 13:23:22 +0400 References: <42922F24-BE5C-47F8-B5C3-C8D3D6268D91@gmail.com> Message-Id: Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Subject: [Qemu-devel] debugging TARGET_HAS_PRECISE_SMC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "qemu-devel@nongnu.org" --Apple-Mail=_3B04D676-D733-4970-ABA8-FC219EA5C808 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Dear Sirs, Please could you advice me a technique to debug an erroneous self-code = modification handling? Installing a guest Windows 7 x64 in qemu w/o KVM causes BSOD. I've found = out that forcing EndOfBlock after each XOR instruction in Zero Page = Thread code + disabled TARGET_HAS_PRECISE_SMC helps. Zero Page Thread is = a guest Windows kernel thread that zeroes pages.=20 Please let me know if you'd have any ideas. -Anna- Begin forwarded message: > From: Anna Melekhova > Subject: a bug in qemu-retranslator with Windows7 x64 Zero Page Thread > Date: 20 =D0=BD=D0=BE=D1=8F=D0=B1=D1=80=D1=8F 2013 =D0=B3., 19:28:04 = GMT+04:00 > To: qemu-devel@nongnu.org >=20 > Dear Sirs, >=20 > I've run into a curious bug in qemu retranslator that looks like a = code self-modification from Zero Page Thread. >=20 > Test case:=20 > Win7 x64 on installation while running w/o KVM gives a BSOD. 45/45 - = 100% reproduction. I've tried to analyze dumps but it is installation = stage and qemu has some troubles with serial debugging (i've failed to = press F8 for choosing debug mode in the target moment) >=20 > Workaround: > I've tried to localize the issue and finally got this suspicious = workaround. > My hack is to interrupt block creation for XORs in ZPT (zero page = thread of Windows kernel) while TARGET_HAS_PRECISE_SMC is turned off. By = "Interrupt block creation" I mean inserting gen_eob for all XORs in ZPT. = ZPT contains a number of XORs that aimed to null a target page. Code = looks like "lock xor [rcx], rdx; xor [rcx+8], rdx; xor [rcx + 16], rdx; = ..". If 2 XORs are in one block, Windows BSODs. If I enable = TARGET_HAS_PRECISE_SMC it doesn't work either.=20 >=20 > It is the second bug I found during installation - the first one with = CR4_DE and I'll send patch later. But now I am really curious about your = suggestions. I am not that good in debugging qemu retranslated code and = I'll be grateful for any tips regarding it. >=20 > Best regards, > Anna --Apple-Mail=_3B04D676-D733-4970-ABA8-FC219EA5C808 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
From: Anna Melekhova = <ann.melekhova@gmail.com>
Subject: a bug in qemu-retranslator with Windows7 x64 Zero = Page Thread
Date: 20 =D0=BD=D0=BE=D1=8F=D0=B1=D1=80=D1=8F = 2013 =D0=B3., 19:28:04 GMT+04:00

Dear Sirs,

I've run into a curious bug in qemu = retranslator that looks like a code self-modification from Zero Page = Thread.

Test case:
Win7 x64 on installation while running w/o = KVM gives a BSOD. 45/45 - 100% reproduction. I've tried to analyze dumps = but it is installation stage and qemu has some troubles with serial = debugging (i've failed to press F8 for choosing debug mode in the target = moment)

Workaround:
I've tried to localize the issue and = finally got this suspicious workaround.
My hack is to interrupt block = creation for XORs in ZPT (zero page thread of Windows kernel) while = TARGET_HAS_PRECISE_SMC is turned off. By "Interrupt block creation" I = mean inserting gen_eob for all XORs in ZPT. ZPT contains a number of = XORs that aimed to null a target page. Code looks like "lock xor [rcx], = rdx; xor [rcx+8], rdx; xor [rcx + 16], rdx; ..". If 2 XORs are in one = block, Windows BSODs. If I enable TARGET_HAS_PRECISE_SMC it doesn't work = either.

It is the second bug I found during installation - the = first one with CR4_DE and I'll send patch later. But now I am really = curious about your suggestions. I am not that good in debugging qemu = retranslated code and I'll be grateful for any tips regarding = it.

Best = regards,
Anna

= --Apple-Mail=_3B04D676-D733-4970-ABA8-FC219EA5C808--