Skip to content

Commit

Permalink
perf/x86/intel/lbr: Mark the {rd,wr}lbr_{to,from} wrappers __always_i…
Browse files Browse the repository at this point in the history
…nline

The {rd,wr}lbr_{to,from} wrappers are invoked in hot paths, e.g. context
switch and NMI handler. They should be always inline to achieve better
performance. However, the CONFIG_OPTIMIZE_INLINING allows the compiler
to uninline functions marked 'inline'.

Mark the {rd,wr}lbr_{to,from} wrappers as __always_inline to force
inline the wrappers.

Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/1593780569-62993-12-git-send-email-kan.liang@linux.intel.com
  • Loading branch information
Kan Liang authored and Peter Zijlstra committed Jul 8, 2020
1 parent 5624986 commit 020d91e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/x86/events/intel/lbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,18 +332,18 @@ static u64 lbr_from_signext_quirk_rd(u64 val)
return val;
}

static inline void wrlbr_from(unsigned int idx, u64 val)
static __always_inline void wrlbr_from(unsigned int idx, u64 val)
{
val = lbr_from_signext_quirk_wr(val);
wrmsrl(x86_pmu.lbr_from + idx, val);
}

static inline void wrlbr_to(unsigned int idx, u64 val)
static __always_inline void wrlbr_to(unsigned int idx, u64 val)
{
wrmsrl(x86_pmu.lbr_to + idx, val);
}

static inline u64 rdlbr_from(unsigned int idx)
static __always_inline u64 rdlbr_from(unsigned int idx)
{
u64 val;

Expand All @@ -352,7 +352,7 @@ static inline u64 rdlbr_from(unsigned int idx)
return lbr_from_signext_quirk_rd(val);
}

static inline u64 rdlbr_to(unsigned int idx)
static __always_inline u64 rdlbr_to(unsigned int idx)
{
u64 val;

Expand Down

0 comments on commit 020d91e

Please sign in to comment.