On Mon, Jun 10, 2024 at 05:01:55PM +0300, Kirill A. Shutemov wrote: > On Mon, Jun 10, 2024 at 03:40:20PM +0200, Borislav Petkov wrote: > > On Fri, Jun 07, 2024 at 06:14:28PM +0300, Kirill A. Shutemov wrote: > > > I was able to address this issue by switching cpa_lock to a mutex. > > > However, this solution will only work if the callers for set_memory > > > interfaces are not called from an atomic context. I need to verify if > > > this is the case. > > > > Dunno, I'd be nervous about this. Althouth from looking at > > > > ad5ca55f6bdb ("x86, cpa: srlz cpa(), global flush tlb after splitting big page and before doing cpa") > > > > I don't see how "So that we don't allow any other cpu" can't be done > > with a mutex. Perhaps the set_memory* interfaces should be usable in as > > many contexts as possible. > > > > Have you run this with lockdep enabled? > > Yes, it booted to the shell just fine. However, that doesn't prove > anything. The set_memory_* function has many obscured cases. > > > > - The function __flush_tlb_all() in kernel_(un)map_pages_in_pgd() must be > > > called with preemption disabled. Once again, I am unsure why this has > > > not caused issues in the EFI case. > > > > It could be because EFI does all that setup on the BSP only before the > > others have arrived but I don't remember anymore... It is more than > > a decade ago when I did this... > > Are you okay with this? Disabling preemption looks strange, but I don't > see a better option. Borislav, given this code deduplication effort is not trivial, maybe we can do it as a separate patchset on top of this one? I also wounder if it makes sense to combine ident_map.c and set_memory.c. There's some overlap between the two. -- Kiryl Shutsemau / Kirill A. Shutemov