Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2865451imm; Fri, 20 Jul 2018 06:20:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe4acFOUqP94wfczSucvCZNkhjOgb3q6xC4F7AF48XBobCuKq1gS5CQA0702MzA8YV5HqqF X-Received: by 2002:a62:8d84:: with SMTP id p4-v6mr2192478pfk.251.1532092823222; Fri, 20 Jul 2018 06:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532092823; cv=none; d=google.com; s=arc-20160816; b=qK3PqyWcrrdY7S4MgYD4Zyk5U9oYITacSkZBst/wBZUinP4uYNEqqUldcdkKcqqN2i YwrhNd6IT3397TMrf32iLB+zNtZ7VSlSj956vXy/9SZo8O3nB4v9pVo6Sii3533J/TTN uaVUnWhphibzXoHx6vJKSKOWsd5dzh8nQ/g9JxQSQEC7zK7p8SJBT4jsDvDXmax5bipR Kno1h3AMUAhXlOPpMnmtHImfAMxBiOwjela6efrXqfgaJUsBAKOlSGhcuCBYQXPpgu0V ixVX8eweXIUdcG/Z5pbnvH+nDnWj879erCSpHEyTnGTrxMQN6ONHDrc1aEqPA3rgYueQ DF6w== 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=UUy4YrZDwWz7KpMHzh6AQ4OWtYhuhJ+2+weW10wuETA=; b=097JFgNW8t4Z8gSL6EXklDjJ8faM1Ovxa5TdvHEtPQX+2M8W0pzvo2kwLbLph0wC+t kTL7VRxs97gzB0f1N2WQJ8yGxzU6eU5WbFZs1i0B9wFLQ7J4fT1KjhKwNtUrWj6rogmN yX/6IleZpuD4tpKQb05VyRYFELXLqZ6PxGlk73lZELGHexPa5peCnVnsrNzcwqfW3rhE XYXBQl0qs0JKBIaL6PR9CPpYKXJ8S55K/kGhl0smnFhKQQYOE8WL92rjzpIdnAim2IAs UF4jn15XrC79KrNGO3TGHgUlJClF3ofAYIsm8qPzfkvb0WYJs6Wy3nhNffpPjU0f+rFz xy4w== 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 o184-v6si1746054pga.520.2018.07.20.06.20.08; Fri, 20 Jul 2018 06:20:23 -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 S1731852AbeGTOGd (ORCPT + 99 others); Fri, 20 Jul 2018 10:06:33 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:36560 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731617AbeGTOGd (ORCPT ); Fri, 20 Jul 2018 10:06:33 -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 1fgVIA-0001si-MC; Fri, 20 Jul 2018 15:17:54 +0200 Date: Fri, 20 Jul 2018 15:17:54 +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: <20180720123415.57m2fqbdjtvnietu@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> <20180720123415.57m2fqbdjtvnietu@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 Fri, 20 Jul 2018, Kirill A. Shutemov wrote: > On Thu, Jul 19, 2018 at 03:40:41PM +0200, Thomas Gleixner wrote: > > > > 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. > > Ouch. I didn't think about this. :/ > > In this case I don't see how to handle the situation properly. > Is it okay to WARN() && pray()? Not really. First of all, you want to do the initial checking on the boot CPU and then when secondary CPUs are brought up, verify that they have matching parameters. If they do not, then we should just shut them down right away before they can touch anything which is TME related and mark them as 'don't online again'. That needs some extra logic in the hotplug code, but I already have played with that for different reasons. Stick a fat comment into that 'not matching' code path for now and I'll give you the magic for preventing full bringup after polishing it a bit. Thanks, tglx