From patchwork Wed Jul 19 04:49:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 790780 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xC4nx3jqvz9t1y for ; Wed, 19 Jul 2017 15:09:25 +1000 (AEST) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xC4nx063SzDrYj for ; Wed, 19 Jul 2017 15:09:25 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xC4NH22D0zDrLs for ; Wed, 19 Jul 2017 14:50:38 +1000 (AEST) Received: from pasglop.ozlabs.ibm.com (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.13.8) with ESMTP id v6J4nmtc017263; Tue, 18 Jul 2017 23:50:24 -0500 From: Benjamin Herrenschmidt To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 10/24] powerpc/mm: Move debugger check to notify_page_fault() Date: Wed, 19 Jul 2017 14:49:32 +1000 Message-Id: <20170719044946.22030-10-benh@kernel.crashing.org> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170719044946.22030-1-benh@kernel.crashing.org> References: <20170719044946.22030-1-benh@kernel.crashing.org> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: aneesh.kumar@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" unclutters the main path Signed-off-by: Benjamin Herrenschmidt --- arch/powerpc/mm/fault.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index 4470500b4871..2f825ae68f20 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -47,27 +47,25 @@ #include "icswx.h" -#ifdef CONFIG_KPROBES -static inline int notify_page_fault(struct pt_regs *regs) +static inline bool notify_page_fault(struct pt_regs *regs) { - int ret = 0; + bool ret = false; +#ifdef CONFIG_KPROBES /* kprobe_running() needs smp_processor_id() */ if (!user_mode(regs)) { preempt_disable(); if (kprobe_running() && kprobe_fault_handler(regs, 11)) - ret = 1; + ret = true; preempt_enable(); } +#endif /* CONFIG_KPROBES */ + + if (unlikely(debugger_fault_handler(regs))) + ret = true; return ret; } -#else -static inline int notify_page_fault(struct pt_regs *regs) -{ - return 0; -} -#endif /* * Check whether the instruction at regs->nip is a store using @@ -242,9 +240,6 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address, if (notify_page_fault(regs)) goto bail; - if (unlikely(debugger_fault_handler(regs))) - goto bail; - if (unlikely(page_fault_is_bad(error_code))) { if (is_user) _exception(SIGBUS, regs, BUS_OBJERR, address);