From: Song Liu <songliubraving@fb.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Kernel Team <Kernel-team@fb.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Jiri Olsa <jolsa@kernel.org>,
Alexey Budankov <alexey.budankov@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>, Tejun Heo <tj@kernel.org>,
"kernel test robot" <rong.a.chen@intel.com>
Subject: Re: [PATCH v12] perf: Sharing PMU counters across compatible events
Date: Wed, 29 Apr 2020 20:44:54 +0000 [thread overview]
Message-ID: <F6DBB30D-B883-4C85-AFB8-8B85F356BA54@fb.com> (raw)
In-Reply-To: <20200420230429.GT2483@worktop.programming.kicks-ass.net>
> On Apr 20, 2020, at 4:04 PM, Peter Zijlstra <peterz@infradead.org> wrote:
>>
>> static inline u64 perf_event_count(struct perf_event *event)
>> {
>> - return local64_read(&event->count) + atomic64_read(&event->child_count);
>> + u64 count;
>> +
>> + if (likely(event->dup_master != event))
>> + count = local64_read(&event->count);
>> + else
>> + count = local64_read(&event->master_count);
>> +
>> + return count + atomic64_read(&event->child_count);
>> }
>
> So lsat time I said something about SMP ordering here. Where did that
> go?
I am not quite sure about this one. I guess the following is sufficient.
Could you please help me double check?
Thanks,
Song
static inline u64 perf_event_count(struct perf_event *event)
{
struct perf_event *master;
u64 count;
again:
master = READ_ONCE(event->dup_master);
if (master == EVENT_TOMBSTONE)
goto again;
if (likely(master != event))
count = local64_read(&event->count);
else
count = local64_read(&event->master_count);
return count + atomic64_read(&event->child_count);
}
prev parent reply other threads:[~2020-04-29 20:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-31 7:55 [PATCH v12] perf: Sharing PMU counters across compatible events Song Liu
2020-04-09 20:40 ` Song Liu
2020-04-20 23:04 ` Peter Zijlstra
2020-04-21 1:13 ` Song Liu
2020-04-21 7:18 ` Peter Zijlstra
2020-04-29 20:44 ` Song Liu [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=F6DBB30D-B883-4C85-AFB8-8B85F356BA54@fb.com \
--to=songliubraving@fb.com \
--cc=Kernel-team@fb.com \
--cc=acme@redhat.com \
--cc=alexey.budankov@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=rong.a.chen@intel.com \
--cc=tj@kernel.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