From: Andi Kleen <andi@firstfloor.org>
To: Hui Zhu <teawater@gmail.com>
Cc: linux-kernel@vger.kernel.org, Andi Kleen <andi@firstfloor.org>,
Christoph Hellwig <hch@infradead.org>,
Geoff Levand <geoff@infradead.org>,
jason.wessel@windriver.com
Subject: Re: [PATCH]KGTP (Linux Kernel debugger and tracer) lite patch for review
Date: Wed, 9 May 2012 16:05:39 +0200 [thread overview]
Message-ID: <20120509140538.GZ27374@one.firstfloor.org> (raw)
In-Reply-To: <4FAA1953.60102@gmail.com>
Please provide better explanation of the use case for this module.
One paragraph why someone would want it in their kernel.
> +++ b/arch/arm/include/asm/gtp.h
> @@ -0,0 +1,34 @@
> +#ifndef _ASM_ARM_GTP_H_
> +#define _ASM_ARM_GTP_H_
> +
> +#define ULONGEST uint64_t
So u64 in kernel. Just use that.
> +#define CORE_ADDR unsigned long
In linux kernel CORE_ADDR is always unsigned long. Use that.
> +
> +#define GTP_REG_ASCII_SIZE 336
> +
> +static inline void
> +gtp_regs2ascii(struct pt_regs *regs, char *buf)
> +{
> +#ifdef __LITTLE_ENDIAN
> +#define SWAB(a) swab32(a)
> +#else
> +#define SWAB(a) (a)
> +#endif
That's just ntohl()? Just use that
Linux already has macros for this:
> + int i;
> +
> + for (i = 0; i < 16; i++) {
> + sprintf(buf, "%08lx", (unsigned long) SWAB(regs->uregs[i]));
Is the gdb protocol really big endian in ASCII?
Also could you share code on this with the in kernel gdbstub?
> +#include <linux/slab.h>
> +#include <asm/gtp.h>
> +
> +#define GTP_DEBUG KERN_WARNING
You should use the pr_* macros now
> +static int gtp_disconnected_tracing;
> +static int gtp_circular;
> +
> +static DEFINE_SPINLOCK(gtp_frame_lock);
Every spinlock needs a comment that describes what it protects.
I believe checkpatch warns about that. Did you run it?
> +
> + tmp = gtp_frame_alloc(GTP_FRAME_REG_SIZE);
> + if (!tmp)
> + return NULL;
> +
> + *next = tmp;
> + tmp[0] = 'r';
> + freg = (struct gtp_frame_reg *) (tmp + 1);
> + memcpy(&freg->regs, regs, sizeof(struct pt_regs));
> +#if !defined CONFIG_X86_32 && !defined CONFIG_X86_64
> + freg->regs.sp = (unsigned long)®s->sp;
> +#endif /* CONFIG_X86_32 CONFIG_X86_64 */
That looks weird. What does that do?
> +gtp_action_alloc(char type)
> +{
> + struct action *ret;
> +
> + ret = kmalloc(sizeof(struct action), GFP_KERNEL);
kzalloc
Same problem in others.
> +static int
> +hex2int(char hex, int *i)
I'm sure we have code for this. strtoul et.al.?
Didn't read further so far.
-Andi
next prev parent reply other threads:[~2012-05-09 14:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 7:14 [PATCH]KGTP (Linux Kernel debugger and tracer) lite patch for review Hui Zhu
2012-05-09 14:05 ` Andi Kleen [this message]
2012-05-10 12:15 ` Hui Zhu
2012-05-10 17:38 ` Andi Kleen
2012-05-24 13:35 ` Hui Zhu
2012-05-24 15:07 ` Andi Kleen
2013-11-21 5:05 ` Hui Zhu
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=20120509140538.GZ27374@one.firstfloor.org \
--to=andi@firstfloor.org \
--cc=geoff@infradead.org \
--cc=hch@infradead.org \
--cc=jason.wessel@windriver.com \
--cc=linux-kernel@vger.kernel.org \
--cc=teawater@gmail.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