Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1710514imm; Thu, 19 Jul 2018 06:43:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdW733sh90tG3FUPa7RvZO81cStHNc9nzWIfq0Q4nbvsKTYEJw/3aZGgJqMy0kf0q5aLEXe X-Received: by 2002:a63:1f4d:: with SMTP id q13-v6mr10103461pgm.241.1532007787079; Thu, 19 Jul 2018 06:43:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532007787; cv=none; d=google.com; s=arc-20160816; b=ith+m09TD4VGLKLsLIkcs3/ZGDnHC7HFvD7Vb6UwIuLyvfOf7R3rPRNwW/sQLB0yRQ GE5lVgeVLjbaxkUszozAVlbFHHw9BGmlfN60F0tnuBtVFtvrIK0R8/eVuY2H5jIUu++g i6oKSLis1k4sDCWO83jc4oawYOQ2NtqkEBUxA7SzFYYAawxb+8KlhCsBpzb04DhLJNrT wZSVWKhXHcX4KAHtlQS1L/JPf5g18gUOwzwVYc1kY6MHP/9WPk5F6wNmx9Hl9VjewThj yWNqYugu9LIDHsm/K3xZ4FyjPcf4eTBHSpu/aliC8fJSHj0sWcWXT4JoYPqRYx7q12W+ yAOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=uWygXSRvyQvK211vg3X5Sk8xtJe9xm5u26a/MOtBBHY=; b=WXj0m5XRgv4nK9bWwY+2pSUb3fS+nmTKYibbdRNuCzhK0I1Ll7NYzVZMxXBb/+XNIV 1Q0J3ClY2mo6pnMpKofjC1jl5PvDiJ5blMX4UkoDG2aZhCxyGbOMB2zlmPhcKNc/w5+B PsDvEADNznfmBTzXPHriIHtEdR9lrXAZPtJBNPsKgkpvrRM/M8fg2cWlsjwrHLAuf1Da xiTohGSDCDTIFNBCM6He+2moUJ0dG//BvIwvWukpIAg0vU4BgsMZ+UakWcoUXaksVQnr zWd0F4C1aZBuaNyza3n38ofIjYA17ZVtAIWt6ugdDPsWJ6NHzwYHiAlE50zueHr9dsFk ZAVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o23-v6si5398534pgv.518.2018.07.19.06.42.52; Thu, 19 Jul 2018 06:43:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731531AbeGSOY2 (ORCPT + 99 others); Thu, 19 Jul 2018 10:24:28 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:33118 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727487AbeGSOY2 (ORCPT ); Thu, 19 Jul 2018 10:24:28 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fg9Af-0008S0-PZ; Thu, 19 Jul 2018 15:40:41 +0200 Date: Thu, 19 Jul 2018 15:40:41 +0200 (CEST) From: Thomas Gleixner To: "Kirill A. Shutemov" cc: Dave Hansen , "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, "H. Peter Anvin" , Tom Lendacky , Kai Huang , Jacob Pan , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCHv5 08/19] x86/mm: Introduce variables to store number, shift and mask of KeyIDs In-Reply-To: <20180719132312.75lduymla2uretax@kshutemo-mobl1> Message-ID: References: <20180717112029.42378-1-kirill.shutemov@linux.intel.com> <20180717112029.42378-9-kirill.shutemov@linux.intel.com> <1edc05b0-8371-807e-7cfa-6e8f61ee9b70@intel.com> <20180719102130.b4f6b6v5wg3modtc@kshutemo-mobl1> <20180719131245.sxnqsgzvkqriy3o2@kshutemo-mobl1> <20180719132312.75lduymla2uretax@kshutemo-mobl1> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Jul 2018, Kirill A. Shutemov wrote: > 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. Hotplug is not guaranteed to happen _BEFORE_ init. Think about physical hotplug. Thanks, tglx