From patchwork Wed Aug 17 11:46:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 9285683 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 7B8E960459 for ; Wed, 17 Aug 2016 11:52:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 712F527FB7 for ; Wed, 17 Aug 2016 11:52:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 656F829072; Wed, 17 Aug 2016 11:52:30 +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=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham 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 D38B327FB7 for ; Wed, 17 Aug 2016 11:52:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzMx-0003On-Dt; Wed, 17 Aug 2016 11:50:51 +0000 Received: from mail-co1nam03on0084.outbound.protection.outlook.com ([104.47.40.84] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bZzKR-0000RT-5f for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2016 11:48:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-caviumnetworks-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7KZnXKnIzGK0wu+vFtH3DZpcz7vYGWB4uX+N2xNtK88=; b=YWoqGAwnOvuczgP4ySOZ/nbwmmx5Zu3NCKu/hZsKHSZavGlrQUqlxDsfL9WH1bX6byDb0Q+jYInrIPUPv93x7VNuNcSB4mCwZUeH1tg1PgC++KGxsYSUeALgMiWvfvy1g0qIKy7i4HMHDtkOnO0D3yzNX+ZT96mgRC53+tSr/Q0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@caviumnetworks.com; Received: from localhost (95.143.213.121) by BN4PR07MB2242.namprd07.prod.outlook.com (10.164.63.148) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Wed, 17 Aug 2016 11:47:54 +0000 From: Yury Norov To: , , , , , , Subject: [PATCH 06/18] thread: move thread bits accessors to separated file Date: Wed, 17 Aug 2016 14:46:31 +0300 Message-ID: <1471434403-25291-7-git-send-email-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> References: <1471434403-25291-1-git-send-email-ynorov@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [95.143.213.121] X-ClientProxiedBy: AM3PR03CA043.eurprd03.prod.outlook.com (10.141.191.171) To BN4PR07MB2242.namprd07.prod.outlook.com (10.164.63.148) X-MS-Office365-Filtering-Correlation-Id: eb76ddba-6437-49eb-fe42-08d3c6945374 X-Microsoft-Exchange-Diagnostics: 1; BN4PR07MB2242; 2:45trbAOBEBgWRsWeOxDv8x1HjGDNYslGjeSYWumAYomYfuYq1wk2IU0mFrmg9Y3pDggDwChiQIZvGtTzX6PbW3o0WvkARWG0gHBZMvLtAEvJPfgCHSbJGGh3oE6Uq4abYiZdpX0y5G3b4S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vqSJdhgkPK1x6Lr+iTiHdHbFoxjmfkz8KdoAFkgENh//N09uSczO06ahk5IZ+mjDWYl+8OdvY0v4VYCrZ+IhSujOygG9TX0bBqL/HV87LUWsy81N2hWkQgCBxa1n8I/ziXX09kAwi9n7+Kl5HIW3okxVjj0O/oWzVsEcgqpqQ8WHXzyD/B5VLmgOeKTsAMWoYXE9pVgpwywh9U3nLMnCWjW2XUGbNHtJolkGDAQKsTkDZxb2GzhhF2WA0bDBOK6T/dxvrqgp9FpIMDGVwoUJomDyLoNVLP3KBsfUaTF8moJfD35yMvCXvRqCIzoiMhNtNL802T7P4uFFGCAJq0AsOlOmLVXfZI38dIdM18swOAPs619bqlP0dPyxrFS5wQtPJFwFrF2mWCx7wuuAweAvzM63Bkj4EZ3dR1lDDjoJO8v3kkPV/e+bE12bVLH/bm5CNUK23Z/+1jIXJjbzVDH3Huiq/vffi8Ji/8Fe8= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046); SRVR:BN4PR07MB2242; BCL:0; PCL:0; RULEID:; SRVR:BN4PR07MB2242; X-Microsoft-Exchange-Diagnostics: 1; BN4PR07MB2242; 4:R4+ZQx1Uo6VHZnnF/HQ8aeyDdZ08ilLjAetAhK3qiOYPyhG2baPrxFRi8EQ8bOLDMKla5HWJPx6jKeqIiKANtqp13/GF00Dl7ZvYGx9wc64Vkxoi/8U/roFitVxA7+w5sAqDWxMB4LU03GcWRhQFsA8RgUBqjK4lYChGPWTQshB43pQy0KTwhg9F5GmvKdcdYDrP5q3iKy24hA8j7qzN71PEx5Bp7K13hsz6Cxosyc2ejF1EKHeyeYuUTpAGAN6X/J2+kqfCKPzzloiikOn5lu0mQwk8U+jM+MwLU7wGC6vI1Xvp2rGz9qyKHLQmCOrjs/GnAyFMIofwZ4XRTaZbSEmyoOZsJa0lsD7bxphmVicf+mMNUkjYiCG5l98mlW+H X-Forefront-PRVS: 0037FD6480 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(979002)(6069001)(6009001)(7916002)(199003)(189002)(33646002)(81156014)(7416002)(8676002)(2906002)(3846002)(5001770100001)(189998001)(68736007)(586003)(81166006)(66066001)(97736004)(19580395003)(6116002)(77096005)(7736002)(50226002)(7846002)(305945005)(2950100001)(5003940100001)(76176999)(106356001)(105586002)(47776003)(50986999)(4326007)(101416001)(76506005)(36756003)(92566002)(42186005)(50466002)(229853001)(19580405001)(48376002)(2201001)(2101003)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN4PR07MB2242; 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; BN4PR07MB2242; 23:AdtqWFLeBmj51l542CjL9sIVjBTYzoe/xkgGoscK8?= =?us-ascii?Q?x2BIOIudeYqttR14DNyz0xWJR0Bq9YGY2SwxvpSM6rNCNMtcv/pqxJjOLGQs?= =?us-ascii?Q?kKoQOyY+0ADSDkWVAqjfCL/f+YSLPOtldCtNpk5k/tGeJJXdTaehBdcVbHDj?= =?us-ascii?Q?n38TsN+ln+B5UuIMv5CHn4fdEllP4mqFbVsmk3EmTT+ue6ezgEOJ9zCNesAu?= =?us-ascii?Q?MzWGRD0MLKRgjD2/mtUb+f6XYeeCWPE/Ta0qujgJJI5jAq8fOYH6u2Qx4pVg?= =?us-ascii?Q?LBS/GrEzYy0GOAqJLHbh44ISfvCkgtFOYHbHRCGkvEXKhmacPfe3Gj8m5S6R?= =?us-ascii?Q?5G26gCq72L8avFn8BTa6apQIpmUHnWbtfT3eeofL0qMxVw7Q36ktizAFnOkx?= =?us-ascii?Q?yOc+CS/ENi6TE9aveGenhZF4gwl4Sc9EFF7Z+pWS5arzVtL18Oi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x916dzo8lIYkUDxPuK74RyJyGJWu2wUwQ1gmue7VknUbYHaQu5+T+gf2M7vXPZJATC6kU8pA4f05aTWghyqhTCGXY8w/yKdEBd8h+oajgNJv7UVKQgR/yiNtXLrjpo+JG3YprFl2H8tjhDdDt2Vg0w0arwA34ASfqRfvGfqFjR0tKlPHoaQut/4Jk+FSajKbSI6AxpJzOT7n1Uu0hSXY664T0XHu95a36cl8cEJIpLz0Jz4tZ3WSYcgp6yFfRuUAztJNBWbrY=; 5:ZUOyntpAsXPlC1YZpw5HEXLin0BqxZKiNB+NW1MGT3CKMswYQiMn9IA6dwNJ5sFPVLksJAQqH5FZllj8ENfl4maaR7U6cW226oIGO221p96QVBuONhgjcmCq/05wO4RvWk76yJ09QVVDBrIpVxMs8Q==; 24:qLX6Z4CPxVL9fv/4YVWhofQtYAiK04AsSj1N5Z8N67LOYdOdpd3KR9q6Om4FdbDpfj9nywRovqk1CNtwDqM3ioGe9Yqs2zvPu0fGK7zHgDM=; 7:61/DIAxXLPSbo8OVhCZFjGVjmuLj4gundjfagSoCUMUKNcRaHzYSNuTn/NhPi5sgUt/3G9KBrPVehpR1l5EdPDWUYMqVwNpFZvHFxY9tAjn0SsD91a2tZfAzy7wi/dBblDusHnXRQglgxzpY4FLpP2Z/ni4CorAYaveiG4y8sq0r3P5nY2L411wAaa8jYqp3buOxBvnvJNJYeCqJ3iWr7m65FIbeIQtKaO4RYNyhKCouvZMiOiZ1P4boJjASxv5r SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2016 11:47:54.4295 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN4PR07MB2242 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160817_044815_784696_E786E9DB X-CRM114-Status: GOOD ( 10.11 ) 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: szabolcs.nagy@arm.com, heiko.carstens@de.ibm.com, cmetcalf@ezchip.com, ynorov@caviumnetworks.com, philipp.tomsich@theobroma-systems.com, joseph@codesourcery.com, zhouchengming1@huawei.com, Prasun.Kapoor@caviumnetworks.com, agraf@suse.de, geert@linux-m68k.org, kilobyte@angband.pl, manuel.montezelo@gmail.com, pinskia@gmail.com, linyongting@huawei.com, klimov.linux@gmail.com, broonie@kernel.org, bamvor.zhangjian@huawei.com, maxim.kuvyrkov@linaro.org, Nathan_Lynch@mentor.com, schwidefsky@de.ibm.com, davem@davemloft.net, 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 cbd8990..c778121 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) #ifndef CONFIG_HAVE_ARCH_WITHIN_STACK_FRAMES