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 43C29C32774 for ; Sun, 21 Aug 2022 05:15:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3A9EC8D0002; Sun, 21 Aug 2022 01:15:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3583D8D0001; Sun, 21 Aug 2022 01:15:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F89E8D0002; Sun, 21 Aug 2022 01:15:56 -0400 (EDT) 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 0E5338D0001 for ; Sun, 21 Aug 2022 01:15:56 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CC757A8C27 for ; Sun, 21 Aug 2022 05:15:55 +0000 (UTC) X-FDA: 79822437870.30.60C608B Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by imf07.hostedemail.com (Postfix) with ESMTP id 85BEF40038 for ; Sun, 21 Aug 2022 05:15:55 +0000 (UTC) Received: by mail-qk1-f178.google.com with SMTP id i7so5869703qka.13 for ; Sat, 20 Aug 2022 22:15:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc; bh=ICbJbu994zVr5Xs1z95aw5HWEa26kaUMyLqHNb1JBhY=; b=PN7QnVx2jBrgPHqyqwc/bGpaE8KQadBOlUYLB6T+dOoTpwUJFZfkh7+JVXHp8AIDdn aHVqAoV2ZwSdEszZ8lrHjiDGK+3Uii266yrUQ3R+HEjiDpKwO+93234VMS0VxIslm3a2 GnKw+ulrN3ttL/lmXtLFPyG1MFfOBD03JI5VIL8VtHlzN+J13QiCn0MqBcDQjVUJ2yxu YXyfDyjsbE5tLakbt0uihPXt6VtlTnTU8qek0GTcV92IjJUEcnKUo2hYjjstnq3Z/sjr QdiFfxuMoiaHkH94kHcVhCTjcWUnNDlAi3dffLlojPKp6NroKfJZsJrztnzru2HRTkKk WHgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc; bh=ICbJbu994zVr5Xs1z95aw5HWEa26kaUMyLqHNb1JBhY=; b=yhHrFG4lC9M0jxPTsx6NXew4RjZjw5Q7/3OrocagN/nzPLDTVhTg6lnqxNc1SOc/t2 BO+47CFQo33+m6rTPa3fcaq2iWV7jzYlpsxqMMSHPIXchHoZTbjdkbRplpNTFzT7BiB2 qWIeVYDcz963RAQqH9kO2wa0QP78gEGSpmlNG446FRpy8YAehyqbvpFDT+4+8L2M5QxP DCfEANpJ+Pheut+vwJmm9mlfeeJ01nmkyqpTIQY0LuQzUQzKK1l0+v8lZEkdjtP7PoOC CVh+S2/uHRJ4ZWgUGJMh8eIbCJ3MhphYbF4zUdR52B16qarBZM5zGInnoZHEUB5g0Cvl u1RQ== X-Gm-Message-State: ACgBeo2Mus24AMgCSk3usgHwt2BNM9h0QyVo6HfLUyb0YBibi51Xl/A+ wa7hQ3XczS8svNwo+FRrerq6hA== X-Google-Smtp-Source: AA6agR68yl2fr8PEnDujhC7M2MHll9zueDCXCVVuM/SRsb8w23zlYBdOQcq71uTGZEOLB6PPe+MzJQ== X-Received: by 2002:a05:620a:70a:b0:6b6:1997:b7f2 with SMTP id 10-20020a05620a070a00b006b61997b7f2mr9605948qkc.417.1661058954697; Sat, 20 Aug 2022 22:15:54 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id s11-20020a05620a0bcb00b006bb9125363fsm7972537qki.121.2022.08.20.22.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Aug 2022 22:15:53 -0700 (PDT) Date: Sat, 20 Aug 2022 22:15:32 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: "Kirill A. Shutemov" 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 , Sean Christopherson , 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, david@redhat.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 In-Reply-To: <20220820002700.6yflrxklmpsavdzi@box.shutemov.name> Message-ID: References: <20220706082016.2603916-1-chao.p.peng@linux.intel.com> <20220818132421.6xmjqduempmxnnu2@box> <20220820002700.6yflrxklmpsavdzi@box.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661058955; 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=ICbJbu994zVr5Xs1z95aw5HWEa26kaUMyLqHNb1JBhY=; b=OpdJ1rmnQO+Zp0mhn96YG9CLaWgibzF41rU1gkoeuQKZnYpiHyHvBZExERzejoJHjuuGnq Lrffd+zTn3e993uvGtfHRE/cQ++CPH4R7Uacm2bkteh81n1VcQ2pzKO++V1vyu7dkctUDn g3c0BPwOeIuqhoYbdQkreTjhpq5HfPc= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=PN7QnVx2; spf=pass (imf07.hostedemail.com: domain of hughd@google.com designates 209.85.222.178 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661058955; a=rsa-sha256; cv=none; b=frRGyk6c+nmSQIkhI2LAN1NKqiOhSnTG8ZgWeU/g1/kUcUuD3c2iX7K9ya2hXJtaOgXHU/ NMuHenZTWhR0+8E5klNy43UG/6UDVeLxQhoCbj1/oaIQZ01E8fzhGc9kjAh3Af5OH/PoNi 5iITHZqTbq4+RVNXYzEIiG/cLWjUlAA= Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=PN7QnVx2; spf=pass (imf07.hostedemail.com: domain of hughd@google.com designates 209.85.222.178 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 85BEF40038 X-Stat-Signature: kmx1q9byogkhrwme8perhxyzpsquaqnz X-Rspam-User: X-HE-Tag: 1661058955-87935 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 Sat, 20 Aug 2022, Kirill A. Shutemov wrote: > > Yes, INACCESSIBLE is increase of complexity which you do not want to deal > with in shmem.c. It get it. It's not so much that INACCESSIBLE increases the complexity of memfd/shmem/tmpfs, as that it is completely foreign to it. And by handling all those foreign needs at the KVM end (where you can be sure that the mem attached to the fd is INACCESSIBLE because you have given nobody access to it - no handshaking with 3rd party required). > > I will try next week to rework it as shim to top of shmem. Does it work > for you? Yes, please do, thanks. It's a compromise between us: the initial TDX case has no justification to use shmem at all, but doing it that way will help you with some of the infrastructure, and will probably be easiest for KVM to extend to other more relaxed fd cases later. > > But I think it is wrong to throw it over the fence to KVM folks and say it > is your problem. Core MM has to manage it. We disagree on who is throwing over the fence to whom :) Core MM should manage the core MM parts and KVM should manage the KVM parts. What makes this rather different from most driver usage of MM, is that KVM seems likely to use a great proportion of memory this way. With great memory usage comes great responsibility: I don't think all those flags and seals and notifiers let KVM escape from that. Hugh