Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp139068ybi; Thu, 13 Jun 2019 13:05:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5gC7+cOZ7TLDAQYlm4gelkSSPVsKYErWJyt7KPnZpe8ZIEvXHrK/5veSVlOXFCEWrme7T X-Received: by 2002:aa7:8143:: with SMTP id d3mr92193053pfn.143.1560456333107; Thu, 13 Jun 2019 13:05:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560456333; cv=none; d=google.com; s=arc-20160816; b=wIHwKpPOxh+n8MHoj6K0N6J7Vm4UUUqOCWbLDu/Fx7YHHnY6yCjCe0LELINAHkceZ9 Ul0OQYhV7R/0dBfPcZ51Cs2jXi1vqMaPF1DIGL/1rBwESch+m+Ijpm/I9UQz5EAxVbKJ khy3L4jkkyOXh9DQ72i5WqR5lNUXNC55gTGiLVaPnBq6LvKjmGdqaaZS7A9lHaEUWcOg 05+fhbljoQJ5V3l4Nriyq/hQnqVCxxKrlsi0qpIVoBgIZvLmL844/8PVuGO6shHNtvXa kRo3gxIIEpWSn6R2IHr+hph5R3gMLg6SufOyyiR3K1x0FD0CSsNsNVlNpyEWFu9Fxw6W WNcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=lhY/dH1LxkksLu5i0IWkS7fg7law7uuNa/mS/dgjQ4Q=; b=bUOil/YXqEZGqgvePrM1kIfdOLMOkaI+R25JmhWNVtFmqCSJh45Dnm6/2c9+twhpp5 XzdKIt00LeCuE/uQFL7u/cnlnDKwMjpafgRS59QSonxoR+0WdEyr07YeOTvHNQ1YMsme +gZuo2BVYIwwoTGTqsgOcP9PaBkrcNisbVu0zfOR9eaKevqOfTAu8aeEh2YBQ+ZcJYIY 1lCGKyeL7yz2vOggLOWgAO+tqiu6qTGdZroaTsfc9A0EZg2Cf+EVmEwoIzvdZl+Q3tIY Z3I6nuHEGC15d3DDju6v9VCkAri9kHmx/S3gx85hKjyy0keZZoeELcJbHjaJH5zA8PGb KQxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=N2gTptqw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si391294pfb.7.2019.06.13.13.05.18; Thu, 13 Jun 2019 13:05:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=N2gTptqw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729038AbfFMUEN (ORCPT + 99 others); Thu, 13 Jun 2019 16:04:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:43706 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728752AbfFMUEM (ORCPT ); Thu, 13 Jun 2019 16:04:12 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.8.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E84021537; Thu, 13 Jun 2019 20:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560456250; bh=STyJgmmKr944RjOkqQ8HWC3xeSyqe7HVqnGI2LWRsD8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=N2gTptqwNshky9t39zHrhF/tFwNwxgbkrbTJor+tak1vLqX97uKewRk8bUnzrn4Ko U5IaH0MfRPlK77bT7Yc/4PbSrlc3n6J8M0GsjcRBoXIwR5bmuZZez1tgkNHDFM277/ c+zGeW7mHjTeucDkGZEHLB7VbopRA5mQ7/vZdAH4= Date: Thu, 13 Jun 2019 13:04:08 -0700 From: Andrew Morton To: Anshuman Khandual Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-mips@vger.kernel.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, 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 , Vineet Gupta , James Hogan , Paul Burton , Ralf Baechle Subject: Re: [PATCH] mm: Generalize and rename notify_page_fault() as kprobe_page_fault() Message-Id: <20190613130408.3091869d8e50d0524157523f@linux-foundation.org> In-Reply-To: <1560420444-25737-1-git-send-email-anshuman.khandual@arm.com> References: <1560420444-25737-1-git-send-email-anshuman.khandual@arm.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 13 Jun 2019 15:37:24 +0530 Anshuman Khandual wrote: > Architectures which support kprobes have very similar boilerplate around > calling kprobe_fault_handler(). Use a helper function in kprobes.h to unify > them, based on the x86 code. > > This changes the behaviour for other architectures when preemption is > enabled. Previously, they would have disabled preemption while calling the > kprobe handler. However, preemption would be disabled if this fault was > due to a kprobe, so we know the fault was not due to a kprobe handler and > can simply return failure. > > This behaviour was introduced in the commit a980c0ef9f6d ("x86/kprobes: > Refactor kprobes_fault() like kprobe_exceptions_notify()") > > ... > > --- a/arch/arm/mm/fault.c > +++ b/arch/arm/mm/fault.c > @@ -30,28 +30,6 @@ > > #ifdef CONFIG_MMU > > -#ifdef CONFIG_KPROBES > -static inline int notify_page_fault(struct pt_regs *regs, unsigned int fsr) Some architectures make this `static inline'. Others make it `nokprobes_inline', others make it `static inline __kprobes'. The latter seems weird - why try to put an inline function into .kprobes.text? So.. what's the best thing to do here? You chose `static nokprobe_inline' - is that the best approach, if so why? Does kprobe_page_fault() actually need to be inlined? Also, some architectures had notify_page_fault returning int, others bool. You chose bool and that seems appropriate and all callers are OK with that.