On 08.01.2025 15:26, Roger Pau Monne wrote:
> The current code to update the Xen part of the GDT when running a PV guest
> relies on caching the direct map address of all the L1 tables used to map the
> GDT and LDT, so that entries can be modified.
>
> Introduce a new function that populates the per-domain region, either using
> the
> recursive linear mappings when the target vCPU is the current one, or by
> directly modifying the L1 table of the per-domain region.
>
> Using such function to populate per-domain addresses drops the need to keep a
> reference to per-domain L1 tables previously used to change the per-domain
> mappings.
Well, yes. You now record MFNs instead. And you do so at the expense of about
100 lines of new code. I'm afraid I'm lacking justification for this price to
be paid.
> @@ -2219,11 +2219,9 @@ void __init trap_init(void)
> init_ler();
>
> /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
> - this_cpu(gdt_l1e) =
> - l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
> + this_cpu(gdt_mfn) = _mfn(virt_to_mfn(boot_gdt));
> if ( IS_ENABLED(CONFIG_PV32) )
> - this_cpu(compat_gdt_l1e) =
> - l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
> + this_cpu(compat_gdt_mfn) = _mfn(virt_to_mfn(boot_compat_gdt));
The comment's going stale this way.
Jan