All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: "K.Prasad" <prasad@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Lai Jiangshan <laijs@cn.fujitsu.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [Patch 3/3] HW-BKPT: Enable/disable the breakpoints when still registered
Date: Thu, 27 Aug 2009 11:25:08 +0530	[thread overview]
Message-ID: <20090827055507.GA7756@in.ibm.com> (raw)
In-Reply-To: <20090826201506.GD12766@in.ibm.com>

On Thu, Aug 27, 2009 at 01:45:06AM +0530, K.Prasad wrote:

...

>  struct hw_breakpoint {
> +	/*
> +	 * Denotes if a breakpoint is currently enabled in physical debug
> +	 * registers. Not to be set directly by the end-user. Must be
> +	 * operated through enable_hw_breakpoint() API only.
> +	 */
> +	unsigned int enabled;

bool?

...

> +void enable_hw_breakpoint(struct hw_breakpoint *bp, struct task_struct *tsk,
> +							unsigned int enabled)
> +{
> +	int i;
> +	struct thread_struct *thread = &(tsk->thread);
> +
> +	spin_lock_bh(&hw_breakpoint_lock);
> +
> +	bp->enabled = enabled;
> +	/* Enable/Disable the kernel-space breakpoint */
> +	if (!tsk) {
> +		if (cpumask_test_cpu(smp_processor_id(), bp->cpumask))
> +			arch_update_kernel_hw_breakpoint(NULL);
> +		smp_call_function_many(bp->cpumask,
> +				arch_update_kernel_hw_breakpoint, NULL, 1);
> +		goto out;
> +	}
> +
> +	/* Enable/disable the user-space breakpoint */
> +	for (i = 0; i < hbp_kernel_pos; i++) {
> +		if (thread->hbp[i] != bp)
> +			continue;
> +		arch_update_user_hw_breakpoint(i, tsk);
> +		if (tsk == current)
> +			arch_install_thread_hw_breakpoint(tsk);
> +		break;
> +	}
> +out:
> +	spin_unlock_bh(&hw_breakpoint_lock);
> +}
> +EXPORT_SYMBOL_GPL(enable_hw_breakpoint);

Not sure if its cleaner to have enable_hw_breakpoint() and
disable_hw_breakpoint() rather than one overloaded call.

Ananth

  reply	other threads:[~2009-08-27  5:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20090826200840.118253312@linux.vnet.ibm.com>
2009-08-26 20:14 ` [Patch 1/3] HW-BKPT: Allow per-cpu kernel-space Hardware Breakpoint requests K.Prasad
2009-08-26 20:14 ` [Patch 2/3] HW-BKPT: Allow kernel breakpoints to be modified through a new API K.Prasad
2009-08-26 20:15 ` [Patch 3/3] HW-BKPT: Enable/disable the breakpoints when still registered K.Prasad
2009-08-27  5:55   ` Ananth N Mavinakayanahalli [this message]
2009-08-28 19:06     ` K.Prasad
     [not found] <20090828190842.015422920@abc>
2009-08-28 19:19 ` K.Prasad

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=20090827055507.GA7756@in.ibm.com \
    --to=ananth@in.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=fweisbec@gmail.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=mingo@elte.hu \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=stern@rowland.harvard.edu \
    /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.