Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1636193pxb; Fri, 13 Nov 2020 19:33:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTQXHbn4VYIuimFnE5ZxWD3sRxU6hmf0EMfo4gIUZXRssgOenrCxWEmWGcQOoLWRS9NprL X-Received: by 2002:a17:906:40cb:: with SMTP id a11mr5325677ejk.217.1605324802827; Fri, 13 Nov 2020 19:33:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605324802; cv=none; d=google.com; s=arc-20160816; b=yPSLzYWhTnMYEfkOEMo+8lkI4d7SbOf0T1n2dSN9G/Vmxr633HGQd8ufIV+hr0SdIs Jv6nHDTzgGRmUUsgPeU9fBXj6SHqRvgQHpl0F7u5F9kMcDH2pKXGFaXT5AglgADcU85m WwNkRXBmBo+kEtEMUAwQdgCQALsdre46NXG4qiJc6zPZqRDUlReWbILpC5fihx1zccr6 UAD3vQeAV/3XwO95dHyg4YDYhWbl5qBJLs0b25iUX9EFZhQpXQA6LpTNNqVUDpTUPfOw f4tp9De8rMANDONHyW1XVkvXkPuRNximOLQTSfkS7hLblzemOdpStopKx1YrHmvWR/Tt ZRQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TqrXO3DXliVB/KdDeTuy4+llFFs2bFLXwfpcQIKB9fI=; b=UCjwQaE4kHa2vS2c8EJeRBBv9o662ViDbDgLoy+2L2zJcJhuElU4ke9qzKWwBH3gED JwTE4OedYHsvpHzb8ss6i8W8zzmkcmpi5I3MVBjnwerjRVjkHWg6tzeA1T9ee/yHSBA/ 0FXf90fVA/TRs0Xol/BGYGBLlOi6vXkkWUU1hZMeyKSQYAH6j8/o1PLMDyi89rRHodvg joouN+eALE37/OMjepkbi7UJkmLpPD6He4wrW2RGTT53b5z+FkF/QRjMqVaS+90SfaF0 vVqY7J7s9LJ/la8QQrx8XfVtlE3x+D5KcnR3TCtA6Num0L9ADly9g67Ros1S7pxniYWj sTsg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si7102037ejb.152.2020.11.13.19.33.00; Fri, 13 Nov 2020 19:33:22 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726540AbgKNDaL (ORCPT + 99 others); Fri, 13 Nov 2020 22:30:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726494AbgKNDaL (ORCPT ); Fri, 13 Nov 2020 22:30:11 -0500 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDD2FC0613D1; Fri, 13 Nov 2020 19:30:10 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 955D61F47993 From: Gabriel Krisman Bertazi To: tglx@linutronix.de Cc: mingo@redhat.com, keescook@chromium.org, arnd@arndb.de, luto@amacapital.net, wad@chromium.org, rostedt@goodmis.org, paul@paul-moore.com, eparis@redhat.com, oleg@redhat.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH 09/10] kernel: entry: Drop usage of TIF flags in the generic syscall code Date: Fri, 13 Nov 2020 22:29:16 -0500 Message-Id: <20201114032917.1205658-10-krisman@collabora.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201114032917.1205658-1-krisman@collabora.com> References: <20201114032917.1205658-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the flags migration in the common syscall entry is complete and the code relies exclusively on syscall_work, clean up the accesses to TI flags in that path. Signed-off-by: Gabriel Krisman Bertazi --- include/linux/entry-common.h | 20 +++++++++----------- kernel/entry/common.c | 17 +++++++---------- 2 files changed, 16 insertions(+), 21 deletions(-) diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index afeb927e8545..cffd8bf1e085 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -26,31 +26,29 @@ #endif /* - * TIF flags handled in syscall_enter_from_user_mode() + * SYSCALL_WORK flags handled in syscall_enter_from_user_mode() */ -#ifndef ARCH_SYSCALL_ENTER_WORK -# define ARCH_SYSCALL_ENTER_WORK (0) +#ifndef ARCH_SYSCALL_WORK_ENTER +# define ARCH_SYSCALL_WORK_ENTER (0) #endif -#define SYSCALL_ENTER_WORK ARCH_SYSCALL_ENTER_WORK - /* * TIF flags handled in syscall_exit_to_user_mode() */ -#ifndef ARCH_SYSCALL_EXIT_WORK -# define ARCH_SYSCALL_EXIT_WORK (0) +#ifndef ARCH_SYSCALL_WORK_EXIT +# define ARCH_SYSCALL_WORK_EXIT (0) #endif -#define SYSCALL_EXIT_WORK ARCH_SYSCALL_EXIT_WORK - #define SYSCALL_WORK_ENTER (SYSCALL_WORK_SECCOMP | \ SYSCALL_WORK_SYSCALL_TRACEPOINT | \ SYSCALL_WORK_SYSCALL_TRACE | \ SYSCALL_WORK_SYSCALL_EMU | \ - SYSCALL_WORK_SYSCALL_AUDIT) + SYSCALL_WORK_SYSCALL_AUDIT | \ + ARCH_SYSCALL_WORK_ENTER) #define SYSCALL_WORK_EXIT (SYSCALL_WORK_SYSCALL_TRACEPOINT | \ SYSCALL_WORK_SYSCALL_TRACE | \ - SYSCALL_WORK_SYSCALL_AUDIT) + SYSCALL_WORK_SYSCALL_AUDIT | \ + ARCH_SYSCALL_WORK_EXIT) /* * TIF flags handled in exit_to_user_mode_loop() diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 0170a4ae58f8..0ddc590bfe73 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -42,7 +42,7 @@ static inline void syscall_enter_audit(struct pt_regs *regs, long syscall) } static long syscall_trace_enter(struct pt_regs *regs, long syscall, - unsigned long ti_work, unsigned long work) + unsigned long work) { long ret = 0; @@ -74,12 +74,10 @@ static long syscall_trace_enter(struct pt_regs *regs, long syscall, static __always_inline long __syscall_enter_from_user_work(struct pt_regs *regs, long syscall) { - unsigned long ti_work; unsigned long work = READ_ONCE(current_thread_info()->syscall_work); - ti_work = READ_ONCE(current_thread_info()->flags); - if (work & SYSCALL_WORK_ENTER || ti_work & SYSCALL_ENTER_WORK) - syscall = syscall_trace_enter(regs, syscall, ti_work, work); + if (work & SYSCALL_WORK_ENTER) + syscall = syscall_trace_enter(regs, syscall, work); return syscall; } @@ -227,8 +225,8 @@ static inline bool report_single_step(unsigned long work) } #endif -static void syscall_exit_work(struct pt_regs *regs, unsigned long ti_work, - unsigned long work) + +static void syscall_exit_work(struct pt_regs *regs, unsigned long work) { bool step; @@ -248,7 +246,6 @@ static void syscall_exit_work(struct pt_regs *regs, unsigned long ti_work, */ static void syscall_exit_to_user_mode_prepare(struct pt_regs *regs) { - u32 cached_flags = READ_ONCE(current_thread_info()->flags); unsigned long work = READ_ONCE(current_thread_info()->syscall_work); unsigned long nr = syscall_get_nr(current, regs); @@ -266,8 +263,8 @@ static void syscall_exit_to_user_mode_prepare(struct pt_regs *regs) * enabled, we want to run them exactly once per syscall exit with * interrupts enabled. */ - if (unlikely(work & SYSCALL_WORK_EXIT || cached_flags & SYSCALL_EXIT_WORK)) - syscall_exit_work(regs, cached_flags, work); + if (unlikely(work & SYSCALL_WORK_EXIT)) + syscall_exit_work(regs, work); } __visible noinstr void syscall_exit_to_user_mode(struct pt_regs *regs) -- 2.29.2