public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: Prasanna S Panchamukhi <prasanna@in.ibm.com>
Cc: linux-kernel@vger.kernel.org, torvalds@osdl.org,
	Andrew Morton <akpm@osdl.org>,
	suparna@in.ibm.com
Subject: Re: [1/2] PATCH Kernel watchpoint interface-2.6.9-rc4-mm1
Date: 18 Oct 2004 14:46:00 +0200
Date: Mon, 18 Oct 2004 14:46:00 +0200	[thread overview]
Message-ID: <20041018124600.GA6175@muc.de> (raw)
In-Reply-To: <20041018084525.GA27936@in.ibm.com>

> +config DEBUGREG
> +	bool "Global Debug Registers"

I agree with Keith that it shouldn't be user visible. I would always
enable it in fact.

> +{
> +	int i;
> +	if (flag == DR_ALLOC_LOCAL) {

[...] This all would be simpler if you used lib/idr.c, no?

> +int dr_free(int regnum)
> +{
> +	spin_lock(&dr_lock);
> +	if (regnum >= DR_MAX || dr_list[regnum].flag == DR_UNUSED) {
> +		spin_unlock(&dr_lock);
> +		return -1;

This should printk

> +#ifdef CONFIG_DEBUGREG
> +{
> +	/*
> +	 * Don't reload global debug registers. Don't touch the global debug
> +	 * register settings in dr7.
> +	 */
> +	unsigned long next_dr7 = next->debugreg[7];
> +	if (unlikely(next_dr7)) {
> +		if (DR7_L0(next_dr7)) loaddebug(next, 0);
> +		if (DR7_L1(next_dr7)) loaddebug(next, 1);
> +		if (DR7_L2(next_dr7)) loaddebug(next, 2);
> +		if (DR7_L3(next_dr7)) loaddebug(next, 3);

I would do this differently - check instead if the registers
are different between the tasks and only reload when different.
This will make updating/freeing more expensive because
you will need to change all tasks, but imho it's worth it.

And then no ifdefs please.

>  	 */
>  clear_dr7:
> -	__asm__("movl %0,%%db7"
> -		: /* no output */
> -		: "r" (0));
> +	load_process_dr7(0);
>  	CHK_REMOTE_DEBUG(1,SIGTRAP,error_code,regs,)

That's mm (and should go away anyways because debug notifiers are better) 
I would do the patch against mainline so that it can be actually merged.

-Andi

  parent reply	other threads:[~2004-10-18 12:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-18  8:43 [0/2] PATCH Kernel watchpoint interface-2.6.9-rc4-mm1 Prasanna S Panchamukhi
2004-10-18  8:45 ` [1/2] " Prasanna S Panchamukhi
2004-10-18  8:46   ` [2/2] " Prasanna S Panchamukhi
2004-10-22  6:40     ` Prasanna S Panchamukhi
2004-10-18  9:22   ` [1/2] " Keith Owens
2004-10-18 12:46   ` Andi Kleen [this message]
2004-10-22  6:15     ` Prasanna S Panchamukhi

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=20041018124600.GA6175@muc.de \
    --to=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.ibm.com \
    --cc=suparna@in.ibm.com \
    --cc=torvalds@osdl.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