Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1636297pxb; Fri, 13 Nov 2020 19:33:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJxKd8w5pczkwnZYlHOAnvJf4Y9U6MLZWK++BTo9adwV3/9yjgLeSB22nl13ZdU5q5O3A0AG X-Received: by 2002:aa7:c3c3:: with SMTP id l3mr5866691edr.118.1605324820550; Fri, 13 Nov 2020 19:33:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605324820; cv=none; d=google.com; s=arc-20160816; b=nbDUyCPfgYEWnY37oWC1h7qjL7U8ir99N2NHUtaXz2lierUwrDIq/1wwqjgN4LnQH4 DX9LUSA4Ej7hwj14QLbFDJfTExHVNdG+TtJ4ssmlV6FzAiXBgcRZRb7r5+V62SxxEotd 0ta5LMF8c/pQ8cC+E5RDz3br6Ct7irkyCkn6sIgmDkpyvFY7IctJYPoiDxdHDo8xcAni EPfbq+uQ55KueHl9WtM0ddZUuJz4xgQ4YQMnqe8gxBV0kmpCivejXWGxSbpiQplf9SEn h1xzNFWPcAlzLnlbdcoSaJLF3eO8PA96GUiLn1uufq1MwRjbz/BstDl40yQcgWCu6yOf MADw== 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=8azh0FVbvT/w5h2zv419iGnZT/c5x6l+t/0DJt2CYIM=; b=qBWxV8RME5D0XweOfHgGsuusC4UTBe+XwH47CmA/rtkFMU20ruZgHwMmoWNe4ulGiZ RkyseQyj8xs8+uL3b9bhIsUwkVtmP/N0mpC6EsHiGeZmkwj6BMDDfwKXEftoi9TS6FiS NN4+J/vXJQ1XaxNJQNs99H5HiPjMRGi9SL7RF1/RAFKK+5GZBI6SCidj6dY+AQ+7/cN5 8s3IOTbzLY7jOgbFkLLm48IJEBfCXf7QCzI3V9/0sh+mXPoDSSLMpGoo7wYXIZVU8ES/ byMmAK37h6Mr88lvQ4zIuscL85MeGngCWmbEfK0oWXhGEf62oHMX0dASz1A8FTSjI5zW zmUQ== 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 a10si7475392eju.313.2020.11.13.19.33.18; Fri, 13 Nov 2020 19:33:40 -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 S1726412AbgKND3r (ORCPT + 99 others); Fri, 13 Nov 2020 22:29:47 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58522 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbgKND3q (ORCPT ); Fri, 13 Nov 2020 22:29:46 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id F2D131F4798C 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 02/10] kernel: entry: Expose helpers to migrate TIF to SYSCALL_WORK flags Date: Fri, 13 Nov 2020 22:29:09 -0500 Message-Id: <20201114032917.1205658-3-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 With the goal to split the syscall work related flags into a separate field that is architecture independent, expose transitional helpers that resolve to either the TIF flags or to the corresponding SYSCALL_WORK flags. This will allow architectures to migrate only when they port to the generic syscall entry code. Signed-off-by: Gabriel Krisman Bertazi --- include/linux/thread_info.h | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index e93e249a4e9b..18755373dc4d 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -97,6 +97,48 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag) #define test_thread_flag(flag) \ test_ti_thread_flag(current_thread_info(), flag) +#ifdef CONFIG_GENERIC_ENTRY +static inline void __set_task_syscall_work(struct thread_info *ti, int flag) +{ + set_bit(flag, (unsigned long *)&ti->syscall_work); +} +static inline int __test_task_syscall_work(struct thread_info *ti, int flag) +{ + return test_bit(flag, (unsigned long *)&ti->syscall_work); +} +static inline void __clear_task_syscall_work(struct thread_info *ti, int flag) +{ + return clear_bit(flag, (unsigned long *)&ti->syscall_work); +} +#define set_syscall_work(fl) \ + __set_task_syscall_work(current_thread_info(), SYSCALL_WORK_##fl) +#define test_syscall_work(fl) \ + __test_task_syscall_work(current_thread_info(), SYSCALL_WORK_##fl) +#define clear_syscall_work(fl) \ + __clear_task_syscall_work(current_thread_info(), SYSCALL_WORK_##fl) + +#define set_task_syscall_work(t, fl) \ + __set_task_syscall_work(task_thread_info(t), SYSCALL_WORK_##fl) +#define test_task_syscall_work(t, fl) \ + __test_task_syscall_work(task_thread_info(t), SYSCALL_WORK_##fl) +#define clear_task_syscall_work(t, fl) \ + __clear_task_syscall_work(task_thread_info(t), SYSCALL_WORK_##fl) +#else +#define set_syscall_work(fl) \ + set_ti_thread_flag(current_thread_info(), SYSCALL_WORK_##fl) +#define test_syscall_work(fl) \ + test_ti_thread_flag(current_thread_info(), SYSCALL_WORK_##fl) +#define clear_syscall_work(fl) \ + clear_ti_thread_flag(current_thread_info(), SYSCALL_WORK_##fl) + +#define set_task_syscall_work(t, fl) \ + set_ti_thread_flag(task_thread_info(t), TIF_##fl) +#define test_task_syscall_work(t, fl) \ + test_ti_thread_flag(task_thread_info(t), TIF_##fl) +#define clear_task_syscall_work(t, fl) \ + clear_ti_thread_flag(task_thread_info(t), TIF_##fl) +#endif /* CONFIG_GENERIC_ENTRY */ + #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES -- 2.29.2