Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751345AbdH3KsU (ORCPT ); Wed, 30 Aug 2017 06:48:20 -0400 Received: from mail-bn3nam01on0047.outbound.protection.outlook.com ([104.47.33.47]:33248 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751263AbdH3KsS (ORCPT ); Wed, 30 Aug 2017 06:48:18 -0400 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Yuri.Norov@cavium.com; Date: Wed, 30 Aug 2017 13:48:05 +0300 From: Yury Norov To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Will Deacon , Laura Abbott , Ard Biesheuvel , Catalin Marinas , James Morse Subject: Re: [RFC PATCH] arm64: move THREAD_* definitions to separated header Message-ID: <20170830104805.cl44gwqslocnr5w4@yury-thinkpad> References: <20170830092249.20638-1-ynorov@caviumnetworks.com> <20170830095854.GA17353@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170830095854.GA17353@leverpostej> User-Agent: NeoMutt/20170113 (1.7.2) X-Originating-IP: [2a01:cb1d:41b:1500:829:7821:d3b5:bd14] X-ClientProxiedBy: VI1PR0502CA0010.eurprd05.prod.outlook.com (2603:10a6:803:1::23) To DM2PR07MB1450.namprd07.prod.outlook.com (2a01:111:e400:50c3::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 19bf68f4-219c-4590-6ac3-08d4ef949e63 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:DM2PR07MB1450; X-Microsoft-Exchange-Diagnostics: 1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GHij1o0z5eyBbIkDtZqx6HZYNRMRWdwB7DdIup5xh6Qg8mpsAWPbFR1VY92tvkJE9XarTCdg/Jum/djO7E3uFJbwsqgqEpnSOCmwe+dYqjY4Y5NvHOMYootgDGXJ/fZhmiXp8n+EqVt/cYAUrVyaLHxtNXyoqLt2RpBJVYI0ion+6YpAKilA3tH/p8/eHpJFiw6VHpZCfydlZNR96qTUOMLaJy55hX59AWgwp1Pu/7QXHiI5j4RiTry8/I9TH0B+0tJ3LubEQ8MdakZ8BkaqtKGYfWc7jknUkHMUXKKbUKRfRDcKtIao+MHzRggVrZT3Pwz/OHZ1MqWU1y07+hhqmpfocivuMzz7VClWCmgqEf0M1LbyKq7/5Uk3mZWnH2Ai55u8UH3WlbEYHkq55GdPN8M96+WrttjzvNoHyd1Dx6Hk1I4fZa7XV3BQ1/bKyVS+c6AKMlUWnEypNq/it84=;4:80wMrUr/IS11xeYjmLH1PZ7onS82XAHS3oHsdmRluGY65COIfJc5qt624ob6DjUnKLfI4bPiONo+CtsX3m7g262N++bf6Nef4h3wFSheE8g/PbtGXouQ8m7rJ0frnXasntMjSKU6JcBTtEgfUISTZ/FR1SIv9qa8bu0tI/hR9Pvf4k/DLxzczfCwY1CrLwzX1maAiijroS/OPQu7oR+VT80xbVro4N7WLlC7SJRHw6Z63b7kN0uwpalHPwdMI9wK X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(6041248)(20161123558100)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(20161123564025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:DM2PR07MB1450;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:DM2PR07MB1450; X-Forefront-PRVS: 041517DFAB X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(6009001)(6069001)(24454002)(199003)(189002)(33716001)(6246003)(4001350100001)(6116002)(68736007)(105586002)(54906002)(9686003)(229853002)(83506001)(53936002)(72206003)(6496005)(47776003)(2950100002)(42882006)(42186005)(76506005)(6486002)(6916009)(6666003)(97736004)(110136004)(106356001)(50986999)(478600001)(305945005)(76176999)(23676002)(189998001)(101416001)(50466002)(25786009)(4326008)(8676002)(33646002)(81166006)(81156014)(5660300001)(1076002)(8936002)(7736002)(2906002)(2870700001)(54356999);DIR:OUT;SFP:1101;SCL:1;SRVR:DM2PR07MB1450;H:localhost;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTJQUjA3TUIxNDUwOzIzOkErd0ZkcVhLL29tOW5kZXgwWmFZTWNzSnVI?= =?utf-8?B?MVZCVEwxb0ZRSElkMVJnclgyOXVTZG9rVkVMMjBUUWZKMWptanI4ZDJ5dDJF?= =?utf-8?B?SmozZnFMeUtJWHhjSUZyallWaC9YR1JRM29TU3NrZ3JRcDZnTmNFSVg4RFRn?= =?utf-8?B?dGRjcGdadWRxeFNBMkh2TTR0V0VacVVqZWRMUi9BSjgycHU4aUVCOHJ5U00y?= =?utf-8?B?QXl2TGFFTHZ6NThQRUdFMktlQnRPTVE5bU00RlRmWnB4RkZBU05iczN0eklE?= =?utf-8?B?S0pxendqMUE4UzY5dE05ZXBHWEtkTEpKYndodENQYys1MlMvcjVQZWlhdHBy?= =?utf-8?B?NitCVzNrWEVXZ25jRTNJdXF4Q3hnSUxRM3FtNm9JNkVnVWE2dWZ2QVNuRmk1?= =?utf-8?B?RTAyUDc2N29tcC9EYUpmT3ROTW1aa25oUnQrYTAwNHR3YkcwUkgrdnF5My80?= =?utf-8?B?Tm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Ju9VjQXBEBJd5phf8UCAUo+Q/yn20nEAZwQtpiyVwPQ8bwrAqYMzykTnxWxSAKospaZKpEB+rH5FFynsXzGRNxDLIG3OJ4YVn9TfhJAxBU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Aug 2017 10:48:15.2442 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR07MB1450 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4493 Lines: 117 On Wed, Aug 30, 2017 at 10:58:54AM +0100, Mark Rutland wrote: > On Wed, Aug 30, 2017 at 12:22:49PM +0300, Yury Norov wrote: > > Hi Mark, all. > > Hi Yury, > > > 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. > > ... and include , giving a circular > dependency. > > In other architectures, TASK_SIZE is defined in processor.h. Can we not > move TASK_SIZE instead of THREAD_SIZE, given that TASK_SIZE is what > causes the dependency? > > We'd need a new __ASSEMBLY__ guard, but otherwise it looks like that > would solve the issue. > > > 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. > > I disagree with this last point. THREAD_SIZE is in > because it affects the kernel's memory layout, as with other definitions > at the top of . > > I would much prefer keeping those definitions together. > > > 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. > > I'd prefer that we moved the TASK_SIZE* definitions first, but if > necessary, I'm ok with seeing the THREAD_SIZE* definitions move. OK, I will try this, and if it's be enough will send new patch. If not - I'll resend this patch and one that moves TASK_SIZE* together in series. > [...] > > > diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h > > > -#include > > +#include > > #include > > #include > > Nit: please keep includes ordered alphabetically. OK > [...] > > > diff --git a/arch/arm64/include/asm/thread_size.h b/arch/arm64/include/asm/thread_size.h > > > +#ifdef __KERNEL__ > > This can go. We haven't needed __KERNEL__ ifdefs for a long time now... OK > [...] > > > 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 > > AFAICT, we can also lose , , and > . > > Changes to this file might be better as a preparatory cleanup. OK. Yury