Re: [PATCH 5/8] x86, brk: Make extend_brk() available with va/pa.

Konrad Rzeszutek Wilk
2013-08-21T14:44:40Z

On Wed, Aug 21, 2013 at 02:35:36PM +0200, H. Peter Anvin wrote:
> Global symbols are inaccessible in physical mode.

Even if they are embedded in the assembler code and use GLOBAL(paging_enabled) ?

>
> This is incidentally yet another example of "PV/weird platform violence", since in their absence it would be trivial to work around this by using segmentation.

I don't follow why it could not.

Why can't there be a __pa_symbol(paging_enabled) that is used. Won't
that in effect allow you to check the contents of that 'global
constant' even when you don't have paging enabled?

> >>As mentioned above, on 32bit before paging is enabled, we have to
> >>access variables
> >>with pa. So introduce a "bool is_phys" parameter to extend_brk(), and
> >>convert va
> >>to pa is it is true.
> >
> >Could you do it differently? Meaning have a global symbol
> >(paging_enabled) which will be used by most of the functions you
> >changed in this patch and the next ones? It would naturally be enabled
> >when paging is on and __va addresses can be used.
> >
> >That could also be used in the printk case to do a BUG_ON before paging
> >is enabled on 32bit. Or perhaps use a different code path to deal with
> >using __pa address.
> >
> >?