Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp77776pxu; Tue, 1 Dec 2020 06:32:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1hhVWek3LMphHbMp0bFiO8SEY1rG6FTmR4FunX+jP0BfXY9lZIgsJjiF24FCaOXbg0s2Z X-Received: by 2002:a17:906:8042:: with SMTP id x2mr3474987ejw.79.1606833172007; Tue, 01 Dec 2020 06:32:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606833172; cv=none; d=google.com; s=arc-20160816; b=j/VAW0JfY5OnSq3BOkUIp02uVcUY5VTD1nEV5uNfhaA5rAZ0i17PTPOxhAyQeGAI+q BAMAYh4yKmXRn+Bt6UXnkZhrucY1CjpbwsAEO6EwoCoTkymtYMNBnOZ+A5gCezD6tvkh 6ZLo/3X7YR2c02n3+mU8MG4SH7oFRJCBoyYYCzHgIo6BY12apjOWFits6k1msuZSzRcV 21lz+huOf2RecH92N6o4gFCVTWntG4SnFzQgo3IUFEjuE7jQhVpx8Mgr7Q9q8l6KjmC5 hkONrHKPqdhheIDwwUybCR+ftTARkcFB36x2HCXHzeRvbZ8HuoHv1aN3brQUAlAtXefR hw7Q== 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=VpOcsmZTE3VC5RIaXiIHR+Zp8f5/KA8dPjVm8isOLfo=; b=U+y7iVGncLKP4UEniEibj+kpPmyLhT2bvK+/YZ0k91/1Tis9q1OE0O8D5xff4lAs/Z LpvD67H0+OVgxK+1Z3eKNF1SN127Vnuim6tCB1Celjh8v84G8WFHeqqqurBc2qEKwjlH YPKVq6ODbifosTZjtWHwzbJ7mUKLpDE6du3x28EKOH4oEU2Er9F2txaumyNBv0U64/yy fj+uva7ugFHNbsmRYKvar7XIcnGmO1nW1jwKzBiyNpx9mkbwJp1aShFTjX30ezESYIdT 5sQer2WuQuAkMl9vEzPMcFFkthZ+IF2Gy6Ryig2e44ln0Xg9cNBBBz/uDnt4aEIMkcVU q8Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=U6GeIYHq; 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 g9si4204ejm.641.2020.12.01.06.32.27; Tue, 01 Dec 2020 06:32:51 -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=U6GeIYHq; 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 S2387650AbgLAO25 (ORCPT + 99 others); Tue, 1 Dec 2020 09:28:57 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:45284 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731028AbgLAO2z (ORCPT ); Tue, 1 Dec 2020 09:28:55 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B1E82VP011682; Tue, 1 Dec 2020 09:28:12 -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=VpOcsmZTE3VC5RIaXiIHR+Zp8f5/KA8dPjVm8isOLfo=; b=U6GeIYHqVaKw+J9sN2z1BAqXpLBOqC2CEfEI2Q+kyhhd5Dxi1ihzj8lif72B44tCqthJ QbUV/YGh07eXjgKEv+H5ypAnvuB0nLcNfup+iN9tFwWWJ/Gl7ypdLvc3If3GvTKzLrpf 8CqSD3QsxH0bUtptrwiwl1VieNcb2wA6Mjzx5ZROgKdn4ihXIJ1fmwnhJTahlwJ/+l5F a0TwN58MD/9ygfPkA/0RkttDnEQQkh7cs0spfmKRDxhDeatj4PvMaYZwHPWMVuk8ALVJ KKG+gRKCP0dluq5VR4oZwCxHLMxLG/qiDMih6Wb5UZ9zeer/7EjRCwtHgnbE9d4458mx Zg== Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com with ESMTP id 355j4q393e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Dec 2020 09:28:12 -0500 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B1EMWt0029199; Tue, 1 Dec 2020 14:28:09 GMT Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by ppma06fra.de.ibm.com with ESMTP id 353dth9nyt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 01 Dec 2020 14:28:08 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B1ES6pt9044700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 1 Dec 2020 14:28:06 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 09BB342045; Tue, 1 Dec 2020 14:28:06 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EC2844203F; Tue, 1 Dec 2020 14:28:05 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 1 Dec 2020 14:28:05 +0000 (GMT) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 55390) id A92B8E0161; Tue, 1 Dec 2020 15:28:05 +0100 (CET) From: Sven Schnelle To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Sven Schnelle Subject: [PATCH v2 5/5] entry: add syscall_exit_to_user_mode_work() Date: Tue, 1 Dec 2020 15:27:55 +0100 Message-Id: <20201201142755.31931-6-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 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 adultscore=0 impostorscore=0 mlxscore=0 malwarescore=0 mlxlogscore=604 clxscore=1015 priorityscore=1501 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012010090 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is the same as syscall_exit_to_user_mode() but without calling exit_to_user_mode(). This is useful if a syscall has to be restarted without leaving to user space. Signed-off-by: Sven Schnelle --- include/linux/entry-common.h | 9 +++++++++ kernel/entry/common.c | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index 112007525f50..bdf6b005bbfb 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -312,6 +312,15 @@ static inline void arch_syscall_exit_tracehook(struct pt_regs *regs, bool step) */ void syscall_exit_to_user_mode(struct pt_regs *regs); +/** + * syscall_exit_to_user_mode_work - Handle work before returning to user mode + * @regs: Pointer to currents pt_regs + * + * Same as syscall_exit_to_user_mode() but without calling exit_to_user_mode() + * to perform the final transition to user mode. + */ +void syscall_exit_to_user_mode_work(struct pt_regs *regs); + /** * irqentry_enter_from_user_mode - Establish state before invoking the irq handler * @regs: Pointer to currents pt_regs diff --git a/kernel/entry/common.c b/kernel/entry/common.c index e696f6912642..c3c4ba21824a 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -246,12 +246,22 @@ static void syscall_exit_to_user_mode_prepare(struct pt_regs *regs) syscall_exit_work(regs, cached_flags); } -__visible noinstr void syscall_exit_to_user_mode(struct pt_regs *regs) +static __always_inline void __syscall_exit_to_user_mode_work(struct pt_regs *regs) { - instrumentation_begin(); syscall_exit_to_user_mode_prepare(regs); local_irq_disable_exit_to_user(); exit_to_user_mode_prepare(regs); +} + +void syscall_exit_to_user_mode_work(struct pt_regs *regs) +{ + __syscall_exit_to_user_mode_work(regs); +} + +__visible noinstr void syscall_exit_to_user_mode(struct pt_regs *regs) +{ + instrumentation_begin(); + __syscall_exit_to_user_mode_work(regs); instrumentation_end(); __exit_to_user_mode(); } -- 2.17.1