From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 09DFF37DABC for ; Thu, 11 Jun 2026 15:46:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781192797; cv=none; b=pn1L73MfwwaDVCbR5IL/dPHEtNfnpX2+fgV03TmRgxmAi0zI+JP7qt8AxeNPrmzPSYAmu4TCnMMpd5ZdhhELE+8JH0SpazzwqUl+VUhoRuA+++gbk2sTfu7W93K7x0dmXnAUDSLIQFI4eG4ixwq+ZP1moYX1Vb1ieFuirUF8pZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781192797; c=relaxed/simple; bh=rzzbz++k+Syo0+alvwR6Pj1Z4/WDKW3XNFj7YkGBOUo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=kP+NoJIX4CNwrM3DjlkFhkeuRwQ+zEiYXKK9uwOHCFyzX0KxYjl9s/N0hlvMeV65/BAHKT001CbsDLt8ptES0dTLqfLEWzIeBYHu8GdCOPgdHk+W/AXUApGRFqKK2v6mOrD8SLPSLH/4soQD6jG+9zn/G1JYzG165qPhBhRHRow= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RxrXnopI; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RxrXnopI" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2bf3636d6c0so85382215ad.2 for ; Thu, 11 Jun 2026 08:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781192792; x=1781797592; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=tkYI56ab44R+CGvXUlfI3ycHykGEF+9O0JMidioFwIA=; b=RxrXnopItWRUKFsvJuGu/1PEMqGZf8sHSY+ZZyZwYmXgTV2hEaRPyMGf1QLNH98tTn ZYN2GfMfyd+FplSUa48NpR+M0r95nKiCwss0a1QWG0TnLc5Hkahdz/jpnq6gUGPlIst/ mRrH17zalUoIhQMLjzjmNUFzu7+K/Z5vdCLia5VjfqRvdZIvrotw+uixqgU0LR5mhZDR lRFGybBNnW/rVx1yreVWQpGtI51qBbKAucX4xruEyIQf35FHnJKScMLOySKw15xtZLk9 gcwkrYUcQ/kGz6DlrSircsVUJE7fC7nLABOBPOa9dA4//CWR+bXiscN4mEF0V7UyrSNY TxyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781192792; x=1781797592; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tkYI56ab44R+CGvXUlfI3ycHykGEF+9O0JMidioFwIA=; b=IUKU0i65oQjLxg5N48e7ezaYwqwngFxxRcit4UwS8jKRdxE8CZ3c/kW3cG/aHueRRo NrviZ+zN1Zbw+3I8faKpqBTSTuCrjNQewxeJ2OlM8005095POxJgnt5tqk7J5Wx3nIbV BhvM9zAs/VrO7B6owDSGVpx/11tnemEKtWi99uSJjcs0vZGFjiqsw6KiLxRtFcMSFVdT I8z091Zxb+VEPYvJohUQO2fCpQI74vTOctDfAzNSqoXglprpWDYdrVpzlrjzwzxJDwQg iKDhijgMYn+X8YBqpsf3oHdpfBkX0+OteBo5aawZQskoY2Xzuo1P9KLJHFc6DMVWm3YV X1ZA== X-Forwarded-Encrypted: i=1; AFNElJ/pDrFpj8lz/GMukrEGPABs64x59mU2DDuG9323R30d9qZLGLpr15LE40f+RUAdlrTwxOO9EcEyilY=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9lAoxsPperHX1KKIG1EzMxb/J3J/MnhHp70wblKbpXfdjP+vD oGnk+QWn+sLkjECC5ihXLuk8Cl1slgYt9+a1zacaoUkY0L0G89nMFOkCLBjXKnsKwL22DtScEfc k9zzOqA== X-Received: from plbbb1.prod.google.com ([2002:a17:902:bc81:b0:2bf:17b5:30c9]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:947:b0:2c2:245a:3366 with SMTP id d9443c01a7336-2c2f305aff9mr45838065ad.27.1781192791738; Thu, 11 Jun 2026 08:46:31 -0700 (PDT) Date: Thu, 11 Jun 2026 08:46:31 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260522-gmem-inplace-conversion-v7-0-2f0fae496530@google.com> Message-ID: Subject: Re: [PATCH v7 00/42] guest_memfd: In-place conversion support From: Sean Christopherson To: Ackerley Tng Cc: Ackerley Tng via B4 Relay , aik@amd.com, andrew.jones@linux.dev, binbin.wu@linux.intel.com, brauner@kernel.org, chao.p.peng@linux.intel.com, david@kernel.org, ira.weiny@intel.com, jmattson@google.com, jthoughton@google.com, michael.roth@amd.com, oupton@kernel.org, pankaj.gupta@amd.com, qperret@google.com, rick.p.edgecombe@intel.com, rientjes@google.com, shivankg@amd.com, steven.price@arm.com, tabba@google.com, willy@infradead.org, wyihan@google.com, yan.y.zhao@intel.com, forkloop@google.com, pratyush@kernel.org, suzuki.poulose@arm.com, aneesh.kumar@kernel.org, liam@infradead.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jonathan Corbet , Shuah Khan , Shuah Khan , Vishal Annapurve , Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Youngjun Park , Qi Zheng , Shakeel Butt , Kiryl Shutsemau , Jason Gunthorpe , Vlastimil Babka , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev Content-Type: text/plain; charset="us-ascii" On Wed, Jun 10, 2026, Ackerley Tng wrote: > Sean Christopherson writes: > > > On Thu, Jun 04, 2026, Ackerley Tng wrote: > >> Sean Christopherson writes: > >> >> + KVM: selftests: Test conversion with elevated page refcount > >> >> + Askar pointed out that soon vmsplice may not pin pages. Should I > >> >> pin pages through CONFIG_GUP_TEST like in [2]? I prefer not to > >> >> take a dependency on CONFIG_GUP_TEST. > >> > > >> > I'm not exactly excited about taking a dependency on CONFIG_GUP_TEST either, but > >> > it probably is the least awful choice. E.g. KVM also pins pages is certain flows, > >> > but we're _also_ actively working to remove the need to pin. > >> > > >> > Hmm, maybe IORING_REGISTER_PBUF_RING? AFAICT, it's almost literally a "pin user > >> > memory" syscall. > >> > > >> > >> Hmm that takes a dependency on io_uring, which isn't always compiled > >> in. Between CONFIG_IO_URING and CONFIG_GUP_TEST, I'd rather > >> CONFIG_GUP_TEST. > > > > Or try both? If it's not a ridiculous amount of work. > > CONFIG_GUP_TEST was tried in [1] > > [1] https://lore.kernel.org/all/baa8838f623102931e755cf34c86314b305af49c.1747264138.git.ackerleytng@google.com/ > > It looks like this > > static void pin_pages(void *vaddr, uint64_t size) > { > const struct pin_longterm_test args = { > .addr = (uint64_t)vaddr, > .size = size, > .flags = PIN_LONGTERM_TEST_FLAG_USE_WRITE, > }; > > gup_test_fd = open("/sys/kernel/debug/gup_test", O_RDWR); > TEST_REQUIRE(gup_test_fd > 0); Use __open_path_or_exit(). I also think it makes sent to make these available to all KVM selftests, there are probably other testcases that could utilize page pinning. > TEST_ASSERT_EQ(ioctl(gup_test_fd, PIN_LONGTERM_TEST_START, &args), 0); > } > > static void unpin_pages(void) > { > TEST_ASSERT_EQ(ioctl(gup_test_fd, PIN_LONGTERM_TEST_STOP), 0); > } > > So in the test I'll call pin_pages(), then try to convert, see that it > fails with EAGAIN and reports the expected error_offset, then I call > unpin_pages(), then I convert again and expect success. > > Are you uncomfortable with the CONFIG_GUP_TEST interface? No, my concern is/was the potential for leaking pages if the test fails/crashes, but it looks gup_test_release() ensures all pins are dropped when the file is released, so that should be a non-issue. > What would you like me to try with CONFIG_IO_URING? I'm thinking that the > main difference between the two is just down to which non-default CONFIG > option we want to take for guest_memfd tests.