Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2801202ybi; Sun, 9 Jun 2019 21:36:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnswZQMbG6w1GDIq3lJzpomhkGKxC5S7O8kgTV1aKkr30d5oFJ7zRs9HU4kwdtEJFaAZRY X-Received: by 2002:a17:902:4181:: with SMTP id f1mr66162075pld.22.1560141412289; Sun, 09 Jun 2019 21:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560141412; cv=none; d=google.com; s=arc-20160816; b=rR28P0pNT+3BazM3vN8/gBXTyuiaEZHF/WQQVcySnmqAiWZXA8oU/aAunSHfWIofav FECdBBo3zy0a7/0o64Hu50WAWNBtGn7GRQLnUWb4yhHSvFhhmmsKhMj3Xfk170jkYhWm vPVWyt5Q9W+Q6gx8U/nHhG3G8QAJDk140DLzVnzZcUPwl9mgH7tLmFmyPa+663i1JplA p5sHPhBoaxFZYm4FDEJCiWMj1kH5/ONm4OPzxcp4IeTDZBYvlgUz2CQo2HCKpNrIU+nN 4cfMrTqVd8Xrn3rgJ7G0jRY7mr25Yx5PWvboa5Rkog0Hywy8kS/OKETdMuyYu80zDxIi 8mGg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=QEjpBEhXhMs1hPZZ/vbr/4veXTMMJxl7rW7tZ6D1L0A=; b=xl1yQPB9+sGcqv3ZOqT790tsWlJj47EKrzS9/OI7ij05MTWR8zPp4WVA+RT47VFGpL TFxTO0sce/m2yCQxCUD+6K2PVrbNuzoTsp33dlKbiYdvQNJEowitReWvMMLwy4tzRC65 5kZgvCO+rSova2gqeySjERqgRzD/ZoI8OGDq9NYKxxH8Kczj5rmXa0v5UEKb+aOA5VBg h7eOBlYOJcrGwQ9oTK3FFODLvEMIK92nr/JYISX/5EJoezb1+o5pyWLMwTTFlYnuXSgy Nuhgmpn6KuGjVBTNRGAwsKA/1q9UQsXb7baOMvwT55WKb1azxDvSyo28IH+8Qpg6hPd5 QiBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 o4si8438815pls.391.2019.06.09.21.36.37; Sun, 09 Jun 2019 21:36:52 -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; 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 S1728352AbfFJEg2 (ORCPT + 99 others); Mon, 10 Jun 2019 00:36:28 -0400 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 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9C058337; Sun, 9 Jun 2019 21:36:26 -0700 (PDT) Received: from [10.162.42.131] (p8cg001049571a15.blr.arm.com [10.162.42.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A664B3F557; Sun, 9 Jun 2019 21:36:16 -0700 (PDT) Subject: Re: [RFC V3] mm: Generalize and rename notify_page_fault() as kprobe_page_fault() 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 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 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 !