qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Gerhard Wiesinger <lists@wiesinger.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] block.c, block/vmdk.c: Fixed major bug in VMDK WRITE and READ handling - FIXES DATA CORRUPTION
Date: Tue, 13 Nov 2012 13:27:57 +0100	[thread overview]
Message-ID: <50A23CCD.6020504@redhat.com> (raw)
In-Reply-To: <509E2584.3020901@wiesinger.com>

Am 10.11.2012 10:59, schrieb Gerhard Wiesinger:
> On 10.11.2012 09:55, Paolo Bonzini wrote:
>> Il 10/11/2012 09:30, Gerhard Wiesinger ha scritto:
>>>>> 2.) Added debug code to block.c and to block/vmdk.c to verify
>>>>> correctness
>>>> Same here.  Also, please use the tracing infrastructure---a lot of the
>>>> debug
>>>> messages you're adding, though not all, are in fact already available
>>>> (not
>>>> saying the others aren't useful!)
>>> Any chance that the patch with debug code only (after some cleaning)
>>> would be accepted (other modules do debug logging, too)?
>>> I  don't like to do useless work.
>>> Tracing infrastructure is quite limited to function calls only (as far
>>> as I saw).
>> No, tracing infrastructure uses function calls for tracing (messages go
>> into trace-events) but you can apply it to everything you want.  Use the
>> stderr backend to debug it.
> 
> Tracing is a good thing for normal behavior but the major limitation is 
> that a function call must be involved. But for deep debugging one needs 
> a lot of more messages than function calls are available.
> 
> Of course every DPRINTF line could be made in a function call but IHMO 
> this introduces unnecessary overhead in performance.
> 
> So how to proceed further, some options:
> 1.) Add additional function calls for each DPRINTF statement?
> 2.) Add just plain DPRINTF statements?
> 3.) Or a mixture of both: on function call boundaries use Tracing, in 
> function debug info use DPRINTF?
> 4.) Refactor code that always function calls are involved?
> 
> Example:
> static void traceing_func(int mul)
> {
>      // Do nothing here
> }
> 
> // Just some dummy useless function doing illustration
> static int addandmultiply(int arg1, int arg2)
> {
>      int mul = 0;
>      int sum = arg1 + arg2;
>      DPRINTF("....", arg1, arg2); // this one can be handled by tracing 
> infrastructure
>      DPRINTF("....", sum); // this one can't be done with tracing

What's the problem? It would usually turn into something like

  trace_addandmultiply_sum(sum);

where trace_addandmultiply_sum() is a generated static inline function
in trace.h, which is empty and has zero overhead with disabled tracing.

Kevin

  reply	other threads:[~2012-11-13 12:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 19:05 [Qemu-devel] [PATCH] block.c, block/vmdk.c: Fixed major bug in VMDK WRITE and READ handling - FIXES DATA CORRUPTION Gerhard Wiesinger
2012-11-09  5:12 ` Fam Zheng
2012-11-09  6:51   ` Gerhard Wiesinger
2012-11-09  7:38   ` Lei Li
2012-11-09  8:26 ` Paolo Bonzini
2012-11-10  8:30   ` Gerhard Wiesinger
2012-11-10  8:55     ` Paolo Bonzini
2012-11-10  9:59       ` Gerhard Wiesinger
2012-11-13 12:27         ` Kevin Wolf [this message]
2012-11-13 13:36           ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50A23CCD.6020504@redhat.com \
    --to=kwolf@redhat.com \
    --cc=lists@wiesinger.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).