Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp77832pxu; Tue, 1 Dec 2020 06:32:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJyVWToa2FtMcD112p+1q9aBndOnpMcf6BnnJsJczUOjTcTVOWkpLE8W5XSHFPNyjba45GvU X-Received: by 2002:aa7:c058:: with SMTP id k24mr3327235edo.263.1606833175291; Tue, 01 Dec 2020 06:32:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606833175; cv=none; d=google.com; s=arc-20160816; b=DTUTukzRvPymKYc4AdhNDEbI082UbGRZ306VzJQL5DKZBPmgIVqsql/r3g90ShWkYJ XZRsROnVzE/go0NYfo8BVf6rb7xymjVP2grKNjdKl238LHOlj1W0z2bgOX2DVqp7oWGZ q7cruloIaPyyyT0RfggKTaJTdR6sjzxTfc7wBKJRKCXbLX42toJMQdcpyLWRkFrbklvL vtOXxzQX5V8ijR9Wausg6VfRLh3/ivUzNjILzGVTqO2mCkOvPttuMEamObB15o/BzsDL cnrkKRjf5mSZVeIiCL0d3qHB/wfcDCvVanV1JThPYybzXG46WzmAbOpT1BsiEKGc1jfU Kfpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=P+egHm3FiNnlA8SX1YiUL8Yi7/QjobpuT6QRh9ARFlE=; b=oS5zw5xFcfPOJAG5V13lHXmtOJ3t9oNz07H9ebsC3vkmmwAmV3TgskU3h2mMm3KgVI CYykxFYN6JBpTVwe6s+kNYIKRhxcVQkxNMdUPR6AvX23z/uVmCo+ocdc61ydqOPaAkDu MdVugVBkXYC7y5rcNlxbE9Gale/6Fv8upJJ3gMF7vD/P7ifyqptajINHA7PMjlL6dkqy /2ahC1RJtfgMKUPqUkxZzaa5bWGLwdqbR7S4oubejM5EWIsGzySgO97o0C3KSvv4VBHL CpqygGKMxohZYehDIzYIxWK/iRVn5VJegd5ca/IS+ffkw+ZzZn9djfLTwtEACvvEAv6G aiGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="mg/4RdPD"; 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=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bz20si19914ejc.177.2020.12.01.06.32.30; Tue, 01 Dec 2020 06:32:55 -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=@ibm.com header.s=pp1 header.b="mg/4RdPD"; 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=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387462AbgLAO2z (ORCPT + 99 others); Tue, 1 Dec 2020 09:28:55 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57708 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731019AbgLAO2y (ORCPT ); Tue, 1 Dec 2020 09:28:54 -0500 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B1E6SFe012949; Tue, 1 Dec 2020 09:28:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pp1; bh=P+egHm3FiNnlA8SX1YiUL8Yi7/QjobpuT6QRh9ARFlE=; b=mg/4RdPDr/g9A4yE66ioHvb+oG0269BfJg9nrddOj874VaqGyrg/U3Xr9jiht0+H+teR 0tnblTKY0zQhD37dj9siJgkRWRTj8t4gaY3yPTtw2PvQLKZWaA147BnRQP6GMxqIMcE2 1lzx/VJcd++SH0Mc2q3dk3c3W/BvO0So9361jlSDsPNuwD+bUDqk1vBYCuecSV06aYVK QcoL/nyYNobe52OzK6oIj6HXF2yL1TU3j7bx+oh+jZNJfxRx761Ay0hpg/i5SXFMup42 jFo/9DOgmMWvX4+LsNeOeCx2/Z5z84F32J2pPk1vJrmdogcQICY2HmJWwixqH2bngut/ Mg== Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 355jt718nk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Dec 2020 09:28:10 -0500 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B1EM2lg023388; Tue, 1 Dec 2020 14:28:07 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma04ams.nl.ibm.com with ESMTP id 353e6837u8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Dec 2020 14:28:07 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B1ES44w5177922 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 1 Dec 2020 14:28:04 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF5754C040; Tue, 1 Dec 2020 14:28:04 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BE86F4C046; Tue, 1 Dec 2020 14:28:04 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 1 Dec 2020 14:28:04 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55390) id 81A0FE0161; Tue, 1 Dec 2020 15:28:04 +0100 (CET) From: Sven Schnelle To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Sven Schnelle Subject: [PATCH v2 3/5] entry: add enter_from_user_mode() wrapper Date: Tue, 1 Dec 2020 15:27:53 +0100 Message-Id: <20201201142755.31931-4-svens@linux.ibm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201201142755.31931-1-svens@linux.ibm.com> References: <20201201142755.31931-1-svens@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-12-01_05:2020-11-30,2020-12-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 mlxscore=0 adultscore=0 spamscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 mlxlogscore=785 suspectscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010087 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Can be called from architecture dependent code, and simply calls __enter_from_user_mode(). This way __enter_from_user_mode can still be inlined because it is declared static. Signed-off-by: Sven Schnelle --- include/linux/entry-common.h | 11 +++++++++++ kernel/entry/common.c | 15 +++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index 474f29638d2c..28a8554fad7d 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -402,4 +402,15 @@ void irqentry_exit_cond_resched(void); */ void noinstr irqentry_exit(struct pt_regs *regs, irqentry_state_t state); +/** + * 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 + */ +void enter_from_user_mode(struct pt_regs *regs); #endif diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 076ee1cde67f..ee588ee9f122 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -8,16 +8,6 @@ #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 - */ static __always_inline void __enter_from_user_mode(struct pt_regs *regs) { arch_check_user_regs(regs); @@ -31,6 +21,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())) { -- 2.17.1