Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp870151pxt; Thu, 5 Aug 2021 13:53:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ1DIHhFhuCbNjk4fFYIp1Q65hmIN4IQ7UTTjxWEilY56zIgHqBwyZk7gvY+fHdZA3FCPs X-Received: by 2002:a05:6602:3421:: with SMTP id n33mr85221ioz.150.1628196785800; Thu, 05 Aug 2021 13:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628196785; cv=none; d=google.com; s=arc-20160816; b=hkeHTUFUa+RZ64NpNnqWeLEkRI3SGE61w5EapNWTJwIjRaIBlBeUOG906Qs2TqsqVf EZpubYWn4UUCLJ/HihYpKayQD+nxnV9gvc3nuyBu4fiw39sy4TbFoenpm4uvYMo6Ql5I ftuYKW/ioJ8aTed7FrBRxIqb4/ww4eIuVxOJR+jBesWOESnwWYcPB9nVQSHAJ3kmcaEJ 5EUgW/x1BT1t59R+Bc3hd2ewb1OUjCTpkNCu2uR2eNYuHQS4QhW0WvXQlr03DhS6ehIP sYqPRTLKDxXJGxs3wUOCuEJ9AX8D6xLvMivGZOdmiFJ9LNhWiUb/2q39FwnT54W7Pjj8 XQgA== 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:dkim-signature; bh=AH1b17dDAm/qClYUiQkfkIc/DiudItItOitQI5OYb/U=; b=W7ZhRnRz+j1ITaNOJXgNPo5Ck5xiyNoxm7JzRAdqxaIjI+xkDM1p3zMKk1P+B6XQsB WvdWfGE0p+Pw2iH/A2YjiQVwn3Y05qlj58jQyGkSAFXFZyUat8/1nyN+bqbyD1ywBhEZ rjUR5G6CYqwvkDSAOH2oN65hi+ZbraENgRymRfh/Of4M7XW5CmDMfC6W7dygeNG/rzs/ Hl9rvgajbtsU4DRU3pMHPyyD9SskaxtISf7k9Sv0mqnxkzIar7Ee4mc3qHIC0N9HAm2Y Oo6cE9ZQUiL5w4q2kfBMFXe7EsY5d6/N58AfhebEdwH92oyR+gTsp4qV/9OzUsikdXAr ZSbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=tmO87efn; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i21si7479386jaj.17.2021.08.05.13.52.49; Thu, 05 Aug 2021 13:53:05 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=tmO87efn; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242140AbhHES7S (ORCPT + 99 others); Thu, 5 Aug 2021 14:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233152AbhHES7N (ORCPT ); Thu, 5 Aug 2021 14:59:13 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B59BAC0613D5 for ; Thu, 5 Aug 2021 11:58:58 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id e2-20020a17090a4a02b029016f3020d867so11831851pjh.3 for ; Thu, 05 Aug 2021 11:58:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AH1b17dDAm/qClYUiQkfkIc/DiudItItOitQI5OYb/U=; b=tmO87efnMKj/JrtHmZLrag/DnLynQgiK4FaL11paV2xYLHtaZwGo7krk+1DbL3+c+O eew7F8J5WjV+ZXv5wfbDO7tZz1u/mjeiCf2mQQrLfoFTSoPxJx/csidMWS1+IuProPY9 vp0IC9IgmLNXf9FtWHsrIVV2Sht6bCHcHkBTUW/S20dcI9aFidqjlhz0OhcKfI4jU7gG dLCeOLuJlcrO1I1bIw8ELwkeoMqbI4wl4cnOS0oyoDra+pLER+ygs1Q/2rIlBSJACOsx G8iSXVt97Hf9Q5HwDGy075FZeSnJD2ZOKA5e/+tXw6gx/UE+MHwPH/Ta9q6eKvwtvwMg Ecfw== 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; bh=AH1b17dDAm/qClYUiQkfkIc/DiudItItOitQI5OYb/U=; b=gF511hwIoFRA2OpKIewRi+3YeTJEWYSIYMfGuEUA9Od3zEzKG1GdWKrBVaXEsdO99w P/ULJosFHzEJX68gA+n8mWgJ69KEJwZTrotYie4jHCyg/rAKTlavSYUxVW9l03vlk2z9 JoW8sYQugpCnZbqVX5jqzzVDHOzIIvlKdTWTuMzmm8j32N9b07qkROnzY5CTHt/T+269 NTjcth0UMt1zu/FzsBZW2Sr4IEvmBLRJnPW2u7Owyo7qeyETt8Ew4jsnZ6nm6WrwY4kx 7T2bqxrNraBDXqa0wO0JcrmdRjqp+BdAg/6B6kpyu6flP6gJL+8etdJD+dQEd3NaVu6o fJyQ== X-Gm-Message-State: AOAM532SWhdY8lEM/Rs7QiKFJRNIZqr/se3UJgPDlzMTxUmFFyPUolDh DlF5LeK60rRk10zboe+1QqYLKw== X-Received: by 2002:a62:dd83:0:b029:30f:d69:895f with SMTP id w125-20020a62dd830000b029030f0d69895fmr846153pff.17.1628189938023; Thu, 05 Aug 2021 11:58:58 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id g23sm8197040pfu.174.2021.08.05.11.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:58:57 -0700 (PDT) Date: Thu, 5 Aug 2021 18:58:53 +0000 From: Sean Christopherson To: "Edgecombe, Rick P" Cc: "erdemaktas@google.com" , "linux-kernel@vger.kernel.org" , "jmattson@google.com" , "Huang, Kai" , "vkuznets@redhat.com" , "kvm@vger.kernel.org" , "tglx@linutronix.de" , "ckuehl@redhat.com" , "joro@8bytes.org" , "x86@kernel.org" , "hpa@zytor.com" , "mingo@redhat.com" , "pbonzini@redhat.com" , "bp@alien8.de" , "Yamahata, Isaku" , "isaku.yamahata@gmail.com" , "wanpengli@tencent.com" Subject: Re: [RFC PATCH v2 41/69] KVM: x86: Add infrastructure for stolen GPA bits Message-ID: References: <20210805234424.d14386b79413845b990a18ac@intel.com> <78b802bbcf72a087bcf118340eae89f97024d09c.camel@intel.com> <7231028edae70dfaeab304d6206d4426b9233f41.camel@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7231028edae70dfaeab304d6206d4426b9233f41.camel@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 05, 2021, Edgecombe, Rick P wrote: > On Thu, 2021-08-05 at 17:39 +0000, Sean Christopherson wrote: > > If we really want to reduce the memory footprint for the common case (TDP > > MMU), the crud that's used only by indirect shadow pages could be shoved > > into a different struct by abusing the struct layout and and wrapping > > accesses to the indirect-only fields with casts/container_of and helpers, > > e.g. > > > Wow, didn't realize classic MMU was that relegated already. Mostly an > onlooker here, but does TDX actually need classic MMU support? Nice to > have? Gah, bad verbiage on my part. I didn't me _the_ TDP MMU, I meant "MMU that uses TDP". The "TDP MMU" is being enabled by default in upstream, whether or not TDX needs to support the classic/legacy MMU is an unanswered question. From a maintenance perspective, I'd love to say no, but from a "what does Google actually want to use for TDX" perspective, I don't have a defininitive answer yet :-/ > > The role is already factored into the collision logic. > > I mean how aliases of the same gfn don't necessarily collide and the > collisions counter is only incremented if the gfn/stolen matches, but > not if the role is different. Ah. I still think it would Just Work. The collisions tracking is purely for stats, presumably used in the past to see if the hash size was effective. If a hash lookup collides then it should be accounted, _why_ it collided doesn't factor in to the stats. Your comments about the hash behavior being different still stand, though for TDX they wouldn't matter in practice since KVM is hosed if it has both shared and private versions of a shadow page.