[dm-devel] [PATCH] multipathd: Suppress uninteresting data race reports

Christophe Varoqui christophe.varoqui at opensvc.com
Mon Aug 29 07:19:35 UTC 2016


Hi,

I think it would be fair to detect the valgrind headers presence in the
Makefile and ifdef the include (else define dummy ANNOTATE_* macros).

Would you care to prepare that ?

Thanks.


On Tue, Aug 16, 2016 at 10:00 PM, Bart Van Assche <
bart.vanassche at sandisk.com> wrote:

> The global variable multipath_conf is modified through RCU. Hence
> avoid that the data race detection tools Helgrind and DRD report
> data races for this variable.
>
> The global variable running_state is read without holding the mutex
> that protects changes of this variable. Suppress complaints about
> these reads.
>
> The global variable uxsock_timeout is not protected by any mutex.
> Suppress complaints about using this variable.
>
> This patch introduces a new build-time requirement, namely that
> the valgrind-devel package has been installed.
>
> Signed-off-by: Bart Van Assche <bart.vanassche at sandisk.com>
> ---
>  multipathd/main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/multipathd/main.c b/multipathd/main.c
> index 1d73b4c..54abfef 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -23,6 +23,7 @@
>  #endif
>  #include <semaphore.h>
>  #include <time.h>
> +#include <valgrind/helgrind.h>
>
>  /*
>   * libcheckers
> @@ -2520,6 +2521,13 @@ main (int argc, char *argv[])
>         int foreground = 0;
>         struct config *conf;
>
> +       ANNOTATE_BENIGN_RACE_SIZED(&multipath_conf,
> sizeof(multipath_conf),
> +                                  "Manipulated through RCU");
> +       ANNOTATE_BENIGN_RACE_SIZED(&running_state, sizeof(running_state),
> +               "Suppress complaints about unprotected running_state
> reads");
> +       ANNOTATE_BENIGN_RACE_SIZED(&uxsock_timeout,
> sizeof(uxsock_timeout),
> +               "Suppress complaints about this scalar variable");
> +
>         logsink = 1;
>
>         if (getuid() != 0) {
> --
> 2.9.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20160829/eaa31b58/attachment.htm>


More information about the dm-devel mailing list