From: peterz@infradead.org (Peter Zijlstra)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 1/5] hw_breakpoint: Add step_needed event attribute
Date: Tue, 1 Aug 2017 10:18:17 +0200 [thread overview]
Message-ID: <20170801081817.GG6524@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <1d7ca935857f93bd09c82a2ff57a53e373211b7e.1501496603.git.panand@redhat.com>
On Mon, Jul 31, 2017 at 04:10:29PM +0530, Pratyush Anand wrote:
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 24a635887f28..7da951f94b47 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -233,6 +233,12 @@ struct hw_perf_event {
> */
> u64 freq_time_stamp;
> u64 freq_count_stamp;
> + /*
> + * A HW breakpoint user can either have it's own step handling
> + * mechanism or it can use default step handling meachanism defined
> + * by arch code. Set step_needed to use default mechanism.
> + */
> + int step_needed;
You'll note that there is an anonymous structure inside the anonymous
union specifically dedicated to hardware breakpoint state. Why not put
it there?
> #endif
> };
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 6c4e523dc1e2..66ce5574e778 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -9444,9 +9444,11 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
> } else if (is_write_backward(event)){
> event->overflow_handler = perf_event_output_backward;
> event->overflow_handler_context = NULL;
> + event->hw.step_needed = 1;
> } else {
> event->overflow_handler = perf_event_output_forward;
> event->overflow_handler_context = NULL;
> + event->hw.step_needed = 1;
> }
These here need a comment, because even if I'd know now why the heck we
need that = 1 here, I'd sure as hell won't know tomorrow.
WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Pratyush Anand <panand@redhat.com>
Cc: linux-arm-kernel@lists.infradead.org,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
mark.rutland@arm.com, will.deacon@arm.com,
huawei.libin@huawei.com, takahiro.akashi@linaro.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 1/5] hw_breakpoint: Add step_needed event attribute
Date: Tue, 1 Aug 2017 10:18:17 +0200 [thread overview]
Message-ID: <20170801081817.GG6524@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <1d7ca935857f93bd09c82a2ff57a53e373211b7e.1501496603.git.panand@redhat.com>
On Mon, Jul 31, 2017 at 04:10:29PM +0530, Pratyush Anand wrote:
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 24a635887f28..7da951f94b47 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -233,6 +233,12 @@ struct hw_perf_event {
> */
> u64 freq_time_stamp;
> u64 freq_count_stamp;
> + /*
> + * A HW breakpoint user can either have it's own step handling
> + * mechanism or it can use default step handling meachanism defined
> + * by arch code. Set step_needed to use default mechanism.
> + */
> + int step_needed;
You'll note that there is an anonymous structure inside the anonymous
union specifically dedicated to hardware breakpoint state. Why not put
it there?
> #endif
> };
>
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 6c4e523dc1e2..66ce5574e778 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -9444,9 +9444,11 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu,
> } else if (is_write_backward(event)){
> event->overflow_handler = perf_event_output_backward;
> event->overflow_handler_context = NULL;
> + event->hw.step_needed = 1;
> } else {
> event->overflow_handler = perf_event_output_forward;
> event->overflow_handler_context = NULL;
> + event->hw.step_needed = 1;
> }
These here need a comment, because even if I'd know now why the heck we
need that = 1 here, I'd sure as hell won't know tomorrow.
next prev parent reply other threads:[~2017-08-01 8:18 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 10:40 [PATCH v3 0/5] ARM64: disable irq between breakpoint and step exception Pratyush Anand
2017-07-31 10:40 ` Pratyush Anand
2017-07-31 10:40 ` [PATCH v3 1/5] hw_breakpoint: Add step_needed event attribute Pratyush Anand
2017-07-31 10:40 ` Pratyush Anand
2017-08-01 8:18 ` Peter Zijlstra [this message]
2017-08-01 8:18 ` Peter Zijlstra
2017-07-31 10:40 ` [PATCH v3 2/5] arm64: use hw_breakpoint_needs_single_step() to decide if step is needed Pratyush Anand
2017-07-31 10:40 ` Pratyush Anand
2017-07-31 10:40 ` [PATCH v3 3/5] register_wide_hw_breakpoint(): modify to accept step_needed arg Pratyush Anand
2017-07-31 10:40 ` Pratyush Anand
2017-07-31 10:40 ` [PATCH v3 4/5] arm64: disable irq between breakpoint and step exception Pratyush Anand
2017-07-31 10:40 ` Pratyush Anand
2017-07-31 10:40 ` [PATCH v3 5/5] arm64: fault: re-enable irq if it was disabled for single stepping Pratyush Anand
2017-07-31 10:40 ` Pratyush Anand
2017-07-31 17:15 ` [PATCH v3 0/5] ARM64: disable irq between breakpoint and step exception James Morse
2017-07-31 17:15 ` James Morse
2017-08-01 4:18 ` Pratyush Anand
2017-08-01 4:18 ` Pratyush Anand
2017-08-02 17:13 ` James Morse
2017-08-02 17:13 ` James Morse
2017-08-02 18:46 ` Pratyush Anand
2017-08-02 18:46 ` Pratyush Anand
2017-08-03 15:25 ` James Morse
2017-08-03 15:25 ` James Morse
2017-08-01 8:14 ` AKASHI Takahiro
2017-08-01 8:14 ` AKASHI Takahiro
2017-08-01 8:32 ` Pratyush Anand
2017-08-01 8:32 ` Pratyush Anand
2017-08-25 6:05 ` Pratyush Anand
2017-08-25 6:05 ` Pratyush Anand
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=20170801081817.GG6524@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.