Re: [PATCH 1/1] x86/vmemmap: Use direct-mapped VA instead of vmemmap-based VA

From: Gwan-gyeong Mun
Date: Fri Mar 07 2025 - 03:58:12 EST


Sorry for the late reply.

On 3/6/25 6:09 PM, Dave Hansen wrote:
On 3/5/25 19:46, Andrew Morton wrote:
Can we please have review from x86 maintainers?

I didn't respond here because I thought this was the same problem from
the same contributor that we addressed in another thread:

https://lore.kernel.org/all/d1da214c-53d3-45ac-a8b6-51821c5416e4@xxxxxxxxx/

I think this approach is a hack. It basically requires that every bit of
code that _might_ update (and then use) a PGD in the init_mm know how to
find the direct map alias and then use that instead. This would further
specialize the x86 code. I have no reason to believe that this is truly
an x86-specific problem. Are we really the only arch that has a
per-process PGD that maps the shared kernel page tables?

currently the scenario that causes this issue only happens on x86, therfore I did a hotfix to make sure it would not affect other archtecture.

And I agree, I don't think this is an x86 only issue, and if there is a scenario that can cause the situation I reported on other platforms, I think it is possible.
The right solution (like I mentioned in the other thread) is to sync the
PGDs more aggressively. Syncing them is expensive, of course, but it's a
pretty darn rare operation.
I'll send a new patch that introdues helper functions suggested by Dave above.

Thank you for not forgetting this issue and bringing it back to the surface.

Thanks,

G.G.