From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: Re: [PATCH v2 3/7] x86, ptrace: Ifdef HW_BREAKPOINTS code in ptrace Date: Mon, 10 Mar 2014 15:42:55 +0100 Message-ID: <20140310144254.GC21735@redhat.com> References: <2741f8cbe6346ef051f7f7b1c39f9a026942b763.1394418994.git.josh@joshtriplett.org> <20140310143522.GB21735@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Suravee Suthikulpanit , Frederic Weisbecker , David Herrmann , Stephane Eranian , Paul Gortmaker , Paul Mackerras , "H. Peter Anvin" , Thomas Gleixner , Andi Kleen , x86@kernel.org, Ingo Molnar , oprofile-list@lists.sf.net, Mel Gorman , Arnaldo Carvalho de Melo , Borislav Petkov , Dave Young , Peter Zijlstra , Gleb Natapov , Steven Rostedt , Bin Gao , Matt Fleming , Jacob Shin , linux-kernel@vger.kernel.org, Torsten Kaiser Return-path: Content-Disposition: inline In-Reply-To: <20140310143522.GB21735@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: oprofile-list-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org On 03/10, Oleg Nesterov wrote: > > On 03/09, Josh Triplett wrote: > > > > +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 ? and ->ptrace_dr7 at least. And in fact, why do we need ptrace_get/set_debugreg(DR6) without HW_BREAKPOINTS? Perhaps get/set should just return the error? > But I won't insist if you prefer to do this later. Yes. 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