From: Song Liu <songliubraving@fb.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: lkml <linux-kernel@vger.kernel.org>,
"lkp@intel.com" <lkp@intel.com>, Kernel Team <Kernel-team@fb.com>,
Tejun Heo <tj@kernel.org>, Peter Zijlstra <peterz@infradead.org>,
Jiri Olsa <jolsa@kernel.org>,
Alexey Budankov <alexey.budankov@linux.intel.com>
Subject: Re: [PATCH v2 1/1] perf: Sharing PMU counters across compatible events
Date: Tue, 11 Sep 2018 13:38:49 +0000 [thread overview]
Message-ID: <F3425547-3F28-44F3-8328-1CAB0FD12A96@fb.com> (raw)
In-Reply-To: <20180910081531.GC31644@krava>
> On Sep 10, 2018, at 1:15 AM, Jiri Olsa <jolsa@redhat.com> wrote:
>
> On Thu, Aug 30, 2018 at 06:51:07PM +0000, Song Liu wrote:
>>
>>
>>> On Aug 30, 2018, at 8:18 AM, Jiri Olsa <jolsa@redhat.com> wrote:
>>>
>>> On Wed, Aug 15, 2018 at 10:03:13AM -0700, Song Liu wrote:
>>>
>>> SNIP
>>>
>>>> @@ -6100,7 +6333,7 @@ static void perf_output_read_group(struct perf_output_handle *handle,
>>>>
>>>> if ((sub != event) &&
>>>> (sub->state == PERF_EVENT_STATE_ACTIVE))
>>>> - sub->pmu->read(sub);
>>>> + event_pmu_read(sub);
>>>>
>>>> values[n++] = perf_event_count(sub);
>>>> if (read_format & PERF_FORMAT_ID)
>>>> @@ -9109,7 +9342,7 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
>>>> if (event->state != PERF_EVENT_STATE_ACTIVE)
>>>> return HRTIMER_NORESTART;
>>>>
>>>> - event->pmu->read(event);
>>>> + event_pmu_read(event);
>>>>
>>>> perf_sample_data_init(&data, 0, event->hw.last_period);
>>>> regs = get_irq_regs();
>>>> @@ -10504,6 +10737,14 @@ SYSCALL_DEFINE5(perf_event_open,
>>>> goto err_cred;
>>>> }
>>>>
>>>> + if (perf_event_can_share(event)) {
>>>> + event->tmp_master = perf_event_alloc(&event->attr, cpu,
>>>> + task, NULL, NULL,
>>>> + NULL, NULL, -1);
>>>
>>> can't get around this.. I understand the need, but AFAICS you allocate
>>> the whole 'struct perf_event', just because there's count field in it
>>> otherwise the 'struct hw_perf_event' should be enough to carry all that's
>>> needed to read hw event
>>>
>>> would it be better to move the count to 'struct hw_perf_event' and use
>>> that instead? assuming I'm not missing anything..
>>>
>>> jirka
>>
>> I am trying to make the master event function the same as a real event,
>> while keep dup events as followers. This avoids "switching master" in
>> earlier versions (and Tejun's RFC).
>
> yep, I understand.. still, it seems too much to allocate
> the whole 'struct perf_even't just to get separated 'count'
> variable
In theory, we only need separated counters. However, in practice, there
are other variables we need to handle for a switch_master operation.
For example, we need make sure event->state is always set properly. So
this optimization is not easy to implement. How about we optimize it
after this patch gets in?
Thanks,
Song
prev parent reply other threads:[~2018-09-11 13:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-15 17:03 [PATCH v2 0/1] perf: Sharing PMU counters across compatible events Song Liu
2018-08-15 17:03 ` [PATCH v2 1/1] " Song Liu
2018-08-30 15:13 ` Jiri Olsa
2018-08-30 18:35 ` Song Liu
2018-09-10 8:13 ` Jiri Olsa
2018-09-11 13:29 ` Song Liu
2018-09-23 21:44 ` Jiri Olsa
2018-08-30 15:18 ` Jiri Olsa
2018-08-30 18:51 ` Song Liu
2018-09-10 8:15 ` Jiri Olsa
2018-09-11 13:38 ` 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=F3425547-3F28-44F3-8328-1CAB0FD12A96@fb.com \
--to=songliubraving@fb.com \
--cc=Kernel-team@fb.com \
--cc=alexey.budankov@linux.intel.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=peterz@infradead.org \
--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;
as well as URLs for NNTP newsgroup(s).