From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com ([217.140.110.172]:36028 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbfFJEg1 (ORCPT ); Mon, 10 Jun 2019 00:36:27 -0400 Subject: Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault() References: <1559903655-5609-1-git-send-email-anshuman.khandual@arm.com> <6e095842-0f7f-f428-653d-2b6e98fea6b3@intel.com> From: Anshuman Khandual Message-ID: Date: Mon, 10 Jun 2019 10:06:34 +0530 MIME-Version: 1.0 In-Reply-To: <6e095842-0f7f-f428-653d-2b6e98fea6b3@intel.com> 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: Dave Hansen , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: 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 , Matthew Wilcox , 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/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 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; >> +} > > Nits: Other that taking the nice, readable, x86 one and globbing it onto > a single line, looks OK to me. It does seem a _bit_ silly to go to the > trouble of converting to 'bool' and then using 0/1 and an 'int' > internally instead of true/false and a bool, though. It's also not a Changing to 'bool'... > horrible thing to add a single line comment to this sucker to say: > > /* returns true if kprobes handled the fault */ > Picking this in-code comment. > In any case, and even if you don't clean any of this up: > > Reviewed-by: Dave Hansen > Thanks !