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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 72226C3DA4A for ; Thu, 1 Aug 2024 22:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:In-Reply-To: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=acXEWndKlCVnwDNwF3qRu8zmTJbIkY9TPABZaKHwjrc=; b=nQox15JjZXMhfSCxhONwE7H/00 7bph9HuH92aQNK58v0ySjW5KvyoK+/Lf8sZ5eqGv03NZCOpsgMcFtTvq6Y8l5kEvsFWuJCjR1jl4M 4cJIyesjoIr2cco3/cFFzmOqlqRSgXX0reUjwwpciemewb3do/oBwg5BXipeakyrkGsQvN36WCGF7 JHAcBVSNn9nfczBLUEJ1JgSBcB0kTtqeDOGSwf1fKH6NtvvFeRij3U6kbSm+/Bkgzz5ITOpLEcf3V w7SiJYEDySivuozJrsvAxWlmdCyGRiR6NtXPH6MaXRpzZB2P0JGQllhs4Ea4BrN/c5Pb3oVtfIzs3 54MBwH2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZeCq-00000006tT8-2rAU; Thu, 01 Aug 2024 22:23:32 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sZeCK-00000006tL7-1ST5 for linux-arm-kernel@lists.infradead.org; Thu, 01 Aug 2024 22:23:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1722550978; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=acXEWndKlCVnwDNwF3qRu8zmTJbIkY9TPABZaKHwjrc=; b=jBNp0j8y5noDVbgiaWc2bLPDJcmP6l1cUrMV6YCLxKBebPg64/1h4zQ9sXwMAXvdadi5al uSIBlL7MIwixl+XNUAIO5mVjfBJjaL8yjKjJWCWSM9StIn/lMCHqR/vGxUP282TuuD8Mgv wm25khkU+jiAqAZXawQtjBV8jX7YC3Q= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-176-3DwgrPBPNVCeJrkQbh-OdQ-1; Thu, 01 Aug 2024 18:22:56 -0400 X-MC-Unique: 3DwgrPBPNVCeJrkQbh-OdQ-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7a1d3392009so52672085a.3 for ; Thu, 01 Aug 2024 15:22:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722550975; x=1723155775; 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=acXEWndKlCVnwDNwF3qRu8zmTJbIkY9TPABZaKHwjrc=; b=Q/qnPmDielBKM0esfUggfATA1Q+p39opkUbxuzagINYHZ2WneVhjeRve7z6m8RYmKl tR20GK3n+9J4XrK+t+iDA7kZZxALVD4ozID/6g/MiDsbf+kQB4oq7B3sxTuQenZ10zmb JeajeoYiFlazMLbQJj0lKqWlWboBPn/pZVXPuvGAJMGjhgrm9/jlRdEBl/Z6S8HKumvR 9fIOLLpw6LKjUE8Ygo98dVnY+G9qVl9BIklI2XISmPc7AbH8OE7dz1/7c0EyGWl5Y68P 7e1AkHFF9Cx9XwPn39md31duppmVLyKaK7/AO39XeiaLcUcF3uS1FR+uJYHBXbTy2vZ/ ZKyg== X-Forwarded-Encrypted: i=1; AJvYcCXuHq9bmCKkmgTSdBM2rLsXdXKRLHKzyiFyhLnPG/Oczw85lPEzUGivrla3lhuWsfipQNjbWz21JWfmi1x4xP2Y@lists.infradead.org X-Gm-Message-State: AOJu0YygLn5DI6ZHLVRJXACxb8PZmkESfZsbws2/6lpNVLJndQrIdkxn vfQV/IXqliYX9lO57iGbbd6BJKA26yPEHD9XMlVwfaLeM9ZB+BjeO0IuwP7qCtac8QvvT47D4sb 1Uvhw+KX621SjIlnxclounbZbtDL37Um7IivHCeSp/OJbTLF5B/qonXxWKa1WMwFspqBggfIo X-Received: by 2002:a05:620a:3902:b0:79f:78a:f7d6 with SMTP id af79cd13be357-7a34ef0f061mr104414285a.1.1722550975316; Thu, 01 Aug 2024 15:22:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEepfEQvZgBRjF0n6c40OJFUnxDJginkdVQ49bHtnVFZ0KbqFVRZ0T0eM1Jvx3otgOTXKNadw== X-Received: by 2002:a05:620a:3902:b0:79f:78a:f7d6 with SMTP id af79cd13be357-7a34ef0f061mr104411785a.1.1722550974882; Thu, 01 Aug 2024 15:22:54 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a34f787aa6sm31839085a.103.2024.08.01.15.22.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 15:22:54 -0700 (PDT) Date: Thu, 1 Aug 2024 18:22:51 -0400 From: Peter Xu To: James Houghton Cc: kalyazin@amazon.com, Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Sean Christopherson , Shuah Khan , Axel Rasmussen , David Matlack , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, roypat@amazon.co.uk, Paolo Bonzini Subject: Re: [RFC PATCH 14/18] KVM: Add asynchronous userfaults, KVM_READ_USERFAULT Message-ID: References: <20240710234222.2333120-1-jthoughton@google.com> <20240710234222.2333120-15-jthoughton@google.com> <4e5c2904-f628-4391-853e-37b7f0e132e8@amazon.com> <4cd16922-2373-4894-b888-83a6bb3978e7@amazon.com> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240801_152300_481174_74BCB317 X-CRM114-Status: GOOD ( 23.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 29, 2024 at 02:09:16PM -0700, James Houghton wrote: > > A more general question is, it looks like Userfaultfd's main purpose was > > to support the postcopy use case [2], yet it fails to do that > > efficiently for large VMs. Would it be ideologically better to try to > > improve Userfaultfd's performance (similar to how it was attempted in > > [3]) or is that something you have already looked into and reached a > > dead end as a part of [4]? > > My end goal with [4] was to take contention out of the vCPU + > userfault path completely (so, if we are taking a lock exclusively, we > are the only one taking it). I came to the conclusion that the way to > do this that made the most sense was Anish's memory fault exits idea. > I think it's possible to make userfaults scale better themselves, but > it's much more challenging than the memory fault exits approach for > KVM (and I don't have a good way to do it in mind). > > > [1] https://lore.kernel.org/lkml/4AEFB823.4040607@redhat.com/T/ > > [2] https://lwn.net/Articles/636226/ > > [3] https://lore.kernel.org/lkml/20230905214235.320571-1-peterx@redhat.com/ > > [4] > > https://lore.kernel.org/linux-mm/CADrL8HVDB3u2EOhXHCrAgJNLwHkj2Lka1B_kkNb0dNwiWiAN_Q@mail.gmail.com/ Thanks for the link here on [3]. Just to mention I still remember I have more thoughts on userfault-generic optimizations on top of this one at that time, like >1 queues rather than one. Maybe that could also help, maybe not. Even with that I think it'll be less-scalable than vcpu exits for sure.. but still, I am always not yet convinced those "speed" are extremely necessary, because postcopy overhead should be page movements, IMHO. Maybe there's scalability on the locks with userfault right now, but maybe that's fixable? I'm not sure whether I'm right, but IMHO the perf here isn't the critical part. Now IMHO it's about guest_memfd is not aligned to how userfault is defined (with a mapping first, if without fd-extension), I think it indeed can make sense, or say, have choice on implementing that in KVM if that's easier. So maybe other things besides the perf point here matters more. Thanks, -- Peter Xu