All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: linux-kernel@vger.kernel.org,
	"Frank Ch. Eigler" <fche@redhat.com>,
	Roland McGrath <roland@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andi Kleen <andi@firstfloor.org>
Subject: Re: [git pull] kgdb-light -v10
Date: Tue, 12 Feb 2008 13:19:03 +0100	[thread overview]
Message-ID: <20080212121903.GA419@one.firstfloor.org> (raw)
In-Reply-To: <20080212112747.GA1569@elte.hu>

On Tue, Feb 12, 2008 at 12:27:47PM +0100, Ingo Molnar wrote:
> > > +	return pid_max + raw_smp_processor_id();
> > 
> > Whatever that shadowpid is. [...]
> 
> GDB wants to track threads, but on the Linux side each idle task has PID 
> 0, so GDB cannot track them. The shadow PID is this remapped space.

Ok, please write that as a comment into the source.

> 
> > That wrapper should not be needed; everybody can use 
> > instruction_pointer() directly, no?
> 
> no, not all architectures have it. This is a weak alias that is 
> otherwise not linked into the kernel.

Can't be very many because oprofile needs it and it works on most archs now.
Anyways, the right thing is to just add it to the architectures
that still miss it, not reimplement it in kgdb.
 
> > > +		if (user_mode(regs))
> > > +			return NOTIFY_DONE;
> > 
> > That seems weird. I think other parts try to support user mode 
> > debugging too. In theory there is no reason it shouldn't be able to do 
> > this (except that you have to make sure to not break regular gdb of 
> > course)
> 
> The currently submitted code does not try to support user mode 
> debugging. It might be a nice add-on later, if done cleanly and 
> correctly enough. If you are interested we welcome patches from you!

Hmm, I'm pretty sure I saw some code that was only useful for the
user case. Perhaps you should take all that out then if it doesn't
work anyways?

a good example is all the code trying to handle user mode mappings.

> 
> > > +	/*
> > > +	 * Lowest-prio notifier priority, we want to be notified last:
> > > +	 */
> > > +	.priority	= -INT_MAX,
> > 
> > This means kcrash will have priority won't it? Doesn't seem correct.
> 
> yes, this means if the user has configured kcrash as well then that will 
> have priority over kgdb. This is the intended behavior.

Seems wrong intended behaviour to me. If kgdb is active it should have priority
over crash dumps.

> 
> > First nobody answered the "kgdb clean enough for a module" high level 
> > question yet. Is it good enough for that?
> 
> i disagree that a kernel debugger should necessarily be a kernel module. 
> It might be nice at a future stage, but right now it would just 
> introduce unnecessary complexity.

The question is less about actually having it as a module, but 
just if the interfaces are clean enough to allow it as a module.
If not you should probably clean them up.


> > > more NR_CPUS spinlocks, there's now proper use of barriers, etc. No 
> > > more silly "timeouts" for locking either ... There's now a very 
> > > well-defined
> > 
> > A timeout for waiting for other CPUs is actually not a bad idea for a 
> > debugger. After all you still want to debug even if some other CPUs 
> > are dead.
> 
> i went for correctness and simplicity first. If a system is hung, the 

If all code is correct, it likely won't need a debugger.
But if you write a debugger you can't assume that.

> debugging CPU might hang too at any time. A timeout on the other hand 


> corrupting debugger data. So for now the rule is 
> very simple.
> 
> timeouts might be an optional "would be nice" feature for later on.

Ok it just makes kgdb useless for a wide range of kernel problems.
Hung CPUs are not that uncommon in my experience.


> 
> > > previously Mark indicated some sort of sprintf return value breakage 
> > > he observed, and kgdb would rely on sprintf return values so i'm 
> > > inclined to leave it as-is. We can fix that later, it's not 
> > > critical.
> > 
> > Pretty much all the proc output and sysfs show functions rely on these 
> > return values, so if there is a problem it is likely very obscure.
> 

> relies on it mostly for user-space "this many bytes were processed" 
> return values and those values are often wrong and user-space just 
> handles it gratiously.

If the return value of read() is wrong not even cat(1) will work
correctly, but lose bytes.

You're saying cat is not supposed to work on /proc? That's certainly
not my experience from many years of successfull cat /proc/... use.

