From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D997C05027 for ; Tue, 24 Jan 2023 01:27:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2FEA76B0072; Mon, 23 Jan 2023 20:27:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2873E6B0074; Mon, 23 Jan 2023 20:27:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0DA336B0078; Mon, 23 Jan 2023 20:27:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id ECFBD6B0072 for ; Mon, 23 Jan 2023 20:27:57 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B41E21203F5 for ; Tue, 24 Jan 2023 01:27:57 +0000 (UTC) X-FDA: 80387956194.26.8647EC2 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf19.hostedemail.com (Postfix) with ESMTP id D101A1A0004 for ; Tue, 24 Jan 2023 01:27:55 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=H0wzig6H; spf=pass (imf19.hostedemail.com: domain of seanjc@google.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=seanjc@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674523675; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=8F6hRIomZ2nfgoOl9vt+Mda6mTJjuiQ/nB/OzAXwDSI=; b=h14ZFXwYIuTmS9QBlTLi6Zb7+DJPVEyUR71HJ2zna871ydhAYzdwyHusXXEFeRjeQB0bbv zMs1GeN2AuKK5lHGvug5Ao2ZM+3RVE+U9e9kQY9scJUoC3N784TiNopIofZJm8VIyzPaXJ YsMArgwm9Z4Dz4ceye2Zadakdd02/KU= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=H0wzig6H; spf=pass (imf19.hostedemail.com: domain of seanjc@google.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=seanjc@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674523675; a=rsa-sha256; cv=none; b=IYXXr/2yOsp7IISIUsATCQs3lCeD84Nx4mR/hKTFEuQbEgNYNk2wQMfrXnkQSXzW21WbVF m/zK/8A7SqOknA35KXTx/3inBuhp0OrgJZbbKJ47yZ0rwBDMFyfv1cscxYrQte+WUBFGBR c9hych7cMV64MUMJahvHHU1kQf/k58E= Received: by mail-pf1-f174.google.com with SMTP id s3so10188370pfd.12 for ; Mon, 23 Jan 2023 17:27:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=8F6hRIomZ2nfgoOl9vt+Mda6mTJjuiQ/nB/OzAXwDSI=; b=H0wzig6HSgCdkJfbnchvpXtWngdQg2CyHZkhgdpFw+HuZ2/LaO4BJx1ZZJ+RRoILq8 GuT7pIND31DaoY+FiJSBILYhipQMPqJ7CZUOuz7x71s515bfTFYymuOqj76dpZGGPe0R roYrZDSWF8NxOve8Pxp7cvCd6BZ0axXo2A8t3B8iw98G/r8Tkcv0kcruglI/OT22oEey j/0uWp0hdocKI/BmP7HVj2M7QFhthg3W7d8Q1vm0Us4lX+kWe4jn02BGZ4yej5UdNIiy ekteTmqXj33t26Jyf+JF3RUpU48Qj5o/y07idXkF5Ho4kjJsXeyVErd+MUZWegqHYXVp q16Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=8F6hRIomZ2nfgoOl9vt+Mda6mTJjuiQ/nB/OzAXwDSI=; b=09iZkolm/7DqvxUsbdVHP3mPz/dkypz6yRJxGyjBoggT63LL2HQ3MzOzEyGRFl4yx/ RY1HOYt4/9jbDjQI8FrV9m5c647HlmrVTcEkCvaQbGbq0qD9YTBVB3QFQ5WTDA2aHOYn PuBnDl8k2AdMbKUhqKiPrURI4zufpfeZOaFioJZf4KqrJKQgC7XkPs8nNOz2u8k6PT7L hfsxT8ZIsI3qfUewdCLqku9RC8n7qRjS8ed7AZUu98KgpMx0KIbUCyJPhltaYXaBVRqk GwCcrfYrM/SHuit0w9vMJbmJFnHMu8dD/SEpaPl3iQ2n/UKWzaElrYI94sLKUsIgYGls 1xCg== X-Gm-Message-State: AO0yUKWhfgXS/bQVZ4NOpaGfujSrvuAaOaX/MsU4/AXfkVY3noEx+ALw L8kmpDtt01M9efulNTEPpjrhkA== X-Google-Smtp-Source: AK7set8oWHW5as5U3Q0r97O5m1dlnRFyFLOsa36pUh2yIP/6nFcX7lH+DqOSXyUNOJ1I4yEcn6HIvg== X-Received: by 2002:a05:6a00:b55:b0:576:9252:d06 with SMTP id p21-20020a056a000b5500b0057692520d06mr19319pfo.0.1674523674434; Mon, 23 Jan 2023 17:27:54 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id a28-20020aa78e9c000000b00582bdaab584sm238831pfr.81.2023.01.23.17.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 17:27:53 -0800 (PST) Date: Tue, 24 Jan 2023 01:27:50 +0000 From: Sean Christopherson To: Isaku Yamahata Cc: Chao Peng , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Arnd Bergmann , Naoya Horiguchi , Miaohe Lin , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , "Kirill A . Shutemov" , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , tabba@google.com, Michael Roth , mhocko@suse.com, wei.w.wang@intel.com Subject: Re: [PATCH v10 0/9] KVM: mm: fd-based approach for supporting KVM Message-ID: References: <20221202061347.1070246-1-chao.p.peng@linux.intel.com> <20230119111308.GC2976263@ls.amr.corp.intel.com> <20230119223704.GD2976263@ls.amr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230119223704.GD2976263@ls.amr.corp.intel.com> X-Stat-Signature: 5s6xkgmgrr9s8b7gtnqy175eqohxjeba X-Rspam-User: X-Rspamd-Queue-Id: D101A1A0004 X-Rspamd-Server: rspam06 X-HE-Tag: 1674523675-432223 X-HE-Meta: U2FsdGVkX1+jspdMJ70IcJql2BTx7q3FOLgWz96NJwYjzo8VduUawWS5Z/ciSNLyg3L6kyZSgEC7Pm4RtxmYU3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fMAn8wxC+V45tKpwpK2qdT5Fv2cFWbU/cmWzgHu4IpqSS9ClVuVIN4UFXbX4yAB2zci/cqmzQWhwjmOPON5k71eOp8Nhsd5+UAjZXywsHTTFFGEqrCmEciEunN63dbOZ5DvcphVK8+Fqm+bpJC+PZnYzRJc9M7qdP+4d24LYOOMDYJrKAhVdse6Yz5h0l5Jxrkp229tlPVOqv+BnZY0YfHCgJQ4rI0yeq0Mix+Ccx1LsidjtjpN7eyOP7gKC6FFKwM25P6AduqAfvMIkwjIOYkSx3hklvGuRM0XPUD8FjhTbEFTovpF+W7tKE4xKt1JCngPG0SMZv5IL/G3YRpFsmcty9U+4LkjzvI3CeV0TadmQwQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jan 19, 2023, Isaku Yamahata wrote: > On Thu, Jan 19, 2023 at 03:25:08PM +0000, > Sean Christopherson wrote: > > > On Thu, Jan 19, 2023, Isaku Yamahata wrote: > > > On Sat, Jan 14, 2023 at 12:37:59AM +0000, > > > Sean Christopherson wrote: > > > > > > > On Fri, Dec 02, 2022, Chao Peng wrote: > > > > > This patch series implements KVM guest private memory for confidential > > > > > computing scenarios like Intel TDX[1]. If a TDX host accesses > > > > > TDX-protected guest memory, machine check can happen which can further > > > > > crash the running host system, this is terrible for multi-tenant > > > > > configurations. The host accesses include those from KVM userspace like > > > > > QEMU. This series addresses KVM userspace induced crash by introducing > > > > > new mm and KVM interfaces so KVM userspace can still manage guest memory > > > > > via a fd-based approach, but it can never access the guest memory > > > > > content. > > > > > > > > > > The patch series touches both core mm and KVM code. I appreciate > > > > > Andrew/Hugh and Paolo/Sean can review and pick these patches. Any other > > > > > reviews are always welcome. > > > > > - 01: mm change, target for mm tree > > > > > - 02-09: KVM change, target for KVM tree > > > > > > > > A version with all of my feedback, plus reworked versions of Vishal's selftest, > > > > is available here: > > > > > > > > git@github.com:sean-jc/linux.git x86/upm_base_support > > > > > > > > It compiles and passes the selftest, but it's otherwise barely tested. There are > > > > a few todos (2 I think?) and many of the commits need changelogs, i.e. it's still > > > > a WIP. > > > > > > > > As for next steps, can you (handwaving all of the TDX folks) take a look at what > > > > I pushed and see if there's anything horrifically broken, and that it still works > > > > for TDX? > > > > > > > > Fuad (and pKVM folks) same ask for you with respect to pKVM. Absolutely no rush > > > > (and I mean that). > > > > > > > > On my side, the two things on my mind are (a) tests and (b) downstream dependencies > > > > (SEV and TDX). For tests, I want to build a lists of tests that are required for > > > > merging so that the criteria for merging are clear, and so that if the list is large > > > > (haven't thought much yet), the work of writing and running tests can be distributed. > > > > > > > > Regarding downstream dependencies, before this lands, I want to pull in all the > > > > TDX and SNP series and see how everything fits together. Specifically, I want to > > > > make sure that we don't end up with a uAPI that necessitates ugly code, and that we > > > > don't miss an opportunity to make things simpler. The patches in the SNP series to > > > > add "legacy" SEV support for UPM in particular made me slightly rethink some minor > > > > details. Nothing remotely major, but something that needs attention since it'll > > > > be uAPI. > > > > > > Although I'm still debuging with TDX KVM, I needed the following. > > > kvm_faultin_pfn() is called without mmu_lock held. the race to change > > > private/shared is handled by mmu_seq. Maybe dedicated function only for > > > kvm_faultin_pfn(). > > > > Gah, you're not on the other thread where this was discussed[*]. Simply deleting > > the lockdep assertion is safe, for guest types that rely on the attributes to > > define shared vs. private, KVM rechecks the attributes under the protection of > > mmu_seq. > > > > I'll get a fixed version pushed out today. > > > > [*] https://lore.kernel.org/all/Y8gpl+LwSuSgBFks@google.com > > Now I have tdx kvm working. I've uploaded at the followings. > It's rebased to v6.2-rc3. > git@github.com:yamahata/linux.git tdx/upm > git@github.com:yamahata/qemu.git tdx/upm And I finally got a working, building version updated and pushed out (again to): git@github.com:sean-jc/linux.git x86/upm_base_support Took longer than expected to get the memslot restrictions sussed out. I'm done working on the code for now, my plan is to come back to it+TDX+SNP in 2-3 weeks to resolves any remaining todos (that no one else tackles) and to do the whole "merge the world" excersise. > kvm_mmu_do_page_fault() needs the following change. > kvm_mem_is_private() queries mem_attr_array. kvm_faultin_pfn() also uses > kvm_mem_is_private(). So the shared-private check in kvm_faultin_pfn() doesn't > make sense. This change would belong to TDX KVM patches, though. Yeah, SNP needs similar treatment. Sorting that out is high up on the todo list.