From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ADE4321BB for ; Tue, 7 Nov 2023 21:10:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="VCorqgMs" Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F58711F for ; Tue, 7 Nov 2023 13:10:47 -0800 (PST) Date: Tue, 7 Nov 2023 21:10:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1699391445; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3Wam5uJ/giI5sPmJbt/lLRc8JhACqZV9mmqdqDS/oEI=; b=VCorqgMsut843PLsDqSsbrfede5+xOgI9SV/8u8tDf3EWMMmi+fofoL2fbhRV8qNa8CDGM UGgjO4Sks4rEiPOVOzf2e4bmCUS2uRbEh6EgyPNyTzLcJItckIkzFZ9kU1BlL7CGMcWLHE Gkilv5g28cvuMJ7uXHZibPGfUlEl1AI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Oliver Upton To: David Matlack Cc: Paolo Bonzini , Peter Xu , kvm list , Sean Christopherson , James Houghton , Oliver Upton , Axel Rasmussen , Mike Kravetz , Andrea Arcangeli Subject: Re: RFC: A KVM-specific alternative to UserfaultFD Message-ID: References: Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT On Tue, Nov 07, 2023 at 12:04:21PM -0800, David Matlack wrote: > On Tue, Nov 7, 2023 at 8:25 AM Paolo Bonzini wrote: [...] > > My > > gut feeling even without reading everything was (and it was confirmed > > after): I am open to merging some specific features that close holes in > > the userfaultfd API, but in general I like the unification between > > guest, userspace *and kernel* accesses that userfaultfd brings. The fact > > that it includes VGIC on Arm is a cherry on top. :) > > Can you explain how VGIC interacts with UFFD? I'd like to understand > if/how that could work with a KVM-specific solution. The VGIC implementation is completely unaware of the existence of UFFD, which is rather elegant. There is no ioctl that allows userspace to directly get/set the VGIC state. Instead, when userspace wants to migrate a VM it needs to flush the cached state out of KVM's representation into guest memory. I would expect the VMM to do this right before collecting the final dirty bitmap. If UFFD is off the table then it would appear there are two options: - Instrument these ioctls to request pages not marked as present in the theorized KVM-owned demand paging interface - Mandate that userspace has transferred all of the required VGIC / ITS pages before resuming on the target The former increases the maintenance burden of supporting post-copy upstream and the latter *will* fail spectacularly. Ideally we use a mechanism that doesn't require us to think about instrumenting post-copy for every new widget that we will want to virtualize. > So in the short term we could provide a partial solution for > HugeTLB-backed VMs (at least unblocking Google's use-case) and in the > long-term there's line of sight of a unified solution. Who do we expect to look after the upstreamed short-term solution once Google has moved on to something else? -- Thanks, Oliver