From patchwork Tue Mar 5 10:33:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 224980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E7AFD2C034C for ; Tue, 5 Mar 2013 21:34:21 +1100 (EST) Received: from localhost ([::1]:51730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCpCN-0001yG-V2 for incoming@patchwork.ozlabs.org; Tue, 05 Mar 2013 05:34:19 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46644) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCpC6-0001yA-Je for qemu-devel@nongnu.org; Tue, 05 Mar 2013 05:34:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UCpC5-0002AQ-9n for qemu-devel@nongnu.org; Tue, 05 Mar 2013 05:34:02 -0500 Received: from mail-wg0-f46.google.com ([74.125.82.46]:54638) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UCpC5-0002AM-4B for qemu-devel@nongnu.org; Tue, 05 Mar 2013 05:34:01 -0500 Received: by mail-wg0-f46.google.com with SMTP id fg15so5303385wgb.25 for ; Tue, 05 Mar 2013 02:34:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=sKvq5w9VzM5y+7W3Eg3TYrS8svbbcqjdafSnuYtuUd4=; b=qoZgKYNNBxw/fR7UF3F8ap0Z+o+er6rut2zSXKXk45s6IvmPTbgxt0a6/1nkXWSw14 lS8bqMLR46IPG8EniH2AeD5w2aLaRk2Ow+KqbzeGvPH+2YNT21ZIothNaCY7r4GS5Z7B ZTxs2uLGoNUt1FIuUz2x8eUY88Bg1+CfPVF/hE4udFQi/QMfBocdLXmil4h/cz3hqTYN a6rRs67u68rJEH+JRNZiYkWu/y/A2MhfbwiWDgKBAwHz0zKT8pp4szNU6hfyJijGgC8O t7+XaQ++nJDVziqQM4IiQbXcCDfPfN3IPeTkjFBTeOC7Fwm8xdUR2XPT6BuWv+E5nRLf DCPQ== X-Received: by 10.180.185.44 with SMTP id ez12mr16930097wic.33.1362479640404; Tue, 05 Mar 2013 02:34:00 -0800 (PST) Received: from localhost ([2a02:810d:e80:64:69de:8c87:ab42:42b3]) by mx.google.com with ESMTPS id r7sm2506616wiz.2.2013.03.05.02.33.58 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 05 Mar 2013 02:33:59 -0800 (PST) Date: Tue, 5 Mar 2013 11:33:57 +0100 From: Stefan Hajnoczi To: =?iso-8859-1?Q?Llu=EDs?= Vilanova Message-ID: <20130305103357.GD1938@stefanha-thinkpad.redhat.com> References: <20130301152934.22476.82209.stgit@fimbulvetr.bsc.es> <20130304142214.GA3981@stefanha-thinkpad.redhat.com> <87d2ve6frc.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <87d2ve6frc.fsf@fimbulvetr.bsc.es> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 74.125.82.46 Cc: Blue Swirl , qemu-devel@nongnu.org Subject: Re: [Qemu-devel] [PATCH v11 0/7] trace: Generic event state description X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On Mon, Mar 04, 2013 at 10:01:43PM +0100, Lluís Vilanova wrote: > Stefan Hajnoczi writes: > > > On Fri, Mar 01, 2013 at 04:29:35PM +0100, Lluís Vilanova wrote: > >> Provides a generic event state description structure (TraceEvent) and a more > >> detailed event control and query interface. > >> > >> This is achieved by creating a new "non-public" tracing backend (i.e., not > >> selectable by the user at configure time) that will generate the appropriate > >> event description information. > >> > >> Signed-off-by: Lluís Vilanova > >> --- > >> > >> Changes in v11: > >> > >> * Rebase on a4bcea3 from master. > > > Hi Lluís, > > Thanks for rebasing. Unfortunately I still hit the hang on shutdown > > with the simple trace backend. > > > Steps to reproduce: > > $ ./configure --target-list=x86_64-softmmu --enable-trace-backend=simple > > $ make > > $ cat my-events > > bdrv_open_common > > $ x86_64-softmmu/qemu-system-x86_64 \ > > -enable-kvm -m 1024 \ > > -trace events=my-events \ > > -drive if=virtio,cache=none,file=test.img > > Ctrl-Alt-2 > > (qemu) quit > > ...hang... > > > Please let me know if you are able to reproduce it. qemu.git/master > > does not behave this way. > > I've been unable to reproduce it with v11, but was able to using v10 (although > only a couple of times). Found it! The problem is that trace_record_start() is writing a 4-byte event field instead of an 8-byte event field. TraceEventID used to be typedef uint64_t. In your series TraceEventID becomes an enum and breaks trace_record_start(). Try this: diff --git a/trace/simple.c b/trace/simple.c index 5bb905c..1e3f691 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -218,6 +218,7 @@ int trace_record_start(TraceBufferRecord *rec, TraceEv { unsigned int idx, rec_off, old_idx, new_idx; uint32_t rec_len = sizeof(TraceRecord) + datasize; + uint64_t event_u64 = event; uint64_t timestamp_ns = get_clock(); do { @@ -235,7 +236,7 @@ int trace_record_start(TraceBufferRecord *rec, TraceEv idx = old_idx % TRACE_BUF_LEN; rec_off = idx; - rec_off = write_to_buffer(rec_off, &event, sizeof(event)); + rec_off = write_to_buffer(rec_off, &event_u64, sizeof(event_u64)); rec_off = write_to_buffer(rec_off, ×tamp_ns, sizeof(timestamp_ns rec_off = write_to_buffer(rec_off, &rec_len, sizeof(rec_len));