From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 B07DA24E002 for ; Wed, 12 Mar 2025 19:32:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741807959; cv=none; b=C5ltYZaAuPEhfVIsE5arCuEHKBYpj7vLbTfmjXTOqOVteTzpRtjYeqVdcLEt0tcKKqGKtPTtFt4mCNV/nsWZpGW5CVF8Of6BYHwcmvaOzzE2qEUQj8hty7VmRbxje8gUkUdgglnC5JVpzdwbCK1+mDKEf/hkacF6V0XUK6qkK1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741807959; c=relaxed/simple; bh=xgBdBBk7i8LAgh8FiRTW2kFqQf8f3xZuiFRK09preGE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XuLfqdX4iABlFksjlBdin20uZ9Br9UQvg03hC0OkS340t73sGr9XbdbwLS5LwAvoXMShFBt+7raG8f0s6onZz11PfQPdTlif0FLBu+kWnOcI8TWqwqycVB1kXW56tNamaLLQ5O0goQLjf3Qpo1f8b5V8kJ+0T16Nxudk/R640n8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RV0vJD6U; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RV0vJD6U" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1741807956; 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=cXwwCzq0XPmqyi1BVWI5psFQo3FiUiCtEITxNLAbSss=; b=RV0vJD6UAewLPRsi4mGVSBdEYqPMHZ13JvRAv0monfpbr5cnRZD/o+tCR/UWLqiElae8vN c1ozSPvWIk7FvABeUFTGqBneCVkHdW0Neme5BB6O7z3dabVbWnjrg56nLkIELQ8KAyXAc4 fpcPeQUaUZqxTlLcUzfnzKkv5qAIaQ4= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-498-UD9Qw37wOkGhZs2bUb2GIA-1; Wed, 12 Mar 2025 15:32:35 -0400 X-MC-Unique: UD9Qw37wOkGhZs2bUb2GIA-1 X-Mimecast-MFC-AGG-ID: UD9Qw37wOkGhZs2bUb2GIA_1741807955 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7c0a8583e60so20169885a.2 for ; Wed, 12 Mar 2025 12:32:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741807955; x=1742412755; 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=cXwwCzq0XPmqyi1BVWI5psFQo3FiUiCtEITxNLAbSss=; b=XKDicacBcUxsraVVTI6aUuS09HWRjlH0HtrM3w/Vk6aMQIlUcUiUA6XncoU5zkxk7U x1ZPStyOqSdi1G7wINqx6t0qnwt12Dy79TdjD6yni6gvKxjtxSRCcIXUr9IReW4FMyJh hZAT4m5OJUknzDqkNkjqucCbGyfP8tc4cjE6f6oAFKjLuHpPgH1HJGDDhdasCJnVM16Z lL5SEiL2O4I0ARIIiE0o4tgyrCe6Fs5EMlpH+ASredGIMEJj4F9MyUfuqnuijL70T9f8 caEGUSfGCKJYKeHI2sD05Vls+/2cxp6C52VwzEp/70ie5qtSynayCPM6UEnsOp8zlbkp 5PgQ== X-Forwarded-Encrypted: i=1; AJvYcCUiM3zJoDyoJdCgh206ADtgaqFTQ/4947LYNTWsMPJ0E/k/TGx1OZhqzXEUQYkugURPthWvsmwgYUSFUOk=@vger.kernel.org X-Gm-Message-State: AOJu0YwXpmVvKvYenb48hAPR09rwFXf/9hQSX1W9UUndjisQcn4bITVY 57sQLNxX1z9xiEkupZH8BgIJgiMPsa+QXun9MduJ7s64UF8JB9fZZs+bMZ3QFHJ8OAODTdW5FEf 6a7IurkPMaTyZkgVjgHgUWIreT8z3ETMOB/aqJQC8FvzSXSPT66ZeVa3jv4jl2m/q6CfChQ== X-Gm-Gg: ASbGncuVXGVtPhxgU3qxr4lqbjVnFrJO6iY/BPFleCed/BPnfNLowtDoQZph4ZA5RkY tzdq1Thgg4Ywo/4IbeIvnoD8+EqwZTqi05UveqgUymqMwgQNjGY6k90IdsGtb5dRRtQuelGzvc/ HwnErWfTKKhYK6mi+31uS3pd9zGzmIo3TsHzRcHbdZyCyANUHuC8QNVnLUWZTIRgq1ilGZCBe86 Kv1AV35h7/njGS9Woj0WJU91G0ZYLZ3fJcpoklF5NInVtkbm+G+qWvFZplPQWF4bWUkHdk9wz4R qYa1Vyk= X-Received: by 2002:a05:620a:268e:b0:7c5:55f9:4bbf with SMTP id af79cd13be357-7c555f94e37mr2089058485a.7.1741807954922; Wed, 12 Mar 2025 12:32:34 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG21UoB4UhW6J7OnJXCWJmtkS+rArAGv2lRBmFk4GlTGcEtlkmQsqJSDwW+31DKN2CBG4Usgw== X-Received: by 2002:a05:620a:268e:b0:7c5:55f9:4bbf with SMTP id af79cd13be357-7c555f94e37mr2089054185a.7.1741807954664; Wed, 12 Mar 2025 12:32:34 -0700 (PDT) Received: from x1.local ([85.131.185.92]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7c54c8f99absm570901185a.117.2025.03.12.12.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Mar 2025 12:32:33 -0700 (PDT) Date: Wed, 12 Mar 2025 15:32:30 -0400 From: Peter Xu To: Nikita Kalyazin Cc: James Houghton , akpm@linux-foundation.org, pbonzini@redhat.com, shuah@kernel.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, lorenzo.stoakes@oracle.com, david@redhat.com, ryan.roberts@arm.com, quic_eberman@quicinc.com, graf@amazon.de, jgowans@amazon.com, roypat@amazon.co.uk, derekmn@amazon.com, nsaenz@amazon.es, xmarcalx@amazon.com Subject: Re: [RFC PATCH 0/5] KVM: guest_memfd: support for uffd missing Message-ID: References: <20250303133011.44095-1-kalyazin@amazon.com> <9e7536cc-211d-40ca-b458-66d3d8b94b4d@amazon.com> <7c304c72-1f9c-4a5a-910b-02d0f1514b01@amazon.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <7c304c72-1f9c-4a5a-910b-02d0f1514b01@amazon.com> On Wed, Mar 12, 2025 at 05:07:25PM +0000, Nikita Kalyazin wrote: > However if MISSING is not registered, the kernel will auto-populate with a > clear page, ie there is no way to inject custom content from userspace. To > explain my use case a bit more, the population thread will be trying to copy > all guest memory proactively, but there will inevitably be cases where a > page is accessed through pgtables _before_ it gets populated. It is not > desirable for such access to result in a clear page provided by the kernel. IMHO populating with a zero page in the page cache is fine. It needs to make sure all accesses will go via the pgtable, as discussed below in my previous email [1], then nobody will be able to see the zero page, not until someone updates the content then follow up with a CONTINUE to install the pgtable entry. If there is any way that the page can be accessed without the pgtable installation, minor faults won't work indeed. > > > as long as the content can only be accessed from the pgtable (either via > > mmap() or GUP on top of it), then afaiu it could work similarly like > > MISSING faults, because anything trying to access it will be trapped. [1] -- Peter Xu