LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Yabin Cui <yabinc@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>
Cc: linux-kernel@vger.kernel.org, Yabin Cui <yabinc@google.com>
Subject: Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head.
Date: Fri, 17 May 2019 10:59:06 -0700	[thread overview]
Message-ID: <20190517175906.78742-1-yabinc@google.com> (raw)
In-Reply-To: <20190517084712.GL2623@hirez.programming.kicks-ass.net>

> > -	local_inc(&rb->nest);
> > +	rb->nest++;
> > +	barrier();

> Urgh; almost but not quite. You just lost the 'volatile' qualifier and
> now the compiler can mess things up for you.

I thought the barriers added could force the compiler to forget what it knows
about rb->nest, and do the write as been told to. I appreciate it if you can
tell me more details about it. Anyway, it's a good choice to be protective
and always use WRITE_ONCE/READ_ONCE for rb->nest.

> What I'm going to do is split this into two patches, one fixes the
> problem and marked for backport, and one changing away from local_t.

I read the split patches. They totally LGTM. Thanks for all your help
and rapid reply! I appreciate it :)

      reply	other threads:[~2019-05-17 17:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-15  0:30 Yabin Cui
2019-05-15  6:51 ` Alexander Shishkin
2019-05-15  9:43   ` Peter Zijlstra
2019-05-15 10:04     ` Alexander Shishkin
2019-05-15 10:51       ` Peter Zijlstra
2019-05-15 10:48 ` Peter Zijlstra
2019-05-16 18:37   ` Yabin Cui
2019-05-16 18:40 ` [PATCH v2] " Yabin Cui
2019-05-17  8:47   ` Peter Zijlstra
2019-05-17 17:59     ` Yabin Cui [this message]

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=20190517175906.78742-1-yabinc@google.com \
    --to=yabinc@google.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --subject='Re: [PATCH] perf/ring_buffer: Fix exposing a temporarily decreased data_head.' \
    /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

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).