Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3931978imm; Mon, 18 Jun 2018 06:34:26 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJtqENdKLQArwGs8D/doHfA/1smqsxGsu3k+z1xi+pKK1eXONe1yjp5WcuHTl/WpyGuxDyH X-Received: by 2002:aa7:8311:: with SMTP id t17-v6mr13637387pfm.45.1529328866780; Mon, 18 Jun 2018 06:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529328866; cv=none; d=google.com; s=arc-20160816; b=WBjIqYnusLLBCBGsBS2B/QWGR49VAcTOX7WIIrtestYiGbz96YpqvV9C62c6DfdqVN CPSzGvA1eKO5Uj88Wy/SVOOhXbLfZwxV3xvSijZvGJpbmLFl9e2urFQgcAdmbus5xthe S9RZPSK2TsCWP4hm19P1tLFoF99BBhF8xQjeNXi3XVdSE7W1P+C7X4OnQ0X+IwFph9sO VyFQB/Mogj0s9KCD39WGMFeYkNu0m0QT2rhOixnTqqOoaebgQPnX90BLEEAvj2wIQ52U fvvnTGF031D9zohs6C6KuA3+RyLR+X0QW93Wsk4dog0p83qKWD1SNpwHpazce+3Wz3hs vBKA== 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:arc-authentication-results; bh=7UTTy4zbsZLBWkkfCwwBn8f6qC9oppgMcCfRsBEyzN0=; b=NcAD/Ua+h2xnrg11yTjLrUvPZV4Za/vDEFa66cGm7QTc3px+RTwmI+GHVqvR3yWaIL PbbeflImX2Mw7HKDCiSg5IKHkkNAUw44m1rCY+SPgGX22NSC2FOi6ey32gxL/uTBKnHr Les9wDhV6uZ5tDU0sKNqtHB5WW1HLemm1vtI8Y+7u8ZQ/x9h/L4ksZPJIsudYdrD2U8z Jwqk2bH9bE6u8H6JkFmr++5fGABmcxiu0Q3HOVQLAY24ZnLN7f8h+QH6j4vrarHC1vOG rT4hOFVbQ5X3SHbBZuEKeYeVIGiI2VzvNhwMUgeJfqBLdHaICHE6xvM2e1OofKUHyji8 1WxA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n12-v6si14550246plp.123.2018.06.18.06.34.13; Mon, 18 Jun 2018 06:34:26 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934410AbeFRNdQ (ORCPT + 99 others); Mon, 18 Jun 2018 09:33:16 -0400 Received: from mga09.intel.com ([134.134.136.24]:5448 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933585AbeFRNdP (ORCPT ); Mon, 18 Jun 2018 09:33:15 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jun 2018 06:33:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,239,1526367600"; d="scan'208";a="60125222" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 18 Jun 2018 06:33:11 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id CE679FA; Mon, 18 Jun 2018 16:33:12 +0300 (EEST) Date: Mon, 18 Jun 2018 16:33:12 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Tom Lendacky , Kai Huang , Jacob Pan , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCHv3 15/17] x86/mm: Implement sync_direct_mapping() Message-ID: <20180618133312.kb6j25jvf6dr7dvh@black.fi.intel.com> References: <20180612143915.68065-1-kirill.shutemov@linux.intel.com> <20180612143915.68065-16-kirill.shutemov@linux.intel.com> <41c9db7f-2277-4403-5556-df56b686d5c8@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <41c9db7f-2277-4403-5556-df56b686d5c8@intel.com> User-Agent: NeoMutt/20170714-126-deb55f (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 13, 2018 at 06:41:21PM +0000, Dave Hansen wrote: > On 06/12/2018 07:39 AM, Kirill A. Shutemov wrote: > > arch/x86/include/asm/mktme.h | 6 + > > arch/x86/mm/init_64.c | 6 + > > arch/x86/mm/mktme.c | 444 +++++++++++++++++++++++++++++++++++ > > 3 files changed, 456 insertions(+) > > Can we not do any better than 400 lines of new open-coded pagetable > hacking? It's not pretty, but I don't see much options. I first tried to modify routines that initialize/modify/remove parts of direct mapping to keep all per-KeyID direct mappings in sync from start. But it didn't really fly. We need to initialize direct mapping very early when we don't have a way to allocated page in a usual way. We have very limited pool of pre-allocated pages to allocate page tables from and it's not able to satisfy demand for multiple direct mappings. So I had to go with syncing it later on. When we have working page allocator. Regarding open-codeness, we need to walk two subtrees in lock steps. I don't see how get mm/pagewalk.c to work in such use case. (And I don't really like callback-based pagewalker.) -- Kirill A. Shutemov