Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3376134pxb; Mon, 16 Nov 2020 12:57:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJw/qZ4VhBxFNz48I9AkLC7oTM/hHcF8CwS7DF1+l4iGmpJT4JcMqH+H0xiqex5r4sRMxczM X-Received: by 2002:a17:906:ccc5:: with SMTP id ot5mr16741250ejb.248.1605560258649; Mon, 16 Nov 2020 12:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605560258; cv=none; d=google.com; s=arc-20160816; b=ZcNXQWf6tQrSCSV6+e3P46DxsZ4pzg/25xWU8XpXMsMkfBqd9KMZYMyJwFZkE+rGWV U3h0FwrovHRlZU5P11QGhxlcvd1/954eEwpE6tUBwjgbfH5nWRLKKL5ZPVymmzFYpYv0 4035/Oondvho5NdrM3csL+uuzLztCB/sbDtAih/MqTBf09LajQdD8b6DqK/hjInDnRVI uKZ0uAxdBRCu3MitvjNedKW3dzMdrBKpz8nXpqIeZBTn0j7klvwyz3nevN9Dr9d7KKCc ZVhbEnoTOjLlxlh1B99VXLLa2ZdiKqykHy8aBXZqP58Xd5hmuJ/zCaCcF7F0cFdyn93m gxxA== 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=nF6ukyxjdX9b2/rz1D+uFMZnXwfR+nohql+Ivp7zLzU=; b=n/tT/MFr9ruszrPnyGMxTUuTWtgiAjRqNjhVbv++D7Ll3fCnmXDNiws4q6+PnQC5Mx I76Ualb86npKTiio5hwOQvN69sN8+yb1kFHD+WHtS/gWxrgIzmpi6VeAO3ws4xm44nBM Jxw5Ctw+SrOdSgFoWWSH8KfOgEdQa6EKyogjgLSQ2rGH8GP4geKcM9gklLcN0a3zQfTf elaB4lyHhRQNb0Cmfo0HEYtuIG+cPSeouPIjeJOCfWNtoWtOOXqr0WjCKEHHKHf9rxls 27CDJt5V+o479cSEoxpY271cydm2FOqXjjmuOBsaCqjs7LnsPN9g/ebIptH0eZvXXlbX lxQw== 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 p1si1792953ejf.418.2020.11.16.12.57.09; Mon, 16 Nov 2020 12:57:38 -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 S2387958AbgKPRmu (ORCPT + 99 others); Mon, 16 Nov 2020 12:42:50 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34424 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387935AbgKPRms (ORCPT ); Mon, 16 Nov 2020 12:42:48 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id D5BE81F45E45 From: Gabriel Krisman Bertazi To: tglx@linutronix.de Cc: hch@infradead.org, 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 v2 09/10] entry: Drop usage of TIF flags in the generic syscall code Date: Mon, 16 Nov 2020 12:42:05 -0500 Message-Id: <20201116174206.2639648-10-krisman@collabora.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201116174206.2639648-1-krisman@collabora.com> References: <20201116174206.2639648-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 --- Changes since v2: - Fix subsystem prefix (tglx) --- 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 a7233cca01ba..61b6936a0623 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; @@ -75,11 +75,9 @@ static __always_inline long __syscall_enter_from_user_work(struct pt_regs *regs, long syscall) { unsigned long work = READ_ONCE(current_thread_info()->syscall_work); - unsigned long ti_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; @@ -249,7 +247,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) { unsigned long work = READ_ONCE(current_thread_info()->syscall_work); - u32 cached_flags = READ_ONCE(current_thread_info()->flags); unsigned long nr = syscall_get_nr(current, regs); CT_WARN_ON(ct_state() != CONTEXT_KERNEL); @@ -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