Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp730852pxu; Wed, 2 Dec 2020 01:42:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIUo1FuZn4ra9oLZAj9IndbkILYdwaZ5pSqANkXAe0IaCk9Wch0tKTBKXKSEYSRpY+32r/ X-Received: by 2002:a50:d54a:: with SMTP id f10mr1798956edj.356.1606902124676; Wed, 02 Dec 2020 01:42:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902124; cv=none; d=google.com; s=arc-20160816; b=Y7PxfLBplZCckfCVNcZsgE70XHJzu4u5fAXGrlugvyCBZgLg4lxKoIDTMdHpXh4CHw S3m1t+LVynNR2bc0YoPHAh861xG4yGPhc0BaWvTEr//IWsK1mM2lgMwJbm4DTMzXhJiK KQdGcnDhf4kntN3XOnPYcELzxFCcv7Vl2YjT6ootAL2MBo7XltekQ4VzkeuMRs/4phRn KTjbqGuETYIDxTyWaDhgOeU7S6u3zP0rzVaPO8pnHXZl1Old8wM+eUcKh6b78TxalTdA wqRKXSkh4CQEwUw+J8UojCZqyfzGE/ElTgXK8geuNanWhZ2CIdJ+xSDUAJdnDOZ4V2MD zJYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=+wNEjWovfC5lVEA2MmAphkVW+CuCCuD6x0ulIda0COY=; b=SVrrO1UxRwEsKw40HGI1k2NaXfXOo6ffYgw2LC6Tk692xydEI5/eAA2v56FXMvZ5qv MuILPEQX/RhKh+8I2z7IeOwf6FAun7nrYUN9TbRNmvEqWdJ7TZwYsV0diMPEGVbqvrIQ XfxpwboUAPFcVw20/FM9Y5FDIHlxKQBB+Z588e/6WvM4DodHM2r5RJ0iwyPg88A+NQ9C 1+mV6M65XksFoiKlOfS+vhM7BKaePOCuz6jmEOMdGNOcFh/RUZ9SncfWj1faQIHoWCvu chEjSYKbI6PkdWhPZc2J3e4CXP/jAFTpvfNGiVtcoIDK+yQPikvs93mK0jqdCfRIRqSs zT9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qvoN486Y; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dg4si686692edb.104.2020.12.02.01.41.41; Wed, 02 Dec 2020 01:42:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qvoN486Y; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388325AbgLBJjf (ORCPT + 99 others); Wed, 2 Dec 2020 04:39:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388253AbgLBJjJ (ORCPT ); Wed, 2 Dec 2020 04:39:09 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AADAC0613D6; Wed, 2 Dec 2020 01:38:29 -0800 (PST) Date: Wed, 02 Dec 2020 09:38:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1606901907; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+wNEjWovfC5lVEA2MmAphkVW+CuCCuD6x0ulIda0COY=; b=qvoN486Ye4LhGLut1d8+dt1e+NFPGkOhvJ6qzgEpUlmfaWzx/5hCfeaaWW/g5oQx4l33Q2 cR8RDOXVtAOrCiQrb4N0inW/W9bxQbpsn1fPHVPsvu2AfqK+UlMrPcoXIP3cJzUTKvwrfs ERI7dF4xliFKWWxUN+nUowJhwJ2vGcXbMxYIZ0ipuOirkmMhWFM0etyLS3U0dVdN5HIs0H yW6JlRKfohdXuuOcIaV5fUValAXN7GRiWwp3oFbRfEwO84oaM8e840AW9Ys4Lli+Se5Cz4 Typ51d+pStc8U0pJl2NIe01Omzo0t26GAAqdQvJgQsQXI6r6dj1AqQNoXp2syQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1606901907; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+wNEjWovfC5lVEA2MmAphkVW+CuCCuD6x0ulIda0COY=; b=FC3XJXfGgrdFg/E179jE0VQdbvacclIfIMUoy7pC9x0Bjg74YCC5cObGjt/PC38atunF6p EZoxClCQ/YH+ARCA== From: "tip-bot2 for Sven Schnelle" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/entry] entry_Add_enter_from_user_mode_wrapper Cc: Sven Schnelle , Thomas Gleixner , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20201201142755.31931-4-svens@linux.ibm.com> References: <20201201142755.31931-4-svens@linux.ibm.com> MIME-Version: 1.0 Message-ID: <160690190693.3364.6030796869296589113.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/entry branch of tip: Commit-ID: 6546601d7e7c8da38f5d87204aa01f7b394f4fb3 Gitweb: https://git.kernel.org/tip/6546601d7e7c8da38f5d87204aa01f7b394f4fb3 Author: Sven Schnelle AuthorDate: Tue, 01 Dec 2020 15:27:53 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 02 Dec 2020 10:32:18 +01:00 entry_Add_enter_from_user_mode_wrapper To be called from architecture specific code if the combo interfaces are not suitable. It simply calls __enter_from_user_mode(). This way __enter_from_user_mode will still be inlined because it is declared static __always_inline. [ tglx: Amend comments and move it to a different location in the header ] Signed-off-by: Sven Schnelle Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20201201142755.31931-4-svens@linux.ibm.com --- include/linux/entry-common.h | 24 +++++++++++++++++++++++- kernel/entry/common.c | 16 ++++++---------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index a6e98b4..da60980 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -102,6 +102,27 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs #endif /** + * enter_from_user_mode - Establish state when coming from user mode + * + * Syscall/interrupt entry disables interrupts, but user mode is traced as + * interrupts enabled. Also with NO_HZ_FULL RCU might be idle. + * + * 1) Tell lockdep that interrupts are disabled + * 2) Invoke context tracking if enabled to reactivate RCU + * 3) Trace interrupts off state + * + * Invoked from architecture specific syscall entry code with interrupts + * disabled. The calling code has to be non-instrumentable. When the + * function returns all state is correct and interrupts are still + * disabled. The subsequent functions can be instrumented. + * + * This is invoked when there is architecture specific functionality to be + * done between establishing state and enabling interrupts. The caller must + * enable interrupts before invoking syscall_enter_from_user_mode_work(). + */ +void enter_from_user_mode(struct pt_regs *regs); + +/** * syscall_enter_from_user_mode_prepare - Establish state and enable interrupts * @regs: Pointer to currents pt_regs * @@ -110,7 +131,8 @@ static inline __must_check int arch_syscall_enter_tracehook(struct pt_regs *regs * function returns all state is correct, interrupts are enabled and the * subsequent functions can be instrumented. * - * This handles lockdep, RCU (context tracking) and tracing state. + * This handles lockdep, RCU (context tracking) and tracing state, i.e. + * the functionality provided by enter_from_user_mode(). * * This is invoked when there is extra architecture specific functionality * to be done between establishing state and handling user mode entry work. diff --git a/kernel/entry/common.c b/kernel/entry/common.c index dff07b4..17b1e03 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -10,16 +10,7 @@ #define CREATE_TRACE_POINTS #include -/** - * __enter_from_user_mode - Establish state when coming from user mode - * - * Syscall/interrupt entry disables interrupts, but user mode is traced as - * interrupts enabled. Also with NO_HZ_FULL RCU might be idle. - * - * 1) Tell lockdep that interrupts are disabled - * 2) Invoke context tracking if enabled to reactivate RCU - * 3) Trace interrupts off state - */ +/* See comment for enter_from_user_mode() in entry-common.h */ static __always_inline void __enter_from_user_mode(struct pt_regs *regs) { arch_check_user_regs(regs); @@ -33,6 +24,11 @@ static __always_inline void __enter_from_user_mode(struct pt_regs *regs) instrumentation_end(); } +void noinstr enter_from_user_mode(struct pt_regs *regs) +{ + __enter_from_user_mode(regs); +} + static inline void syscall_enter_audit(struct pt_regs *regs, long syscall) { if (unlikely(audit_context())) {