Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-11 Thread Leonardo Bras
On Tue, 2019-06-11 at 10:44 +0530, Anshuman Khandual wrote: > > On 06/10/2019 08:57 PM, Leonardo Bras wrote: > > On Mon, 2019-06-10 at 08:09 +0530, Anshuman Khandual wrote: > > > > > +/* > > > > > + * To be potentially processing a kprobe fault and to be allowed > > > > > + * to call

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-10 Thread Anshuman Khandual
On 06/11/2019 10:16 AM, Christophe Leroy wrote: > > > Le 10/06/2019 à 04:39, Anshuman Khandual a écrit : >> >> >> On 06/07/2019 09:01 PM, Christophe Leroy wrote: >>> >>> >>> Le 07/06/2019 à 12:34, Anshuman Khandual a écrit : Very similar definitions for notify_page_fault() are being used

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-10 Thread Anshuman Khandual
On 06/10/2019 08:57 PM, Leonardo Bras wrote: > On Mon, 2019-06-10 at 08:09 +0530, Anshuman Khandual wrote: +/* + * To be potentially processing a kprobe fault and to be allowed + * to call kprobe_running(), we have to be non-preemptible. + */ +if

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-10 Thread Christophe Leroy
Le 10/06/2019 à 04:39, Anshuman Khandual a écrit : On 06/07/2019 09:01 PM, Christophe Leroy wrote: Le 07/06/2019 à 12:34, Anshuman Khandual a écrit : Very similar definitions for notify_page_fault() are being used by multiple architectures duplicating much of the same code. This

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-10 Thread Leonardo Bras
On Mon, 2019-06-10 at 08:09 +0530, Anshuman Khandual wrote: > > > +/* > > > + * To be potentially processing a kprobe fault and to be allowed > > > + * to call kprobe_running(), we have to be non-preemptible. > > > + */ > > > +if (kprobes_built_in() && !preemptible() &&

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-09 Thread Anshuman Khandual
On 06/10/2019 10:27 AM, Dave Hansen wrote: > On 6/9/19 9:34 PM, Anshuman Khandual wrote: >>> Do you really think this is easier to read? >>> >>> Why not just move the x86 version to include/linux/kprobes.h, and replace >>> the int with bool? >> Will just return bool directly without an

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-09 Thread Dave Hansen
On 6/9/19 9:34 PM, Anshuman Khandual wrote: >> Do you really think this is easier to read? >> >> Why not just move the x86 version to include/linux/kprobes.h, and replace >> the int with bool? > Will just return bool directly without an additional variable here as > suggested > before. But for

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-09 Thread Anshuman Khandual
On 06/07/2019 08:36 PM, Dave Hansen wrote: > On 6/7/19 3:34 AM, Anshuman Khandual wrote: >> +static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs, >> + unsigned int trap) >> +{ >> +int ret = 0; >> + >> +/* >> + * To be

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-09 Thread Anshuman Khandual
On 06/08/2019 01:42 AM, Matthew Wilcox wrote: > Before: > >> @@ -46,23 +46,6 @@ kmmio_fault(struct pt_regs *regs, unsigned long addr) >> return 0; >> } >> >> -static nokprobe_inline int kprobes_fault(struct pt_regs *regs) >> -{ >> -if (!kprobes_built_in()) >> -return 0;

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-09 Thread Anshuman Khandual
On 06/07/2019 09:01 PM, Christophe Leroy wrote: > > > Le 07/06/2019 à 12:34, Anshuman Khandual a écrit : >> Very similar definitions for notify_page_fault() are being used by multiple >> architectures duplicating much of the same code. This attempts to unify all >> of them into a generic

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-09 Thread Anshuman Khandual
On 06/07/2019 05:33 PM, Stephen Rothwell wrote: > Hi Anshuman, > > On Fri, 7 Jun 2019 16:04:15 +0530 Anshuman Khandual > wrote: >> >> +static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs, >> + unsigned int trap) >> +{ >> +int ret =

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-07 Thread Matthew Wilcox
Before: > @@ -46,23 +46,6 @@ kmmio_fault(struct pt_regs *regs, unsigned long addr) > return 0; > } > > -static nokprobe_inline int kprobes_fault(struct pt_regs *regs) > -{ > - if (!kprobes_built_in()) > - return 0; > - if (user_mode(regs)) > - return 0; >

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-07 Thread Christophe Leroy
Le 07/06/2019 à 12:34, Anshuman Khandual a écrit : Very similar definitions for notify_page_fault() are being used by multiple architectures duplicating much of the same code. This attempts to unify all of them into a generic implementation, rename it as kprobe_page_fault() and then move it

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-07 Thread Dave Hansen
On 6/7/19 3:34 AM, Anshuman Khandual wrote: > +static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs, > + unsigned int trap) > +{ > + int ret = 0; > + > + /* > + * To be potentially processing a kprobe fault and to be allowed > +

Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-07 Thread Stephen Rothwell
Hi Anshuman, On Fri, 7 Jun 2019 16:04:15 +0530 Anshuman Khandual wrote: > > +static nokprobe_inline bool kprobe_page_fault(struct pt_regs *regs, > + unsigned int trap) > +{ > + int ret = 0; > + > + /* > + * To be potentially processing a

[RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault()

2019-06-07 Thread Anshuman Khandual
Very similar definitions for notify_page_fault() are being used by multiple architectures duplicating much of the same code. This attempts to unify all of them into a generic implementation, rename it as kprobe_page_fault() and then move it to a common header. kprobes_built_in() can detect