From: Jan Kiszka <jan.kiszka@siemens.com>
To: Jason Wessel <jason.wessel@windriver.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kgdb-bugreport@lists.sourceforge.net"
<kgdb-bugreport@lists.sourceforge.net>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>
Subject: Re: [PATCH 4/4] kgdb: x86: Detach gdb if machine shuts down or reboots
Date: Mon, 19 Mar 2012 14:49:53 +0100 [thread overview]
Message-ID: <4F673981.8030709@siemens.com> (raw)
In-Reply-To: <4F635E06.8070006@windriver.com>
On 2012-03-16 16:36, Jason Wessel wrote:
> On 03/16/2012 07:17 AM, Jan Kiszka wrote:
>> Hook into machine restart/power-off/halt handlers and call gdbstub_exit
>> so that a attached gdb frontend is properly informed. If kgdb is
>> disabled or no frontend attached, gdbstub_exit will do nothing.
>>
>
>
> We have long had an out of tree patch which hooked the reboot notifier, vs adding call backs to the actual reboot functions. It seems at first glance that all of cases that Jan probably cares about are actually caught by the reboot notifier.
>
> I attached the patch I am referencing, and perhaps Jan can try it out. It applies on top of Jan's series at the moment.
>
> A few more comments first.
>
>> static void __machine_emergency_restart(int emergency)
>> {
>> reboot_emergency = emergency;
>> + gdbstub_exit(1);
>
>
> If we do have to add callbacks at the arch level, my preference is to pass the stop code like you would have received in the reboot notifier. Specifically something like: gdbstub_exit(SYS_RESTART).
Yes, that sounds reasonable.
>
>> machine_ops.emergency_restart();
>> }
>>
>> @@ -730,6 +732,7 @@ struct machine_ops machine_ops = {
>>
>> void machine_power_off(void)
>> {
>> + gdbstub_exit(0);
>
>
> Similarly gdbstub_exit(SYS_HALT) and so on.
>
> Jan, what do you think about trying the reboot notifier version?
An arch-independent hook has its advantages, no question. Maybe we
should just start this way and then evolved on top as needed.
I was wondering why those other archs do not use the notifier. Maybe one
motivation is to avoid that too much code is excluded from the debugger
by detaching too early. Could possibly be addressed by making
detach-on-reboot runtime configurable.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2012-03-19 13:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-16 12:17 [PATCH 0/4] kgdb: Small usability improvements for x86 Jan Kiszka
2012-03-16 12:17 ` [PATCH 1/4] kgdb: x86: Return all segment registers also in 64-bit mode Jan Kiszka
2012-03-16 15:57 ` Jason Wessel
2012-03-19 13:52 ` Jan Kiszka
2012-03-19 20:52 ` Jason Wessel
2012-03-16 12:17 ` [PATCH 2/4] kgdb: Make gdbstub_exit a nop unless gdb is attached Jan Kiszka
2012-03-16 16:04 ` Jason Wessel
2012-03-16 12:17 ` [PATCH 3/4] kgdb: Respect that flush op is optional Jan Kiszka
2012-03-16 12:46 ` Jason Wessel
2012-03-16 12:53 ` Jan Kiszka
2012-03-16 16:16 ` Jason Wessel
2012-03-16 12:17 ` [PATCH 4/4] kgdb: x86: Detach gdb if machine shuts down or reboots Jan Kiszka
2012-03-16 15:36 ` Jason Wessel
2012-03-19 13:49 ` Jan Kiszka [this message]
2012-03-20 1:00 ` Jason Wessel
2012-03-20 11:18 ` [Kgdb-bugreport] " Sergei Shtylyov
2012-03-20 11:46 ` Jason Wessel
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=4F673981.8030709@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=hpa@zytor.com \
--cc=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox