Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3891435rwa; Tue, 23 Aug 2022 12:00:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR62bLeXi19KVI2/BD4HLsusvsV26hHIjGtCE8iBTc9VeMQCrEBGQ3NOtqFmAuyBboktU5HN X-Received: by 2002:a05:6402:270c:b0:446:f754:371a with SMTP id y12-20020a056402270c00b00446f754371amr4844161edd.388.1661281251074; Tue, 23 Aug 2022 12:00:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661281251; cv=none; d=google.com; s=arc-20160816; b=WjOpxsuxi0JIoukfG8+tzHHHIzPyM33UwQ52h4QPEB6zpS90RfG6fgCaIPRsaaReyp jLgkpcTQ0o4/h3EE6X1Xz8MeFbnVb+d9U8aXqlrZYBo7GwNiTyrBbKDjulniP2LaLVUE exK7J0SeTRhI0vZvZM8vlO/7GjhsqtRmmAcaWEhoGC/zSz6Z6dBEnOkJpOdAwBDR9VCu 6cLU60eLNvayIPK/PG6YqF6N+I9qm9uvKQlh2x5dnj6JSTg+NX9tEK2gPQnJcMLcqRr4 6EmAQy8/98SZzt+ryylsH2+6eXgH2rmPA4EeSDU3U4Cmf6bJZWtvJ1UnNVciS/sYzTdI 0+ZQ== 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=aVBt+IuocN3gZGMsPNsv72g8OF66w1EEamrVZjnB+J4=; b=IQQ6dAhid/G9UmsAB7ZxeeWdZH4CcRlc5eAkrCLRM9rn4gBZTmVsGjFoybBvzcxYHw iFtZx5K4vcLBsTYxPeTkk4Sfa0Qy3638TFnB3yXJ8GZSvyLrXTVv5qHzqK8DxdM2om3o eSEK+OI37GgBmDok0+OrmzjV7wIZuLTmZy1FVBveqVUCTXijOUrl2PNYqCrV7OO6vrB3 f5ku7zuJR2deUn+Vhji0kAs6RHVmkgdx+I5X1tRMtMNhg1U4t1RtJZhyDY+zXW/kxxrU Kk9WIeEfqUXueRarpv7f+ea35zuf5p0SKrzW9+R/Ekbs1Q3BYK+YETEtQF+6DZzpJ6Oq fjWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=aHRlHO4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a05640234c600b00446b907d8d2si3071411edc.7.2022.08.23.12.00.23; Tue, 23 Aug 2022 12:00:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=aHRlHO4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229907AbiHWSAI (ORCPT + 99 others); Tue, 23 Aug 2022 14:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232918AbiHWR7t (ORCPT ); Tue, 23 Aug 2022 13:59:49 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EAE6D4F77 for ; Tue, 23 Aug 2022 09:05:32 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id 67so5698702pfv.2 for ; Tue, 23 Aug 2022 09:05:32 -0700 (PDT) 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; bh=aVBt+IuocN3gZGMsPNsv72g8OF66w1EEamrVZjnB+J4=; b=aHRlHO4kNIRNDNrpKgB2QM9cSMZjQBb6u4l59Y4E0tZW/BrvBnqckZTcn9cz3SUw3D igHUCLBokcR+QGB8XUc1cJbRn7hVuyKGyfeg1tfWEOZHpP64tT9cUzSSzx1Y0vgX+Uyv RPdN051ayBxF8NbSnhZI7UkDJIxJC2b9PXw94OGmVsv1/XB2K1qoCbLTnhTe5HqVT1w+ uDjWiexbtDjcheCp9qg/+R4RDyAtHxBooBSO8W1phCNDG09PvGpKx4gmxB38OKo5Au+a wQuvSmBbg3eLIxGH8V0BVxy3Pbhs0aKjR4E9VsFcpOdyvMRpUtUfAdi6lWLpFgc21aKV eFRg== 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; bh=aVBt+IuocN3gZGMsPNsv72g8OF66w1EEamrVZjnB+J4=; b=C5dH7OHymtLo4jy64Vp4MpKGc7M+qeqBoYk5xXxU2FAGg34u33qkI7xv+TN89d5Kk1 xTCnIj/Or8rNZ85TY8Y2b2RsrTZSFrb18e5ksWkDhhNiHG1FF3R+4rkpio5YhEOXv7XQ i+gN2tSBiggEfpcP49NpizVfM41qbF0y+Niq+zpan2rLuIBru1A+bDvDhVWybWNSnMnq I5geYqBDfoKaEO7GFGJ6INKFp0aHEjFTjHuInBVJVUghil/VDiNvpdXb4qIjF+/A93pH J5IDcZdcbNfUw2QanfUDpqd5IJc9BKVZQ/IGOLyxPvWOKTO9/HSsikHuzFAZ0XBluENG nrAg== X-Gm-Message-State: ACgBeo1pYuiRrFU08hphtRXcZ7+7GIZzzN6UGfCLZGpq6kxrscqjgsYg nwy8247Qnp3OKYNv3h8ckszgYw== X-Received: by 2002:a63:1c11:0:b0:41d:89d5:8ef0 with SMTP id c17-20020a631c11000000b0041d89d58ef0mr21289304pgc.403.1661270731660; Tue, 23 Aug 2022 09:05:31 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id z27-20020aa7959b000000b00536ede9e344sm2384650pfj.14.2022.08.23.09.05.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Aug 2022 09:05:31 -0700 (PDT) Date: Tue, 23 Aug 2022 16:05:27 +0000 From: Sean Christopherson To: David Hildenbrand Cc: Hugh Dickins , "Kirill A . Shutemov" , Chao Peng , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, linux-kselftest@vger.kernel.org, Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , Michael Roth , mhocko@suse.com, Muchun Song , "Gupta, Pankaj" Subject: Re: [PATCH v7 00/14] KVM: mm: fd-based approach for supporting KVM guest private memory Message-ID: References: <20220706082016.2603916-1-chao.p.peng@linux.intel.com> <20220818132421.6xmjqduempmxnnu2@box> <226ab26d-9aa8-dce2-c7f0-9e3f5b65b63@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,FSL_HELO_FAKE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 23, 2022, David Hildenbrand wrote: > On 19.08.22 05:38, Hugh Dickins wrote: > > On Fri, 19 Aug 2022, Sean Christopherson wrote: > >> On Thu, Aug 18, 2022, Kirill A . Shutemov wrote: > >>> On Wed, Aug 17, 2022 at 10:40:12PM -0700, Hugh Dickins wrote: > >>>> On Wed, 6 Jul 2022, Chao Peng wrote: > >>>> But since then, TDX in particular has forced an effort into preventing > >>>> (by flags, seals, notifiers) almost everything that makes it shmem/tmpfs. > >>>> > >>>> Are any of the shmem.c mods useful to existing users of shmem.c? No. > >>>> Is MFD_INACCESSIBLE useful or comprehensible to memfd_create() users? No. > >> > >> But QEMU and other VMMs are users of shmem and memfd. The new features certainly > >> aren't useful for _all_ existing users, but I don't think it's fair to say that > >> they're not useful for _any_ existing users. > > > > Okay, I stand corrected: there exist some users of memfd_create() > > who will also have use for "INACCESSIBLE" memory. > > As raised in reply to the relevant patch, I'm not sure if we really have > to/want to expose MFD_INACCESSIBLE to user space. I feel like this is a > requirement of specific memfd_notifer (memfile_notifier) implementations > -- such as TDX that will convert the memory and MCE-kill the machine on > ordinary write access. We might be able to set/enforce this when > registering a notifier internally instead, and fail notifier > registration if a condition isn't met (e.g., existing mmap). > > So I'd be curious, which other users of shmem/memfd would benefit from > (MMU)-"INACCESSIBLE" memory obtained via memfd_create()? I agree that there's no need to expose the inaccessible behavior via uAPI. Making it a kernel-internal thing that's negotiated/resolved when KVM binds to the fd would align INACCESSIBLE with the UNMOVABLE and UNRECLAIMABLE flags (and any other flags that get added in the future). AFAICT, the user-visible flag is a holdover from the early RFCs and doesn't provide any unique functionality. If we go that route, we might want to have shmem/memfd require INACCESSIBLE to be set for the initial implementation. I.e. disallow binding without INACCESSIBLE until there's a use case.