linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Raghavendra Rao Ananta <rananta@codeaurora.org>
Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org,
	alexander.shishkin@linux.intel.com, namhyung@kernel.org,
	linux-kernel@vger.kernel.org, psodagud@codeaurora.org,
	tsoni@codeaurora.org
Subject: Re: [PATCH] perf: Add support for creating offline events
Date: Tue, 13 Feb 2018 17:08:26 +0100	[thread overview]
Message-ID: <20180213160826.GA9121@krava> (raw)
In-Reply-To: <6aab2b36-0fe6-7a3d-2106-d4c93ec95a8a@codeaurora.org>

On Mon, Feb 12, 2018 at 02:22:30PM -0800, Raghavendra Rao Ananta wrote:
> 
> 
> On 02/12/2018 01:21 PM, Jiri Olsa wrote:
> > On Mon, Feb 12, 2018 at 10:04:42PM +0100, Jiri Olsa wrote:
> > > On Mon, Feb 12, 2018 at 09:42:05AM -0800, Raghavendra Rao Ananta wrote:
> > > > Hi Jiri,
> > > > 
> > > > Thank you for the response.
> > > > 
> > > > Does perf tool has its own check to see if the CPU was offline during the
> > > > lifetime of an event? If so, it might ignore these type of events.
> > > 
> > > nope, we don't check on that
> > > 
> > > > 
> > > > Initially, I tested the same using perf tool and found similar results.
> > > > Then I debugged further and found that the perf core was actually sending
> > > > data to the userspace (copy_to_user()) and the corresponding count for the
> > > > data. Hence, I tested this further by writing my own userspace application,
> > > > and I was able to read the count through this,
> > > > even when the CPU was made offline and back online.
> > > > 
> > > > Do you think we also have to modify the perf tool accordingly?
> > > 
> > > hum, I wonder what's wrong.. will check
> > 
> > I think the user space needs to enable the event once the
> > cpu gets online.. which we dont do and your app does..?
> > 
> > maybe we could add perf_event_attr::enable_on_online ;-)
> > 
> > I'll check what we can do in user space, I guess we can
> > monitor the cpu state and enable event accordingly
> > 
> > jirka
> > 
> Yes, probably that's the reason.
> 
> In order for an event to get scheduled-in, it expects the event to be at
> least in PERF_EVENT_STATE_INACTIVE state. If you notice, in my patch,
> when the cpu wakes up, we are initializing the state of the event
> (perf_event__state_init()) and then trying to schedule-in. Since the event
> was created with a disabled state, it seems that the same this is followed
> and the state gets initialized to PERF_EVENT_STATE_OFF. Unfortunately,
> events in this state could not be scheduled.
> 
> One way for things to get working is, instead of calling
> perf_event__state_init() before the event is scheduled-in (when the cpu
> wakes up), we can do something like:
> perf_event_set_state(event, PERF_EVENT_STATE_INACTIVE);

could you add check in ioctl call that set the inactive state
on the dormant event.. that would start it once the cpu is
online.. as requested

jirka

  reply	other threads:[~2018-02-13 16:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-09 23:07 [PATCH] perf: Add support for creating offline events Raghavendra Rao Ananta
2018-02-12  9:43 ` Jiri Olsa
2018-02-12 17:42   ` Raghavendra Rao Ananta
2018-02-12 21:04     ` Jiri Olsa
2018-02-12 21:21       ` Jiri Olsa
2018-02-12 22:22         ` Raghavendra Rao Ananta
2018-02-13 16:08           ` Jiri Olsa [this message]
2018-02-13 18:03             ` Raghavendra Rao Ananta
2018-02-12  9:44 ` Jiri Olsa
2018-02-12 19:11 ` kbuild test robot
2018-02-13 18:23 ` Peter Zijlstra
2018-02-13 22:17   ` Sodagudi Prasad
2018-02-14  8:32     ` Peter Zijlstra

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=20180213160826.GA9121@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=psodagud@codeaurora.org \
    --cc=rananta@codeaurora.org \
    --cc=tsoni@codeaurora.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).