From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Date: Tue, 04 Jun 2019 21:53:26 +0000 Subject: Re: [RFC V2] mm: Generalize notify_page_fault() Message-Id: <20190604215325.GA2025@bombadil.infradead.org> List-Id: References: <1559630046-12940-1-git-send-email-anshuman.khandual@arm.com> In-Reply-To: <1559630046-12940-1-git-send-email-anshuman.khandual@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Anshuman Khandual Cc: Mark Rutland , Michal Hocko , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Catalin Marinas , Dave Hansen , Will Deacon , linux-mm@kvack.org, Paul Mackerras , sparclinux@vger.kernel.org, linux-s390@vger.kernel.org, Yoshinori Sato , Michael Ellerman , x86@kernel.org, Russell King , Ingo Molnar , Fenghua Yu , Stephen Rothwell , Andrey Konovalov , Andy Lutomirski , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Tony Luck , Heiko Carstens , linux-kernel@vger.kernel.org, Martin Schwidefsky , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" On Tue, Jun 04, 2019 at 12:04:06PM +0530, Anshuman Khandual wrote: > +++ b/arch/x86/mm/fault.c > @@ -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) > -{ ... > -} > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 0e8834a..c5a8dcf 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -1778,6 +1778,7 @@ static inline int pte_devmap(pte_t pte) > } > #endif > > +int notify_page_fault(struct pt_regs *regs, unsigned int trap); Why is it now out-of-line? > +++ b/mm/memory.c > +int __kprobes notify_page_fault(struct pt_regs *regs, unsigned int trap) > +{ > + int ret = 0; > + > + /* > + * 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() && !user_mode(regs)) { > + if (kprobe_running() && kprobe_fault_handler(regs, trap)) > + ret = 1; > + } > + return ret; > +} > + I would argue this should be in kprobes.h as a static nokprobe_inline.