qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/2] coroutine-ucontext: Help valgrind understand coroutines
Date: Fri, 13 Jul 2012 10:45:55 +0200	[thread overview]
Message-ID: <4FFFE043.4050604@redhat.com> (raw)
In-Reply-To: <4FFF0446.7000009@weilnetz.de>

Am 12.07.2012 19:07, schrieb Stefan Weil:
> Great that you address this issue!
> I have two annotations, please see below.
> 
> 
> Am 12.07.2012 16:27, schrieb Kevin Wolf:
>> valgrind tends to get confused and report false positives when you
>> switch stacks and don't tell it about it.
>>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
>>   configure            |   18 ++++++++++++++++++
>>   coroutine-ucontext.c |   21 +++++++++++++++++++++
>>   2 files changed, 39 insertions(+), 0 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 500fe24..b424fcf 100755
>> --- a/configure
>> +++ b/configure
>> @@ -2855,6 +2855,20 @@ if compile_prog "" "" ; then
>>   fi
>>   
>>   ########################################
>> +# check if we have valgrind/valgrind.h
>> +
>> +valgrind_h=no
>> +cat > $TMPC << EOF
>> +#include <valgrind/valgrind.h>
>> +int main(void) {
>> +  return 0;
>> +}
>> +EOF
>> +if compile_prog "" "" ; then
>> +    valgrind_h=yes
>> +fi
>> +
>> +########################################
>>   # check if environ is declared
>>   
>>   has_environ=no
>> @@ -3380,6 +3394,10 @@ if test "$linux_magic_h" = "yes" ; then
>>     echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak
>>   fi
>>   
>> +if test "$valgrind_h" = "yes" ; then
>> +  echo "CONFIG_VALGRIND_H=y" >> $config_host_mak
> 
> I'd prefer CONFIG_VALGRIND instead of CONFIG_VALGRIND_H.
> The important feature is Valgrind, not the valgrind.h which is
> needed to get that feature.
> 
> Of course that is a matter of personal taste, and there are
> already a few CONFIG_SOMETHING_H macros, but most
> macros omit the _H even if there _is_ a related h file.

Okay, I don't really mind, it was just the style of the check
immediately before the new one, so I used that. I can change it.

>> +fi
>> +
>>   if test "$has_environ" = "yes" ; then
>>     echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak
>>   fi
>> diff --git a/coroutine-ucontext.c b/coroutine-ucontext.c
>> index 5f43083..db4ba88 100644
>> --- a/coroutine-ucontext.c
>> +++ b/coroutine-ucontext.c
>> @@ -30,6 +30,10 @@
>>   #include "qemu-common.h"
>>   #include "qemu-coroutine-int.h"
>>   
>> +#ifdef CONFIG_VALGRIND_H
>> +#include <valgrind/valgrind.h>
>> +#endif
>> +
>>   enum {
>>       /* Maximum free pool size prevents holding too many freed coroutines */
>>       POOL_MAX_SIZE = 64,
>> @@ -43,6 +47,11 @@ typedef struct {
>>       Coroutine base;
>>       void *stack;
>>       jmp_buf env;
>> +
>> +#ifdef CONFIG_VALGRIND_H
>> +    int valgrind_stack_id;
> 
> Stack ids are "unsigned" in valgrind.h, so please use
> "unsigned" here, too, 

Hm, indeed. Then the example code I looked at was wrong...

> although I know that you like "int" very much :-).

If you're alluding to something, I didn't get it.

Kevin

  reply	other threads:[~2012-07-13  8:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 14:27 [Qemu-devel] [PATCH 0/2] qemu-iotests: valgrind support Kevin Wolf
2012-07-12 14:27 ` [Qemu-devel] [PATCH 1/2] coroutine-ucontext: Help valgrind understand coroutines Kevin Wolf
2012-07-12 17:07   ` Stefan Weil
2012-07-13  8:45     ` Kevin Wolf [this message]
2012-07-13  8:53       ` Kevin Wolf
2012-07-12 17:14   ` Peter Maydell
2012-07-13  8:36     ` Kevin Wolf
2012-07-13 15:31   ` [Qemu-devel] [PATCH v2 " Kevin Wolf
2012-07-13 15:37     ` Peter Maydell
2012-07-13 16:06       ` Kevin Wolf
2012-07-13 16:13         ` Eric Blake
2012-07-13 16:18           ` Kevin Wolf
2012-07-12 14:27 ` [Qemu-devel] [PATCH 2/2] qemu-iotests: Valgrind support Kevin Wolf
2012-07-12 16:51 ` [Qemu-devel] [PATCH 0/2] qemu-iotests: valgrind support Paolo Bonzini
2012-07-12 17:14   ` Stefan Weil

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=4FFFE043.4050604@redhat.com \
    --to=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sw@weilnetz.de \
    /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).