Received: from eggs.gnu.org ([2001:4830:134:3::10]:54373) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKNyA-0001EY-Lr for qemu-devel@nongnu.org; Fri, 13 Sep 2013 03:39:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKNy6-0000CD-Bc for qemu-devel@nongnu.org; Fri, 13 Sep 2013 03:39:10 -0400 Received: from wanbli.kerneis.info ([2001:41d0:8:38ad::1]:47105) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKNy6-0000Bm-2G for qemu-devel@nongnu.org; Fri, 13 Sep 2013 03:39:06 -0400 Received: from [176.254.216.29] (helo=wacehi.kerneis.info) by wanbli.kerneis.info with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1VKNxz-0006Fp-4Q for qemu-devel@nongnu.org; Fri, 13 Sep 2013 07:38:59 +0000 Received: from gabriel by wacehi.kerneis.info with local (Exim 4.80) (envelope-from ) id 1VKNxy-0001BR-1C for qemu-devel@nongnu.org; Fri, 13 Sep 2013 08:38:58 +0100 Date: Fri, 13 Sep 2013 08:38:58 +0100 From: Gabriel Kerneis Message-ID: <20130913073857.GB4374@kerneis.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] Tracking down a bug in CIL + tcg + kernel >= 3.2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Dear all, I am using CIL [1] to compile QEMU. CIL is a wrapper around gcc which can be used to analyse C code. As explained recently on this list, the ultimate goal is to check coroutine_fn annotations statically [2]. When CIL compiles C code, it performs a number of simplifications, which are supposed to preserve behaviour. As a matter of fact, CIL processes the whole of QEMU (all backends), gcc does not complain (with --disable-warn-error), and "make check" completes successfully. But I'm nonetheless hitting a bug in CIL simplifications and I have a hard time tracking it down. [1] http://kerneis.github.io/cil/ [2] https://github.com/kerneis/corocheck When I try to boot a "recent" Debian kernel (>= 3.2) with -machine accel=tcg, I get the following kernel panic: ------------[ cut here ]------------ WARNING: at /build/buildd-linux_3.2.41-2-amd64-Wvc92F/linux-3.2.4 1/kernel/rcutree.c:2052 rcu_scheduler_starting+0x27/0x4e() Hardware name: Bochs Modules linked in: Pid: 0, comm: swapper/0 Not tainted 3.2.0-4-amd64 #1 Debian 3.2.4 1-2 Call Trace: nabled. [] ? warn_slowpath_common+0x78/0x8c [] ? rcu_scheduler_starting+0x27/0x4e [] ? rest_init+0x6/0x6b [] ? start_kernel+0x3b8/0x3c3 [] ? early_idt_handlers+0x140/0x140 [] ? x86_64_start_kernel+0x104/0x111 ---[ end trace 9a2513986472a43d ]--- Older kernels (2.6.32) boot fine. Recent kernels with KVM boot fine. Compiling with gcc (of course) boots fine. So CIL introduces a bug in TCG which prevents >= 3.2 kernels from booting with the above error message, but I have absolutely no clue which files of QEMU's code might be involved. Does that ring a bell? It would help me tremendously if someone could point me at a specific file (or, even better, function) that I could analyse by hand to look for unsound simplifications. Many thanks, -- Gabriel