Re: [RFC PATCH v2 17/19] x86/mm/cpa: PKS protect direct map page tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2021-08-31 at 13:14 +0300, Mike Rapoport wrote:
trim
> > +/*
> > + * If pre boot, reserve large pages from memory that will be
> > mapped. It's ok that this is not
> > + * mapped as PKS, other init code in CPA will handle the
> > conversion.
> > + */
> > +static unsigned int __init reserve_pre_boot(u64 start, u64 end)
> > +{
> > +     u64 cur = memblock_find_in_range(start, end, HPAGE_SIZE,
> > HPAGE_SIZE);
> > +     int i;
> 
> Please use memblock_phys_alloc_range() here.
Oh yea, that's better. Thanks.

> Besides, it seems this reserved pages are not accessed until
> late_initcall
> time, so there is no need to limit the allocation to already mapped
> areas,
> memblock_alloc_raw() would suffice.
The page itself is used for the llist_node. I didn't see an easy way to
get a smaller allocate at this time. I guess it could use less mapped
memory by just using a few mapped pages for some structs to keep the
list outside of the unmapped pages, but it becomes more complex.

> 
> > +
> > +     if (!cur)
> > +             return 0;
> > +     memblock_reserve(cur, HPAGE_SIZE);
> > +     for (i = 0; i < HPAGE_SIZE; i += PAGE_SIZE)
> > +             add_dmap_table((unsigned long)__va(cur + i));
> > +     return HPAGE_SIZE;
> > +}
> > +
> > +/* If post boot, memblock is not available. Just reserve from
> > other memory regions */
> > +static unsigned int __init reserve_post_boot(void)
> > +{
> > +     struct page *page = alloc_table(GFP_KERNEL);
> > +
> > +     if (!page)
> > +             return 0;
> > +
> > +     add_dmap_table((unsigned long)page_address(page));
> 
> add_dmap_table() calls use casting everywhere, maybe make it
> add_dmap_table(void *)?
> 
Yea, I'll give it a try. It was on my todo list, but somehow got
forgotten.

> > +




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux