2021-09-29 15:12:09

by Dave Hansen

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] x86/mm: Flush global TLB when switching to trampoline page-table

On 9/29/21 7:55 AM, Joerg Roedel wrote:
> + /*
> + * Flush global TLB entries to catch any bugs where code running on the
> + * trampoline_pgd uses memory not mapped into the trampoline page-table.
> + */
> + __flush_tlb_all();
> +}

This comment took me a minute to parse. How about a bit more info, like:

/*
* The CR3 writes above may not flush global TLB entries.
* Stale, global entries from previous sets of page tables may
* still be present. Flush those stale entries.
*
* This ensures that memory accessed while running with
* trampoline_pgd is *actually* mapped into trampoline_pgd.
*/


2021-10-01 13:11:35

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] x86/mm: Flush global TLB when switching to trampoline page-table

On Wed, Sep 29, 2021 at 08:07:10AM -0700, Dave Hansen wrote:
> /*
> * The CR3 writes above may not flush global TLB entries.
> * Stale, global entries from previous sets of page tables may
> * still be present. Flush those stale entries.
> *
> * This ensures that memory accessed while running with
> * trampoline_pgd is *actually* mapped into trampoline_pgd.
> */

Yes, this is better. I replaced my comment with this one (only did some
minor rewording).

Thanks,

Joerg