On Thu, Jul 19, 2018 at 03:18:03PM +0200, Thomas Gleixner wrote: > On Thu, 19 Jul 2018, Kirill A. Shutemov wrote: > > On Thu, Jul 19, 2018 at 02:37:35PM +0200, Thomas Gleixner wrote: > > > On Thu, 19 Jul 2018, Kirill A. Shutemov wrote: > > > > On Wed, Jul 18, 2018 at 04:19:10PM -0700, Dave Hansen wrote: > > > > > > } else { > > > > > > /* > > > > > > * Reset __PHYSICAL_MASK. > > > > > > @@ -591,6 +592,9 @@ static void detect_tme(struct cpuinfo_x86 *c) > > > > > > * between CPUs. > > > > > > */ > > > > > > physical_mask = (1ULL << __PHYSICAL_MASK_SHIFT) - 1; > > > > > > + mktme_keyid_mask = 0; > > > > > > + mktme_keyid_shift = 0; > > > > > > + mktme_nr_keyids = 0; > > > > > > } > > > > > > > > > > Should be unnecessary. These are zeroed by the compiler. > > > > > > > > No. detect_tme() called for each CPU in the system. > > > > > > And then the variables are cleared out while other CPUs can access them? > > > How is that supposed to work? > > > > This code path only matter in patalogical case: when MKTME configuation is > > inconsitent between CPUs. Basically if BIOS screwed things up we disable > > MKTME. > > I still don't see how that's supposed to work. > > When the inconsistent CPU is brought up _AFTER_ MKTME is enabled, then how > does clearing the variables help? It does not magically make all the other > stuff go away. We don't actually enable MKTME in kernel. BIOS does. Kernel makes choose to use it or not. Current design targeted to be used by userspace. So until init we don't have any other stuff to go away. We can just pretend that MKTME was never there. -- Kirill A. Shutemov