From patchwork Wed Aug 30 09:22:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 111294 Delivered-To: patch@linaro.org Received: by 10.140.95.112 with SMTP id h103csp631409qge; Wed, 30 Aug 2017 02:23:08 -0700 (PDT) X-Received: by 10.84.231.197 with SMTP id g5mr1165201pln.208.1504084988301; Wed, 30 Aug 2017 02:23:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504084988; cv=none; d=google.com; s=arc-20160816; b=jtnqyPpNd7022igde54npGEDiIPFJiRrkdvimkPn+nexZESfiZxx3KGBeKPBnRt/Ow NwLulh1BcBtLV481+ugX0bzWfz5mCmQ8PY/CNEguRA2R7Qdw8EEd9RN6qkqmhl4+nqra NFfWcHLjMVhzMZJrtl1UR+CAaqhlxYUE6Lg/gLoRKjFXYyXLvLQ7lyln79XFqXLNwCQM YBk6VmAuaagL+hiEwCqE1QI5VnBcMK6AZqZ1sUNvUHCY8kE/LBebulxz87EbdjyqiVfJ 1kcjUDr+dl5IFFDEpsTsMKIEKJTLMpGR0qEIOXmhdqgKH0jT7uouwYFS0MKPvv54gFDU X36g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=AQREhlQofFVKBbvsey3TIMdCeq7lw83Ovaw654hI29I=; b=S0R22yS3wYWNP2y27QfI/INnf4brWifV4wReEugV1PF8UOTrAKHJ+eQ4NCpMwkA4ik ZvXnIycEHgM88+J+xw98xMdw9z1VDmlDzhMFKLmwop2P6rsBCzuKu0XyFxp/0d29VAV0 DjUzI0B58S6AvaMGk6TrsEGpi085oNbCYblgek44YZyMYVRLuyz6Bc6V20oduA5Meubi jfwv1PwG1oxvtvEZqxa6xNE1oCrWGUP7/OiVyGTexeuKYS25MAWuL2swGJp//G18R0BC v5FGa7taSIiFDTtVFNsGbQnHZxhYBCHE8YM1dQKG6OZPDzf4LSb0HtyLb/c5vWAk1J30 2GNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@CAVIUMNETWORKS.onmicrosoft.com header.s=selector1-cavium-com header.b=e1c2ylMp; 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 o3si3969312pld.436.2017.08.30.02.23.07; Wed, 30 Aug 2017 02:23:08 -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=e1c2ylMp; 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 S1751480AbdH3JXF (ORCPT + 26 others); Wed, 30 Aug 2017 05:23:05 -0400 Received: from mail-co1nam03on0068.outbound.protection.outlook.com ([104.47.40.68]:13742 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751295AbdH3JXD (ORCPT ); Wed, 30 Aug 2017 05:23:03 -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; bh=AQREhlQofFVKBbvsey3TIMdCeq7lw83Ovaw654hI29I=; b=e1c2ylMpz8KWsfFVzRBXykmfKSZOoJF64woDZnfYleAXtjbapmJP/GvPxJ15hRdRT9vE5gn0I3UM0UDeXjSf1aVfDnuc5X/KRUDSD3agN1s2PYTrE4sdtgA1feKULEqFVbQen6WiRcnB8zTLaLCJldEseaa3XrNIaHkci5QJGTg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Received: from localhost (2a01:cb1d:41b:1500:dc7f:bb27:a4cf:e7) by SN1PR07MB1455.namprd07.prod.outlook.com (10.161.223.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Wed, 30 Aug 2017 09:23:00 +0000 From: Yury Norov To: Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Yury Norov , Will Deacon , Laura Abbott , Ard Biesheuvel , Catalin Marinas , James Morse Subject: [RFC PATCH] arm64: move THREAD_* definitions to separated header Date: Wed, 30 Aug 2017 12:22:49 +0300 Message-Id: <20170830092249.20638-1-ynorov@caviumnetworks.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-Originating-IP: [2a01:cb1d:41b:1500:dc7f:bb27:a4cf:e7] X-ClientProxiedBy: DB6PR02CA0009.eurprd02.prod.outlook.com (10.170.218.150) To SN1PR07MB1455.namprd07.prod.outlook.com (10.161.223.141) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2b070baa-7ecc-4f56-d1f6-08d4ef88b5b9 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN1PR07MB1455; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB1455; 3:oM1+GIR2ggFK1NPMZOrGVtRhdYmNg8cN5qbOnyMfk8Rc1QsT2logZAGBBFKTal0esqaQFm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CUiVAR+ki7odpZLkdM7IEFVFBEJqhvt4MRvx6izpivMq5K0MWRpwfPPn4/EnL82m/jGzGzUYl8rsxr5sgZfkAlLNd6IGHaM30NIBzJEfexrzSxeJEZKC3f//9tVppNHQK7w2Rl9P89Mhh2dFu95Nxm6DD55Tauq3ckQwqi4ObV/SLX9ggr5Ig9ddcE1V4stc7SgZSkoKsCxrXUdn/veAX8CUhjhJrxFEu4EbaWjuzEySDUXyRYkaSDoxLYlF87sYCT+fafs5otpM8nsVCZLo92g8a4tLV6ngyj8nBmJylfKa60bf+BnSiEqgXoSJsC1NZ2Sb+iZXKkyGOET39ALpVJmCKFBJy7cI0IYdPUuorNAyMMhVTNjHiDlJyTDv64= X-Exchange-Antispam-Report-Test: UriScan:(250305191791016)(180628864354917)(22074186197030)(166708455590820); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(10201501046)(93006095)(3002001)(6041248)(20161123562025)(20161123555025)(20161123558100)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR07MB1455; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR07MB1455; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB1455; 4:ZAXD2bYMvFVT2FqpP2g/By0Iu8JxKqYW/LdKNDYnV4gHzu20LxwwrYWu0BL7tlhl0Xt5vqwpFwrRpuv8Q1o+sidGNoehfcqp87V6+1afgugz9sFmikhxng6aRbq/rvdFR4EBTD4U9XcifVuAnjH4qFrhCO56s7s+lNdWOHFIUoZvwZ+qkOYeXiKZngQCQg3LNw+mUH8yk1UbsZAK8b3nGA1QlFfxe2ql1rX3nyQzHDfePWqxbm28R2EkNhj6WOMyahBJ/SaDWfBDx88AJ7LnowZdf93NtAi9dHuJMuRdPOdUjMyXVt/qCwm47X9gy7TpT/gX8eanQ7jkiTAdyraGRaOr8lSkjf1vvclb36LoRFk0ppEmCwyVlNt4HzSaiRaGMDM64uuyL6I5luiS6mRD2w== X-Forefront-PRVS: 041517DFAB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(189002)(199003)(106356001)(8676002)(189998001)(6666003)(42882006)(101416001)(33646002)(50986999)(105586002)(76506005)(966005)(575784001)(72206003)(50466002)(23676002)(68736007)(5660300001)(6306002)(97736004)(54906002)(1076002)(6116002)(6486002)(53936002)(36756003)(110136004)(6496005)(81166006)(47776003)(50226002)(81156014)(7736002)(4326008)(305945005)(8936002)(2906002)(478600001)(2870700001)(42186005)(25786009)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB1455; H:localhost; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?q?1=3BSN1PR07MB1455=3B23=3AuFqt?= =?utf-8?q?6z1vKtLdrqG3K27190X0UwI7SeaffYIrB0aIu87uj2ZOEUjnNS5Z6pnW?= =?utf-8?q?lzG86xJsqCqxkXvHTU2kICsxU4EfXwvra8GSKJED7pyMgMMd4xK4tR+w?= =?utf-8?q?tSM9EQS3uFBzrx4D9SdS563i6+cPfrX2aICPeKXMhY4/qwUj+kv1IK6/?= =?utf-8?q?ZUAsdgAerpVOTWBgyL9NPvTgEC0w5yTJAdJpbPVzuH8sR9tXKaRMlvyr?= =?utf-8?q?iC3owJlh5tL+gsW4iyoabW8AJ6PYKNvjMo5pu+F0QTIgiJRRUFY/86gB?= =?utf-8?q?xS89ha02r3HZpbi2ZBlrz4J4SjLNFK/lFE0XmZnh8wHhT1b5iTzc2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wfKtRLIpn3Z412SUD5PZuQpsovCM3maFvJ3NKYcswBUYQLoM76TLhD8JPB/mNQB99/aMh9dMZ+JA6x/hB7R7/ByzusIawTyIBnVKI+9fD20Gx2xXKG5A2DuyHgbKGgsFW2arilNlUWlQUBZr+BbrXPdeXpKOEYUoEr9vBG4o68AKKZHXVOVgc1A43KxNcbUx5Ns3M0n54QSV4UtKhMFHGsBh8QOvafsSfA==; 5:s2JgdqTDWbL4tNt8imH4VNh+N/TW/s6iY4sgTYgaXXtCEZX1AieJhJ283e846h7KxOFXoAIIQKxTVAotyNqYXEMK+eHhmlZRSrxnP8G3xHXsQDOEJ0QMP8ndNH9QTcfswPENBIJfxNB78etIZ1rxNw==; 24:p2oeMiqYs4dQzEx9k9EXq/lnPKTJ+DP9Enrb/NIFbIzT16zdWLj/gwys9/BtcIx3xBkB+eZmqZYGL4J+qDqEQs7fMiQlx8XM7n/xxPxn1es=; 7:NJglMrSCuRJ1H5nwT/eqq3Adb0+92Y5WVuOdsNdsvOkxsG2JMw6m5YZl/qDrCj0mXwp2QsCe568qTk08QhmEdHT1AFSZsd6wFcrMWuPGrDniu2Y9IutIapuMuSqI9dpwh0ryydwfK+0iWGv9gHJvObh8/uhcz6QC9fJ49HJr1s73AksjhLO/hQuRkwMpkVMQPidoEGWlH8u2GAsB2UqdimVAtmN6lImvf65mNJcT64Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2017 09:23:00.3745 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB1455 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, all. In patch 'dbc9344a68e506f19f8 ("arm64: clean up THREAD_* definitions")' you move THREAD_* definitions from arch/arm64/include/asm/thread_info.h to asm/memory.h. After that asm/thread_info.h starts to depend on asm/memory.h. When I try to apply ilp32 series on top of it [1], it causes circular dependencies like this one: In file included from ./arch/arm64/include/asm/memory.h:30:0, from ./arch/arm64/include/asm/thread_info.h:30, from ./include/linux/thread_bits.h:20, from ./include/linux/thread_info.h:13, from ./include/asm-generic/preempt.h:4, from ./arch/arm64/include/generated/asm/preempt.h:1, from ./include/linux/preempt.h:80, from ./include/linux/rcupdate.h:40, from ./include/linux/rculist.h:10, from ./include/linux/pid.h:4, from ./include/linux/sched.h:13, from arch/arm64/kernel/asm-offsets.c:21: ./arch/arm64/include/asm/is_compat.h: In function ‘is_a32_compat_task’: ./arch/arm64/include/asm/is_compat.h:25:9: error: implicit declaration of function ‘test_thread_flag’ [-Werror=implicit-function-declaration] return test_thread_flag(TIF_32BIT); ^~~~~~~~~~~~~~~~ The problem is that asm/memory.h depends on asm/is_compat.h to define TASK_SIZE, which in turn requires asm/thread_info.h. The most obvious solution for it is to create is_compat.c file and make is_*_compat() real functions. The other option is to move THREAD_* definitions to separated macro. I would prefer 2nd one because of following reasons: - TASK_SIZE macro is used many times in kernel, including hot paths; - asm/memory.h is included widely, as well as asm/thread_info.h, and it's better not to make them depend one from another; - THREAD_SIZE etc are not memory-related definitions. In this patch THREAD_* definitions moved to separated asm/thread_size.h header. It's enough to resolve dependency above. If you find this approach useful, I can prepare other patch that moves TASK_* definitions from asm/memory.h to new header to remove the dependency from asm/is_compat.h. Also, arch/arm64/kernel/entry.S and arch/arm64/kernel/hibernate-asm.S #includes list is cleaned. [1] https://github.com/norov/linux/tree/ilp32-next (still in progress) CC: Will Deacon CC: Laura Abbott Cc: Ard Biesheuvel Cc: Catalin Marinas Cc: James Morse Signed-off-by: Yury Norov --- arch/arm64/include/asm/memory.h | 30 +------------------- arch/arm64/include/asm/thread_info.h | 2 +- arch/arm64/include/asm/thread_size.h | 53 ++++++++++++++++++++++++++++++++++++ arch/arm64/kernel/entry.S | 2 +- arch/arm64/kernel/hibernate-asm.S | 1 - 5 files changed, 56 insertions(+), 32 deletions(-) create mode 100644 arch/arm64/include/asm/thread_size.h -- 2.11.0 diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index 0c3ee6afda5b..bc7ec1930659 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -21,6 +21,7 @@ #ifndef __ASM_MEMORY_H #define __ASM_MEMORY_H +#include #include #include #include @@ -105,35 +106,6 @@ #define KASAN_SHADOW_SIZE (0) #endif -#define MIN_THREAD_SHIFT 14 - -/* - * VMAP'd stacks are allocated at page granularity, so we must ensure that such - * stacks are a multiple of page size. - */ -#if defined(CONFIG_VMAP_STACK) && (MIN_THREAD_SHIFT < PAGE_SHIFT) -#define THREAD_SHIFT PAGE_SHIFT -#else -#define THREAD_SHIFT MIN_THREAD_SHIFT -#endif - -#if THREAD_SHIFT >= PAGE_SHIFT -#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) -#endif - -#define THREAD_SIZE (UL(1) << THREAD_SHIFT) - -/* - * By aligning VMAP'd stacks to 2 * THREAD_SIZE, we can detect overflow by - * checking sp & (1 << THREAD_SHIFT), which we can do cheaply in the entry - * assembly. - */ -#ifdef CONFIG_VMAP_STACK -#define THREAD_ALIGN (2 * THREAD_SIZE) -#else -#define THREAD_ALIGN THREAD_SIZE -#endif - #define IRQ_STACK_SIZE THREAD_SIZE #define OVERFLOW_STACK_SIZE SZ_4K diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h index 5d889c645321..6267ba7bd0e4 100644 --- a/arch/arm64/include/asm/thread_info.h +++ b/arch/arm64/include/asm/thread_info.h @@ -27,7 +27,7 @@ struct task_struct; -#include +#include #include #include diff --git a/arch/arm64/include/asm/thread_size.h b/arch/arm64/include/asm/thread_size.h new file mode 100644 index 000000000000..dd0b8906f9de --- /dev/null +++ b/arch/arm64/include/asm/thread_size.h @@ -0,0 +1,53 @@ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __ASM_THREAD_SIZE_H +#define __ASM_THREAD_SIZE_H + +#ifdef __KERNEL__ + +#include +#include + +#define MIN_THREAD_SHIFT 14 + +/* + * VMAP'd stacks are allocated at page granularity, so we must ensure that such + * stacks are a multiple of page size. + */ +#if defined(CONFIG_VMAP_STACK) && (MIN_THREAD_SHIFT < PAGE_SHIFT) +#define THREAD_SHIFT PAGE_SHIFT +#else +#define THREAD_SHIFT MIN_THREAD_SHIFT +#endif + +#if THREAD_SHIFT >= PAGE_SHIFT +#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) +#endif + +#define THREAD_SIZE (_AC(1, UL) << THREAD_SHIFT) + +/* + * By aligning VMAP'd stacks to 2 * THREAD_SIZE, we can detect overflow by + * checking sp & (1 << THREAD_SHIFT), which we can do cheaply in the entry + * assembly. + */ +#ifdef CONFIG_VMAP_STACK +#define THREAD_ALIGN (2 * THREAD_SIZE) +#else +#define THREAD_ALIGN THREAD_SIZE +#endif + +#endif /* __KERNEL__ */ +#endif /*__ASM_THREAD_SIZE_H */ diff --git a/arch/arm64/kernel/entry.S b/arch/arm64/kernel/entry.S index 84b9f1d235ba..43f8ea210bb3 100644 --- a/arch/arm64/kernel/entry.S +++ b/arch/arm64/kernel/entry.S @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/arm64/kernel/hibernate-asm.S b/arch/arm64/kernel/hibernate-asm.S index e56d848b6466..46b91702ea26 100644 --- a/arch/arm64/kernel/hibernate-asm.S +++ b/arch/arm64/kernel/hibernate-asm.S @@ -22,7 +22,6 @@ #include #include #include -#include #include #include