[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0b92bf98-74d8-594e-31c3-ed5867f015dd@csgroup.eu>
Date: Tue, 30 Aug 2022 06:05:12 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Christoph Hellwig <hch@...radead.org>, Baoquan He <bhe@...hat.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"agordeev@...ux.ibm.com" <agordeev@...ux.ibm.com>,
"wangkefeng.wang@...wei.com" <wangkefeng.wang@...wei.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
Jonas Bonn <jonas@...thpole.se>,
Stefan Kristiansson <stefan.kristiansson@...nalahti.fi>,
Stafford Horne <shorne@...il.com>,
"openrisc@...ts.librecores.org" <openrisc@...ts.librecores.org>
Subject: Re: [PATCH v2 07/11] openrisc: mm: Convert to GENERIC_IOREMAP
Hi Christoph,
Le 21/08/2022 à 09:03, Christoph Hellwig a écrit :
>> + if (unlikely(!mem_init_done)) {
>> if ((fixmaps_used + (size >> PAGE_SHIFT)) > FIX_N_IOREMAPS)
>> + return IOMEM_ERR_PTR(ret);
>> v = fix_to_virt(FIX_IOREMAP_BEGIN + fixmaps_used);
>> fixmaps_used += (size >> PAGE_SHIFT);
>>
>> + if (ioremap_page_range(v, v + size, p, __pgprot(*prot_val))) {
>> fixmaps_used -= (size >> PAGE_SHIFT);
>> + return IOMEM_ERR_PTR(ret);
>> + }
>> +
>> + return (void __iomem *)(offset + (char *)v);
>> }
>
> This code needs to go away, and all very early boot uses of ioremap
> need to switch to use early_ioremap insted.
>
early_ioremap() is not that easy to use. I don't know in this particular
openrisc context, but in powerpc we have many places that use ioremap()
very early.
Three years ago we implemented EARLY_IOREMAP, commit d538aadc2718
("powerpc/ioremap: warn on early use of ioremap()") added a warning to
identify all places using ioremap() early with the target being to get
rid of early usage of ioremap. But it turned that using early_ioremap()
is not that easy.
The problem with early_ioremap() is that it installs ephemeral mappings
that must be freed before the end of init. Most early uses of ioremap()
in powerpc are to install mappings that will last for life.
If we could have something that works like memblock_alloc() and allows
to keep the allocation forever, then it would be a lot easier to use
early_ioremap() and we could get rid of the early handling of ioremap()
in powerpc.
Christophe
Powered by blists - more mailing lists