Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751945AbdCAT5g (ORCPT ); Wed, 1 Mar 2017 14:57:36 -0500 Received: from mail-co1nam03on0089.outbound.protection.outlook.com ([104.47.40.89]:24736 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751595AbdCAT40 (ORCPT ); Wed, 1 Mar 2017 14:56:26 -0500 Authentication-Results: lists.infradead.org; dkim=none (message not signed) header.d=none;lists.infradead.org; dmarc=none action=none header.from=caviumnetworks.com; From: Yury Norov To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Arnd Bergmann , Catalin Marinas Cc: Yury Norov , Andrew Pinski , Andrew Pinski , Adam Borowski , Chris Metcalf , Steve Ellcey , Maxim Kuvyrkov , Ramana Radhakrishnan , Florian Weimer , Bamvor Zhangjian , Andreas Schwab , Chris Metcalf , Heiko Carstens , schwidefsky@de.ibm.com, broonie@kernel.org, Joseph Myers , christoph.muellner@theobroma-systems.com, szabolcs.nagy@arm.com, klimov.linux@gmail.com, Nathan_Lynch@mentor.com, agraf@suse.de, Prasun.Kapoor@caviumnetworks.com, geert@linux-m68k.org, philipp.tomsich@theobroma-systems.com, manuel.montezelo@gmail.com, linyongting@huawei.com, davem@davemloft.net, zhouchengming1@huawei.com Subject: [PATCH 08/20] thread: move thread bits accessors to separated file Date: Thu, 2 Mar 2017 00:49:16 +0530 Message-Id: <1488395968-14313-9-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488395968-14313-1-git-send-email-ynorov@caviumnetworks.com> References: <1488395968-14313-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [27.97.135.110] X-ClientProxiedBy: DB6P191CA0001.EURP191.PROD.OUTLOOK.COM (10.175.236.139) To CY1PR07MB2245.namprd07.prod.outlook.com (10.164.112.147) X-MS-Office365-Filtering-Correlation-Id: 930f73c2-8b68-485a-6d7b-08d460d81ffe X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2245; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2245;3:4RqC6PfJUmy52e+SCQ49xGxSzCLw283PdBTHcvsAmKAJNVky/0RDpSXWiyUaiuyUMlbNGHz67x/djBSHcH5ZrvlOVtPMULZBQghKRPth13WBWR1a6ewYKw8o4zBkXUQN2kLpPa2hBRtWuZyJGR0G2+UGrrdy6PnAeLxHPp9ICElbiMoTnF6jv+kEf0AmkmD1GMfMS6gFHqgvdXU4qU68iw9lMHhwqcZNFN+lp4tQtHl01sjYHrkgh3JMJWAE/yKNGSSRL9s5pahpnZq2KAvGFQ==;25:OXOFhh1MtoXjjAtJkbSUvs6nlFlv5EoMvQ3rbaH4j1rPJZ3hAC+A0rS8hbToOrJRr6w5msIJBkCLrP2evWnPKxysR5mRLTwG15nwzGfgM6nrx46YC9AypM9VoRfge7LF/c6xlk7hE2eTvKDhH4bdl5htl5yK888VYHL5cWrReZFr+3xxKSeL8r0XE7Lnswjr7tjE1/cJOpa3y4NqbQrOC0+0PBpPavdiZElG2TMKbfu6LXx0BnKh4+LAgGXng/Pz0D14Z8/ceEVlxuMQVK/+NDhuNn9HCxbOIkHKNYY8ZsjBBY9oTk71n37sQiIdCM7pm68iv1eIhsQAJgTEI9K3z47veS40hrO77P8WPruGWO6Sxt8szmeKO20wTUymNs02NxCBWSfkhKCV/4c94q+IJvM2tqmCr8SP2FRagJmuXEr+Zh+2BvrYtNVi6LQOhSKoFFz2ximZQBAULspgbPE3QA== X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2245;31:lh7ZQmCGKMr+8D04CA201U19xdLCUeBDMAbkE1eNa6T1Td/E6Xm8IMtjuivhSFnsI/mKcGfpBMPc0ds9uMHerzDW59o87Un0CvIDAZo+fj+9MtWMqKvntVZtIeRd8jvZIRwbE4/34jJ3HmOVyLnE77PjDOH8ZfPctX/xIOq4DAwgLj3cGm2N7vr5VOIa5hb0RAq58eRhOsbC4Ww18Eq9tFxJXsP1o6PqbFHOVkE/z7E=;20:ki2yaqtKFC9f4RB/iVvSMgUHMcEVP+AuC/QGAutKdFbE+087U0I8BPqk4LmvyCCjQryNniFJy6IU4+anrCwPxLXsHPaLtGNEMq50dckVLVMvy3aE6qc/L6EtbMs4DkdIm0bm1OFNSnCYlvixZ2vPc77uNz3CbTjSgEA8FsD6OeXGlNAaMRQacWitQG7oQMQedGUssAzFFoS/T+90+JiooCC4tL+VWraPTT4XSVvUIVBm9DOGcLPwbSodzXSvqysKbNjJ04Q5LyCn0FjKeKfidQKFwRgyJKrKklDIuybN0enbDzsOGftorotUagn1Yr1PjgaskycetYX5qF3MbO78Co7EKMeR5o4LS38Hjpr71rNYccPppbb/G1J0WBGo/Wxax+0+XOG/+/ogTmBnsb+P3/MqpVQ5tTocKSB0p2HD3k8oA+UpP6DdZxiU24hGcWHQbTMLTrlVS9thIiyXj02OroNfz+xFT/+y08TP7OcBqzl9FLQ8Pr1qkTVXNpkGzJUW8YSHfsTb2AxH7BEzw/IqNJ7SYxvyyUeuGUfbPFJv/hd/E909+bebftlxhkLNXhW9U0lT7t2wmHbUcsdQ0JGYozukGuK6gyE7MPFijd8e164= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(20161123558025)(6072148);SRVR:CY1PR07MB2245;BCL:0;PCL:0;RULEID:;SRVR:CY1PR07MB2245; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2245;4:DnUdT78FS36vGAXnzwiX5F0rV3kgbfJjsGIg+jiqGL8wKDVW6AKPqEbjRCcVg+m2fbOWzKvN1k6uDUvyDFu0BgkyWbL5AImDIp1vwzOFIIqdg0w1Jd3YDxzSPrURfCE3lHUlacmHmVJ0VBWtArkBAJAjPRiHNoN5SzE2i6JXj7P+7hq3f/TulYwhl5SOjwqrVEmeuJai7TSrpYp9O7AZd9+pGt82V+SVNrGKMPWYyuU/QZLOHTWQKvmgnQ96fbKDakQBeVi2DD+Tpr//mcZ5ZEis5uZ7LP3ImfMF6gbF04VLaIsmC1MbTgPsGRk/ue6hlS/P7pdbpBUfDW/jgN5zjcPk2cWC6dYg5LAv7bqe9f5NUNtUEiLccp4fmidiubVpNDShyVVaAJz3U3yphVkR7HmSwwohukhTj3baXVIR9/5rr37xt4nYfupBOiQWx3434YfxesR1uQr9QBMqq/kF67U/xb31OBAb+aZD9TSncxs+sqs5llb3pHWom2derpDOTPY7jpCmj+iCrDAJRNC+XOSkWeJKFCsZjPUd5EgmvXYN0QzX7tOX+w7xOJLOgpLR/Bhd8154cufV2QMTDuj7Rq8z+JEyhWh3Dq60hL4oOb0= X-Forefront-PRVS: 0233768B38 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(76176999)(5009440100003)(50226002)(33646002)(66066001)(2906002)(2950100002)(81166006)(47776003)(50986999)(8676002)(53936002)(76506005)(4326008)(305945005)(7736002)(7416002)(25786008)(5660300001)(6116002)(6496005)(6486002)(3846002)(5003940100001)(189998001)(48376002)(50466002)(36756003)(38730400002)(42186005)(92566002)(54906002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2245;H:localhost;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2245;23:nZ/P2rnGIGTjFDIeyB47k2NV2ZEOXo671+MIHEoADfZI8/vmVYhxhq6nYgpAYNc0bNeHcUZPSHLzQMaPrWBV+7lxkLekTilWmjBXGRDO6/iV9sCzMacXFaDL9PytdUp8Sdhc1lDHHztutiH5O6dMK1YQ5ReVkMc7KHbzwNKmOxRVlS9hp1qgp/d33kw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NaDavjKN1csHNW5WgRghc5nmuKLxQXtYqNTG1JFMMG59IbflMexI0KmGFXIF8Un9U/jdanECal1zNAkr/L2VE8rMME15P2ZHOneoH+lEu2+8GaCy52sbNVIK9OzOB0hq+NcaTw==;5:MphyhzN0s9bOaOF2TnpVLVXXz5E5m8AW1I9GtmzyL0ltkarrZILEI8HaMK5gdoFXT4sMn9BXXx9BAaLU/ElALnQGAhIuoNjgOuKbp23gvIZ9Jx3y/x4IWVCG90Bt215jhgp04er/mRAxZOkPq9vrVH68DWiPF2miOk0FiKQht4E=;24:QZIqrUyXZy1ufod2/kYLft6AvcwEwITHgWNPQT8Tu4DVp9zRkdaic1U7srZ8PVBiN7uo2rwYVaP/48Q+WyQXFssP1WEitoHZW1RZbHDdLHo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2245;7:6xoy+UOTfgWu1I0lL3UoHlxOwUcb+ISqGEUaZ5Hr0OgwntPD44Ab2IzEWnnePE740FsZBq1KuVBmH/c6ivWI+Z4RhN1QtDWpXojKAo/GiCZCcnVI1qNc7Og2i2slYLesH8nEggObikG8Hcno60VRORy23NZbgnnrEmUDqgM4BuXEou520OeaW1ENAgvVGjW2GPPKeF67tHFEUGYhIMO7r3z010VgWvOKEIt6m07nfvywz1GZuyO92l21EfZ1UdCkR3yf86ucFP3f2WWaT21p6K9Bnjnoc9np6vxwS+CiniloO5vZhe6vlAFUcVhqA/Aft0LetzWjQm64/lEb/DADtQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2017 19:21:12.4396 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2245 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4871 Lines: 157 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 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 | 63 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/thread_info.h | 54 +------------------------------------- 2 files changed, 64 insertions(+), 53 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..8735433 --- /dev/null +++ b/include/linux/thread_bits.h @@ -0,0 +1,63 @@ +/* thread_bits.h: common low-level thread bits accessors */ + +#ifndef _LINUX_THREAD_BITS_H +#define _LINUX_THREAD_BITS_H + +#ifndef __ASSEMBLY__ + +#include +#include + +#ifdef CONFIG_THREAD_INFO_IN_TASK +/* + * For CONFIG_THREAD_INFO_IN_TASK kernels we need for the + * definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels, + * including can cause a circular dependency on some platforms. + */ +#include +#define current_thread_info() ((struct thread_info *)current) +#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) + +#endif /* !__ASSEMBLY__ */ +#endif /* _LINUX_THREAD_BITS_H */ diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h index 5837387..a325deb 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -11,18 +11,7 @@ #include #include -#ifdef CONFIG_THREAD_INFO_IN_TASK -/* - * For CONFIG_THREAD_INFO_IN_TASK kernels we need for the - * definition of current, but for !CONFIG_THREAD_INFO_IN_TASK kernels, - * including can cause a circular dependency on some platforms. - */ -#include -#define current_thread_info() ((struct thread_info *)current) -#endif - -#include -#include +#include #ifdef __KERNEL__ @@ -33,47 +22,6 @@ # 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) #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES -- 2.7.4