public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: linux-s390@vger.kernel.org
Subject: Re: [patch 3/3] S390-HWBKPT v4: Modify ptrace to use Hardware
Date: Fri, 26 Mar 2010 23:15:50 +0000	[thread overview]
Message-ID: <20100326231548.GH7166@nowhere> (raw)
In-Reply-To: <20100203063932.GD17281@in.ibm.com>

On Wed, Feb 03, 2010 at 12:09:32PM +0530, Mahesh Salgaonkar wrote:
> +static void ptrace_triggered(struct perf_event *bp, int nmi,
> +			     struct perf_sample_data *data,
> +			     struct pt_regs *regs)
> +{
> +	struct thread_struct *thread = &(current->thread);
> +
> +	thread->ptrace_bps[0] = bp;
> +}



Hmm, I don't understand what happens here. You only set up the
thread->ptrace_bps here?

So if it never triggers it will never be freed? Also how do you
handle the signal?



> +
> +static void ptrace_set_breakpoint(struct task_struct *task, int disabled)
> +{
> +	per_struct *per_info;
> +	struct perf_event *bp;
> +	struct thread_struct *t = &task->thread;
> +	struct perf_event_attr attr;
> +
> +	hw_breakpoint_init(&attr);
> +	per_info = (per_struct *) &task->thread.per_info;
> +
> +	if (per_info->single_step | per_info->instruction_fetch)
> +		attr.bp_type = HW_BREAKPOINT_X;
> +	else if (per_info->storage_alteration)
> +		attr.bp_type = HW_BREAKPOINT_W;
> +	else {
> +		ptrace_remove_breakpoint(task);
> +		return;
> +	}
> +
> +	attr.disabled = disabled;
> +	attr.bp_addr = get_per_addr(per_info);
> +	attr.bp_len = get_per_len(per_info);
> +
> +	if (!t->ptrace_bps[0]) {
> +		bp = register_user_hw_breakpoint(&attr, ptrace_triggered, task);
> +		if (!IS_ERR(bp))
> +			t->ptrace_bps[0] = bp;



Hmm, and you actually set it up here before.
I'm not sure what's the point of doing the same in ptrace_triggered()

      reply	other threads:[~2010-03-26 23:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03  6:51 [patch 3/3] S390-HWBKPT v4: Modify ptrace to use Hardware Mahesh Salgaonkar
2010-03-26 23:15 ` Frederic Weisbecker [this message]

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=20100326231548.GH7166@nowhere \
    --to=fweisbec@gmail.com \
    --cc=linux-s390@vger.kernel.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