Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5621311imm; Mon, 23 Jul 2018 03:06:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeaE2wiBVZ7AIbYHQQj8X8ju+egM6MRbhYUVlD0GIUOh4ubiFCG4wSy0fNQeHKWhakOvb3I X-Received: by 2002:a63:d15:: with SMTP id c21-v6mr11733187pgl.322.1532340366722; Mon, 23 Jul 2018 03:06:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532340366; cv=none; d=google.com; s=arc-20160816; b=eGps3MksAWtGE/lf5EpaNf3PESe2igDanf3Qcqgji4l76c1Dn47ShBqtf/iJk906Qt JytSNcNPPlpU02Y34eRXB/RJDuaC7PAgqHHVeRm6LcsoHmYNcunmXICkNb3GEgPvDHzj 4XicjCEFljY7zRbGQG4MhhAeLcVYnr4yGXfiO18GUh7H48sl7PqzVU1reXqR0w7XbFRI wwJFZuGqFasR5jOmwo5T+AtfWPcoBYqCHz0+JuGo4YBn7z7DntSfwd+Xog2st3D8NzOI HajG1jPaQ0UoZwxNYfDFabNplnDNPc2rBu2yWfpGYhaFj6sYhxGtICVfaZq5mucrG4Jz 1noQ== 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=Zk9Pme2iV/NriyqwcPPpH9br25cbVvY0c5t6UwQGT9M=; b=bKSkHwD5E8eV5Wjs5GpvMYoFenlbXSM0PRWlTLmlLQ6+GsphFhiYiatTkirL96MgjB Q2ilAGc59f9s5BmhqChGmS4/LA/Ha92DaknamWMGgCBmsrcGFe1NWCTvi1kidw3rPX7u +uaCQobuMQzX/uJ+qA0FuvDeNNTLWf9iNiEZb2aspNpofiWvg0+UNmlVX/KNZD4tlla4 x+8CFpEI2ruS9PanOfEinqqpdqF7Xo0nW7ryd3sMz2EOIMEcZnJcgL5Mjn3in/8XJOwp 5fDtA9vKbF7L4bhuZCkVnnMAx4/CrZE8Qyc68WsY3uZInCUvB8p2rzaYaU3SG7kJ6i6e u6pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=JIuVOYgS; 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 ay1-v6si493673plb.266.2018.07.23.03.05.52; Mon, 23 Jul 2018 03:06: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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=JIuVOYgS; 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 S2388263AbeGWLF3 (ORCPT + 99 others); Mon, 23 Jul 2018 07:05:29 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:34593 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387933AbeGWLF3 (ORCPT ); Mon, 23 Jul 2018 07:05:29 -0400 Received: by mail-pl0-f68.google.com with SMTP id f6-v6so30810plo.1 for ; Mon, 23 Jul 2018 03:05:03 -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=Zk9Pme2iV/NriyqwcPPpH9br25cbVvY0c5t6UwQGT9M=; b=JIuVOYgSrYSNTq/tlMyHCavAAsOCtofyXSnvmkGvrwr+lGRD/zWxJqQigOy5uBGl5U XrDEA4M6kqQmJL/hyfFgMvcO3pt8e0t1K4/8klNJqF6zgwnW3aPiGNkm4c+6RpOjK+Z6 7zOf/DcLBvbUoY5gu9p0xF5EvzO5XQbuU5ccBxAFC+PWz1Rf64Wd65PXO8wMPJS3nI2n KLvL3ZJ7rNG/fF2F6qdYiBhhkDJF1aSeyW2EyzjwUpyNMuFJGIk6Lvyk/xpCKDOu+r26 pFraK58UlY9Zx5g2WIJJPmzcFYXzqcARYVwkY1c3gqbVRHX0QmrmAI8FHHociCPDStAe VgDA== 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=Zk9Pme2iV/NriyqwcPPpH9br25cbVvY0c5t6UwQGT9M=; b=gaKxRsD2KZHmAOUUZoM5jrq83UlgpoNEtlwxdO1IUQnfvF0jQcDU4NubmPuGy6Y0pk AVWJ1wVm+pcRQkKwJ57yDF5sr5VhlCvE0rX5Objl/slDRyfOKmWVi1K5hbmw86VVPXvP xmm/nKJckCZdyjmY5yg+EfyzYP13TxmsgxoHRQdlDpsii/SvZF7IHZNQwc+5Z5udxcyj 6uCfZzs8nvhfSrsoAdlCf0IERoT/QDpOZeeezkjnS3WGezlkPS6cDUOpjht3hLTOz4kD O6njYSct5MXWDPAgbMOUnlSKVdZohNrSySysShv4pEK03CUGKWwkQ6qOx6aHNpGjx7Gf MnNQ== X-Gm-Message-State: AOUpUlFS6i1n8N0cHAoNfXOzqtRmfnNjcmqk2id88pbpkSkOABrUv9TL O/GTCGEIfO1esZ1x2z7K/HtcSA== X-Received: by 2002:a17:902:59da:: with SMTP id d26-v6mr12253978plj.42.1532340303107; Mon, 23 Jul 2018 03:05:03 -0700 (PDT) Received: from kshutemo-mobl1.localdomain ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id z8-v6sm12356273pfe.163.2018.07.23.03.05.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 03:05:02 -0700 (PDT) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id A44A7303A0F; Mon, 23 Jul 2018 13:04:58 +0300 (+03) Date: Mon, 23 Jul 2018 13:04:58 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: "Kirill A. Shutemov" , 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: [PATCHv5 17/19] x86/mm: Implement sync_direct_mapping() Message-ID: <20180723100458.3oifgqyfavb6c45j@kshutemo-mobl1> References: <20180717112029.42378-1-kirill.shutemov@linux.intel.com> <20180717112029.42378-18-kirill.shutemov@linux.intel.com> <4a99e079-7bd0-a611-571a-d730815b4b2a@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4a99e079-7bd0-a611-571a-d730815b4b2a@intel.com> User-Agent: NeoMutt/20180622 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 05:01:37PM -0700, Dave Hansen wrote: > On 07/17/2018 04:20 AM, Kirill A. Shutemov wrote: > > arch/x86/include/asm/mktme.h | 8 + > > arch/x86/mm/init_64.c | 10 + > > arch/x86/mm/mktme.c | 437 +++++++++++++++++++++++++++++++++++ > > 3 files changed, 455 insertions(+) > > I'm not the maintainer. But, NAK from me on this on the diffstat alone. > > There is simply too much technical debt here. There is no way this code > is not riddled with bugs and I would bet lots of beer on the fact that > this has received little to know testing with all the combinations that > matter, like memory hotplug. I'd love to be proven wrong, so I eagerly > await to be dazzled with the test results that have so far escaped > mention in the changelog. > > Please make an effort to refactor this to reuse the code that we already > have to manage the direct mapping. We can't afford 455 new lines of > page table manipulation that nobody tests or runs. I'll look in this once again. But I'm not sure that there's any better solution. The problem boils down to page allocation issue. We are not be able to allocate enough page tables in early boot for all direct mappings. At that stage we have very limited pool of pages that can be used for page tables. The pool is allocated at compile-time and it's not enough to handle MKTME. Syncing approach appeared to be the simplest to me. Other possibility I see is to write down a journal of operations on direct mappings to be replayed once we have proper page allocator around. > How _was_ this tested? Besides normal boot with MTKME enabled and access pages via new direct mappings, I also test memory hotplug and hotremove with QEMU. Ideally we wound need some self-test for this. But I don't see a way to simulate hotplug and hotremove. Soft offlining doesn't cut it. We actually need to see the ACPI event to trigger the code. -- Kirill A. Shutemov