Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3755589pxt; Tue, 10 Aug 2021 10:33:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJys0Ry/4yXu7GVMdHrcF+RKz0OHstGnFJZvlHTUrH2DjrGrl8hepvhiNzF+i7tu2THrVpCt X-Received: by 2002:a17:906:8751:: with SMTP id hj17mr28192544ejb.511.1628616827841; Tue, 10 Aug 2021 10:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628616827; cv=none; d=google.com; s=arc-20160816; b=WFmz55ziUmDvb/+TXctWPxh9/wHYmcwu4Nh4ge3izaB18MQzCLZPgLCu5Hb/DUNOmT LxqMCOzVEtOnlts7labq8nQbNNR5LC1e6J9TcuUJt7x6XJ/ZUCsOk5kb8+u+sd2Fg3Nk GNxI7Ytq/2iPnUUG5mb3WmiLV2jS/GLRBX6GxPOBpbQeDV1JicUZRX+pUicuz6Z6mnpp ERIZBPK2+chgZO0oPcEb01MlNB+AGbvrFUjFdmINRtmsJciz3wPIRPE9ZjjAVLMjamGO 7ogy8SQxf6QqBulvhBE+GDJ6ZE1KsNcfIT0u0mPR1pyKF1vf9VzfwAfZ6HDVyWYeuZVt 7Rlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=cXERNoun0fz+0zOLLhae8d7tBgeXplw4THUEB7tDOpo=; b=weR7H0qyVOoFmxu+JWzSQnDBDr7IiCa1Ot8LKT1IO4f3tpN/YPd0L3DOb75t8eM0VQ 2zf8JQwR5VIRv9cGgmz2trZjUdFHEgHeUJ6VOBpkkML/vqsFKQN2Q2v9MJShgCrqmtH8 eSMLeLFsTPT/q6Itua0m0uq2lWXFZYKxL302N9yxEnM7JT36zk19cE05wXt3RxgmBioA sSD+wUAOyLgJkps2gN2fzlFBWB5j+cT5BbSsJ1P4JT7K3IjUGzp6i6GdRLJs0/lbJTrf IW4SDwae+Qo1Mik9/b8F3ixmcs9YYxRlTaSCtfREyf/bhdtEm6PZmwmzYoh2M8sxk/Ij 2skg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id u10si21427928edy.509.2021.08.10.10.33.23; Tue, 10 Aug 2021 10:33:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S230331AbhHJRcP (ORCPT + 99 others); Tue, 10 Aug 2021 13:32:15 -0400 Received: from mga03.intel.com ([134.134.136.65]:23278 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230295AbhHJRcL (ORCPT ); Tue, 10 Aug 2021 13:32:11 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10072"; a="214979758" X-IronPort-AV: E=Sophos;i="5.84,310,1620716400"; d="scan'208";a="214979758" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2021 10:31:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,310,1620716400"; d="scan'208";a="570859629" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga004.jf.intel.com with ESMTP; 10 Aug 2021 10:31:43 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 2147AF9; Tue, 10 Aug 2021 20:31:24 +0300 (EEST) Date: Tue, 10 Aug 2021 20:31:24 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: "Kirill A. Shutemov" , Borislav Petkov , Andy Lutomirski , Sean Christopherson , Andrew Morton , Joerg Roedel , Andi Kleen , Kuppuswamy Sathyanarayanan , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , Peter Zijlstra , Paolo Bonzini , Ingo Molnar , Varad Gautam , Dario Faggioli , x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/5] x86: Impplement support for unaccepted memory Message-ID: <20210810173124.vzxpluaepdfe5aum@black.fi.intel.com> References: <20210810062626.1012-1-kirill.shutemov@linux.intel.com> <4b80289a-07a4-bf92-9946-b0a8afb27326@intel.com> <20210810151548.4exag5uj73bummsr@black.fi.intel.com> <82b8836f-a467-e5ff-08f3-704a85b9faa0@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <82b8836f-a467-e5ff-08f3-704a85b9faa0@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 08:51:01AM -0700, Dave Hansen wrote: > In other words, I buy the boot speed argument. But, I don't buy the > "this saves memory long term" argument at all. Okay, that's a fair enough. I guess there's *some* workloads that may have memory footprint reduced, but I agree it's minority. > >> I had expected this series, but I also expected it to be connected to > >> CONFIG_DEFERRED_STRUCT_PAGE_INIT somehow. Could you explain a bit how > >> this problem is different and demands a totally orthogonal solution? > >> > >> For instance, what prevents us from declaring: "Memory is accepted at > >> the time that its 'struct page' is initialized" ? Then, we use all the > >> infrastructure we already have for DEFERRED_STRUCT_PAGE_INIT. > > > > That was my first thought too and I tried it just to realize that it is > > not what we want. If we would accept page on page struct init it means we > > would make host allocate all memory assigned to the guest on boot even if > > guest actually use small portion of it. > > > > Also deferred page init only allows to scale memory accept across multiple > > CPUs, but doesn't allow to get to userspace before we done with it. See > > wait_for_completion(&pgdat_init_all_done_comp). > > That's good information. It's a refinement of the "I want to boot > faster" requirement. What you want is not just going _faster_, but > being able to run userspace before full acceptance has completed. > > Would you be able to quantify how fast TDX page acceptance is? Are we > talking about MB/s, GB/s, TB/s? This series is rather bereft of numbers > for a feature which making a performance claim. > > Let's say we have a 128GB VM. How much does faster does this approach > reach userspace than if all memory was accepted up front? How much > memory _could_ have been accepted at the point userspace starts running? Acceptance code is not optimized yet: we accept memory in 4k chunk which is very slow because hypercall overhead dominates the picture. As of now, kernel boot time of 1 VCPU and 64TiB VM with upfront memory accept is >20 times slower than with this lazy memory accept approach. The difference is going to be substantially lower once we get it optimized properly. -- Kirill A. Shutemov