[coyotos-dev] transmap patch, take 1
Jonathan S. Shapiro
shap at eros-os.com
Thu Oct 25 13:27:11 EDT 2007
On Thu, 2007-10-25 at 12:19 -0400, Jeroen Visser wrote:
> Shap,
>
> Real quick note because I have to run...
>
> On 10/25/07, Jonathan S. Shapiro <shap at eros-os.com> wrote:
> > Nice work!
>
> Thanks!
>
> > Can you please look at my changes to transmap.c with a very critical eye
> > and confirm them? It is altogether possible that my translation of your
> > work wasn't entirely right.
>
> A cursory look yields only one thing that doesn't seem right:
>
> +#if TRANSMAP_PAGES > 2
> +#error "TRANSMAP_WINDOW_KVA requires adjustment for this many CPUs"
> +#endif
>
> Should read:
>
> +#if TRANSMAP_PAGES > 4
> +#error "TRANSMAP_WINDOW_KVA requires adjustment for this many CPUs"
> +#endif
>
> The transmap window after all is 8MB in size. Under PAE that requires
> 4 pages worth of page tables.
I understand the point that you are making, but matters are
(unfortunately) a bit more complicated than this. The problem is that in
PTE mode the correct limit really is 2, and the check has to work in
both cases.
After thinking about it a little more, I decided that the right thing to
do here is to use the PAE check (yours) and then map only half the pages
in TRANSMAP_INIT if we are not using PAE. I have made the appropriate
change in transmap_init().
> This guard should in fact be a little more sophisticated, something
> like the following snippet (does not check alignment of
> TRANSMAP_WINDOW_KVA)....
I agree. My concern was getting the arithmetic right to guard against
integer rollover in the check.
I introduced a slightly simpler variant.
> (TRANSMAP_PAGE_CPUS should be renamed to TRANSMAP_CPUS_PER_PAGE, more
> readable and consistent with the existing TRANSMAP_ENTRIES_PER_CPU)
Done.
--
Jonathan S. Shapiro, Ph.D.
Managing Director
The EROS Group, LLC
www.coyotos.org, www.eros-os.org
More information about the coyotos-dev
mailing list