Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2887044imm; Fri, 20 Jul 2018 06:41:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcLBgKOl8hfHN1e+EW48ewNrPolRi/lG9G+02IxceAbEh/4YBqRrHFYzTYNKyIbOJieB8WK X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr2107022pll.343.1532094101301; Fri, 20 Jul 2018 06:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532094101; cv=none; d=google.com; s=arc-20160816; b=wE1tko7CsXMYd4gFEViwBwp66clXLSxw7ijMBVwrg6EXhiVJrpLiBHwooV42BYc+aA 7j0fnUuwnN0wxf27hexcojeV2geYRXOZcKNZHEVEnzWsHcvh28ZhsPJlcxj+y+k/Ugiv ei+sQb7IymV1LyzOUTrxa6IjuGyBU7IQDGDBbm3wQgCmzdV9AwB1F5dMqCBCx7Ykohcv zafr+IbZ5rrGKH6AXZqdvoLlBYRj1DLyBw+2mNxzd398TempwF3gtFFuMBt/GeoHYIZR gcgjmYA6odU1ETjJ7CBgDK3AGXlUhTHNYIA0Dc/Ugs7rMz/uboH3mdDjURk2nSUBJeV1 /gjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=cqwRwz5WvUraR6XNVxZxSxVFZBSQrVW8UAkH2+gtLLU=; b=gOz6UzXmT/inoUYAz+a/jqB8BhYSD3BP3/gQMKl9IcajbnIkLuiKAILce6TAgt5x/P dvdvOgy+EICa0/rOZr22aVF6LAWocCBmG0iyDHrNwU4B5DUCqGuxShVrgddiEszehy/s PlZ8dE9Hrzn67oDRwnVU03oWLFhhnysEdOkn0AX1FLrTBkg1lPi/liRup8K9kofpdKaB e+odjHv1VENd9NJS8m6cHPKHMQ69qJ73gTWtpjttc5IL+6JIzrTuKV12EdSTPiHLazkF WeLjsNAFXEl/28+RgGiyBJbeinQeJdKwCC03m6SycCCtGBnvqgvXTx0fIIuZ1F8ssx00 YAnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=BPSg9uzt; 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 b6-v6si1642011plr.210.2018.07.20.06.41.26; Fri, 20 Jul 2018 06:41:41 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=BPSg9uzt; 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 S1731906AbeGTO2w (ORCPT + 99 others); Fri, 20 Jul 2018 10:28:52 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:33923 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728335AbeGTO2w (ORCPT ); Fri, 20 Jul 2018 10:28:52 -0400 Received: by mail-pg1-f193.google.com with SMTP id y5-v6so6953227pgv.1 for ; Fri, 20 Jul 2018 06:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cqwRwz5WvUraR6XNVxZxSxVFZBSQrVW8UAkH2+gtLLU=; b=BPSg9uztMUShV+u3tduglSDkOpLpiHSV8t1IAra6IsmkWZUw9uUZv05v2oL9DdamX/ jDkHjUcT89X+0xtnBuut2EYRUeHx2YlrjxWuhvKipN4kVACc4BMG5HU6zNsq3gqKxdo/ ILY858gT0EH5X7gMH6ToHo1KAms5n+z0e6ybN58OdWGL+Wyp3L7vbg8vFmeW8cSRFPnV sNzzvwFSPAnXErW4wxVnii9Rcs9Mu1TBqytujSv1+84Tf64pCCPAwJiyOeClTR3xf3PC BAGxEAxjHUZy9cDILBSWonEH4SyMxJ2mWqt32GdkE95IlKIabSjG3O+E87u9KNBW0iMw jC4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cqwRwz5WvUraR6XNVxZxSxVFZBSQrVW8UAkH2+gtLLU=; b=KhTExbQa87aK+YCpVF4at8Fsnn6jQuxuce1Ej8Z0xVRO1gg0Oy3ccRMBwPcmXequh1 L6hTSQkFI3awwDAOkjOthZNOubNweHb7oSghWRE26FWXCutdkBWh2A18QUAwivpXYBUh xxI8ejKzybRY6RnJk40iiPCUj1bEnxM41qFagCyHt0HDaQ1ghm5DBUj53wz8FmY5YfF8 8cYbU/sGtiBztiK2bza56KsyIxdOXphfMV4vRsKlnc/2i92mnLygWZ+Ydh0IN4AfJNJQ xUD4zTEViYGGL61XK88uRenoEC5jeKv/SFz6vV5PMVDgW/0JTAcaBUi5SjLGPAGtUw8y gauQ== X-Gm-Message-State: AOUpUlGoK/PZPFAENwK6yZ16XccQpluvh7t5lDwdzuA6dxmxnO/i/J43 Z5JBphyLwwkA6We7zeZbc6vPlQ== X-Received: by 2002:a62:aa02:: with SMTP id e2-v6mr2216371pff.211.1532094030608; Fri, 20 Jul 2018 06:40:30 -0700 (PDT) Received: from kshutemo-mobl1.localdomain (fmdmzpr04-ext.fm.intel.com. [192.55.54.39]) by smtp.gmail.com with ESMTPSA id z184-v6sm3749258pgd.83.2018.07.20.06.40.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Jul 2018 06:40:29 -0700 (PDT) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id 7F7BE300254; Fri, 20 Jul 2018 16:40:26 +0300 (+03) Date: Fri, 20 Jul 2018 16:40:26 +0300 From: "Kirill A. Shutemov" To: Thomas Gleixner 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 Message-ID: <20180720134026.6saxekgxxgltv3hg@kshutemo-mobl1> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180622 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 20, 2018 at 03:17:54PM +0200, Thomas Gleixner wrote: > 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. Got it. Thanks! -- Kirill A. Shutemov