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 C3665D307 for ; Thu, 9 Nov 2023 22:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vz1sHPcR" Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D7714206 for ; Thu, 9 Nov 2023 14:44:47 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-32fadd4ad09so912529f8f.1 for ; Thu, 09 Nov 2023 14:44:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699569885; x=1700174685; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oEHk7Szdsc46fYaY/zOqEjHTCfMq3/MMsT0vQVQOtlY=; b=vz1sHPcRPm0IKPinbkse2f5BwvCrUzyPaGVIsRcH7x1Jc/sDZOA8s4hNVyHQsM2XSR h4QXbqtfVIBBn5korYm20QiC2AECPmvpQzVlqeY4ALK/ejXMs2mNH2jAmfqpM8/asOpx O0xhTqQvfAP+BEwvSDzWKo9Vz/uTAdXbFexUH1Irgcs4M+EoAHwcxExAfBRI+O4wW7zr 4OBvlO+dIf+fJkE933k46lT1bel1+LI2K1+KswtBl0biMq0JRGGlFiRfsPuT8be8/zTj b/lBlQABhLrART+D1PZyVSQittqs9sFOTgnRF05XJoy+SxvIuSce40OkZO6ynWIpCqr7 dyqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699569885; x=1700174685; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oEHk7Szdsc46fYaY/zOqEjHTCfMq3/MMsT0vQVQOtlY=; b=ZHoMEeFAo7mW1tMbPfAz0u0BlcOrcNcjwWAtVM+nMDWjwVjTPm1n7Te2qukZWKLJpE 5CubszNGR2cl/v43wQmUgHvSsmhjbGEv/DZDfJDXkK1PjazBl3bvzPMnmh1L489RPcCx 19R1GjtDOJgTr69t/6l3/iDt1uiQKxN0kmF0054EkdcAKMQ2u6f2K7HWO0locLNa2eda p/fsTfSHI3sly/hsNXQAbeVREbQNj9DYOPac0iBiv60UDWyLefY/mKQw0b0PoQf6PfgP 52NXJnqS/3QAceqCbQdaZM6DznpL7rL+AANZ462g+LE/g+cEVOVkliSBgmaY5J7kVQHi SCGw== X-Gm-Message-State: AOJu0Yz75KQrLdIdFozO37pQMWgCvg6NeCLdA2aXapKrj4jCjgt00tF1 NQKXwjXVBkxACSECi9AV/4qXE0AMHC5oHZiWTcuOUg== X-Google-Smtp-Source: AGHT+IHihzgotT8DWstn6jBTf86N0w2EZ704+c2t/i0cb2P2uSYWr6BV5Gys7wu1M6lYRnb2l0ViaAYxUc3Xabe/EFc= X-Received: by 2002:a05:6000:1863:b0:331:3469:d58c with SMTP id d3-20020a056000186300b003313469d58cmr2509193wri.33.1699569885482; Thu, 09 Nov 2023 14:44:45 -0800 (PST) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: David Matlack Date: Thu, 9 Nov 2023 14:44:16 -0800 Message-ID: Subject: Re: RFC: A KVM-specific alternative to UserfaultFD To: Sean Christopherson Cc: Peter Xu , Paolo Bonzini , kvm list , James Houghton , Oliver Upton , Axel Rasmussen , Mike Kravetz , Andrea Arcangeli Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Nov 9, 2023 at 10:33=E2=80=AFAM David Matlack = wrote: > On Thu, Nov 9, 2023 at 9:58=E2=80=AFAM Sean Christopherson wrote: > > For both cases, KVM will need choke points on all accesses to guest mem= ory. Once > > the choke points exist and we have signed up to maintain them, the extr= a burden of > > gracefully handling "missing" memory versus frozen memory should be rel= atively > > small, e.g. it'll mainly be the notify-and-wait uAPI. > > To be honest, the choke points are a relatively small part of any > KVM-based demand paging scheme. We still need (a)-(e) from my original > email. Another small thing here: I think we can find clean choke point(s) that fit both freezing and demand paging (aka "missing" pages), but there is a difference to keep in mind. To freeze guest memory KVM only needs to return an error at the choke point(s). Whereas handling "missing" pages may require blocking, which adds constraints on where the choke point(s) can be placed.