Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Nigel Stephens <nigel@mips.com>
To: colin <colin@realtek.com.tw>
Cc: linux-mips@linux-mips.org
Subject: Re: Using hardware watchpoint for applications debugging
Date: Thu, 30 Mar 2006 11:49:22 +0100	[thread overview]
Message-ID: <442BB7B2.1010204@mips.com> (raw)
In-Reply-To: <002d01c6539f$d040a200$106215ac@realtek.com.tw>



colin wrote:
> As to adding watchpoint to kernel, there will be another problem.
> ASID in kernel is variable. Therefore, we cannot indicate which thread we
> want to watch by ASID.
> What we can do is setting G (global) bit to WatchHi Register and then all
> threads accessing that address will cause the exception.
> In the exception, it will filter the threads by PID to find out the thread
> we are watching.
>
>   

They're variable, but not very variable: the PID->ASID mapping will only
change when the ASIDs roll over and the ASID gets reallocated to a
different process, which will only happen after another 256 processes
have been created. But in that case your watched process will have to be
allocated a new ASID before it can run again. So you could, perhaps,
modify the TLB management code to clear the Watch registers whenever an
ASID belong to a process with watchpoints is recycled, and then
reprogram the Watch registers when such a process is allocated a new
ASID. Alternatively you could maintain pre-process copies of the Watch
registers, and context switch them along with other per-process register
state -- though that is adding context switch overhead to processes
which don't use watchpoints, and might not be popular with the maintainer.

Nigel

  parent reply	other threads:[~2006-03-30 10:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-29 13:47 Using hardware watchpoint for applications debugging colin
2006-03-29 13:47 ` colin
2006-03-29 14:08 ` Nigel Stephens
2006-03-29 14:32   ` Kevin D. Kissell
2006-03-29 14:32     ` Kevin D. Kissell
2006-03-30  2:19     ` colin
2006-03-30  2:19       ` colin
2006-03-30  2:15   ` colin
2006-03-30  2:15     ` colin
2006-03-30 10:49     ` Nigel Stephens [this message]
2006-03-30 18:37       ` Ralf Baechle
2006-03-30 18:57       ` Daniel Jacobowitz

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=442BB7B2.1010204@mips.com \
    --to=nigel@mips.com \
    --cc=colin@realtek.com.tw \
    --cc=linux-mips@linux-mips.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