From patchwork Fri Jun 17 23:54:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9185211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E8D0D601C0 for ; Fri, 17 Jun 2016 23:58:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4624208C2 for ; Fri, 17 Jun 2016 23:58:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C84AC280B0; Fri, 17 Jun 2016 23:58:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 61294208C2 for ; Fri, 17 Jun 2016 23:58:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bE3cs-0002ga-Ac; Fri, 17 Jun 2016 23:56:38 +0000 Received: from mail-bl2on0088.outbound.protection.outlook.com ([65.55.169.88] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bE3bk-0000jY-Uw for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2016 23:55:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sgId0KmeR7Bc+FyLWNbQKzJZM5AcnII/zbcoPLesjmY=; b=h40kRsJQSA5zPUO3Xi5iV/imTTbTQ8/IyQ1218RAB5V72Drno9r9bHkpfZwI1p8wfUZD7qblj3o8tyC720KtNwdyT5ak48rSZgnR5v0FTcygeXNFx61nQl8VP7NVHTQB2wJvQlWDFV8WNpc4dxQFW4wvo1A/cd3Ca6gS7E72ciI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (50.233.148.158) by SN1PR07MB2254.namprd07.prod.outlook.com (10.164.47.148) with Microsoft SMTP Server (TLS) id 15.1.517.8; Fri, 17 Jun 2016 23:55:05 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 07/19] thread: move thread bits accessors to separated file Date: Sat, 18 Jun 2016 02:54:16 +0300 Message-ID: <1466207668-10549-8-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1466207668-10549-1-git-send-email-ynorov@caviumnetworks.com> References: <1466207668-10549-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.158] X-ClientProxiedBy: SN1PR10CA0025.namprd10.prod.outlook.com (10.162.255.163) To SN1PR07MB2254.namprd07.prod.outlook.com (10.164.47.148) X-MS-Office365-Filtering-Correlation-Id: 5411c645-1348-4f76-2313-08d3970ace60 X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 2:EbPowYr5cSTnWJxSlA1fhev1jQW33uE8kqDvw4Ej22qEPXo4H3STlXxV44xqb+G0tn10co0eJezIBtblBtSV7huZWYFSnYdlk2aXIjoqaF12Nz5zJNkadoh/HKkMCg2WpTewZB5HcouvshKlUZ540HAEEiyM/iD3o9L8uE22L25htW4NHqwdvMWmcob3wwCw; 3:zk3tXkecX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CWtbhAjyI8FBuxZV3TmQhDlZLBK8mE7EHRAWfH2Tc5tgkFaswpzj1rMNmeO8Wmi1nz99sv9aiIq5MlRoaG4QhJB6MHNzNjrn6FXsZH7nM4F+q2J8J/aIzSmDHVWkC0N/6cT6MRIgTnSOA/OVHzVl/Z42zoYMCJYkBEP4lEyAfdlVyyLFx41R2z680Fm4BHM5hFrQ+1nzGwnoHXkbd/sY71y7pt1itzBxZ5GuqN6f0UBqxwYfyi4qwtWUMX5U+Jx0fVcuinZPpj3UuZ8im1dVnJPgEPO+n6f8b6YsxLeaViuq82zmYp9PEYUh90RRtH7XnJJ8wprEX3/tm4XFb32r7EKeIt3k3omYAeeGe4cCs2ow8QGQ1PsRsZW09IDJVm8SWwnSyQbudjQImbGyEe2f3m+8YikYuWBFvlJIj/XpbIb8rRChqVI4jR06jgJCkBYMSND2YENVGa9/C+O+57a2PhdhkTEbb0FFhg136RQI0yWC58pmsWDDD8CSETBWDewhjwpVDixBjVMk9bU6nVOVacPtFuOWhd5PPSGs9Id2y4Ulo2whUGoi1F6+VBkVd9N7rhRUkbv5fx+hGyo858= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:SN1PR07MB2254; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2254; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2254; 4:46FIfv2Tk+LYe2NDj/MtK1oS8qdpwXXcvncbzrR5QgoSSLX8ytukDhxp7CRqyIKu24tEtUJ/UVpcUoALAFttH8aWa3xKTY6OpqgpTxMVo8uBq21StkmZTHEBWyNBEpaCEf95vUydFrLCvr7K7Nhh9uzAhdCVcpP3hkI9h3g3nqEuUntHAXoN0ArVobzDo8fYRa5uWLVWsK0OgGRjCI8vTCE/lzrn2qvi9il5nVmS4oKR+RslbKECGDSI2+tLVnjZdFYDsV8ead6BMMrVt5VbR8Puf45vyOBn8kOIJmOk3DRBxbOUCF+QpFJkp85paiKqvt9/PrSTKFZBEN31XmCxmA8qSHDYjPelDcGdCNb14hN3r6vhSjogwnI1aLyWMjTk X-Forefront-PRVS: 09760A0505 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(229853001)(66066001)(5004730100002)(2950100001)(92566002)(3846002)(586003)(6116002)(50986999)(2201001)(68736007)(76176999)(50466002)(5003940100001)(50226002)(76506005)(48376002)(2906002)(189998001)(7846002)(42186005)(106356001)(5001770100001)(97736004)(105586002)(19580405001)(19580395003)(47776003)(36756003)(33646002)(101416001)(4326007)(77096005)(81156014)(81166006)(8676002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2254; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; CAT:NONE; LANG:en; CAT:NONE; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2254; 23:/0pjraxJqUenj4hobc5hSyGcNP59srplnnq0m1fOu?= =?us-ascii?Q?qKPhcPJQj0FcG0UJbwZYD0981+bzJpyjhni8h/LrKgxGhNnRtLX9lyqekPk6?= =?us-ascii?Q?kYSeUq7LzkIAZ8v/JDFOu2ff4WPB7u+GyxRB8bqjuilsqs1FXKxebpx6rq5Z?= =?us-ascii?Q?qJrn+mujxSSwpMPl6c/c4hfO0zc9nb0qB718hYtkKj/q9V1jds3utEdpWQY5?= =?us-ascii?Q?/Si2suUC4b0VM3gb7Y5ZSxL5wGmXNkMZuGvFZ1Qp8uzvMfU+v9akExITjfOF?= =?us-ascii?Q?fDrjq1ijcc1c6A7y+CAg6JbM8pepieOhQdFtuvPo7SycXKTUR3g4OE3+m/1r?= =?us-ascii?Q?LxQ0bHid3DZ97rQs9lbNkWW12JlqJXXNV89+j4Vhlfhm+VWG7+ldfaC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aUv2TP4fUXyaYpGGkEMs5+zlMAYK+8Mq5nHcjFzieJ2q1eKfoPubsadAd5eyN+8P0ctMYaca/2EKqx7myGrQD4ruzQHW5/dkfApmKO0pHHHdQR1B/olRFcRfp+Ygt7KDTpIcBsUyEYWL7jjPYvs0zk=; 5:aCWX5+Toh5znousyQvdP+X3eZc7LxdCmejiHWCB0DFsgKcOOqge+iJN71TU7BsPpo4Jwc9H8zEtzzVPveI9MN6H8Cdu64yH3yoVx+MDLTX4j4FCQNpsWn7R/+0kkIP9iLG/btehp3oE+yA998DjniA==; 24:ZDO71mNs+JdW+uXCqR2ULGNmewXvIP3rIj9Z4bF0NbadFwR/3G5QxxsmJVZtB5KOmfzhuHwJt5Xg908ejmBfFFUfG6uINYA91rD02ykaSEg=; 7:EFIdxjLHjgxfzhPUYhmU7s52aYL6L7qtkR15JKH4oEDbGncrx00gMMBXzogod5Ut1nqXsi+GrIJj1ALa4IJINXzMtbSqZ5pLNNG6YaOvxmJM969hYpLZRfkG1+KqbEtqlM4BgI5jH8T3jlIQm8c4fci6xy/tz6FD4EVBgV5V5c2n3257xsnKbTgd+PJYxgQg39GcvBGgU23J7vQOdoyssA== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 23:55:05.5364 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2254 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160617_165529_428760_6DE362D8 X-CRM114-Status: GOOD ( 10.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, szabolcs.nagy@arm.com, Nathan_Lynch@mentor.com, heiko.carstens@de.ibm.com, agraf@suse.de, geert@linux-m68k.org, Prasun.Kapoor@caviumnetworks.com, klimov.linux@gmail.com, broonie@kernel.org, ynorov@caviumnetworks.com, maxim.kuvyrkov@linaro.org, schwidefsky@de.ibm.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, linyongting@huawei.com, davem@davemloft.net, joseph@codesourcery.com, christoph.muellner@theobroma-systems.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP They may be accessed from low-level code, so isolating is a measure to avoid circular dependencies in header files. The exact reason for circular dependency is WARN_ON() macro added by Al Viro in patch [edd63a27] "set_restore_sigmask() is never called without SIGPENDING (and never should be)" Signed-off-by: Yury Norov --- include/linux/thread_bits.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/thread_info.h | 44 +----------------------------------- 2 files changed, 56 insertions(+), 43 deletions(-) create mode 100644 include/linux/thread_bits.h diff --git a/include/linux/thread_bits.h b/include/linux/thread_bits.h new file mode 100644 index 0000000..0d05d16 --- /dev/null +++ b/include/linux/thread_bits.h @@ -0,0 +1,55 @@ + +/* thread_bits.h: common low-level thread bits accessors */ + +#ifndef _LINUX_THREAD_BITS_H +#define _LINUX_THREAD_BITS_H + +#ifndef __ASSEMBLY__ + +#include +#include + +/* + * flag set/clear/test wrappers + * - pass TIF_xxxx constants to these functions + */ + +static inline void set_ti_thread_flag(struct thread_info *ti, int flag) +{ + set_bit(flag, (unsigned long *)&ti->flags); +} + +static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) +{ + clear_bit(flag, (unsigned long *)&ti->flags); +} + +static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) +{ + return test_and_set_bit(flag, (unsigned long *)&ti->flags); +} + +static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) +{ + return test_and_clear_bit(flag, (unsigned long *)&ti->flags); +} + +static inline int test_ti_thread_flag(struct thread_info *ti, int flag) +{ + return test_bit(flag, (unsigned long *)&ti->flags); +} + +#define set_thread_flag(flag) \ + set_ti_thread_flag(current_thread_info(), flag) +#define clear_thread_flag(flag) \ + clear_ti_thread_flag(current_thread_info(), flag) +#define test_and_set_thread_flag(flag) \ + test_and_set_ti_thread_flag(current_thread_info(), flag) +#define test_and_clear_thread_flag(flag) \ + test_and_clear_ti_thread_flag(current_thread_info(), flag) +#define test_thread_flag(flag) \ + test_ti_thread_flag(current_thread_info(), flag) + +#endif /* !__ASSEMBLY__ */ +#endif /* _LINUX_THREAD_BITS_H */ + diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index b4c2a48..b094aed 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -50,8 +50,7 @@ struct restart_block { extern long do_no_restart_syscall(struct restart_block *parm); -#include -#include +#include #ifdef __KERNEL__ @@ -62,47 +61,6 @@ extern long do_no_restart_syscall(struct restart_block *parm); # define THREADINFO_GFP (GFP_KERNEL_ACCOUNT | __GFP_NOTRACK) #endif -/* - * flag set/clear/test wrappers - * - pass TIF_xxxx constants to these functions - */ - -static inline void set_ti_thread_flag(struct thread_info *ti, int flag) -{ - set_bit(flag, (unsigned long *)&ti->flags); -} - -static inline void clear_ti_thread_flag(struct thread_info *ti, int flag) -{ - clear_bit(flag, (unsigned long *)&ti->flags); -} - -static inline int test_and_set_ti_thread_flag(struct thread_info *ti, int flag) -{ - return test_and_set_bit(flag, (unsigned long *)&ti->flags); -} - -static inline int test_and_clear_ti_thread_flag(struct thread_info *ti, int flag) -{ - return test_and_clear_bit(flag, (unsigned long *)&ti->flags); -} - -static inline int test_ti_thread_flag(struct thread_info *ti, int flag) -{ - return test_bit(flag, (unsigned long *)&ti->flags); -} - -#define set_thread_flag(flag) \ - set_ti_thread_flag(current_thread_info(), flag) -#define clear_thread_flag(flag) \ - clear_ti_thread_flag(current_thread_info(), flag) -#define test_and_set_thread_flag(flag) \ - test_and_set_ti_thread_flag(current_thread_info(), flag) -#define test_and_clear_thread_flag(flag) \ - test_and_clear_ti_thread_flag(current_thread_info(), flag) -#define test_thread_flag(flag) \ - test_ti_thread_flag(current_thread_info(), flag) - #define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED) #if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK