From patchwork Tue May 24 00:04:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9132569 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 146B8607D3 for ; Tue, 24 May 2016 00:13:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 093D328237 for ; Tue, 24 May 2016 00:13:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E28B528252; Tue, 24 May 2016 00:13:21 +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=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 6050928237 for ; Tue, 24 May 2016 00:13:21 +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 1b4zx7-00058W-Dk; Tue, 24 May 2016 00:12:05 +0000 Received: from mail-bn1bon0093.outbound.protection.outlook.com ([157.56.111.93] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b4zrR-0005Yl-GF for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2016 00:06:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1Xq47MjavRh/UpLrCNkPSYEoAfKN+XdxgXh4DYka2X0=; b=bofL95cSd8uSxiUDF5UsO4/LT3kyU9P8noOwudz3FeGyD8aeUd0jhEzgnGe18rH0xQoMlJ/e0ClkvqbCXf8hxRfrmE4bwoQY+/eQBWlQAoiZGOpk4EHZG8k+nvhjfEduh6lorYs9n7OK4yskQ7VavAEejRd5xrwqTgC3OhlcQFg= Authentication-Results: arndb.de; dkim=none (message not signed) header.d=none;arndb.de; dmarc=none action=none header.from=caviumnetworks.com; Received: from localhost (50.233.148.158) by DM3PR07MB2236.namprd07.prod.outlook.com (10.164.33.146) with Microsoft SMTP Server (TLS) id 15.1.501.7; Tue, 24 May 2016 00:05:50 +0000 From: Yury Norov To: , , , , , , , Subject: [PATCH 12/23] thread: move thread bits accessors to separated file Date: Tue, 24 May 2016 03:04:41 +0300 Message-ID: <1464048292-30136-13-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1464048292-30136-1-git-send-email-ynorov@caviumnetworks.com> References: <1464048292-30136-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [50.233.148.158] X-ClientProxiedBy: DM3PR13CA0024.namprd13.prod.outlook.com (10.164.193.34) To DM3PR07MB2236.namprd07.prod.outlook.com (10.164.33.146) X-MS-Office365-Filtering-Correlation-Id: 98cf27a2-15b6-41f1-881c-08d383672ab4 X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2236; 2:raByQzzoCI+ZO8RH8KfZ/TL8KFUUulvyFtLfgVyfcqqJmJdLeb/nWmq087fAbl+0THUZM5EDa7mvJbmi38EZGCpQ2l/jdVD9xjAfFu0bBu6pX2uvj2Zh6qNMukF0NYxrlYotyG9gtTfQwumnueDGtuNEi9liwppT/8OJ+/yK+HPSGwvQ4EKDQHN7YdV4ubl0; 3:phCvzz59BxO9jFbIyLvDRZ8IVEmvJydSTdSjUlv2lgBLtZfVvgJydgp8CDb4u6htV+ppivZZknfmexLWfjd9tAwRkbrKCSyRNcQbbB9lS/99Gl60tu7n0A8fwazhW04K; 25:YbLaxqWx6PUSSjhYnIUVtU463noPulEiA5j1F75IctfJhMZGE9QfgoaN1T6KidcUiNV+RqMIz/UkQYoY3j3D917HeYyH0KIykB0GjOp9sd5DdiFFgrcRKv6NYyFeWy0GqJ3gQ6y/aaj1Af3dg+k/1zI5mwgNJkWwt9zNxG5uCTmEzk77LbE+2TbaH079CCVbKP+4h1cFmtQzshEGgEE8vxnydg7+dJQwaLZtpMwxa8gd79iSQ6GdbKlREimItna0gxrMv2AON1bREHx7nokhwrfpk5VS730yjON9A0E7pvMwMeESGyb0/s15ueRT4xr5MgopTkOtKf/wmChAWN8dCNft2HaU9eeWc4BByHyofvo8CbdInbPD858ShuisOQr9Y6IbwKVX+0oFNfGIR+LAdZfXpEytcEt97pbB0vdr/dA= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM3PR07MB2236; X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2236; 20:H2WBSdBFNfS4hJ+2AnksOPXoMCqD8m4iUlgRGI+9LLA23UAAVvCEMdRJXjIDAO6VC7supnHj3wFFC2GN+IOdjRjvGTq8IEOlgUqC56TuK07bAZj9GIUOn2nWOfX6GL7Sdt/G+34JtL42qqZkHM+cJgd5ozMW8ag2zuYe5lo0hw33VdbhGAlbAR8HCnnLrcHyndR7sligVT3jXB8o6F2iMO1IR+zDfnSKghZ3mSW9jB3nFuowrmcQ2Oc3iNkmZY8Onidk1HOQ0PYxH3oHufgtB6ZjV+WFCFjaOdc6B3Pual9w9l9dF+uNBlrO67bhmMKRXiY3TsThBxVMDkhCLgOd6STCD0sSFJtRZFe3sz6a1frZxV3Rybwv6kuSR9YtrBL3oKFnTOUyCryePvjSP0iK1InEknvsnXzufsmgAatKc7joae3cmVnZhcKk/fK/5m94Yq2PqUhm45SNfzx/XWlt4a6ISJ2nIBilz6YaKWWcUDZDSOGUxsf/Q+5RJ6R0sEF+mn2Ql4/bYvf8rHWK69Btt6c0jI/CrMvgAwfXrw1qsMwbMyPpp8L2hrTmW0zOWicjG/ucUIAxxGsSRU+iU6PjCL/HaO2STiJNamAsHUnmCSM= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:DM3PR07MB2236; BCL:0; PCL:0; RULEID:; SRVR:DM3PR07MB2236; X-Microsoft-Exchange-Diagnostics: 1; DM3PR07MB2236; 4:828QxjQm1hMdQJH1oIP5l652nKRobN178TYda4slR+LtzlSiGm9QpyGWIVBodixhgQb/ur7r7x0CCToXtEPgcKbEn+XDc/VkD869wZ1w8EWSucnFQOjvcCfhyRFoR4+V/FwOP8OFzOarvEU8YocCuEnHYH2H90rpdqN3JdRO1IbnMTvV1rU80JZqsirXRsciX3DejWXimjvfeYg6x0lZqKHBaEY+2/HHYthoSKCKw3fwA2yvx09uBiBqhIWZfr2FxiUKkxUVSlzhSy1psOdKVuV2uPS1oqfzeZQrXO+HQbYk04yvu9weGA6UobVxYP+41mkygbNgJcY/iFm/1ksbMhuYlfHKWUB6IthkDSzTeZxtgYT/TwpSrCEiZxKaKrnh X-Forefront-PRVS: 09525C61DB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(36756003)(229853001)(6116002)(66066001)(2950100001)(50466002)(47776003)(586003)(92566002)(2201001)(4326007)(5004730100002)(5003940100001)(48376002)(77096005)(5001770100001)(76506005)(2906002)(189998001)(76176999)(33646002)(50226002)(8676002)(42186005)(81166006)(5008740100001)(50986999)(19580405001)(19580395003)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM3PR07MB2236; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnost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y9XlGmp4UOAYayiGSGEgMaK7S4XqZH7SWB6+LmWdTsY6782tgw==; 24:pEQONaya3kIsX+9LnlNwu32xSt1y7bMyrrx5J6ArPcbjbHpnCKo7ariRFj1cEBnienrphQOoBqc9b6aNN01hnh7z0i0E99cK1e+rpboJqgk=; 7:HmbdA6HjqJtYSus0MFvw7YbAMYqgslqgavxrTfdL30b7gvdXvy3pChDQrz91QdfXv5+jiAOcLWbXoNnNWGGw8D9kj2huuYyG3WJ1QUr3DGGh9hideEaCo5K/urFWameStGiU0SULAuHppXESwGh0o8pairUhjQjqDkZTQgQbgtL2Ya6zqbcn2WdHI1CmvcnT SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 May 2016 00:05:50.8528 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR07MB2236 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160523_170614_083456_3B032868 X-CRM114-Status: UNSURE ( 9.52 ) X-CRM114-Notice: Please train this message. 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, 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, schwidefsky@de.ibm.com, bamvor.zhangjian@huawei.com, philipp.tomsich@theobroma-systems.com, 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