> 
> Anyway, the presence of a few special parsers that impact nothing else 
> but kgdb is not even close to being a merge showstopper, it is something 
> that can be consolidated later on. We've already got 7 instances of KGDB 
> code in the upstream kernel:
> 
>   ./sparc/kernel/sparc-stub.c
>   ./cris/arch-v32/kernel/kgdb.c
>   ./cris/arch-v10/kernel/kgdb.c
>   ./mips/kernel/gdb-stub.c
>   ./frv/kernel/gdb-stub.c
>   ./mn10300/kernel/gdb-stub.c
>   ./ppc/kernel/ppc-stub.c
> 
> so obviously these parsers work in practice.

Sure a lot of ugly code works in practice. If it's clean and maintaintable 
code is another question of course.

-Andi


  reply	other threads:[~2008-02-12 11:43 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-11  1:53 kgdb in git-x86#mm review Andi Kleen
2008-02-11 15:32 ` Frank Ch. Eigler
2008-02-11 16:11   ` Andi Kleen
2008-02-11 16:21   ` [git pull] kgdb-light -v8, (was: Re: kgdb in git-x86#mm review) Ingo Molnar
2008-02-11 16:41     ` [git pull] kgdb-light -v8, Jan Kiszka
2008-02-11 16:54       ` Ingo Molnar
2008-02-11 17:10     ` [git pull] kgdb-light -v8, (was: Re: kgdb in git-x86#mm review) Andi Kleen
2008-02-11 23:03       ` [git pull] kgdb-light -v9 Ingo Molnar
2008-02-12 10:03         ` Andi Kleen
2008-02-12  9:35           ` Sam Ravnborg
2008-02-12 10:26           ` Roland McGrath
2008-02-12 10:34             ` Ingo Molnar
2008-02-12 11:27           ` [git pull] kgdb-light -v10 Ingo Molnar
2008-02-12 12:19             ` Andi Kleen [this message]
2008-02-12 12:38               ` Ingo Molnar
2008-02-12 13:30                 ` Jason Wessel
2008-02-12 14:39                   ` Andi Kleen
2008-02-12 14:35                     ` Jason Wessel
2008-02-12 15:36                       ` Andi Kleen
2008-02-12 16:21                         ` Jason Wessel
2008-02-12 17:10                           ` Andi Kleen
2008-02-12 16:48                             ` Jason Wessel
2008-02-12 13:50                 ` Andi Kleen
2008-02-12 15:16                   ` Ingo Molnar
2008-02-12 15:28                     ` Andi Kleen
2008-02-12 15:28                   ` Ingo Molnar
2008-02-12 16:11                     ` Andi Kleen
2008-02-12 16:24                       ` Ingo Molnar
2008-02-12 17:01                         ` Andi Kleen
2008-02-12 16:25                       ` Linus Torvalds
2008-02-12 16:42                         ` Ingo Molnar
2008-02-12 17:07                         ` Andi Kleen
2008-02-15 12:35                           ` [RFC][PATCH] modular kgdb-light (was: Re: [git pull] kgdb-light -v10) Jan Kiszka
2008-02-15 13:32                             ` Andi Kleen
2008-02-15 20:24                               ` [RFC][PATCH] modular kgdb-light Jason Wessel
2008-02-15 20:36                         ` [git pull] kgdb-light -v10 Jason Wessel
2008-02-12 16:46                     ` Linus Torvalds
2008-02-12 17:01                       ` Ingo Molnar
2008-02-12 17:10                         ` Ingo Molnar
2008-02-12 18:20                       ` Andi Kleen
2008-02-12 18:11                         ` Linus Torvalds
2008-02-12 19:22                           ` Andi Kleen
2008-02-12 19:01                             ` Linus Torvalds
2008-02-12 18:20                         ` Andrew Morton
2008-02-12 19:16                           ` Andi Kleen
2008-02-12 21:01                             ` Ingo Molnar
2008-02-12 19:34                           ` Frank Ch. Eigler
2008-02-12 20:16                             ` Andi Kleen
2008-02-12 13:18             ` Domenico Andreoli
2008-02-12 13:59               ` Jason Wessel
2008-02-12 15:45                 ` Domenico Andreoli
2008-02-11 16:03 ` kgdb in git-x86#mm review Mark Lord

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=20080212121903.GA419@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=akpm@linux-foundation.org \
    --cc=fche@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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.