On Mon, Jan 11, 2016 at 06:15:56PM +0100, Ard Biesheuvel wrote:
On 11 January 2016 at 18:08, Ard Biesheuvel [off-list ref] wrote:
quoted
On 11 January 2016 at 17:51, Mark Rutland [off-list ref] wrote:
quoted
Sorry, I'm gonig to change my mind on that again. I think using
p?d_offset_kimg is preferable. e.g.
static inline pud_t * fixmap_pud(unsigned long addr)
{
pgd_t *pgd = pgd_offset_k(addr);
BUG_ON(pgd_none(*pgd) || pgd_bad(*pgd));
return pud_offset_kimg(pgd, addr);
}
static inline pmd_t * fixmap_pmd(unsigned long addr)
{
pud_t *pud = fixmap_pud(addr);
BUG_ON(pud_none(*pud) || pud_bad(*pud));
return pmd_offset_kimg(pud, addr);
}
That avoids having to check CONFIG_PGTABLE_LEVELS check and perform a cast,
avoids duplicating details about bm_{pud,pmd}, and keeps the existing structure
so it's easier to reason about the change. I was wrong about having to pass the
pgd or pud in, so callers don't need upating.
From my PoV that is preferable.
OK. I think it looks better, indeed.
... however, this does mean we have to go through a __pa() translation
and back just to get to the address of bm_pud/bm_pmd
True, but we only do it in the case of a one-off init function, so I
don't think we'll notice the overhead.
Mark.