From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754199AbbKWQZF (ORCPT ); Mon, 23 Nov 2015 11:25:05 -0500 Received: from terminus.zytor.com ([198.137.202.10]:44539 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750972AbbKWQZB (ORCPT ); Mon, 23 Nov 2015 11:25:01 -0500 Date: Mon, 23 Nov 2015 08:24:31 -0800 From: tip-bot for Andi Kleen Message-ID: Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, acme@redhat.com, torvalds@linux-foundation.org, mingo@kernel.org, jolsa@redhat.com, tglx@linutronix.de, ak@linux.intel.com, peterz@infradead.org Reply-To: peterz@infradead.org, ak@linux.intel.com, tglx@linutronix.de, jolsa@redhat.com, mingo@kernel.org, acme@redhat.com, torvalds@linux-foundation.org, hpa@zytor.com, linux-kernel@vger.kernel.org In-Reply-To: <1445551641-13379-1-git-send-email-andi@firstfloor.org> References: <1445551641-13379-1-git-send-email-andi@firstfloor.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] x86: Add an inlined __copy_from_user_nmi() variant Git-Commit-ID: 10013ebb5d7856c243541870f4e62fed68253e88 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 10013ebb5d7856c243541870f4e62fed68253e88 Gitweb: http://git.kernel.org/tip/10013ebb5d7856c243541870f4e62fed68253e88 Author: Andi Kleen AuthorDate: Thu, 22 Oct 2015 15:07:20 -0700 Committer: Ingo Molnar CommitDate: Mon, 23 Nov 2015 09:58:24 +0100 x86: Add an inlined __copy_from_user_nmi() variant Add a inlined __ variant of copy_from_user_nmi. The inlined variant allows the user to: - batch the access_ok() check for multiple accesses - avoid having a pagefault_disable/enable() on every access if the caller already ensures disabled page faults due to its context. - get all the optimizations in copy_*_user() for small constant sized transfers It is just a define to __copy_from_user_inatomic(). Signed-off-by: Andi Kleen Signed-off-by: Peter Zijlstra (Intel) Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1445551641-13379-1-git-send-email-andi@firstfloor.org Signed-off-by: Ingo Molnar --- arch/x86/include/asm/uaccess.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 09b1b0a..660458a 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -745,5 +745,14 @@ copy_to_user(void __user *to, const void *from, unsigned long n) #undef __copy_from_user_overflow #undef __copy_to_user_overflow +/* + * We rely on the nested NMI work to allow atomic faults from the NMI path; the + * nested NMI paths are careful to preserve CR2. + * + * Caller must use pagefault_enable/disable, or run in interrupt context, + * and also do a uaccess_ok() check + */ +#define __copy_from_user_nmi __copy_from_user_inatomic + #endif /* _ASM_X86_UACCESS_H */