lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fXJ3oG3GmG7puq+n9W3mQYfmdx37jq548Wf1_6hcpja2g@mail.gmail.com>
Date:   Thu, 19 Jan 2023 08:09:21 -0800
From:   Ian Rogers <irogers@...gle.com>
To:     Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Ian Rogers <irogers@...gle.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1] perf test workload thloop: Make count increments atomic

On Sat, Jan 14, 2023 at 1:53 PM Ian Rogers <irogers@...gle.com> wrote:
>
> The count variable is incremented by multiple threads, doing so
> without an atomic operation causes thread sanitizer warnings. Switch
> to using relaxed atomics.
>
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
>  tools/perf/tests/workloads/thloop.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/workloads/thloop.c b/tools/perf/tests/workloads/thloop.c
> index 29193b75717e..af05269c2eb8 100644
> --- a/tools/perf/tests/workloads/thloop.c
> +++ b/tools/perf/tests/workloads/thloop.c
> @@ -20,7 +20,7 @@ static void sighandler(int sig __maybe_unused)
>  noinline void test_loop(void)
>  {
>         while (!done)
> -               count++;
> +               __atomic_fetch_add(&count, 1, __ATOMIC_RELAXED);

Ping. No functional change, cleans up a lot of thread sanitizer
issues, the use of __atomic_fetch_add is consistent with other files.

Thanks,
Ian

>  }
>
>  static void *thfunc(void *arg)
> --
> 2.39.0.314.g84b9a713c41-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