From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] arm64: Store breakpoint single step state into pstate
Date: Mon, 4 Jan 2016 16:55:35 +0000 [thread overview]
Message-ID: <20160104165535.GI1616@arm.com> (raw)
In-Reply-To: <1450921362-198371-1-git-send-email-wangnan0@huawei.com>
Hello,
On Thu, Dec 24, 2015 at 01:42:42AM +0000, Wang Nan wrote:
> Two 'perf test' fail on arm64:
>
> # perf test overflow
> 17: Test breakpoint overflow signal handler : FAILED!
> 18: Test breakpoint overflow sampling : FAILED!
>
> When breakpoint raises, after perf_bp_event, breakpoint_handler()
> temporary disables breakpoint and enables single step. Then in
> single_step_handler(), reenable breakpoint. Without doing this
> the breakpoint would be triggered again.
>
> However, if there's a pending signal and it have signal handler,
> control would be transfer to signal handler, so single step handler
> would be applied to the first instruction of signal handler. After
> the handler return, the instruction triggered the breakpoint would be
> executed again. At this time the breakpoint is enabled, so the
> breakpoint is triggered again.
Whilst I appreciate that you're just trying to get those tests passing
on arm64, I really don't think its a good idea for us to try and emulate
the x86 debug semantics here. This doesn't happen for ptrace, and I think
we're likely to break more than we fix if we try to do it for perf too.
The problem seems to be that we take the debug exception before the
breakpointed instruction has been executed and call perf_bp_event at
that moment, so when we single-step the faulting instruction we actually
step into the SIGIO handler and end up getting stuck.
Your fix doesn't really address this afaict, in that you don't (can't?)
handle:
* A longjmp out of a signal handler
* A watchpoint and a breakpoint that fire on the same instruction
* User-controlled single-step from a signal handler that enables a
breakpoint explicitly
* Nested signals
so I'd really rather leave the code as-is.
Will
WARNING: multiple messages have this Message-ID (diff)
From: Will Deacon <will.deacon@arm.com>
To: Wang Nan <wangnan0@huawei.com>
Cc: takahiro.akashi@linaro.org, guohanjun@huawei.com,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, pi3orama@163.com,
Fengguang Wu <fengguang.wu@intel.com>,
Jiri Olsa <jolsa@kernel.org>
Subject: Re: [PATCH v2] arm64: Store breakpoint single step state into pstate
Date: Mon, 4 Jan 2016 16:55:35 +0000 [thread overview]
Message-ID: <20160104165535.GI1616@arm.com> (raw)
In-Reply-To: <1450921362-198371-1-git-send-email-wangnan0@huawei.com>
Hello,
On Thu, Dec 24, 2015 at 01:42:42AM +0000, Wang Nan wrote:
> Two 'perf test' fail on arm64:
>
> # perf test overflow
> 17: Test breakpoint overflow signal handler : FAILED!
> 18: Test breakpoint overflow sampling : FAILED!
>
> When breakpoint raises, after perf_bp_event, breakpoint_handler()
> temporary disables breakpoint and enables single step. Then in
> single_step_handler(), reenable breakpoint. Without doing this
> the breakpoint would be triggered again.
>
> However, if there's a pending signal and it have signal handler,
> control would be transfer to signal handler, so single step handler
> would be applied to the first instruction of signal handler. After
> the handler return, the instruction triggered the breakpoint would be
> executed again. At this time the breakpoint is enabled, so the
> breakpoint is triggered again.
Whilst I appreciate that you're just trying to get those tests passing
on arm64, I really don't think its a good idea for us to try and emulate
the x86 debug semantics here. This doesn't happen for ptrace, and I think
we're likely to break more than we fix if we try to do it for perf too.
The problem seems to be that we take the debug exception before the
breakpointed instruction has been executed and call perf_bp_event at
that moment, so when we single-step the faulting instruction we actually
step into the SIGIO handler and end up getting stuck.
Your fix doesn't really address this afaict, in that you don't (can't?)
handle:
* A longjmp out of a signal handler
* A watchpoint and a breakpoint that fire on the same instruction
* User-controlled single-step from a signal handler that enables a
breakpoint explicitly
* Nested signals
so I'd really rather leave the code as-is.
Will
next prev parent reply other threads:[~2016-01-04 16:55 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-23 8:52 [RESEND PATCH] arm64: Store breakpoint single step state into pstate Wang Nan
2015-12-23 8:52 ` Wang Nan
2015-12-23 10:44 ` kbuild test robot
2015-12-23 10:44 ` kbuild test robot
2015-12-24 1:42 ` [PATCH v2] " Wang Nan
2015-12-24 1:42 ` Wang Nan
2016-01-04 16:55 ` Will Deacon [this message]
2016-01-04 16:55 ` Will Deacon
2016-01-05 1:41 ` Wangnan (F)
2016-01-05 1:41 ` Wangnan (F)
2016-01-05 4:58 ` [RFC PATCH] arm64: perf test: Improbe bp_signal Wang Nan
2016-01-05 4:58 ` Wang Nan
2016-01-05 5:09 ` Wangnan (F)
2016-01-05 5:09 ` Wangnan (F)
2016-01-05 8:53 ` Jiri Olsa
2016-01-05 8:53 ` Jiri Olsa
2016-01-05 9:00 ` Jiri Olsa
2016-01-05 9:00 ` Jiri Olsa
2016-01-05 9:05 ` Jiri Olsa
2016-01-05 9:05 ` Jiri Olsa
2016-01-05 9:09 ` Jiri Olsa
2016-01-05 9:09 ` Jiri Olsa
2016-01-05 5:06 ` [PATCH v2] arm64: Store breakpoint single step state into pstate Wangnan (F)
2016-01-05 5:06 ` Wangnan (F)
2016-01-12 17:06 ` Will Deacon
2016-01-12 17:06 ` Will Deacon
2016-01-15 8:20 ` xiakaixu
2016-01-15 8:20 ` xiakaixu
2016-01-21 8:06 ` xiakaixu
2016-01-21 8:06 ` xiakaixu
2016-01-18 11:39 ` Wangnan (F)
2016-01-18 11:39 ` Wangnan (F)
2016-01-05 9:57 ` [RFC PATCH v2] perf test: Improve bp_signal Wang Nan
2016-01-05 9:57 ` Wang Nan
2016-01-05 10:07 ` Jiri Olsa
2016-01-05 10:07 ` Jiri Olsa
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=20160104165535.GI1616@arm.com \
--to=will.deacon@arm.com \
--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.