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 A0D6DC636D7 for ; Wed, 8 Feb 2023 12:24:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16CDC6B0073; Wed, 8 Feb 2023 07:24:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 11D586B0074; Wed, 8 Feb 2023 07:24:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 00B9D6B0075; Wed, 8 Feb 2023 07:24:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E22DA6B0073 for ; Wed, 8 Feb 2023 07:24:26 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id AD18940E2C for ; Wed, 8 Feb 2023 12:24:26 +0000 (UTC) X-FDA: 80444042532.26.EC3CB7F Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by imf16.hostedemail.com (Postfix) with ESMTP id BD6A8180019 for ; Wed, 8 Feb 2023 12:24:24 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UwDzNnVK; spf=pass (imf16.hostedemail.com: domain of isaku.yamahata@gmail.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=isaku.yamahata@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1675859064; 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=Eww0bGHARNDro+m4qM4alVSDjm0iyW4r5Bw76JD/1d0=; b=pP2swofs8t+A8xogBgd9PuttkYrlQP5S3YChJbJcT6AZjZimg1Takz6elAqydAZ+Di2Qcx NkITW5B6La/oMjpAg4kx7Hf2vRmk/SD8BNSyeTshiurW5JqorIGVl063Br+F2+2NrOHEIo 687scCyA+dK5333TvVWjAgHPFSowpAI= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=UwDzNnVK; spf=pass (imf16.hostedemail.com: domain of isaku.yamahata@gmail.com designates 209.85.214.170 as permitted sender) smtp.mailfrom=isaku.yamahata@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1675859064; a=rsa-sha256; cv=none; b=yr2s1MLlbhkv3PhiCOWZ2g+CJHFxuQVKBOEN5sdpIi7RZWkoNOAyRbBKRT9vw+lmbfTEQo EUeEGFe0xLLtM2iS9456PnpTi1JAt4TxWDnaJvEetx0xPSHPhr7gaXWsRi3vCBRyX/c4rP j0+q7AeyDa3iRszBFT+FobzXffu1xcI= Received: by mail-pl1-f170.google.com with SMTP id be8so19039086plb.7 for ; Wed, 08 Feb 2023 04:24:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.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=Eww0bGHARNDro+m4qM4alVSDjm0iyW4r5Bw76JD/1d0=; b=UwDzNnVKuF/8eUzNV/aymL9+YcldSIDvjEKmYPNChw9tl/cW29Zad264smZsYHW8Qe 3K+A+0a2pom4OZZbxKrjZjNutSB5FHodxpuAzzRchE6kaJcQ+5/lupwMD0s9d0crb4Sa E2m54aLLmCbokqcbW9FYc9zQr3zWZnOqTWppeVRy7ISY2XtRs4xPRjU02s++w/HKJlFl kg04wIBDr54WQd38+rYVn2umHbHARWKII1ybL4idTSuoiziEp1hZqzFvsUqhl59swDNr Yi7r6xIUpqFdwY449R217+sVKup3An5sYZWWhbEK3lIoH3KXY5u5fLczWnZjy4KAyIPb 6UgA== 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=Eww0bGHARNDro+m4qM4alVSDjm0iyW4r5Bw76JD/1d0=; b=C+kG41fsmu93NkYbxIEWmKwtDz3D5SXhJkt3RJiRBzbz9uIH+u3/SYfYPEfrjiYZUA R8+HV7/+1oOlZ1QAUdinTxFcleUPWx3yvxPMMswpsmZiCCCA2rZhfc0qg/Bwam9Y0KvF badcuSeO/+6RbdoBbzrUvRODU9xNEnpESfnvs7MpUbWJFAvc1q/Qj1PNKhi4t6YwbJsf 98ikhO4zjRluRJm1yNtmtFVIO/LdO9GNi7CwUkB9wVe7L+NBWOxH10snDff2hRLZKTDk kYQScwXoqWjN/zaOLwXTFFxIJzG67jLPIq5+/WzuAxP8S6XDn9HcHf/cXTVrwqD+1q3k rg/w== X-Gm-Message-State: AO0yUKUUuGghNo3OfVH9KIpzo8SXKD1qPnWdEJ6hEqmBoOuDzmdHRsTY esGpcbuPDlu+7bcSaWD6z4Y= X-Google-Smtp-Source: AK7set/EW3iOkejUiaBMrPtlYGHcnCsU5yA10F1vOHdYEM6oZRjOqRVew+hXFhEI9WsmU30z7oOHew== X-Received: by 2002:a05:6a21:38c8:b0:be:bf28:b7da with SMTP id yk8-20020a056a2138c800b000bebf28b7damr5858337pzb.20.1675859063311; Wed, 08 Feb 2023 04:24:23 -0800 (PST) Received: from localhost ([192.55.54.55]) by smtp.gmail.com with ESMTPSA id p22-20020aa78616000000b0058d9b68042fsm1546476pfn.14.2023.02.08.04.24.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 04:24:22 -0800 (PST) Date: Wed, 8 Feb 2023 04:24:21 -0800 From: Isaku Yamahata To: Sean Christopherson Cc: Isaku Yamahata , 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: <20230208122421.GA4175971@ls.amr.corp.intel.com> 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=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: BD6A8180019 X-Stat-Signature: g1z7nigxe9n9f4ra6rfgdcj6hwyyissz X-Rspam-User: X-HE-Tag: 1675859064-276368 X-HE-Meta: U2FsdGVkX1+Ftxnekd2OvWk9yszZPKqKEirOB10J8uhUhoCo1oh7DvVZAud7KaMJXIs1cPefTK3LDFkW2CEN0q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FjEw/8ZLwiC/lWBSRUL/AYos0maTR7L06WSM08CyqRuVIIc+qkhVNnOsTPdKeITcaFnEYPSkls+KksDHyVg8UjXiycU/5qGN3vd2gJG0rPidfQwfA3F1+igNwonQntq9UjZYuGiZvfBRxakM46GUQMXty5Sd11D6LxfSbcm6nQxvc2Ikzt5q2JDp7Z8DNmI3OUeh7pABQrA4+jyj4s3CHLNEMu5UeVCOQxsvyC3OE+NmOqIdJQYlcekl0s+Cu65IK7abAFcVuX0hxSzni20hp9Br6Gz3BywvuI9xaT92c7tW2tNGThNvI4d4+um76f2LJf9PwtKcgIfT3AoJizbWvw8u8eBZx4sz0TlsyMNwOkG1Mdty4BIZDPs7gSWqa9J6Dqnp6hPHN3Qv1O/rbkkVZfQZ8665o+di5qtcURxN8+0708Leq43gvWcsLjKSChtfdsg9ZykKm6soJCQSNGeJH8= 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 Tue, Jan 24, 2023 at 01:27:50AM +0000, Sean Christopherson wrote: > 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 > Ok, I rebased TDX part to the updated branch. git@github.com:yamahata/linux.git tdx/upm git@github.com:yamahata/qemu.git tdx/upm Now it's v6.2-rc7 based. qemu needs more patches to avoid registering memory slot for SMM. -- Isaku Yamahata