Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1689803imm; Wed, 16 May 2018 01:23:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpeBTQScH5E44rZFSnO0AlIYeMKTw4QJ6+DHwFh3mJfG/xbttT2ap1NU0NIAXtrQ/l50Kp7 X-Received: by 2002:a62:a21e:: with SMTP id m30-v6mr19001794pff.251.1526458995291; Wed, 16 May 2018 01:23:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526458995; cv=none; d=google.com; s=arc-20160816; b=S6CXs+Z4dgC++BeB4UIdQIARbuGPVjE9Pyg3eSP5LRgTmLIu+hU5tdbDjslafJRNnv W+9Cd5IqXXheFuqZOGDfEeCWhpziYOxUV1XJg0hX5y6npE4vzTp4oSnzzWmTSlK2pNlq 1TlyXX6e6gxQMzWZlkXbNjbO4L+0+cvIcm3OxJzCOTjgOH+0qg4X6e146fOexsjmszom oX+oI16h0uoNBzjNbAVS/fV3EyFoO/1/FGCkC28bufd+iYNKpAojLaNSCcMRkZQvfMAy 1wDNc620Iq8/rUo2TcTVw4JJMrR23h2oMKb7Sq7MhKqr/P0PJArz++TOFMjI95Tg+OqS Xueg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=oeSBxHIuf/Tqf8yOKE/47XyXXtlLmFlM3t33ksf6H3A=; b=qkrdCfy4xT16MRQZ9YXXrRpBTEnW34MEl4cIEQMpozRKVKbdsJBiBxnLYLIm3EcfLw KVefPb+ORsUTCf/H/rcwXpUzAnYslXs+5nM6U3TcpLQM3NGTqeCvq6Wdrpp6XHLJRVDe daIi0l2uJbma7o0oxtwML62aLl9nR+JjkPkTh5PkQk7YaTPTIYB4B091qkKGbdq0fJLR o7WOAh42R9tMC+stjjrbNvBPT0gchVcvRW6FEq53exDNhRLZMCChH/RrTDKJ92Xgr11N thcS5QVpkBgHKpxvFAIDdwteqnhB+N/AZ/8r18AyUxPWJWTd0cIXZ1o8eTmHmRe8pyVD d05g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=N14R3csl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n79-v6si2044286pfj.152.2018.05.16.01.23.01; Wed, 16 May 2018 01:23:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=N14R3csl; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752867AbeEPIUx (ORCPT + 99 others); Wed, 16 May 2018 04:20:53 -0400 Received: from mail-dm3nam03on0073.outbound.protection.outlook.com ([104.47.41.73]:35872 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751904AbeEPIUs (ORCPT ); Wed, 16 May 2018 04:20:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oeSBxHIuf/Tqf8yOKE/47XyXXtlLmFlM3t33ksf6H3A=; b=N14R3cslOwjl4jic8Z7FSilI/AjbX7Jno3SDfW5+HU2nSRygbUhVZfB/JNCh0SIIc13csduXPzTMVz1iXQu0/AXsvJiEbkJ+9nzGdIIfuo6oVtN4F1d+cCKqpvYv2I1Vh1uuOnBcKl7Lt44BicYLFIoBWd0ikSVCidgQ5V4wJEU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (176.59.36.13) by BYAPR07MB4376.namprd07.prod.outlook.com (2603:10b6:a02:c0::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.755.16; Wed, 16 May 2018 08:20:43 +0000 From: Yury Norov To: Catalin Marinas , Arnd Bergmann , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org Cc: Yury Norov , Adam Borowski , Alexander Graf , Alexey Klimov , Andreas Schwab , Andrew Pinski , Bamvor Zhangjian , Chris Metcalf , Christoph Muellner , Dave Martin , "David S . Miller" , Florian Weimer , Geert Uytterhoeven , Heiko Carstens , James Hogan , James Morse , Joseph Myers , Lin Yongting , Manuel Montezelo , Mark Brown , Martin Schwidefsky , Maxim Kuvyrkov , Nathan_Lynch , Philipp Tomsich , Prasun Kapoor , Ramana Radhakrishnan , Steve Ellcey , Szabolcs Nagy Subject: [PATCH 06/24] thread: move thread bits accessors to separated file Date: Wed, 16 May 2018 11:18:51 +0300 Message-Id: <20180516081910.10067-7-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180516081910.10067-1-ynorov@caviumnetworks.com> References: <20180516081910.10067-1-ynorov@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [176.59.36.13] X-ClientProxiedBy: VI1PR08CA0116.eurprd08.prod.outlook.com (2603:10a6:800:d4::18) To BYAPR07MB4376.namprd07.prod.outlook.com (2603:10b6:a02:c0::19) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:BYAPR07MB4376; X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4376;3:MRdyN7uWHM+UfBRjGgFI4bkbFabFzadpv8GMFcGEVJtwmVQZPPO3Entv+ZwtScX5PO4bmgXZkgJZLaZyVpdv0PKQsjOS2hixNaa+9/IOIPLwOcMJbxrVQ7ELRYSmcP64cumppYKhxdawkwZeHBQ2TAla8x9ct0cHgLzLNRwC+VEPmlYTdCyjZwrlEmKOmsyMnZJ3VB5duVVMqI8aH+71P/8xGQvKeP++Sy0pyaig8ghYlX69JrBnjWVOb5mPfMe2;25:oQMTthZn7PyT2zVbF/+OfGQVjgZMQ+EihQpVXrm9J7kq3COA/AEMgCWCJwlgxxu/hnt3Klhh6Fmpu5HTSapDDpfKwVoITRMr7BzYXnU6wGtauRlSvYikMrsijuQMoVvz76XJrtdIEs7sZr7WjP7sStyD0sTs3ZJ0lMfgpcANTBUkoWWZFe3zjdQ31NV3ZbXCGHgY7wfHLK6DPaTf3PPutJCLFz3QlbtYLMIBXSexNJ4rU0JVc/TlQEa5g71wM8f6bFIe8uOjMUB4y7ketdOX3d8bXBwUr+ilpsB+kX1RjyRsU/yNAiOuXpa5tzhYl2+dt4n94Yb2J5a41Qhgo4QE0A==;31:x6puukXLwKzVGNaHNCW57M9lBxwagm9LPk1HqYyadzigqCXkjCi4cZ5afaHq3g4grAO1aUCrM7aQcA9UvUvFJ9hp98DJquBJl0Nmo0u1eufNF1BPqIijmMkADzHGdgdI57tPJwLInffazYcizn/9m3PQYAJBTtVVhxsXaas6UIX13HIZ5ZbkYVrHdEQyJGbQji052WvtyYclo44J9naiKBcgF2pxmmfvvfgOm3pp3u4= X-MS-TrafficTypeDiagnostic: BYAPR07MB4376: X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4376;20:Jyapb+w38GqL5fQQcvZB4AD2u7qH0/pMmjq26AdIyYJVEY/VNRX11bDDYHG0hhWBY4lYNO2weO1qjOURrGtZZwYtin3UxhZ4BEAl9eux9257aN2pAajM8ImYwYHlchKKmSvoMuitW92VTHhv+2HRa7nhgwtZ11tfWWeHNBSXyG9ztaWy6UMU9RJZmXrsPMvvJKrlaYqao9WlkwORKL6D2caew7m/g5XjWUHFSnO+1UfGZYHHEzs5YexTRqgX8s5k/gfDbVpSclBqWB1cmwhmoeXE956w7X3U28JoUzpy+AhhduwwFR35JB5vdlizUnKBsbTEaWCpw6WoCEHJdw/IQC8CedErL1ogf/T08DUkzpBeYxX9ZTUQoGPSipsgLrF13WUqjdbvjCXQCMSj8GRFdEY1A5Nho7esDCFsX30JOxTBj2Fvv0ZU62EqMh7T1PD7c5i14EHs4a4QREEHBXNuH/IJnkFOU8aKgCl1nys8yEzyA7q/GRwMBDpnsUCX0aYn3mJJHrpX/UHjenz2dAddn8aTBzsNxz9NEv9Rx77AJbG9Y5ADWHuuPgt/9q7u8sQ8wJVAi7s3Kz0/Xhs59vPDaqy2UJfu+AjHOAlBC9Sz9PE=;4:VruydIPwbryDqoZKZKx/capTmkj1DZIbbOaIiPihQ/aaE0pQoAjM8+UjgN1jh7YAypwStnbQVU0++bloYt5WCgqeMkVupTeMTzNlVZV+J1vKwjx4PsZIKSiyKKkiYgzN1QwUowGlMNnK5xbXhTZwB40UGZXaceK6s3jdfI4/oIcpffo+J+RZxlbo6qma28U1cYs8RIz7FHqzP199KEbZjG1qiEQQkJnfxjJgK5ihwisrP+FOr7TGNFrPbIZJtzj46TMYx4qf8UWF6IyTEW+rtw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(93006095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011);SRVR:BYAPR07MB4376;BCL:0;PCL:0;RULEID:;SRVR:BYAPR07MB4376; X-Forefront-PRVS: 0674DC6DD3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6069001)(376002)(346002)(366004)(39850400004)(39380400002)(396003)(189003)(199004)(39060400002)(42882007)(59450400001)(6486002)(53936002)(6666003)(4326008)(51416003)(386003)(76176011)(52116002)(446003)(6496006)(50226002)(16586007)(305945005)(7736002)(72206003)(2616005)(26005)(316002)(478600001)(11346002)(36756003)(956004)(105586002)(186003)(16526019)(97736004)(2906002)(486006)(5660300001)(106356001)(8936002)(476003)(76506005)(50466002)(48376002)(110136005)(47776003)(66066001)(25786009)(54906003)(7416002)(3846002)(81166006)(7406005)(1076002)(68736007)(81156014)(8676002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR07MB4376;H:localhost;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BYAPR07MB4376;23:Y+Ae4WdwiUNuLk5kSCCeJLi42tPcYEcxyw+1sxSjP?= =?us-ascii?Q?yIvvjPUTRD3ifZVgk88omwtU2H+dInxjzeisT6/o+ew1Cvlv11aJvnAyeV0E?= =?us-ascii?Q?HzbrpJkgjkODoWg6Okb7yYe18Xnm6LZp+rcxD4OeXHYHRORySbphql0tg0Vp?= =?us-ascii?Q?chC1MWbO7JY2tgs8RTfHnpMbJufx2MQ5Re4psKYKHUN6b0xrtfk1FmJFotZz?= =?us-ascii?Q?P6n9MZSt90YrJVL11EU5z+UNxKZjk3UAu467dJ7ry3ES7G/eBTEJutjS8EjC?= =?us-ascii?Q?rFd1FD+yCGT9eMyIChyR76TyLn34QEkBJbV0lmGcJ5J78ZBWwn8tjzhWySe4?= =?us-ascii?Q?OSA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cPK7jM=;24:dbSghtACev4FMqfs/8gsvPj02qBOxLWr+spsUZtyi7AulTbwn+TDQXorH89SNJqcJfGtRHMoeCPHYkD5kMqkx7y6hQiy7vaKLfo14Hea6YM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BYAPR07MB4376;7:aNQ4cMrveyW+sm2xFAlkH1qdxRtAAeiRcmU3mdsEOH+VjrSLM6H/UBbfYAdUSOGP2w4EK1Zy27bG9hoS+E3Vnrtu+CkOFIE9Z3AURKaC+85jOyiucP6WztbEIliQB8N9jMXgJeLbNttTaJk2g1YEaEImtbuynILBr5HOBTuSOJBQUnWJ2GNMoG19oYQQxmSuIzhXAtaqU+9MjSFwb6oGz28FvAt2JnV3tKG5E81/7sh1FALBByAadIitgR6d+ROo X-MS-Office365-Filtering-Correlation-Id: a06266f0-582f-414b-5ca8-08d5bb05eb84 X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 May 2018 08:20:43.5375 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a06266f0-582f-414b-5ca8-08d5bb05eb84 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR07MB4376 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thread bits 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/sched.h | 1 + include/linux/thread_bits.h | 76 +++++++++++++++++++++++++++++++++++++ include/linux/thread_info.h | 64 +------------------------------ 3 files changed, 78 insertions(+), 63 deletions(-) create mode 100644 include/linux/thread_bits.h diff --git a/include/linux/sched.h b/include/linux/sched.h index b161ef8a902e..c1bddf06baed 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -27,6 +27,7 @@ #include #include #include +#include /* task_struct member predeclarations (sorted alphabetically): */ struct audit_context; diff --git a/include/linux/thread_bits.h b/include/linux/thread_bits.h new file mode 100644 index 000000000000..7512f8527e9a --- /dev/null +++ b/include/linux/thread_bits.h @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +/* Common low-level thread bits accessors */ + +#ifndef _LINUX_THREAD_BITS_H +#define _LINUX_THREAD_BITS_H + +#ifndef __ASSEMBLY__ + +/* + * For per-arch arch_within_stack_frames() implementations, defined in + * asm/thread_info.h. + */ +enum { + BAD_STACK = -1, + NOT_STACK = 0, + GOOD_FRAME, + GOOD_STACK, +}; + +#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 34f053a150a9..793ab9b290ad 100644 --- a/include/linux/thread_info.h +++ b/include/linux/thread_info.h @@ -11,30 +11,9 @@ #include #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 - -/* - * For per-arch arch_within_stack_frames() implementations, defined in - * asm/thread_info.h. - */ -enum { - BAD_STACK = -1, - NOT_STACK = 0, - GOOD_FRAME, - GOOD_STACK, -}; - #include #ifdef __KERNEL__ @@ -49,47 +28,6 @@ enum { # define THREADINFO_GFP (GFP_KERNEL_ACCOUNT) #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.17.0