Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Russell King <linux@armlinux.org.uk>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/3] perf: Add perf_event_attr::bp_priv
Date: Tue, 9 Jul 2024 11:03:04 +0100	[thread overview]
Message-ID: <20240709100304.GA12978@willie-the-truck> (raw)
In-Reply-To: <20240709095506.9691-2-yangtiezhu@loongson.cn>

On Tue, Jul 09, 2024 at 05:55:04PM +0800, Tiezhu Yang wrote:
> When developing hardware watchpoint on LoongArch, we want to set the
> same privilege passed by the ptrace user data, but there is no bridge
> to save this value like bp_addr, bp_type and bp_len. This is a common
> issue for the archs which have privilege level of breakpoint.
> 
> Add a member "bp_priv" which lives in a union on config3 at the end
> of the uapi struct perf_event_attr to make a bridge between ptrace
> and hardware breakpoint.
> 
> This is preparation for later patch on some archs such as ARM, ARM64
> and LoongArch which have privilege level of breakpoint.
> 
> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
> ---
>  include/uapi/linux/perf_event.h | 5 ++++-
>  kernel/events/hw_breakpoint.c   | 1 +
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
> index 3a64499b0f5d..abe8da7a1f60 100644
> --- a/include/uapi/linux/perf_event.h
> +++ b/include/uapi/linux/perf_event.h
> @@ -521,7 +521,10 @@ struct perf_event_attr {
>  	 */
>  	__u64	sig_data;
>  
> -	__u64	config3; /* extension of config2 */
> +	union {
> +		__u8	bp_priv; /* privilege level of breakpoint */
> +		__u64	config3; /* extension of config2 */
> +	};
>  };
>  
>  /*
> diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c
> index 6c2cb4e4f48d..3ad16b226e4f 100644
> --- a/kernel/events/hw_breakpoint.c
> +++ b/kernel/events/hw_breakpoint.c
> @@ -754,6 +754,7 @@ static void hw_breakpoint_copy_attr(struct perf_event_attr *to,
>  	to->bp_addr = from->bp_addr;
>  	to->bp_type = from->bp_type;
>  	to->bp_len  = from->bp_len;
> +	to->bp_priv = from->bp_priv;
>  	to->disabled = from->disabled;
>  }

Sorry, but I still don't see why we should change uapi for this. As I
have said multiple times, this is unnecessary.

Will


  reply	other threads:[~2024-07-09 10:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09  9:55 [PATCH v3 0/3] hw_breakpoint: Save privilege of access control via ptrace Tiezhu Yang
2024-07-09  9:55 ` [PATCH v3 1/3] perf: Add perf_event_attr::bp_priv Tiezhu Yang
2024-07-09 10:03   ` Will Deacon [this message]
2024-07-09 12:05     ` Tiezhu Yang
2024-07-09  9:55 ` [PATCH v3 2/3] arm: hw_breakpoint: Save privilege of access control via ptrace Tiezhu Yang
2024-07-09  9:55 ` [PATCH v3 3/3] arm64: " Tiezhu Yang
2024-07-09 10:05   ` Will Deacon
2024-07-09 12:07     ` Tiezhu Yang
2024-07-10 12:11       ` Will Deacon

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=20240709100304.GA12978@willie-the-truck \
    --to=will@kernel.org \
    --cc=acme@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yangtiezhu@loongson.cn \
    /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