From patchwork Tue Apr 5 22:08:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 8756051 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1893B9F3D1 for ; Tue, 5 Apr 2016 22:17:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EC5720219 for ; Tue, 5 Apr 2016 22:17:20 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 23E8D200D4 for ; Tue, 5 Apr 2016 22:17:19 +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 1anZG3-0003zj-1O; Tue, 05 Apr 2016 22:15:35 +0000 Received: from mail-bl2on0091.outbound.protection.outlook.com ([65.55.169.91] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1anZCs-0007Yy-PW for linux-arm-kernel@lists.infradead.org; Tue, 05 Apr 2016 22:12:24 +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=P79kTC+6TEaWnlGIB7YfHewCDtxt1OOP5vxGJi4KgsA=; b=CCuXgbcTuy64/06npUmHX+lBLANFziTi5D3hYoNRyqN9Ia4Nn4yKsNRcYbFOUq7wRWo+jaFavVeSbgaJ2NLU1Ts00m4Unwpo1fbG8R5oha7ZEb1PBd4pyhUjWFZ5C0h4k/X3zAOpWkRX+8gJsx1Asz4sAauxvz8hxQ6777LLKUU= 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 (95.143.213.121) by BLUPR07MB612.namprd07.prod.outlook.com (10.141.207.27) with Microsoft SMTP Server (TLS) id 15.1.443.12; Tue, 5 Apr 2016 22:11:56 +0000 From: Yury Norov To: , , , Subject: [PATCH 14/25] thread: move thread bits accessors to separated file Date: Wed, 6 Apr 2016 01:08:36 +0300 Message-ID: <1459894127-17698-15-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> References: <1459894127-17698-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM2PR03CA0038.eurprd03.prod.outlook.com (25.160.207.48) To BLUPR07MB612.namprd07.prod.outlook.com (10.141.207.27) X-MS-Office365-Filtering-Correlation-Id: 798f142a-fde6-4db5-9d01-08d35d9f4d4d X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 2:euVdI0EAXtkKpgma2TdKEZ870qCTx7Ta7YKe5H1WbedwaNCpUfGs1ZFNe15tZf8mqRKpnw+xZMOxB+oNAhr1y+YgZ3ngNWno5U3VQQEXfqOO/YNOkeY55zw1/CZlWssbwjFqZjF1SyFvmEPlqcXtve9hvHp+932RYfEuNx3WbxFI2JgDRGfaoelD6zrOHN9A; 3:nBZk7Ahn/6WHMuwQ1lidQxv8TpYKonb4R5052q23jecWu6OHAftafPSMSUQwP6Fb3bOIhTft1gU5MnSz3b+iI00Xd2x4IRrE2W5tfO8I4Slym9yGIYF6ikivnvSWbe+P X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR07MB612; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612;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gE7u7uqByKY7rUG4jHL9jzdj4u4z5ZljBKfsTFbwPl2tTTc74PD51jhCBIZ+2ljfjLrOKqeahXD1EQvLUb2sbZRX7CihnF7oiPI9eaURfVVPS3xGDc2IMXQeRzAhZtcXIjYLccBrgCAxRgjA4JhZRJ3liDv1kBczIMsHhlEEX0khNHLbjdeWwCkbtmOVR7Kqp7BBFzPDZC0Ak6g1L/uKm6z2mfIlbbSR+y6dc8LI95apjUnrLePJc/KwZkcUb7HW4= 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:BLUPR07MB612; BCL:0; PCL:0; RULEID:; SRVR:BLUPR07MB612; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 4:3zYGC6HxQDg8gBgGLvy1SSGX05iIsWJKippgKKPYX6RZ2PqmV84d3JnCW/Ifd54MUb2Ib7iOKGOi8ujcPUPo82N543IwCTQk8A4STYiEIpNtAdlQP6K3sidZ1/5Lc/06l+D+py82f2DACf1RLJfsVHsseYR4x0jGudPjhOJuGNlNA16v4dsoJ5/JPra0WlNHgBpTW+jkP5j6Ir/WXzuol3wpmQ/AoN20VxPYBy0nHCX9p9ZNutu3SBDRh7wbeeLYCAkw4gXSt5BczJNXIiqLQ/jdJOWXdMr/81ZwA5TaNKbcL1q3KzA3BnI4v+d0DSdK+CNxYTiNo2Xe8SZgjjy5hAdh7vDtQTVbAqxQA70tXtBqZ3IamGJLhT1myZnRPda9 X-Forefront-PRVS: 0903DD1D85 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(33646002)(5008740100001)(3846002)(229853001)(92566002)(19580395003)(77096005)(5004730100002)(1096002)(36756003)(2201001)(50466002)(48376002)(50226001)(47776003)(42186005)(66066001)(4326007)(76506005)(76176999)(6116002)(50986999)(5003940100001)(586003)(81166005)(19580405001)(2950100001)(5001770100001)(189998001)(2906002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR07MB612; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 23:DW9+KaR/Z4dDK4fcZ+0Rgyi0qDt2/sm/syGw//q2YiQJBOjbzdKtzWhs/8G8YX5aJ0UmMMWM5zBKkNTEnzj35g2TgozhPJBZnlu0yhCU8bfWkVsIqdnMJOrXUH9qNpna+twWdqrt1SGnZqYz2aY/QNnCp8KKlySe9LMdlR6KdRxLwHZq/7DcwIJrQpP0qagULh9/wYeowR+3XGmg7b2sKD31tj8CjmGXThsUlUmgvWHE6lSKZgJIkQRRdqSHXXqBSCrLZ8djhcSvpQLgyzV+21F21jNm1SlYaedesem1EIeRVgmTXb2VOUKggLI1QUhNMv7G0qDPLDazF6eU9mkSez/DM79kgaC+zj9H7uuXF1RotugE7F3zL4bUT4Ri9q2XBZ6HNTdpY2oIKPKavnkkig+cTywSC4ArKidL2rWSeCXwfQQ2tYGVqmh49gnMHpsqAAZOnZvWl/2venMvcvGB95SbXyskB23irbBEOcUeKEuKFdCwiQ12ObOWwV2lsmXIlLpWaY7e9CDRKR1OdiPyjH4IgHNYY/alrtmXD3hA/GYW0V6pSXIqOwBtxysYGCtxRIYXpyzFsNBgzxITU/kyqJdkXGiW+fzqbS7kKHc8VxV/SoebbLmpnlj0Fx/nz5c0c+fGrw7bSf2fjF9KDgh1dT7uNt2vqRbINDbtWDWE0vqc9jc74hALGj//BmcPjXwhfRNynrHPPcN8Zz09Qxvj73noDmrTlgHghgQUP1iRaszpHpXHZQFMTNRC7yw8BtWymsBtfLYQQ0VrO1vWNFDCQVMcOD4x6Qeg4gDSqCvwzJEusrr9UlSEfddpPSItcaW/F83jzP8I9F8326/XTi8b7HJLiRM21n6bk7ufAi6+qmaOwcXYtVInvZs/DxjmQxTdLdMP1wlD9mvZQId9ALaN7kgcfj9vi2gyvVGnd6Dvq8NWJQwPjUEn97aNbxVK3Mg8 X-Microsoft-Exchange-Diagnostics: 1; BLUPR07MB612; 5:nFwiuCcUqulcR017hIKCXkOArkmEc+08qNFDajeul37DDU4zqYksoVtQ4XEA9w3UheycmzByG4SjOeWtsXDWkdbuyyMp96tpZ+eSdAqMxvfjiwnwmy3F13bo6wPbsrS1Ym0mqmP+FCz0spccVtAiFQ==; 24:rhUKULz2lIAo5NFQI2HwqxdR2+onOfCbckqjZWxV3HZHH70ICFATt4y+9vUWHhvZ5tMpEOotP1eGUnD+eqs6dhYyMO+RlFvDzipVi5qJv0I= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2016 22:11:56.4205 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR07MB612 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160405_151219_426178_94F4B080 X-CRM114-Status: UNSURE ( 9.73 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) 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: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, broonie@kernel.org, linux-doc@vger.kernel.org, heiko.carstens@de.ibm.com, agraf@suse.de, klimov.linux@gmail.com, ynorov@caviumnetworks.com, bamvor.zhangjian@huawei.com, schwidefsky@de.ibm.com, Nathan_Lynch@mentor.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-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 "set_restore_sigmask() is never called without SIGPENDING (and never should be)" [edd63a27] 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