[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ztl4TDI98tnCkH0X@gmail.com>
Date: Thu, 5 Sep 2024 11:22:20 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Colton Lewis <coltonlewis@...gle.com>
Cc: kvm@...r.kernel.org, Oliver Upton <oliver.upton@...ux.dev>,
Sean Christopherson <seanjc@...gle.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Will Deacon <will@...nel.org>, Russell King <linux@...linux.org.uk>,
Catalin Marinas <catalin.marinas@....com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Naveen N Rao <naveen@...nel.org>,
Heiko Carstens <hca@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>,
Thomas Gleixner <tglx@...utronix.de>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>, linux-perf-users@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linuxppc-dev@...ts.ozlabs.org, linux-s390@...r.kernel.org
Subject: Re: [PATCH 4/5] x86: perf: Refactor misc flag assignments
* Colton Lewis <coltonlewis@...gle.com> wrote:
> Break the assignment logic for misc flags into their own respective
> functions to reduce the complexity of the nested logic.
>
> Signed-off-by: Colton Lewis <coltonlewis@...gle.com>
> ---
> arch/x86/events/core.c | 31 +++++++++++++++++++++++--------
> arch/x86/include/asm/perf_event.h | 2 ++
> 2 files changed, 25 insertions(+), 8 deletions(-)
>
> diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
> index 760ad067527c..87457e5d7f65 100644
> --- a/arch/x86/events/core.c
> +++ b/arch/x86/events/core.c
> @@ -2948,16 +2948,34 @@ unsigned long perf_arch_instruction_pointer(struct pt_regs *regs)
> return regs->ip + code_segment_base(regs);
> }
>
> +static unsigned long common_misc_flags(struct pt_regs *regs)
> +{
> + if (regs->flags & PERF_EFLAGS_EXACT)
> + return PERF_RECORD_MISC_EXACT_IP;
> +
> + return 0;
> +}
> +
> +unsigned long perf_arch_guest_misc_flags(struct pt_regs *regs)
> +{
> + unsigned long guest_state = perf_guest_state();
> + unsigned long flags = common_misc_flags();
> +
> + if (guest_state & PERF_GUEST_USER)
> + flags |= PERF_RECORD_MISC_GUEST_USER;
> + else if (guest_state & PERF_GUEST_ACTIVE)
> + flags |= PERF_RECORD_MISC_GUEST_KERNEL;
> +
> + return flags;
> +}
> +
> unsigned long perf_arch_misc_flags(struct pt_regs *regs)
> {
> unsigned int guest_state = perf_guest_state();
> - int misc = 0;
> + unsigned long misc = common_misc_flags();
So I'm quite sure this won't even build at this point ...
Thanks,
Ingo
Powered by blists - more mailing lists