Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp490761ybk; Sat, 9 May 2020 08:51:47 -0700 (PDT) X-Google-Smtp-Source: APiQypKZwe6CEvwCpLgGnO5a1Y2riuTRB10vOPFXrrWAntutrUP2x/PaTXnn1bNt5TZ863rcSl8S X-Received: by 2002:a17:906:48c:: with SMTP id f12mr6759376eja.93.1589039506865; Sat, 09 May 2020 08:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589039506; cv=none; d=google.com; s=arc-20160816; b=Elmir6Zxo2EYKK35IScejmPe9ScSXXuIWnxFUfcxt9EiN3As5ptcC5bG4eDAPIh5xi pIxXteHJ3lBGvCEx8hjObuk8IaB5VGWSUUQIgvJM4TKfGXCzVgiQTBJx0FhH3SqojSQP TWn+PwTNbI4zEwfnL8YCnEq7eIb9vmZnIwtxjqbaCCK//R0fsPcv+f7q9RKEQYE0msAC yqvT6GjAkt5gaAHRTYVwAgq1oFHKO/iN/5NLqhoGGOK3iuUc0LCsBkiC9AQcOZqiWRIl n5uFPZe03678VowIIcde6Hdkk9Kshu9cKoIc0Va+L6/ZgKN282DRFiSyys43fe6kpz5l 43Wg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=fhP4tvfBBN55+cn5I4NzrczqO7E7KrpDCkwpZ9gCB98=; b=w++09zf/E0CyfqqNrlcL+sZ4crS8gjSvGqxuSYepzvULUVDjSzaYGF/tirNKoHjNB8 zBip9axcuCqUjRa06X3vJUiB1u6rFedPmYQsasfW8L+tYHttXXYVbq+WNp+F6Y49bkZY Ld0vBIQ4v2zOp/pYVsBkimHGL6Iinfh+CKCAMAZEgEEVFkL4OP/2sDYaw/ycfa8xPLpI PRUGxEnGR86kWNvW6ZU4UDhGbh0FHDORdM8l+VAcBeyNRB6kiN7Zc+nJc3KUWZzvTbRT Cqn/YUlo5PXsvhi6QL6GmIiDWgTwx7K3cswXp2IrZXoAXGsnkGN04GZvqOBmXGUDRwAA uShg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t19si1251023edt.351.2020.05.09.08.51.22; Sat, 09 May 2020 08:51:46 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727857AbgEIPtm (ORCPT + 99 others); Sat, 9 May 2020 11:49:42 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:36110 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726013AbgEIPtm (ORCPT ); Sat, 9 May 2020 11:49:42 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 49KBTY630YzB09b3; Sat, 9 May 2020 17:49:37 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id 099NYsCV6Cpu; Sat, 9 May 2020 17:49:37 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 49KBTY4L2qzB09b2; Sat, 9 May 2020 17:49:37 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B63538B775; Sat, 9 May 2020 17:49:39 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0AQC4Nh5-Sma; Sat, 9 May 2020 17:49:39 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C14678B75F; Sat, 9 May 2020 17:49:37 +0200 (CEST) Subject: Re: ioremap() called early from pnv_pci_init_ioda_phb() To: Qian Cai , Christophe Leroy , Michael Ellerman Cc: linuxppc-dev , LKML References: <229E1896-0C06-418A-B7DE-40AEBFB44F85@lca.pw> From: Christophe Leroy Message-ID: Date: Sat, 9 May 2020 17:49:31 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <229E1896-0C06-418A-B7DE-40AEBFB44F85@lca.pw> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 08/05/2020 à 19:41, Qian Cai a écrit : > > >> 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 early_ioremap() instead” >> >> but use the patch below will result in leaks because it will never call 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 strong? >> >> --- 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 = r.start; >> - phb->regs = ioremap(r.start, resource_size(&r)); >> + phb->regs = early_ioremap(r.start, resource_size(&r)); >> if (phb->regs == NULL) >> pr_err(" Failed to map registers !\n”); > > This will also trigger a panic with debugfs reads, so isn’t that this commit bogus at least for powerpc64? > > d538aadc2718 (“powerpc/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 ? Christophe