From patchwork Thu Jan 7 23:34:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7980621 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DBA8DBEEE5 for ; Thu, 7 Jan 2016 23:41:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ECDB82014A for ; Thu, 7 Jan 2016 23:41:13 +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 0CCFC2010E for ; Thu, 7 Jan 2016 23:41:13 +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 1aHK9d-0002KA-8p; Thu, 07 Jan 2016 23:39:41 +0000 Received: from mail-bn1on0099.outbound.protection.outlook.com ([157.56.110.99] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aHK8x-0001TZ-H5 for linux-arm-kernel@lists.infradead.org; Thu, 07 Jan 2016 23:39:04 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by BY2PR07MB615.namprd07.prod.outlook.com (10.141.222.150) with Microsoft SMTP Server (TLS) id 15.1.361.13; Thu, 7 Jan 2016 23:38:35 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 07/21] thread: move thread bits accessors to separated file Date: Fri, 8 Jan 2016 02:34:25 +0300 Message-ID: <1452209679-19445-8-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1452209679-19445-1-git-send-email-ynorov@caviumnetworks.com> References: <1452209679-19445-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM2PR09CA0016.eurprd09.prod.outlook.com (25.161.22.154) To BY2PR07MB615.namprd07.prod.outlook.com (10.141.222.150) X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB615; 2:ZcrOJzfFcolQovrH6lffZvvrsikkHuFMhCLyVixvPPTQohds+y3am+f/BQIdIMF1+Uqr5x0PRj3TqOdbVEuYDu+FOtzGpbCk2Gfor4GI6uJRhPhbKMdc6h6TEddGPfs6KCvyCt3TkjrexszvwxrxFQ==; 3:dH0gFcGufCAxiAanXEyoKwBaT5pzn9LtzMoamje21jFTRvTPJZnVG+6LrXvk0pyMZgp/BYYyW1vwVq81JUGaeZqmpiR2CATJcVaX1iBxQ1ImpQF0eeoBlPlEP+0m1IFT; 25:KPg8J5+1O9tsRjzQ/CqGH0B4k8upNORO8COSrPdscArBoJ3uqJCW2xc2Cgqb9qGNRnA8XoH5BI92Mx8B2jbsjBvvsphH7tZ8A4ubafg8ORphQfTDTiRdcGRPkvs8SCPqRwX4VOkKiJp+OZMNAW63E6Qe6IpVwzcwjM4XxKRQOQlbo2Q889Tq7+KRATUNmTQ1c7nH77ERGMm493qbPmecAaGv3N7dE6egtMm09cgqrCT8cMaYpoGbT+lLDuqPeu1i X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY2PR07MB615; X-MS-Office365-Filtering-Correlation-Id: b43b8586-1fff-4d48-d8a5-08d317bba9b4 X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB615; 20:NXZbVHBmovaP0vxTk6+oRqr95fZzoG94PeK/k9ArY3rBq7QYcjsjTSpHSfBKlWPUqPi0mfEPzn+1EMqZXvmxRr6p3IFKA+LQFpIbl2tnXuNJ1fLJ0AbQyyNHr2Pp9H3tPxJ70eT3ZfDeTuMxEDtzZ9Y308YNRN6p+bg4UO0ARCjbMugdH76zOwYcH0Fk3YzQZKH3+OtKcGSuolsMjq8PVWAEN+yCQ6lS/Nek4Vo1hwcdQGzeIy9PCLb0KFtYTIP+AUePTWEahPxIiqk5pfMrUo3nfCeaRNLqMCteRPFvEdUDRnj7y45b0Gt+c8mT1tnPAZs6PFRCboKZ+kXbd9979j3F6QodCPaXlM2YEbYDcDe8fhgGLIQLC/gMCldccAstMZYgnsNd0TOIubS8G5ppaWgBx0f/HNEkF8Xjre40nQoDmUxn0lr94Fv1iEo1eBAz/ZfFn+BPwIdbzWpjRxpl4dNCbiZFNOo3l5+C0rO3V5jaGVu5uu1mL1MWAtne3TCEeUcNqboIfmb9/rEISZryqSghSw4AYp3LRkX4sVLNaxcBXAxsfJT4vnvJI3Q3tvJiOejPZm3uc8y0DKnDJTbLc5W+Cmi+DDX0jDHDi/VkE/M= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:BY2PR07MB615; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB615; X-Microsoft-Exchange-Diagnostics: 1; BY2PR07MB615; 4:7aJRSYYSV5R25+tBvUyPxQuvrDUvCNRbWNMVKJE4z649RbzKO3fYJypxcjsZn6AfxKhEESA8LnL4TaVpKdwzZt1qV9inEvG+EZX5EpYJPBmqjyzdAoHssO4gAm7akeq5wgC/HYHjBVGnZTZyNtPjAHGu9nSZ7J8TWR37wdIfjQ3gM7iYoXci1KSWi2kxM05kIbIu3aNf87Jg0AhtIYhX9RGL7oR3P7e+2RamYdAL5y7fM0eKJCVqnw3mwtAt/AnyFpnARHcJSdl6TYkwUZA/HJM3IVCih/0ori7i5DSRWDt+6YdgE8j21cdkhsdRRqJ9q26tuUmGMyE7PKkiTYajpsqMjhVZ0LbvqyOVUEruym56AP7/oq3gGSOxeHDdCEGVYm5dJGUIJQwM3bGzAVFzvzrrDXxBA9z+kb0cqzaohUw= X-Forefront-PRVS: 0814A2C7A3 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(189002)(105586002)(1096002)(77096005)(189998001)(106356001)(42186005)(97736004)(5001770100001)(5003940100001)(586003)(2950100001)(5004730100002)(50466002)(101416001)(2906002)(81156007)(5001960100002)(92566002)(5008740100001)(4326007)(2201001)(50226001)(19580405001)(40100003)(229853001)(76176999)(47776003)(122386002)(50986999)(19580395003)(66066001)(87976001)(3846002)(48376002)(76506005)(6116002)(36756003)(33646002)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB615; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: caviumnetworks.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR07MB615; 23:yao3UGRBElK1V2wRhgniJYS0hgs29EBNI0eYEuYqxQ?= =?us-ascii?Q?rjdbff3SRcRIVB64t6C04i583AzR8Xyil+RmVmGI6/MTDFcK+hgvbw1KjgAx?= =?us-ascii?Q?qHHjgZFgCcSi5UkECqQNHgsCM8nQ7s7twQHx2SOmwGGjQ0cRS3Qv0/zVOTZH?= =?us-ascii?Q?BMrb0B+KDsuOEYEHMnxz9e7Z33svpVIm4tEFsim6eQujRpKLxeEFBYvTnqJY?= =?us-ascii?Q?cD/bVdJK/ojPlEBZ4q9ApMedrEdOMcV+CBEz8L/6e1/D4L1KbV3cdWhgvwDq?= =?us-ascii?Q?HataTOUPSwsWcwoitK4qSCq8kBq3j2c2NzmvWeQL73JmDO/hgKANZ1XeyjBx?= =?us-ascii?Q?q2QidrRV2b5qnqkobR2Tt37UlAC1xbxjCnQIScAt4TUzuLaWKSX/wjF2u6JB?= =?us-ascii?Q?NUXT8pRhvGczRDAYOz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:WVeVmWqZ1NimyHUtdek6gsRWL+Cs0cGEhZAnuaTAVF3HP+IFmDwzlL4Kl1FTvVeuWi+QQn8ddNf/Rm/dPnOFNoJrnmW7wx86habROQOYyk0= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jan 2016 23:38:35.8521 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB615 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160107_153900_275109_123F8103 X-CRM114-Status: GOOD ( 10.16 ) 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: pinskia@gmail.com, Prasun.Kapoor@caviumnetworks.com, schwab@suse.de, broonie@kernel.org, Nathan_Lynch@mentor.com, agraf@suse.de, klimov.linux@gmail.com, ynorov@caviumnetworks.com, jan.dakinevich@gmail.com, ddaney.cavm@gmail.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-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 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 ff307b5..c905fec 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__ @@ -61,47 +60,6 @@ extern long do_no_restart_syscall(struct restart_block *parm); # define THREADINFO_GFP (GFP_KERNEL | __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