Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp702622ybk; Sat, 9 May 2020 16:04:02 -0700 (PDT) X-Google-Smtp-Source: APiQypJ2oXQOw6FqrGCindOXFZPQ4PvpDnhHi9nh0PUIJz7OKOoA3ppVW5uHyYZPyE+uEjGyFtt9 X-Received: by 2002:aa7:c453:: with SMTP id n19mr7664162edr.218.1589065442586; Sat, 09 May 2020 16:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589065442; cv=none; d=google.com; s=arc-20160816; b=S0wrBU6QODFeJNo+dBYSFBBLWobV/f4EFMfARwZ7DFDcgAU81WYPBfPcxTt4p41eHd naWo8wCfiKNIYq6DkW1nzD4tJ6pCKk7ByC/i2x1mTD0NhU/Y10BDdfvIKkpWd2Gh74W6 V37cGCUWAgXJGGIHdj9f2Bzz3B60zva8juJ1B0/Asjnra1uHriH9OO+emgXMP0TYBJiw Xv5kqqoP76GwKMlJVrTOcVLL6CGcyDdWn/+FW+sqapmJboPTdkJV9QK9V2OVLSHD3uH9 Bym5pcqLPgM9u/L2xy1pJb3bLJ7lQZOYQJbWI2/6rvXim2xrfyP48mooIhJIKleCP6w8 Svdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Cu5XCMlYmCles9cU1zQwpiIO21jpNUEqhrhXon1DyTk=; b=X4p7bAVeXPGULhnx88GuAGIUcHiZKAdBU404p0YLuTJcnbHq1i/dpLm266WGT2pzPF mvzR9m4XRJXxhM8D54tKIGupXesusYyaodN27LCW76bJGEo0ZFpljAxoAfiXS5mt3tAC hqNkmT3OGiP2EKzpmu/uDZaViVYLaS3PstmOjZ1LHtlxc2i0YcfkhpvT5/DF4CdYFR09 Lmp4UB3V/SO6K1QSfSBmkbA6gkRfGIgYmhihyLLHsEW1RBooPT2nXQq7JwC6UIPGfsak Knn6iCdcdfb/JMU8CiGrylCdB2WiW5GRPzMSupHWyeM0Rz4BHcOHnXgB9bDJKcGDaRuK O9Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ArCp/cIA"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v22si3364121ejw.454.2020.05.09.16.03.36; Sat, 09 May 2020 16:04:02 -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=@gmail.com header.s=20161025 header.b="ArCp/cIA"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726320AbgEIW7k (ORCPT + 99 others); Sat, 9 May 2020 18:59:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725922AbgEIW7k (ORCPT ); Sat, 9 May 2020 18:59:40 -0400 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B1FC05BD09 for ; Sat, 9 May 2020 15:59:38 -0700 (PDT) Received: by mail-io1-xd42.google.com with SMTP id j8so5600824iog.13 for ; Sat, 09 May 2020 15:59:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Cu5XCMlYmCles9cU1zQwpiIO21jpNUEqhrhXon1DyTk=; b=ArCp/cIAUPJ/JCkJdrEDvwlWmGjF3AzFJHP8CbZpYzbO0cs7JN90wOY2+phy5hmj+m ZkyZnzfpB1wU4gad/X5Ns25I6G4qI6SUAjPPVdAYzqG4oKV5MzhWyGJTGimk4aEvlgoc nDsLQtDt1b+XQb/cPt/0TNgao7ZFig6LbeZCs0umCsKJ4WDOpmksak12b25ipUsQZVHx FbnjECmSWwo8hWHmt8qzZs4Qm1C3dbQJIqRvJHqI3oZYirs+r6sskhltk/wFjEMQh9RJ Y5Ih8GsXENUzVEKpf/nwdi8Ymsienu1DfFgCSDUmk/fvp5psNL/Cc56PJZ1rpdc5Bd9B 4o9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Cu5XCMlYmCles9cU1zQwpiIO21jpNUEqhrhXon1DyTk=; b=aPdHqUdD08SrmSCSum0EE2WqgQe9MPlOSkwvibo3qBA3H/VLcHFzP0EJZXKRUq+Xh6 GPg+OBA8FrQQjr1vVzywkDEb/0ZQQLp3mPNxQM8Up+Myzi+gNh9+A95hAtomQbbo/oI4 u7vmCfWuY60wqk1srTb8BOw6x6vEszitK9pT5aH2OVEnwLAPQKQOJJljsnYjry6Rsk+Q 3weMc5TvuIlw4ptEmqwmd8RajnfB3O3BhhJqkTWrFEZ6yUUZs0zcfpcA9z65GVb8y96j CUFrROq3U9ZWlyttSLWwrmallFdoCKKCXut3S146loqYx/8eekUzzOlR6Glh3SPIqj/t uJQQ== X-Gm-Message-State: AGi0PuY5zJuyzx2yTjA4KvqCSxm0NtoJoA7BzicYTWZMJ0z0kzrD9wjw /a3DLNp7Cc5P+rWQr6luFEzDwhHia+lFQdWC79MX0w== X-Received: by 2002:a02:c8c7:: with SMTP id q7mr877554jao.111.1589065178240; Sat, 09 May 2020 15:59:38 -0700 (PDT) MIME-Version: 1.0 References: <229E1896-0C06-418A-B7DE-40AEBFB44F85@lca.pw> In-Reply-To: From: "Oliver O'Halloran" Date: Sun, 10 May 2020 08:59:27 +1000 Message-ID: Subject: Re: ioremap() called early from pnv_pci_init_ioda_phb() To: Christophe Leroy Cc: Qian Cai , Christophe Leroy , Michael Ellerman , linuxppc-dev , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 10, 2020 at 1:51 AM Christophe Leroy wrote: > > > > Le 08/05/2020 =C3=A0 19:41, Qian Cai a =C3=A9crit : > > > > > >> On May 8, 2020, at 10:39 AM, Qian Cai wrote: > >> > >> Booting POWER9 PowerNV has this message, > >> > >> "ioremap() called early from pnv_pci_init_ioda_phb+0x420/0xdfc. Use ea= rly_ioremap() instead=E2=80=9D > >> > >> but use the patch below will result in leaks because it will never cal= l early_iounmap() anywhere. However, it looks me it was by design that phb-= >regs mapping would be there forever where it would be used in pnv_ioda_get= _inval_reg(), so is just that check_early_ioremap_leak() initcall too stron= g? > >> > >> --- a/arch/powerpc/platforms/powernv/pci-ioda.c > >> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c > >> @@ -36,6 +36,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> > >> #include > >> > >> @@ -3827,7 +3828,7 @@ static void __init pnv_pci_init_ioda_phb(struct = device_node *np, > >> /* Get registers */ > >> if (!of_address_to_resource(np, 0, &r)) { > >> phb->regs_phys =3D r.start; > >> - phb->regs =3D ioremap(r.start, resource_size(&r)); > >> + phb->regs =3D early_ioremap(r.start, resource_size(&r)= ); > >> if (phb->regs =3D=3D NULL) > >> pr_err(" Failed to map registers !\n=E2=80=9D= ); > > > > This will also trigger a panic with debugfs reads, so isn=E2=80=99t tha= t this commit bogus at least for powerpc64? > > > > d538aadc2718 (=E2=80=9Cpowerpc/ioremap: warn on early use of ioremap()"= ) > > No d538aadc2718 is not bogus. That's the point, we want to remove all > early usages of ioremap() in order to remove the hack with the > ioremap_bot stuff and all, and stick to the generic ioremap logic. > > In order to do so, all early use of ioremap() has to be converted to > early_ioremap() or to fixmap or anything else that allows to do ioremaps > before the slab is ready. > > early_ioremap() is for temporary mappings necessary at boottime. For > long lasting mappings, another method is to be used. > > Now, the point is that other architectures like for instance x86 don't > seem to have to use early_ioremap() much. Powerpc is for instance doing > early mappings for PCI. Seems like x86 initialises PCI once slab is > ready. Can't powerpc do the same ? Patches welcome.