Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1688060imm; Thu, 19 Jul 2018 06:19:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpctL9UGkRd6FA0KWIENc7Ay4LDMoWYz/Wyopb3T1ejhiCzO4HdapXRKdj8iskmlGPXxM8GO X-Received: by 2002:a62:384:: with SMTP id 126-v6mr9542438pfd.11.1532006346657; Thu, 19 Jul 2018 06:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532006346; cv=none; d=google.com; s=arc-20160816; b=qx2BZBKnEAt9lHWxYIGUnGtd8OwuG7dhQp88RJE3Gj5PruN6CkkaxsCByToqPuC+4f rHTOmN0BwEGZXhG/nkcJ1G8UhrnHlbqL+jt47bAShspcTIRworGqISFDFfW7QwX4Wzav KSFCRXRSIJi8EdZEpbJDEj8ot/dRLiujTwD22+aJORQS2TtM/66f8KtviaIWIGmYccBG yTx84SOXo1DuvNJ0a98EB2sctaPbYUj2yZpfBXRc3PoMw7JrAPLbBwUhnIxQb8pS2AUM fKHHW4k8EzUZ+suAKRwM44sSEWCdg7RD1DuGIEvCOuhnj6o+gKNPuL0Q4br8bR90UckF D/hw== 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=1Pn6AaXRq7XSNa9/VsK6n3PQoI2VYVLN6rnk2EN6eng=; b=xIGVYt35rv9Ce+XvnoQMANLY2di23XzmW50/jlTmeDSNNYYrtlPeLm/PL7kCbI3kN+ 9Lq7lcuK7Yygcg2Lwrax/s8NFn6mDyGgWxOF2Gxx7tuv3ow/2Ndt+t9VZONM3MgusU2z RIL2+JIzek1nMf1bm40+yf18BDfkG1Y8XIoIuvtHX/CgmAITCLOiVfnJQiUz51zUuFWg rj/3YK6NtngtywuCG6PBrJoywTKZQpM7Uezggd62z2i4U6ZOtpkwfn1LhDB/g+IM2NnJ njLz8MDuM9dTbqqP6rvCkyKFtLYb0rPUfi0ANo2zpK6gm7TeTCLZktxf0lyNjsxa8eG/ d94Q== 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 v18-v6si5641313plo.285.2018.07.19.06.18.52; Thu, 19 Jul 2018 06:19:06 -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 S1731773AbeGSOBY (ORCPT + 99 others); Thu, 19 Jul 2018 10:01:24 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:33066 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731577AbeGSOBX (ORCPT ); Thu, 19 Jul 2018 10:01:23 -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 1fg8om-000813-DS; Thu, 19 Jul 2018 15:18:04 +0200 Date: Thu, 19 Jul 2018 15:18:03 +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: <20180719131245.sxnqsgzvkqriy3o2@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> 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 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. Thanks, tglx