Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1457889

Re: [PATCH v2 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG

From Nilay Vaish <nilayvaish@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG
Date 2016-08-08 18:20 +0200
Message-ID <s3Vrr-3D1-13@gated-at.bofh.it> (permalink)
References <s3mN3-6xA-1@gated-at.bofh.it> <s3mN4-6xA-9@gated-at.bofh.it> <s3BM5-7R3-9@gated-at.bofh.it> <s3CI9-8tY-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 7 August 2016 at 15:10, David Carrillo-Cisneros <davidcc@google.com> wrote:
> Hi Nilay,
>
>>>  static int perf_event_read(struct perf_event *event, bool group)
>>>  {
>>> -       int ret = 0;
>>> +       int ret = 0, cpu_to_read;
>>>
>>> -       /*
>>> -        * If event is enabled and currently active on a CPU, update the
>>> -        * value in the event structure:
>>> -        */
>>> -       if (event->state == PERF_EVENT_STATE_ACTIVE) {
>>> +       cpu_to_read = find_cpu_to_read(event);
>>> +
>>> +       if (cpu_to_read >= 0) {
>>>                 struct perf_read_data data = {
>>>                         .event = event,
>>>                         .group = group,
>>>                         .ret = 0,
>>>                 };
>>> -               ret = smp_call_function_single(event->oncpu,
>>> +               ret = smp_call_function_single(cpu_to_read,
>>>                                                __perf_event_read, &data,
>>> 1);
>>>                 ret = ret ? : data.ret;
>>>         } else if (event->state == PERF_EVENT_STATE_INACTIVE) {
>>>
>>
>> I would like to suggest a small change to this patch.  I think the check on
>> PERF_EVENT_STATE_ACTIVE should be retained in the perf_event_read()
>> function.  The new function should assume that the event is active.  I find
>> this more readable since the next check in function perf_event_read() is on
>> PERF_EVENT_STATE_INACTIVE.
>
> Two oncoming flags that Intel CQM/CMT will use are meant to allow read
> even if event is inactive. This makes sense in CQM/CMT because the hw
> RMID is always reserved. I am ok with keeping the check for
> STATE_ACTIVE until those flags are actually introduced, tough.


Hello David

Lets go with checking PERF_EVENT_STATE_ACTIVE in perf_event_read() for
the time being.  With the new version of the patch that you posted, I
find that checking PERF_EVENT_STATE_ACTIVE in find_cpu_to_read() makes
you introduce another if statement for checking STATE_INACTIVE.

If your CQM/CMT patches later need the code structure you have now, I
would also support it.  But as of now, I think, it is better to check
STATE_ACTIVE in perf_event_read().


Thanks
Nilay

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] remove unnecessary IPI reading uncore events David Carrillo-Cisneros <davidcc@google.com> - 2016-08-07 05:20 +0200
  [PATCH v2 4/4] perf/x86: use PMUEF_READ_CPU_PKG in uncore events David Carrillo-Cisneros <davidcc@google.com> - 2016-08-07 05:20 +0200
  [PATCH v2 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG David Carrillo-Cisneros <davidcc@google.com> - 2016-08-07 05:20 +0200
    Re: [PATCH v2 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG Nilay Vaish <nilayvaish@gmail.com> - 2016-08-07 21:20 +0200
      Re: [PATCH v2 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG David Carrillo-Cisneros <davidcc@google.com> - 2016-08-07 22:20 +0200
        Re: [PATCH v2 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG Nilay Vaish <nilayvaish@gmail.com> - 2016-08-08 18:20 +0200
          Re: [PATCH v2 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG David Carrillo-Cisneros <davidcc@google.com> - 2016-08-09 07:10 +0200
          [PATCH 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG David Carrillo-Cisneros <davidcc@google.com> - 2016-08-10 00:30 +0200
            Re: [PATCH 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG Nilay Vaish <nilayvaish@gmail.com> - 2016-08-10 22:20 +0200
    [PATCH v3 3/4] perf/core: introduce PMU_EV_CAP_READ_ACTIVE_PKG David Carrillo-Cisneros <davidcc@google.com> - 2016-08-08 12:10 +0200
  [PATCH v2 1/4] perf/core: check return value of perf_event_read IPI David Carrillo-Cisneros <davidcc@google.com> - 2016-08-07 05:20 +0200
    Re: [PATCH v2 1/4] perf/core: check return value of perf_event_read  IPI Ingo Molnar <mingo@kernel.org> - 2016-08-10 22:20 +0200
  [PATCH v2 2/4] perf/core: generalize event->group_flags David Carrillo-Cisneros <davidcc@google.com> - 2016-08-07 05:20 +0200
  Re: [PATCH v2 0/4] remove unnecessary IPI reading uncore events Nilay Vaish <nilayvaish@gmail.com> - 2016-08-10 22:10 +0200

csiph-web