From patchwork Fri Oct 7 13:46:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 679270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sr9ys467Qz9sCZ for ; Sat, 8 Oct 2016 00:55:49 +1100 (AEDT) Received: from localhost ([::1]:35850 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsVco-0001A8-5F for incoming@patchwork.ozlabs.org; Fri, 07 Oct 2016 09:55:46 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37561) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsVTx-00020h-Hz for qemu-devel@nongnu.org; Fri, 07 Oct 2016 09:46:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsVTs-0006P8-IP for qemu-devel@nongnu.org; Fri, 07 Oct 2016 09:46:37 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:57735) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsVTs-0006O4-6D for qemu-devel@nongnu.org; Fri, 07 Oct 2016 09:46:32 -0400 Received: from gw-3.ac.upc.es (gw-3.ac.upc.es [147.83.30.9]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id u97DkSF0011637; Fri, 7 Oct 2016 15:46:28 +0200 Received: from localhost (unknown [84.88.51.85]) by gw-3.ac.upc.es (Postfix) with ESMTPSA id EF7BA7F4; Fri, 7 Oct 2016 15:46:27 +0200 (CEST) From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= To: Peter Maydell References: <1475834979-4980-1-git-send-email-stefanha@redhat.com> Mail-Followup-To: Peter Maydell , Stefan Hajnoczi , QEMU Developers Date: Fri, 07 Oct 2016 15:46:27 +0200 In-Reply-To: (Peter Maydell's message of "Fri, 7 Oct 2016 14:22:38 +0100") Message-ID: <87y420l1ak.fsf@fimbulvetr.bsc.es> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Subject: Re: [Qemu-devel] [PULL 00/20] Tracing patches X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Developers , Stefan Hajnoczi Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Peter Maydell writes: > On 7 October 2016 at 11:09, Stefan Hajnoczi wrote: >> The following changes since commit e902754e3d0890945ddcc1b33748ed73762ddb8d: >> >> Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.8-20161006' into staging (2016-10-06 13:34:00 +0100) >> >> are available in the git repository at: >> >> git://github.com/stefanha/qemu.git tags/tracing-pull-request >> >> for you to fetch changes up to bcdc1363dcb9adb5f7ea016a4d0b41f0357c8182: >> >> trace: Add missing execution mode of guest events (2016-10-07 09:17:49 +0100) >> >> ---------------------------------------------------------------- >> >> ---------------------------------------------------------------- > This makes all the linux-user binaries dump core on startup: > $ gdb --args /home/petmay01/linaro/qemu-for-merges/build/all-linux-static/x86_64-linux-user/qemu-x86_64 > /bin/ls > (gdb) r > Starting program: > /home/petmay01/linaro/qemu-for-merges/build/all-linux-static/x86_64-linux-user/qemu-x86_64 > /bin/ls > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". > [New Thread 0x7ffff7ffa700 (LWP 14965)] > Thread 1 "qemu-x86_64" received signal SIGABRT, Aborted. > 0x000000006019fbe8 in raise () > (gdb) bt > #0 0x000000006019fbe8 in raise () > #1 0x00000000601a030a in abort () > #2 0x00000000600bdd02 in bitmap_new (nbits=0) > at /home/petmay01/linaro/qemu-for-merges/include/qemu/bitmap.h:99 > #3 0x00000000600be99f in cpu_common_initfn (obj=0x625f6340) > at /home/petmay01/linaro/qemu-for-merges/qom/cpu.c:360 > #4 0x00000000600bfe97 in object_init_with_type (obj=0x625f6340, ti=0x625eb9a0) > at /home/petmay01/linaro/qemu-for-merges/qom/object.c:339 > #5 0x00000000600bfe79 in object_init_with_type (obj=0x625f6340, ti=0x625e2d80) > at /home/petmay01/linaro/qemu-for-merges/qom/object.c:335 > #6 0x00000000600bfe79 in object_init_with_type (obj=0x625f6340, ti=0x625e78d0) > at /home/petmay01/linaro/qemu-for-merges/qom/object.c:335 > #7 0x00000000600c00aa in object_initialize_with_type > (data=0x625f6340, size=38416, type=0x625e78d0) > at /home/petmay01/linaro/qemu-for-merges/qom/object.c:370 > #8 0x00000000600c0508 in object_new_with_type (type=0x625e78d0) > at /home/petmay01/linaro/qemu-for-merges/qom/object.c:478 > #9 0x00000000600c0542 in object_new (typename=0x625e2fe0 "qemu64-x86_64-cpu") > at /home/petmay01/linaro/qemu-for-merges/qom/object.c:488 > #10 0x00000000600be03f in cpu_generic_init (typename=0x6025ad54 > "x86_64-cpu", cpu_model=0x60247ca5 "qemu64") > at /home/petmay01/linaro/qemu-for-merges/qom/cpu.c:76 > #11 0x0000000060089438 in cpu_x86_init (cpu_model=0x60247ca5 "qemu64") > at /home/petmay01/linaro/qemu-for-merges/target-i386/cpu.c:2266 > #12 0x0000000060031031 in main (argc=2, argv=0x7fffffffe4b8, > envp=0x7fffffffe4d0) > at /home/petmay01/linaro/qemu-for-merges/linux-user/main.c:4253 Aha! I didn't take that abort into consideration during the review. The fix should be on patch 13 of the series (trace: dynamically allocate trace_dstate in CPUState): Beware that min() needs to be defined somewhere on that file first (should it be available on some generic header?). Cheers, Lluis diff --git a/qom/cpu.c b/qom/cpu.c index 484c493..40f2eb1 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -356,12 +356,15 @@ static void cpu_common_initfn(Object *obj) qemu_mutex_init(&cpu->work_mutex); QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); - bitmap_zero(cpu->trace_dstate, TRACE_VCPU_EVENT_COUNT); + + cpu->trace_dstate = bitmap_new(min(trace_get_vcpu_event_count(), 1); } static void cpu_common_finalize(Object *obj) { - cpu_exec_exit(CPU(obj)); + CPUState *cpu = CPU(obj); + cpu_exec_exit(cpu); + g_free(cpu->trace_dstate); } static int64_t cpu_common_get_arch_id(CPUState *cpu)