From patchwork Tue Dec 15 21:42:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 7857461 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 76FC1BEEE1 for ; Tue, 15 Dec 2015 21:48:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 900F2203C2 for ; Tue, 15 Dec 2015 21:48:05 +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 A35A4203A9 for ; Tue, 15 Dec 2015 21:48:04 +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 1a8xQY-0004kK-Fi; Tue, 15 Dec 2015 21:46:34 +0000 Received: from mail-bl2on0064.outbound.protection.outlook.com ([65.55.169.64] helo=na01-bl2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a8xPQ-0002Ho-Po for linux-arm-kernel@lists.infradead.org; Tue, 15 Dec 2015 21:45:28 +0000 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by CO2PR07MB617.namprd07.prod.outlook.com (10.141.228.143) with Microsoft SMTP Server (TLS) id 15.1.337.19; Tue, 15 Dec 2015 21:44:59 +0000 From: Yury Norov To: , , , Subject: [PATCH v6 06/20] thread: move thread bits accessors to separated file Date: Wed, 16 Dec 2015 00:42:32 +0300 Message-ID: <1450215766-14765-7-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1450215766-14765-1-git-send-email-ynorov@caviumnetworks.com> References: <1450215766-14765-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: HE1PR01CA0020.eurprd01.prod.exchangelabs.com (25.163.2.158) To CO2PR07MB617.namprd07.prod.outlook.com (10.141.228.143) X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB617; 2:pUJjifSAL4apetuB454bu3PkNjdXnTlkF633mCQMgBottle7S97c6OzafRcmXHrGcfRHpuLfsTOdAkcGDqT6eYG4Jb2o8x+SPfU0xf2wFjU5gXJ2qKM0lLpfOc5fNmefUxYOe+yzJVjtqHcudIqTBw==; 3:ri8GzNSBBZpHyZGtjKkOclPsrF1d/QGjt0lnyWYMXwQJXIj5kcXt7U/QRs5VGlDNFDdgaEo+68l+ngMqqIG20OTpSVygZs5LymUqN9UMNP47oBKBlodbrokXBd+pWqN1; 25:Nx8M0/j5xWPs8v/APd/EmbJGap8/a/LdeyavW5+N+RNaFzRL9KUQi/NHGH64+cxkbsoDaKt5zBFHrta+uZF4jCXlhQFrEKt5+GB5Tb837BQ5hAALJP1cUUTXFKQX+3hI5EuzlnCm0ZU8VPI2MZV8ga1jnO4aSedlkJAc47BDw4fojZeTc8edaYOYQDSXm/rQTwqA7s4Cg8kcgL0jtr9bAIZGvX9BcMK1SgDuiezsheLZqyABs5hkjUhOgyTo6vlP X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR07MB617; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB617; 20:EPX4HdDxRPqILcaZnx0AwbbLD6+tvkf8TPysvrgb+dsX3TNflQctIu8u1oJh6dWxXyScsehY86tmR3Y8yUC2PO3SVaUUoc+k1QdR6urYPEnPXQYcRNHJOjkc5OB1DNzc8RhMZMsnG117mPg6I7u6qEYRvTsyUlS6bMLc1kdt/CdgNMdZqYKMAskioJvXi8dzu+XkFrkV9x/wwBKAOwsToMP03SWmi28hSG6ygpxaUyFCHcv8QEwBxQE9WvXr13FISa9qDW149HoI4vP3RjBVczEklTFVIZjiOwt4QyQKLgJOc4xDNxGQ2NNbMhwEy5wayD8Ldp7AK7HdnGJ4Ie2yX3OumSpEpQceCver5HUmUjcw2WVduaFTHNd+R4gtQxwRY3xUdWRz6z1n0AVp4i+Bo3VRU6nQLtlYkr8cVheLdwdkGutkqNwJ8IS9jAliQlhOSYnBtu4dH1cTgJz6vfs+MadcdQgjl3dX28LE6kV0DTAZ31+A4mQepU8yT4pnIoY4Rpd1ASkw4JOfRYtG2NQvgNlTLeAhDNWDkE0E1qvHmWnvgdrqZDTu2dwmyuJdma4tAszX7Ezjy4hZtG4aOrcG4SzeF2yIX5B1WfcE/Hg9sQY= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(236414709691187); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001)(10201501046); SRVR:CO2PR07MB617; BCL:0; PCL:0; RULEID:; SRVR:CO2PR07MB617; X-Microsoft-Exchange-Diagnostics: 1; CO2PR07MB617; 4:+JnKcR+15FxlutSqlb6Fmi4CJrCE507fiDhCQYD1DWqam85W++Nv7Q4M8Sqvie0MZc4+VSEC1g49EVRpVAFbRhQoPtihbllsHeRoKqpRojbeD/WhdfwjfOAw7JD5IQX5rsauNxA21UjmzvB9LYb7LCa32YqQPhdiO0gLLhhLroca5hQy/+ec4sIzGd/dVSXQApbMSWegxIqMjrkvcCLhGY2YGZw6PDAhkq/JYj8IGRwOnIkHKamo6Ji+1DhAQWEdY+K4PU3GEX95J2UPkS9AmJVm5jmLNd/JwTn/yJrL3oHzmtQsh/pHQw+kNzORSTRAY/wIZYc5fgLQ4DEcsGopteeXN39DX5ojqDm8ioB93pQtZIXDCvdX8ZV9wgRcbbBENTNfp2RdUepIIGQn7zSN7SiQaakmaW++TkOyuYp38kY= X-Forefront-PRVS: 07915F544A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(199003)(189002)(229853001)(66066001)(101416001)(6116002)(3846002)(50986999)(586003)(36756003)(47776003)(189998001)(81156007)(76176999)(5001960100002)(105586002)(40100003)(87976001)(92566002)(33646002)(97736004)(5001770100001)(1096002)(122386002)(5003940100001)(50226001)(50466002)(5004730100002)(106356001)(77096005)(5008740100001)(2201001)(2950100001)(19580395003)(19580405001)(48376002)(76506005)(42186005)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR07MB617; 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; CO2PR07MB617; 23:GWy/jIfl8gNMKr8eFhEYePX1fsbGTJ6uc3LIx5t7iM?= =?us-ascii?Q?xUCFk9p+UCkOiVD3VVCOCIWdkeq93rH4lny9x+vK/msPyWlq+st00ezC/lqb?= =?us-ascii?Q?lAhJmFvh7ppxTfgDaEoWtVdyOEcPISOgxbzV2Tn52OBfQv8cJFUXNXzzan7r?= =?us-ascii?Q?ydzpaBTFwPKZt9TUxUOUlAa8RFsXOP33XqgeeOmGuRFUQGbRP48CqjBcvaUL?= =?us-ascii?Q?ma5a39Q3BkJKLvtfviAMr+tHLzv0W1f/HAo9eVCQrRGqCsMPVod+fcIvbbHx?= =?us-ascii?Q?WPybVSvNzQ/v9KUDKhCXCEUhE3X4j4M7N6Inp1grJDyJrbMAtPFQAlzjS2U+?= =?us-ascii?Q?l0C0Tow9gOuiwV4oZ0iX6zwS4cQUEL2RZR6jKypAwXgevFnyxs8judyMRiF4?= =?us-ascii?Q?ix42kiLs75jDx9vNsTI3B2yzSDSsynyhcmKdK8dtH68Ljnkjo+lpHQbaLvq3?= =?us-ascii?Q?g6cpV1jDD+hrSUvl7UJwcc89CNaOzc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ticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2015 21:44:59.8959 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR07MB617 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151215_134525_705858_E8BD21CC X-CRM114-Status: GOOD ( 10.54 ) 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, T_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 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 | 57 +++++++++++++++++++++++++++++++++++++++++++++ include/linux/thread_info.h | 44 +--------------------------------- 2 files changed, 58 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..8d1e3be --- /dev/null +++ b/include/linux/thread_bits.h @@ -0,0 +1,57 @@ + +/* thread_bits.h: common low-level thread bits accessors */ + +#ifndef _LINUX_THREAD_BITS_H +#define _LINUX_THREAD_BITS_H + +#ifdef __KERNEL__ +#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 /* __KERNEL_ */ +#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