From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:39658 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726593AbfFFCDr (ORCPT ); Wed, 5 Jun 2019 22:03:47 -0400 Subject: Re: [RFC V2] mm: Generalize notify_page_fault() References: <1559630046-12940-1-git-send-email-anshuman.khandual@arm.com> <20190604215325.GA2025@bombadil.infradead.org> From: Anshuman Khandual Message-ID: <016a4808-527d-7164-b8a0-3173a4ecfa25@arm.com> Date: Thu, 6 Jun 2019 07:33:52 +0530 MIME-Version: 1.0 In-Reply-To: <20190604215325.GA2025@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-s390-owner@vger.kernel.org List-ID: To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org, Andrew Morton , Michal Hocko , Mark Rutland , Christophe Leroy , Stephen Rothwell , Andrey Konovalov , Michael Ellerman , Paul Mackerras , Russell King , Catalin Marinas , Will Deacon , Tony Luck , Fenghua Yu , Martin Schwidefsky , Heiko Carstens , Yoshinori Sato , "David S. Miller" , Thomas Gleixner , Peter Zijlstra , Ingo Molnar , Andy Lutomirski , Dave Hansen On 06/05/2019 03:23 AM, Matthew Wilcox wrote: > 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? Did not get it. AFAICS it is the same from last version and does not cross 80 characters limit on that 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. We can do that. Though it will be a stand alone (not inside #ifdef) as it already takes care of CONFIG_KPROBES via kprobes_built_in(). Will change it and in which case the above declaration in mm.h would not be required.