From: Peter Zijlstra <peterz@infradead.org>
To: kan.liang@linux.intel.com
Cc: mingo@redhat.com, acme@kernel.org, linux-kernel@vger.kernel.org,
eranian@google.com, ak@linux.intel.com
Subject: Re: [RESEND PATCH V3] perf/x86: Consider pinned events for group validation
Date: Fri, 17 Jan 2020 10:13:41 +0100 [thread overview]
Message-ID: <20200117091341.GX2827@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1579201225-178031-1-git-send-email-kan.liang@linux.intel.com>
On Thu, Jan 16, 2020 at 11:00:25AM -0800, kan.liang@linux.intel.com wrote:
> @@ -2054,9 +2057,38 @@ static int validate_group(struct perf_event *event)
> if (n < 0)
> goto out;
>
> + /*
> + * Disable interrupts and preemption to prevent the events in this
> + * CPU's cpuc going away and getting freed.
> + */
> + local_irq_save(flags);
> +
> + /*
> + * The new group must can be scheduled together with current pinned
> + * events. Otherwise, it will never get a chance to be scheduled later.
> + *
> + * It won't catch all possible cases that cannot schedule, such as
> + * events pinned on CPU1, but the validation for a new CPU1 event
> + * running on other CPU. However, it's good enough to handle common
> + * cases like the global NMI watchdog.
> + */
> + for (i = 0; i < cpuc->n_events; i++) {
> + pinned_event = cpuc->event_list[i];
> + if (WARN_ON_ONCE(!pinned_event))
> + continue;
> + if (!pinned_event->attr.pinned)
> + continue;
> + fake_cpuc->n_events = n;
> + n = collect_events(fake_cpuc, pinned_event, false);
> + if (n < 0)
> + goto irq;
> + }
> +
So I still completely hate this, because it makes the counter scheduling
more eratic.
It changes a situation where we only have false-positives (we allow
scheduling a group that might not ever get to run) into a situation
where we can have both false-positives and false-negatives.
Imagine the pinned event is for a currently running task; and that task
only runs sporadically. Then you can sometimes not create the group, but
mostly it'll work.
Yes, this is all very annoying, but I really don't see how this makes
anything any better.
next prev parent reply other threads:[~2020-01-17 9:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-16 19:00 [RESEND PATCH V3] perf/x86: Consider pinned events for group validation kan.liang
2020-01-17 8:58 ` Peter Zijlstra
2020-01-17 9:13 ` Peter Zijlstra [this message]
2020-01-17 16:22 ` Andi Kleen
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=20200117091341.GX2827@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/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