Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp286398pxb; Wed, 14 Apr 2021 15:37:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEUXcArRW3ApGLL/Z1uXX4lh8BoVDlFFvJW6J8IHudfUQWNabrdR3IHaN9mlxHbsu3o5Qb X-Received: by 2002:aa7:d3d5:: with SMTP id o21mr520388edr.183.1618439862081; Wed, 14 Apr 2021 15:37:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1618439862; cv=pass; d=google.com; s=arc-20160816; b=SXrf5MzPHYs4T65KXzPxmw9lXYtT/oOFGhrij8hyxBD8xxR7OSFq0lTUMCGDTDGcf/ DZwondMN7YvHRieyOE9QQChO1OUjvs+9oOL2Ib6cmsMpJC5a2KzKIjHsOgXJsBEg62at NmCiqtnPOlGkA7XY36wSr3KCkxo2gSKQfLWNfkN3ubHxEX34WWvSIYV28nrXtD1l5IQd KK5SltnWVwMij/5jQ52seUwhfHzUngml1cpyiGSfuH6dAiaAfJOaImPFnl+dTnwA3RSF Okg8ty2b3KZKdMSlF2XQBuYBa3wxnls7DKzN03591QFP0mRYp17R1Nb6JfweKWCnp6su i9OA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=wGn6HpN6f+b3HanJnFxiW4e/ZPzZpDDHYpCx/0xUmrs=; b=W13Dv4BT1IS4fLJmuimFFcitHWL7Xd0oytIq8afezCiNu4rt/r2ps9WWI/29SKEzG9 Et9k8pk5QR6pWwDaarvlJfahz5XWOz11GSJcgPoQF5B/XYhpahIhx7aixRfsv1Jfhfiv 88ELaVPiy/RglbpVzs8PN3E2I64OGWSEDptRFtaVEv1aSxIx3oNYExuHKSgWYnMnRRyV t0AOKj+kIx1RzFTpwyEGQzpkN4XDNyeVDY3fVPSZk95mcl+bJfHPeJXi6ySq4vSbZT8O q+fRETS4CGGiOWRSoXcyh8spP4EtHras9hZeG4NP8C8GggzpHR6QIWM2SPQ1rUsjno61 WvIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=gCK3Woso; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i19si801754edc.451.2021.04.14.15.37.18; Wed, 14 Apr 2021 15:37:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector2-Synaptics-onmicrosoft-com header.b=gCK3Woso; arc=pass (i=1 spf=pass spfdomain=synaptics.com dkim=pass dkdomain=synaptics.com dmarc=pass fromdomain=synaptics.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synaptics.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232841AbhDNJ2o (ORCPT + 99 others); Wed, 14 Apr 2021 05:28:44 -0400 Received: from mail-bn8nam12on2062.outbound.protection.outlook.com ([40.107.237.62]:58208 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231888AbhDNJ2i (ORCPT ); Wed, 14 Apr 2021 05:28:38 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NWfcPYzyYgdp2Z9UdLYDGnFSjv631FQt9ZqJ7mCpdN+Yo7moSq618V2qZAr9L8XqipdN6LqxoCG+HWIM18iRDfa4RiVUlJD90e18r0hywZd0wWTvkY9J0FpgJZTGnik7+G71Wg6y/G8BbYZvHcQD3BvFvHnsXnRXbuDzRD3BZtQcXCZZeBcq8m8Ca8Dy6LSd+dlP4Jk5Ye1XjgDmzYTPAU1M6bygJQIwHMdITceenp6wExDAVlKwJqMuuIYX7nVez2pwkH8h8Y/u1jYi1oSVRbfQ7fLBCADfFIxAaJqXhUrAOV4ZB03kBXvbUIN3vrgc+kuJzkWNAszjaynUk7APyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wGn6HpN6f+b3HanJnFxiW4e/ZPzZpDDHYpCx/0xUmrs=; b=SLzQ7Wcpg7Yoe/g5QDjERPjuuj9daNLu1GQ2m+v9E/ptt0qU+/jxH0Y0D9g18eZTEWeALLOoYq8X8jVG4+L2+lTUiAGxQ9pPy1MT3HTZQzt2Q5MWLcgkuvnn4ZOR+FwqgAiSrp0u1VboVOQ9XfTuRHnzj8sOs+DnFbDcrlMOmo8035VcCfce1uWdpsjoM0mLXWKXpRd9VK6gYlpljZfPS7W1jHu1pJB9H6aJAq+T4OTYIpzDWeJEvNDoWMkV2Gpk0K6kHVMCVWyXDcfizZ5pU0CC36/lGwa1r2orWGqczA23qU6YJn0/fkQvV/90IvxVNdmw31G4uMu3tWuYLNdKkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wGn6HpN6f+b3HanJnFxiW4e/ZPzZpDDHYpCx/0xUmrs=; b=gCK3WosoSkUVj9o0NyAZtww7Lm4CfCxWPidNUpYLeMu6Sx5UhkNxCg24QQa67fD0uHkCEMHNTnFVZcOjBaa2cCpUBa9PoaEBFqfxPsW/Vf07Wth9USxbPqE0dTb/45+WUEE7s4KKB8aP3OTsrqTP+9NQk8lspmbrQc12JcEMy0s= Authentication-Results: csgroup.eu; dkim=none (message not signed) header.d=none;csgroup.eu; dmarc=none action=none header.from=synaptics.com; Received: from BY5PR03MB5345.namprd03.prod.outlook.com (2603:10b6:a03:219::16) by BYAPR03MB3622.namprd03.prod.outlook.com (2603:10b6:a02:b9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17; Wed, 14 Apr 2021 09:28:10 +0000 Received: from BY5PR03MB5345.namprd03.prod.outlook.com ([fe80::8569:341f:4bc6:5b72]) by BY5PR03MB5345.namprd03.prod.outlook.com ([fe80::8569:341f:4bc6:5b72%8]) with mapi id 15.20.4020.022; Wed, 14 Apr 2021 09:28:10 +0000 Date: Wed, 14 Apr 2021 17:27:57 +0800 From: Jisheng Zhang To: Christophe Leroy Cc: Vineet Gupta , Russell King , Yoshinori Sato , Brian Cain , Nick Hu , Greentime Hu , Vincent Chen , Ley Foon Tan , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Jeff Dike , Richard Weinberger , Anton Ivanov , uclinux-h8-devel@lists.sourceforge.jp, linux-parisc@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, openrisc@lists.librecores.org, Anup Patel , linux-riscv@lists.infradead.org, linux-snps-arc@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] init: consolidate trap_init() Message-ID: <20210414172757.3ebfaa4c@xhacker.debian> In-Reply-To: <44bdf1f1-117d-0f10-fc59-9edd32d1ad61@csgroup.eu> References: <20210414165808.458a3d11@xhacker.debian> <44bdf1f1-117d-0f10-fc59-9edd32d1ad61@csgroup.eu> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [192.147.44.204] X-ClientProxiedBy: BYAPR07CA0088.namprd07.prod.outlook.com (2603:10b6:a03:12b::29) To BY5PR03MB5345.namprd03.prod.outlook.com (2603:10b6:a03:219::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from xhacker.debian (192.147.44.204) by BYAPR07CA0088.namprd07.prod.outlook.com (2603:10b6:a03:12b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Wed, 14 Apr 2021 09:28:02 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5120a7f7-5623-41c8-77de-08d8ff279e49 X-MS-TrafficTypeDiagnostic: BYAPR03MB3622: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BBoyky1dSeFRX0Ag+4ecLhEn/iqymRc0DygmvkAJG3qhX3BIAN+gpVB9ehyrxpTj5MK7V2fqC98QUaAKJlZMdsPp97mbd333mEaHQ06xvJ69BvHY7r8u5+tXHNuaxLXanEpftcMrJpg3RyQzLUNUYkD/+cGEy2SooAnCRWom7NRVDIkROqXPpJ9HXVWls63l27z9Q0jSLyakwF0dlu5mapmrbbVXVznyMqcj8wBXjQ6N0l4dETrBMZRqv7d9qixkbaWGZENrVAeCEKyAE8sw51HK0gqK8jhTXqVPuBBMs7vGDEN4G6ATNEwie6nGfBVKpih5ws45GL/BMD7hLHTuMVtMSL2PRW7HEdZ/F1Z9WijnNxPK5/Y6C8oXlqf+6EIR2B94+Q1QGLy5ASTmYack67TxVQEHXBRuJFYTb9p8dhmzzf1ExxyjWZMAsSo6O3pwL8zLWuDxaKOoaGQLC32NjIri66ndEgthYqub92SYWIs2bW3F4oH0xyQ6fnTJOhifKyBbNsp3/bqwtJMe/gZL5LBwAHdzyijp630WfUnMYwNHrefGq3UcJSoNm5A7DTTW3O4XSljjLtkbwtNq8JEIUbeDCnRiGTKaP5mV+/MQ0si9L7/L4HO2NUACU0JIf3ZEj9OZcQmnkJB8ukE0ooeAwl/l+SUPH0nxtUc5DUN0EzU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR03MB5345.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(376002)(366004)(346002)(136003)(39850400004)(396003)(55016002)(66476007)(316002)(66574015)(66946007)(186003)(66556008)(2906002)(9686003)(4326008)(7416002)(16526019)(6506007)(26005)(478600001)(52116002)(38350700002)(5660300002)(8936002)(1076003)(38100700002)(7696005)(6666004)(8676002)(7406005)(83380400001)(54906003)(956004)(86362001)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?B?MjY4SzdaNDlMNVhRcjBnY2hJcHJrazRPY0tkN1Z6ckd4YUZYa2sxekI4YXRC?= =?utf-8?B?U01vdzYydTljc0tMenhnaHRpV28zZWhCcm5hWGZBNzkyV0UxZGh6ZE5QYVlv?= =?utf-8?B?ZDljb0xYb1VtaDRqNjg4eFhCVWNsODV4NzBPNHdYOURNTnEyWTFHN0FJejJq?= =?utf-8?B?RWRnSHZ4MFU2c2RMWExMWktqN1ZFbTVSZDY5NjluZHhxN3RuUlozVlprT3My?= =?utf-8?B?Vkp5UnNMZj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TUtjS0krSEM4cHA1NjB3QVpxcUZMbC9CZjVQZVJockx1dXBZOUNDbkJ6UnAz?= =?utf-8?B?SUlJWTI0L3ZZVFlGZHZlT05HbTEwQk5PdnRuYktiMTQ2SEV0d2d4NkdWMjBL?= =?utf-8?B?TS9oTm9mMFVPMnZObUI1dVRWV3IwdCtZR1JQVzd4UWhINFFubjFtY2FVQXds?= =?utf-8?B?VUNBeFlIbzNudHM4VStoaHJ1OFB5enV1TEsvU250Z1hHRnF4UDNoUUI0Z1U2?= =?utf-8?B?UGZBb2xOVytveDNTc3d3bnN3OFNQOTd2UDJlNW5oRjlrUEc2OWtvbzF3TENz?= =?utf-8?B?R3poSllndHRESEI1N2F6NWNNK0NsdzFHZzFxNGV0ZGtUbmR2azBnYXd5Q1NB?= =?utf-8?B?K2p2Y2F0TEwyd1RnZDh3OEZsNHVOOWxJMWVENzdUV0xGRmZRd0tPRk9udUht?= =?utf-8?B?STd0VzBaQWdVREtDVUJLL09pMmp4TzM4TUhiU21TV09hWmJOUEJIK2dxM0xV?= =?utf-8?B?YmZnRTJlNDBSWjlFc2pVTHUycGl1NDNQVmJRY0FZQTY5Szl2TWJ6bHREaktK?= =?utf-8?B?Q3FxQUVWVjZoQWRKb0x6d2pSdnRJUVZCc0ZhTjhlWU90ck51VkRCeWgwdXFi?= =?utf-8?Q?D3GmPb0EMi3pdCwfFb4tp/A+lzyS75V5Z67/b0v?= X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5120a7f7-5623-41c8-77de-08d8ff279e49 X-MS-Exchange-CrossTenant-AuthSource: BY5PR03MB5345.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Apr 2021 09:28:09.9985 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xbSQwoe9+sk+OIeMD2fVJIdjwRYcFjMH/krNmyYNJFJsAtaRccxFVAkceNwNekPD/uStkHEqycl7udIev9Ns4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3622 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 14 Apr 2021 11:10:42 +0200 Christophe Leroy wrote: >=20 > Le 14/04/2021 =C3=A0 10:58, Jisheng Zhang a =C3=A9crit : > > Many architectures implement the trap_init() as NOP, since there is > > no such default for trap_init(), this empty stub is duplicated among > > these architectures. Provide a generic but weak NOP implementation > > to drop the empty stubs of trap_init() in these architectures. =20 >=20 > You define the weak function in the __init section. >=20 > Most but not all architectures had it in __init section. >=20 > And the remaining ones may not be defined in __init section. For instance= look at the one in alpha > architecture. >=20 > Have you checked that it is not a problem ? It would be good to say somet= hing about it in the commit > description. For those non-nop platforms, I can only test x86/arm64/, but both has __init mark. I'm not sure whether this is a problem for alpha etc. Maybe I can check which section the trap_init() sits. Or to avoid any possible regression, I can add __init mark to those remaining ones without it in preparation patches. >=20 >=20 > > > > Signed-off-by: Jisheng Zhang > > --- > > arch/arc/kernel/traps.c | 5 ----- > > arch/arm/kernel/traps.c | 5 ----- > > arch/h8300/kernel/traps.c | 13 ------------- > > arch/hexagon/kernel/traps.c | 4 ---- > > arch/nds32/kernel/traps.c | 5 ----- > > arch/nios2/kernel/traps.c | 5 ----- > > arch/openrisc/kernel/traps.c | 5 ----- > > arch/parisc/kernel/traps.c | 4 ---- > > arch/powerpc/kernel/traps.c | 5 ----- > > arch/riscv/kernel/traps.c | 5 ----- > > arch/um/kernel/trap.c | 4 ---- > > init/main.c | 2 ++ > > 12 files changed, 2 insertions(+), 60 deletions(-) > > > > diff --git a/init/main.c b/init/main.c > > index 53b278845b88..4bdbe2928530 100644 > > --- a/init/main.c > > +++ b/init/main.c > > @@ -790,6 +790,8 @@ static inline void initcall_debug_enable(void) > > } > > #endif > > > > +void __init __weak trap_init(void) { } > > + =20 >=20 > I think in a C file we don't try to save space as much as in a header fil= e. >=20 This is to follow most weak NOP implementations in init/main.c to make the style unified in the same file. I'm not sure which is better. > I would prefer something like: >=20 >=20 > void __init __weak trap_init(void) > { > } >=20 >=20 > > /* Report memory auto-initialization states for this boot. */ > > static void __init report_meminit(void) > > { > > =20