public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel•org>
To: Colton Lewis <coltonlewis@google•com>
Cc: kvm@vger•kernel.org, Oliver Upton <oliver.upton@linux•dev>,
	Sean Christopherson <seanjc@google•com>,
	Peter Zijlstra <peterz@infradead•org>,
	Ingo Molnar <mingo@redhat•com>,
	Arnaldo Carvalho de Melo <acme@kernel•org>,
	Namhyung Kim <namhyung@kernel•org>,
	Mark Rutland <mark.rutland@arm•com>,
	Alexander Shishkin <alexander.shishkin@linux•intel.com>,
	Jiri Olsa <jolsa@kernel•org>, Ian Rogers <irogers@google•com>,
	Adrian Hunter <adrian.hunter@intel•com>,
	Kan Liang <kan.liang@linux•intel.com>,
	Will Deacon <will@kernel•org>,
	Russell King <linux@armlinux•org.uk>,
	Catalin Marinas <catalin.marinas@arm•com>,
	Michael Ellerman <mpe@ellerman•id.au>,
	Nicholas Piggin <npiggin@gmail•com>,
	Christophe Leroy <christophe.leroy@csgroup•eu>,
	Naveen N Rao <naveen@kernel•org>,
	Heiko Carstens <hca@linux•ibm.com>,
	Vasily Gorbik <gor@linux•ibm.com>,
	Alexander Gordeev <agordeev@linux•ibm.com>,
	Christian Borntraeger <borntraeger@linux•ibm.com>,
	Sven Schnelle <svens@linux•ibm.com>,
	Thomas Gleixner <tglx@linutronix•de>,
	Borislav Petkov <bp@alien8•de>,
	Dave Hansen <dave.hansen@linux•intel.com>,
	x86@kernel•org, "H . Peter Anvin" <hpa@zytor•com>,
	linux-perf-users@vger•kernel.org, linux-kernel@vger•kernel.org,
	linux-arm-kernel@lists•infradead.org,
	linuxppc-dev@lists•ozlabs.org, linux-s390@vger•kernel.org
Subject: Re: [PATCH 4/5] x86: perf: Refactor misc flag assignments
Date: Thu, 5 Sep 2024 11:22:20 +0200	[thread overview]
Message-ID: <Ztl4TDI98tnCkH0X@gmail.com> (raw)
In-Reply-To: <20240904204133.1442132-5-coltonlewis@google.com>


* Colton Lewis <coltonlewis@google•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@google•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


  reply	other threads:[~2024-09-05  9:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04 20:41 [PATCH 0/5] Correct perf sampling with guest VMs Colton Lewis
2024-09-04 20:41 ` [PATCH 1/5] arm: perf: Drop unused functions Colton Lewis
2024-09-05 10:25   ` Mark Rutland
2024-09-11 17:24     ` Colton Lewis
2024-09-04 20:41 ` [PATCH 2/5] perf: Hoist perf_instruction_pointer() and perf_misc_flags() Colton Lewis
2024-09-05  9:46   ` Ingo Molnar
2024-09-11 22:01     ` Colton Lewis
2024-09-04 20:41 ` [PATCH 3/5] powerpc: perf: Use perf_arch_instruction_pointer() Colton Lewis
2024-09-04 20:41 ` [PATCH 4/5] x86: perf: Refactor misc flag assignments Colton Lewis
2024-09-05  9:22   ` Ingo Molnar [this message]
2024-09-11 22:05     ` Colton Lewis
2024-09-04 20:41 ` [PATCH 5/5] perf: Correct perf sampling with guest VMs Colton Lewis
2024-09-05 10:55   ` Mark Rutland
2024-09-11 17:42     ` Colton Lewis

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=Ztl4TDI98tnCkH0X@gmail.com \
    --to=mingo@kernel$(echo .)org \
    --cc=acme@kernel$(echo .)org \
    --cc=adrian.hunter@intel$(echo .)com \
    --cc=agordeev@linux$(echo .)ibm.com \
    --cc=alexander.shishkin@linux$(echo .)intel.com \
    --cc=borntraeger@linux$(echo .)ibm.com \
    --cc=bp@alien8$(echo .)de \
    --cc=catalin.marinas@arm$(echo .)com \
    --cc=christophe.leroy@csgroup$(echo .)eu \
    --cc=coltonlewis@google$(echo .)com \
    --cc=dave.hansen@linux$(echo .)intel.com \
    --cc=gor@linux$(echo .)ibm.com \
    --cc=hca@linux$(echo .)ibm.com \
    --cc=hpa@zytor$(echo .)com \
    --cc=irogers@google$(echo .)com \
    --cc=jolsa@kernel$(echo .)org \
    --cc=kan.liang@linux$(echo .)intel.com \
    --cc=kvm@vger$(echo .)kernel.org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-perf-users@vger$(echo .)kernel.org \
    --cc=linux-s390@vger$(echo .)kernel.org \
    --cc=linux@armlinux$(echo .)org.uk \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=mark.rutland@arm$(echo .)com \
    --cc=mingo@redhat$(echo .)com \
    --cc=mpe@ellerman$(echo .)id.au \
    --cc=namhyung@kernel$(echo .)org \
    --cc=naveen@kernel$(echo .)org \
    --cc=npiggin@gmail$(echo .)com \
    --cc=oliver.upton@linux$(echo .)dev \
    --cc=peterz@infradead$(echo .)org \
    --cc=seanjc@google$(echo .)com \
    --cc=svens@linux$(echo .)ibm.com \
    --cc=tglx@linutronix$(echo .)de \
    --cc=will@kernel$(echo .)org \
    --cc=x86@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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