Re: [PATCH 4/6] x86: Only direct map addresses that are marked asE820_RAM

From: Borislav Petkov
Date: Wed Aug 29 2012 - 17:32:54 EST


On Wed, Aug 29, 2012 at 02:17:51PM -0700, Yinghai Lu wrote:
> > +struct range pfn_mapped[E820_X_MAX];
> > +int nr_pfn_mapped;
>
> change to static?
>
> > +
> > +void add_pfn_range_mapped(unsigned long start_pfn, unsigned long end_pfn)
> > +{
> > + nr_pfn_mapped = add_range_with_merge(pfn_mapped, E820_X_MAX,
> > + nr_pfn_mapped, start_pfn, end_pfn);
> > + nr_pfn_mapped = clean_sort_range(pfn_mapped, E820_X_MAX);
> > +
> > + max_pfn_mapped = max(max_pfn_mapped, end_pfn);
> > +
> > + if (end_pfn <= (1UL << (32 - PAGE_SHIFT)))
> > + max_low_pfn_mapped = max(max_low_pfn_mapped, end_pfn);
> > +}
> > +
> > +bool pfn_range_is_mapped(unsigned long start_pfn, unsigned long end_pfn)
> > +{
> > + int i;
> > +
> > + for (i = 0; i < nr_pfn_mapped; i++)
> > + if ((start_pfn >= pfn_mapped[i].start) &&
> > + (end_pfn <= pfn_mapped[i].end))
> > + return true;
> > +
> > + return false;
> > +}
> > +
> > +bool pfn_is_mapped(unsigned long pfn)
> > +{
> > + return pfn_range_is_mapped(pfn, pfn + 1);
> > +}
>
> wonder if those functions have to be in arch/x86/kernel/setup.c.
>
> also do we need to update the tracking array when we have do memory hot-remove?

Would you please make sure you've reviewed this whole patchset
thoroughly so that Jacob can do all changes at once and not keep
resending them twice a week.

Thanks a lot!

--
Regards/Gruss,
Boris.

Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach
GM: Alberto Bozzo
Reg: Dornach, Landkreis Muenchen
HRB Nr. 43632 WEEE Registernr: 129 19551
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/