public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Josh Triplett <josh@joshtriplett.org>
Cc: kvm@vger.kernel.org,
	Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	David Herrmann <dh.herrmann@gmail.com>,
	Stephane Eranian <eranian@google.com>,
	Paul Gortmaker <paul.gortmaker@windriver.com>,
	Paul Mackerras <paulus@samba.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andi Kleen <ak@linux.intel.com>,
	x86@kernel.org, Ingo Molnar <mingo@redhat.com>,
	oprofile-list@lists.sf.net, Mel Gorman <mgorman@suse.de>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Borislav Petkov <bp@suse.de>, Dave Young <dyoung@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Gleb Natapov <gleb@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>, Bin Gao <bin.gao@intel.com>,
	Matt Fleming <matt.fleming@intel.com>,
	Jacob Shin <jacob.shin@amd.com>,
	linux-kernel@vger.kernel.org, Torsten Kaiser <just.for.lkml@goog
Subject: Re: [PATCH v2 3/7] x86, ptrace: Ifdef HW_BREAKPOINTS code in ptrace
Date: Mon, 10 Mar 2014 15:35:22 +0100	[thread overview]
Message-ID: <20140310143522.GB21735@redhat.com> (raw)
In-Reply-To: <2741f8cbe6346ef051f7f7b1c39f9a026942b763.1394418994.git.josh@joshtriplett.org>

On 03/09, Josh Triplett wrote:
>
> +#ifdef CONFIG_HW_BREAKPOINTS
> +
>  static void ptrace_triggered(struct perf_event *bp,
>  			     struct perf_sample_data *data,
>  			     struct pt_regs *regs)
> @@ -778,6 +780,34 @@ static int ptrace_set_debugreg(struct task_struct *tsk, int n,
>  	return rc;
>  }
>
> +#else
> +
> +/* Without breakpoints only handle DR6 */
> +static unsigned long ptrace_get_debugreg(struct task_struct *tsk, int n)
> +{
> +	struct thread_struct *thread = &tsk->thread;
> +
> +	if (n == 6)
> +		return thread->debugreg6;
> +	return 0;
> +}
> +
> +/* Without breakpoints only handle DR6 */
> +static int ptrace_set_debugreg(struct task_struct *tsk, int n,
> +			       unsigned long val)
> +{
> +	struct thread_struct *thread = &tsk->thread;
> +	int rc = -EIO;
> +
> +	if (n == 6) {
> +		thread->debugreg6 = val;
> +		rc = 0;
> +	}
> +	return rc;
> +}
> +
> +#endif

OK, but then perhaps this patch should also make thread_struct->ptrace_bps[]
depend on CONFIG_HW_BREAKPOINTS ?

This needs more changes though. In particular, it seems it makes sense to
move flush_ptrace_hw_breakpoint() to x86/kernel/ptrace.c, so that it can
live in the same ifdef'ed section.

copy_threads() needs a cleanup anyway...

But I won't insist if you prefer to do this later.

Oleg.


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech

  parent reply	other threads:[~2014-03-10 14:35 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1394418994.git.josh@joshtriplett.org>
2014-03-10  4:19 ` [PATCH v2 0/7] Allow disabling HW_BREAKPOINTS, PERF_EVENTS, INSTRUCTION_DECODER, IRQ_WORK, ANON_INODES Andi Kleen
2014-03-10  7:43 ` Ingo Molnar
2014-03-10  8:42   ` Josh Triplett
2014-03-11 10:29     ` Ingo Molnar
2014-03-10 14:50   ` Oleg Nesterov
2014-03-11 10:30     ` Ingo Molnar
     [not found] ` <32f5e0a3b421b615be3af24b0319afff1a385403.1394418994.git.josh@joshtriplett.org>
2014-03-10 14:21   ` [PATCH v2 4/7] trace: Make UPROBES depend on PERF_EVENTS Oleg Nesterov
2014-03-10 15:03     ` Josh Triplett
     [not found] ` <2741f8cbe6346ef051f7f7b1c39f9a026942b763.1394418994.git.josh@joshtriplett.org>
2014-03-10 14:35   ` Oleg Nesterov [this message]
2014-03-10 14:42     ` [PATCH v2 3/7] x86, ptrace: Ifdef HW_BREAKPOINTS code in ptrace Oleg Nesterov
2014-03-10 15:15       ` Josh Triplett
2014-03-10 17:41         ` Andi Kleen
2014-03-10 17:44           ` Andi Kleen
     [not found] ` <5a5942a0cdb0914ecd81d2880190c19abb228511.1394418994.git.josh@joshtriplett.org>
2014-03-10 16:14   ` [PATCH v2 6/7] x86: Allow disabling HW_BREAKPOINTS, PERF_EVENTS, INSTRUCTION_DECODER, IRQ_WORK Frederic Weisbecker
2014-03-10 17:20     ` Josh Triplett
2014-03-10 20:50     ` Josh Triplett

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=20140310143522.GB21735@redhat.com \
    --to=oleg@redhat.com \
    --cc=Suravee.Suthikulpanit@amd.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=ak@linux.intel.com \
    --cc=bin.gao@intel.com \
    --cc=bp@suse.de \
    --cc=dh.herrmann@gmail.com \
    --cc=dyoung@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=gleb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=jacob.shin@amd.com \
    --cc=josh@joshtriplett.org \
    --cc=just.for.lkml@goog \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt.fleming@intel.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=oprofile-list@lists.sf.net \
    --cc=paul.gortmaker@windriver.com \
    --cc=paulus@samba.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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