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 X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55DC1C433E2 for ; Fri, 4 Sep 2020 13:39:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1116D2083B for ; Fri, 4 Sep 2020 13:39:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="ICshZPu8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1116D2083B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8D0108E0001; Fri, 4 Sep 2020 09:39:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 87F3D6B00A2; Fri, 4 Sep 2020 09:39:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 76E0E8E0001; Fri, 4 Sep 2020 09:39:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0212.hostedemail.com [216.40.44.212]) by kanga.kvack.org (Postfix) with ESMTP id 61E966B00A1 for ; Fri, 4 Sep 2020 09:39:12 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1D8B4181AC9B6 for ; Fri, 4 Sep 2020 13:39:12 +0000 (UTC) X-FDA: 77225485344.15.song62_3c0bd0d270b2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id DBF221814B0C8 for ; Fri, 4 Sep 2020 13:39:11 +0000 (UTC) X-HE-Tag: song62_3c0bd0d270b2 X-Filterd-Recvd-Size: 6648 Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) by imf19.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Sep 2020 13:39:11 +0000 (UTC) Received: by mail-qt1-f195.google.com with SMTP id 92so4578094qtb.6 for ; Fri, 04 Sep 2020 06:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to; bh=y63H0eil7cRo4Z3Spspx32PZ0iMyNjkSmFBNpt+Ifzc=; b=ICshZPu87gxXRV7go1aGqkfsunf1FfCR+1VSRcVy2Jfz3Pt57eXImUODRxkivPv6Ao n2nx79VlpBPHr+gBU3n4+nFJPVFJl+Em8rtdGjq6x/+9gZP4mXcTkZ/ljUSnE7kwDPmB xaL+CMOMHlbTOnBWuegBbDcByLozg73il/uvBUTN3XCxlC1aKzKB0oDqFhEJ85jVhs0q ijqLbr1284NBoa3O/6PX3sOrNfx/RUdnDILVPlYxOQzxXn1AzSFzvBmqe4h4IFkxlsYO cRcC/RiUTXhHqkDFnQykKAOFqHCGYfdHujl/51OfyASEf+YEiOCOUJJmF8b+RGpIkONO pszw== 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:content-transfer-encoding :in-reply-to; bh=y63H0eil7cRo4Z3Spspx32PZ0iMyNjkSmFBNpt+Ifzc=; b=Z1JBMmNs/Twj3HmTb6cSEwlsC61DfR5WddGd40olQ7zmg6wd5NvfiQQPwSoGv50o6M L9ynj1X4uad2RgnLpxeZTG/BUcH6+ZmjORTsxmuaSD57Q4Bx+56ZR567vTUTjSalHbr+ 40Zq8meibFjv2zUyMq43M2iryxeWkvWwG+3i4nWBeg6ybeRgdxiZE1foUVQWiV/KkFpb 7B5KEj2QV6rr/waB/0ODouzACG2PDPE9cxt0CsJC4chJRuCbEqZhatnZ/rDYRCu7UDAL zIZUr2aku/gn1NOitnZYDb42xbDL/PTT4rZj3jgI5Uwh3kPZhrWir6fKcPIRajf6wXMz zjCw== X-Gm-Message-State: AOAM532kcF9PWYwXVkFCxXesMFbtGtshXTNZfKqHvh3zWfEvS3juAbPr cZfDs2JhaeA7J4U9MGzdkVDB7Q== X-Google-Smtp-Source: ABdhPJz4IYp9Yx0ptsdpwS3IyFtCg0MoRemzPNZPgMuvPTnjIWvlfGmsXRez56Ul+LW7plLhZ+wCXg== X-Received: by 2002:ac8:1a52:: with SMTP id q18mr8853580qtk.274.1599226748978; Fri, 04 Sep 2020 06:39:08 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id g64sm4384220qkf.71.2020.09.04.06.39.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Sep 2020 06:39:08 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kEBvn-007Wkb-Gn; Fri, 04 Sep 2020 10:39:07 -0300 Date: Fri, 4 Sep 2020 10:39:07 -0300 From: Jason Gunthorpe To: Mircea CIRJALIU - MELIU Cc: Adalbert =?utf-8?B?TGF6xINy?= , "linux-mm@kvack.org" , "linux-api@vger.kernel.org" , Andrew Morton , Alexander Graf , Stefan Hajnoczi , Jerome Glisse , Paolo Bonzini , Mihai =?utf-8?B?RG9uyJt1?= , Andy Lutomirski , Arnd Bergmann , Sargun Dhillon , Aleksa Sarai , Oleg Nesterov , Jann Horn , Kees Cook , Matthew Wilcox , Christian Brauner Subject: Re: [RESEND RFC PATCH 0/5] Remote mapping Message-ID: <20200904133907.GS24045@ziepe.ca> References: <20200904113116.20648-1-alazar@bitdefender.com> <20200904121148.GR24045@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: DBF221814B0C8 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable 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 Fri, Sep 04, 2020 at 01:24:43PM +0000, Mircea CIRJALIU - MELIU wrote: > > On Fri, Sep 04, 2020 at 02:31:11PM +0300, Adalbert Laz=C4=83r wrote: > > > VMAs obtained by mmap()ing memory access fds mirror the contents of > > > the remote process address space within the specified range. Pages = are > > > installed in the current process page tables at fault time and remo= ved > > > by the mmu_interval_notifier invalidate callbck. No further memory > > management is involved. > > > On attempts to access a hole, or if a mapping was removed by > > > PIDFD_MEM_UNMAP, or if the remote process address space was reaped > > by > > > OOM, the remote mapping fault handler returns VM_FAULT_SIGBUS. > >=20 > > I still think anything along these lines needs to meet the XPMEM use = cases as > > well, we have to have more general solutions for such MM > > stuff: > >=20 > > https://gitlab.com/hjelmn/xpmem > >=20 > > However, I think this fundamentally falls into some of the same bad d= irection > > as xpmem. > >=20 > > I would much rather see this design copy & clone the VMA's than try t= o > > mirror the PTEs inside the VMAs from the remote into a single giant V= MA and > > somehow split/mirror the VMA ops. >=20 > This design was made specifically for virtual machine introspection, wh= ere we=20 > care more about the contents of the address space, rather than the remo= te VMAs > and their vmops. (Right now only anon pages can be mapped, but I guess > we can extend to pagecache pages as well.) I just used what seemed to b= e the > common denominator to all page-related operations: range invalidation. > This looks like a general solution. The point is that a VMA is how the MM connects its parts together, cloning the content of a VMA without the rest of the VMA meta-data is just going to be very fragile in the long run..=20 Especially if the VMA is presented as a normal VMA with working struct pages/etc, not a pfn map. > IMO cloning a VMA in an address space that has a completely different l= ayout > will present its own set of caveats: What happens if the VMA resizes/sp= lits?=20 > Can you replay all the remote VMA vmops on the clone VMA? The mirror would have to reclone the source VMA every time the source VMA changes. > > This is just too weird and fragile to be maintaible over a long term. > >=20 > > For instance, one of the major bugs in things like xpmem was that the= y are > > incompatible with get_user_pages(), largely because of this issue. >=20 > We support get_user_pages(), that's how we integrate with KVM. This seems really sketchy, get_user_pages is sensitive to the VMA, what happens when VMA flags are different/etc? Jason