From: Peter Zijlstra <peterz@infradead.org>
To: Like Xu <like.xu@linux.intel.com>
Cc: Kan Liang <kan.liang@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
linux-kernel@vger.kernel.org, Borislav Petkov <bp@alien8.de>,
seanjc@google.com, x86@kernel.org
Subject: Re: [PATCH v2 2/2] perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region
Date: Tue, 18 May 2021 15:29:10 +0200 [thread overview]
Message-ID: <YKPBJoK1b/2PIQfk@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <a9032de6-e55d-bfff-e6b5-4c79dcab30f3@linux.intel.com>
On Tue, May 18, 2021 at 08:34:33PM +0800, Like Xu wrote:
> > > + if (!static_cpu_has(X86_FEATURE_ARCH_LBR))
> > > + return;
> > > +
> > > + for_each_possible_cpu(cpu) {
> > > + cpuc = per_cpu_ptr(&cpu_hw_events, cpu);
> > > + kmem_cache = x86_get_pmu(cpu)->task_ctx_cache;
> > > + if (kmem_cache && !cpuc->lbr_xsave && !event->attr.precise_ip)
> > > + cpuc->lbr_xsave =
> > > + kmem_cache_alloc_node(kmem_cache, GFP_KERNEL,
> > > + cpu_to_node(cpu));
> >
> > (coding style fail)
> >
> > But then I looked at this function, and srlsy that !precise_ip is the
> > only thing you need @event for? Why do we care?
>
> Kan once commented, we only need to alloc the buffer for the non-PEBS
> event. It seems the check "(cpuc->lbr_users != cpuc->lbr_pebs_users)"
> is implicitly removed.
>
> I think we still need to check !precision_ip, right ?
It's just a memory allocation; who cares if we allocate but not use it
ever?
next prev parent reply other threads:[~2021-05-18 13:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-30 5:22 [PATCH v2 1/2] perf/x86: Skip checking if 0x0 MSR exists for guest Arch LBR Like Xu
2021-04-30 5:22 ` [PATCH v2 2/2] perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region Like Xu
2021-05-10 2:10 ` Like Xu
2021-05-18 8:48 ` Like Xu
2021-05-18 10:02 ` Peter Zijlstra
2021-05-18 12:34 ` Like Xu
2021-05-18 13:29 ` Peter Zijlstra [this message]
2021-05-19 8:02 ` [tip: perf/urgent] perf/x86/lbr: Remove cpuc->lbr_xsave allocation from atomic context tip-bot2 for Like Xu
2021-05-18 9:30 ` [PATCH v2 1/2] perf/x86: Skip checking if 0x0 MSR exists for guest Arch LBR Peter Zijlstra
2021-05-19 8:02 ` [tip: perf/urgent] perf/x86: Avoid touching LBR_TOS MSR for " tip-bot2 for Like Xu
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=YKPBJoK1b/2PIQfk@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=bp@alien8.de \
--cc=jolsa@redhat.com \
--cc=kan.liang@linux.intel.com \
--cc=like.xu@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=seanjc@google.com \
--cc=x86@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
Powered by JetHome