From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: catalin.marinas@arm.com, will.deacon@arm.com, jason.wessel@windriver.com
Cc: linux-arm-kernel@lists.infradead.org,
kgdb-bugreport@lists.sourceforge.net, stable@vger.kernel.org,
AKASHI Takahiro <takahiro.akashi@linaro.org>
Subject: [PATCH v2 1/3] arm64: kgdb: fix single stepping
Date: Fri, 23 Sep 2016 16:33:25 +0900 [thread overview]
Message-ID: <20160923073327.9657-2-takahiro.akashi@linaro.org> (raw)
In-Reply-To: <20160923073327.9657-1-takahiro.akashi@linaro.org>
After entering kgdb mode, the first 'stepi' can succeed, but the following
'stepi' never executes the next instruction.
This is because a software step cannot get enabled as the software step
bit(SS) in SPSR, which is cleared by the first single stepping, will not
be set again for the following 's' commands.
Please note that this bit, as well as the software step control bit(SS)
in MDSCR, must be set before resuming the execution.
kernel_active_single_step() called by kgdb_arch_handle_exception() checks
only for the bit in MDSCR, and so kgdb_enable_single_step() will never be
called.
This patch removes kgdb_disable_single_step() from 'c' command handling
and enables/disables a single step explicitly at every entry and exit
of 's' command handling.
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: <stable@vger.kernel.org> # 3.15-
---
arch/arm64/kernel/kgdb.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/arch/arm64/kernel/kgdb.c b/arch/arm64/kernel/kgdb.c
index 8c57f64..afe5f90 100644
--- a/arch/arm64/kernel/kgdb.c
+++ b/arch/arm64/kernel/kgdb.c
@@ -189,14 +189,6 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,
* over and over again.
*/
kgdb_arch_update_addr(linux_regs, remcom_in_buffer);
- atomic_set(&kgdb_cpu_doing_single_step, -1);
- kgdb_single_step = 0;
-
- /*
- * Received continue command, disable single step
- */
- if (kernel_active_single_step())
- kernel_disable_single_step();
err = 0;
break;
@@ -211,8 +203,6 @@ int kgdb_arch_handle_exception(int exception_vector, int signo,
*/
kgdb_arch_update_addr(linux_regs, remcom_in_buffer);
atomic_set(&kgdb_cpu_doing_single_step, raw_smp_processor_id());
- kgdb_single_step = 1;
-
/*
* Enable single step handling
*/
@@ -244,6 +234,9 @@ NOKPROBE_SYMBOL(kgdb_compiled_brk_fn);
static int kgdb_step_brk_fn(struct pt_regs *regs, unsigned int esr)
{
+ kernel_disable_single_step();
+ atomic_set(&kgdb_cpu_doing_single_step, -1);
+
kgdb_handle_exception(1, SIGTRAP, 0, regs);
return 0;
}
--
2.10.0
next prev parent reply other threads:[~2016-09-23 7:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-23 7:33 [PATCH v2 0/3] arm64: kgdb: fix single stepping AKASHI Takahiro
2016-09-23 7:33 ` AKASHI Takahiro [this message]
2016-09-23 7:33 ` [PATCH v2 2/3] arm64: kgdb: prevent kgdb from being invoked recursively AKASHI Takahiro
2016-09-23 10:02 ` Will Deacon
2016-09-23 7:33 ` [PATCH v2 3/3] arm64: kgdb: disable interrupts while a software step is enabled AKASHI Takahiro
2016-09-23 8:16 ` [PATCH v2 0/3] arm64: kgdb: fix single stepping Greg KH
2016-09-23 8:32 ` AKASHI Takahiro
2016-09-23 8:43 ` Greg KH
2016-09-23 9:27 ` AKASHI Takahiro
2016-09-23 9:23 ` Greg KH
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=20160923073327.9657-2-takahiro.akashi@linaro.org \
--to=takahiro.akashi@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=stable@vger.kernel.org \
--cc=will.deacon@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).