From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmQh5-0005nf-K6 for qemu-devel@nongnu.org; Mon, 19 May 2014 12:45:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmQgx-0006XH-TW for qemu-devel@nongnu.org; Mon, 19 May 2014 12:45:43 -0400 Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:44747) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmQgx-0006X9-ID for qemu-devel@nongnu.org; Mon, 19 May 2014 12:45:35 -0400 Received: by mail-wi0-f173.google.com with SMTP id bs8so4504440wib.0 for ; Mon, 19 May 2014 09:45:34 -0700 (PDT) Date: Mon, 19 May 2014 18:45:26 +0200 From: Marc =?UTF-8?B?TWFyw60=?= Message-ID: <20140519184526.00364e81@crunchbang> In-Reply-To: References: <1400367823-32610-1-git-send-email-marc.mari.barcelo@gmail.com> <1400367823-32610-4-git-send-email-marc.mari.barcelo@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 03/16] s390: Convert debug printfs to QEMU_DPRINTF List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: "open list:Overall" , Stefan Hajnoczi , "qemu-devel@nongnu.org Developers" , Alexander Graf , Andreas =?UTF-8?B?RsOkcmJlcg==?= , Richard Henderson El Sun, 18 May 2014 19:37:12 +1000 Peter Crosthwaite escribi=C3=B3: > On Sun, May 18, 2014 at 9:03 AM, Marc Mar=C3=AD > wrote: > > Modify debug macros to have the same format through the codebase > > and use regular ifs instead of ifdef. > > > > Signed-off-by: Marc Mar=C3=AD > > --- > > hw/s390x/s390-virtio-bus.c | 9 +++++---- > > hw/s390x/s390-virtio.c | 9 +++++---- > > target-s390x/helper.c | 23 +++++++++++++++-------- > > target-s390x/kvm.c | 9 +++++---- > > 4 files changed, 30 insertions(+), 20 deletions(-) > > > > diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c > > index 9c71afa..2a1799e 100644 > > --- a/hw/s390x/s390-virtio-bus.c > > +++ b/hw/s390x/s390-virtio-bus.c > > @@ -38,13 +38,14 @@ > > /* #define DEBUG_S390 */ > > > > #ifdef DEBUG_S390 > > -#define DPRINTF(fmt, ...) \ > > - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) > > +#define DEBUG_S390_ENABLED 1 > > #else > > -#define DPRINTF(fmt, ...) \ > > - do { } while (0) > > +#define DEBUG_S390_ENABLED 0 > > #endif > > > > +#define DPRINTF(fmt, ...) \ > > + QEMU_DPRINTF(DEBUG_S390_ENABLED, "s390 virtio bus", fmt, ## > > __VA_ARGS__) + > > #define VIRTIO_EXT_CODE 0x2603 > > > > static void virtio_s390_bus_new(VirtioBusState *bus, size_t > > bus_size, diff --git a/hw/s390x/s390-virtio.c > > b/hw/s390x/s390-virtio.c index aef2003..b69afb4 100644 > > --- a/hw/s390x/s390-virtio.c > > +++ b/hw/s390x/s390-virtio.c > > @@ -42,13 +42,14 @@ > > //#define DEBUG_S390 > > > > #ifdef DEBUG_S390 > > -#define DPRINTF(fmt, ...) \ > > - do { fprintf(stderr, fmt, ## __VA_ARGS__); } while (0) > > +#define DEBUG_S390_ENABLED 1 > > #else > > -#define DPRINTF(fmt, ...) \ > > - do { } while (0) > > +#define DEBUG_S390_ENABLED 0 > > #endif > > > > +#define DPRINTF(fmt, ...) \ > > + QEMU_DPRINTF(DEBUG_S390_ENABLED, "s390 virtio", fmt, ## > > __VA_ARGS__) + > > #define MAX_BLK_DEVS 10 > > #define ZIPL_FILENAME "s390-zipl.rom" > > > > diff --git a/target-s390x/helper.c b/target-s390x/helper.c > > index 7c76fc1..c2aa568 100644 > > --- a/target-s390x/helper.c > > +++ b/target-s390x/helper.c > > @@ -30,19 +30,26 @@ > > //#define DEBUG_S390_STDOUT > > > > #ifdef DEBUG_S390 > > -#ifdef DEBUG_S390_STDOUT > > -#define DPRINTF(fmt, ...) \ > > - do { fprintf(stderr, fmt, ## __VA_ARGS__); \ > > - qemu_log(fmt, ##__VA_ARGS__); } while (0) > > +#define DEBUG_S390_ENABLED 1 > > #else > > -#define DPRINTF(fmt, ...) \ > > - do { qemu_log(fmt, ## __VA_ARGS__); } while (0) > > +#define DEBUG_S390_ENABLED 0 > > #endif > > + > > +#ifdef DEBUG_S390_STDOUT >=20 > This STDOUT vs _log() choice is a bit irregular, and I think you might > be better off abandoning it completely. Richard, Alex, do we really > need to optionally route printfery to log or stderr? (considering _log > is NOW stderr by default now, and -D option gives you some flexibility > there). Can we have just log and drop STDOUT mode? >=20 > Regards, > Peter QEMU_DPRINTF outputs to stderr, and, as you say qemu_log does it too. Should QEMU_DPRINTF be removed and leave only qemu_log? Marc