From patchwork Tue Sep 10 23:44:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ackerley Tng X-Patchwork-Id: 13799507 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ADE9EE01F4 for ; Tue, 10 Sep 2024 23:46:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 691858D00ED; Tue, 10 Sep 2024 19:45:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 642E18D00E2; Tue, 10 Sep 2024 19:45:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 447178D00ED; Tue, 10 Sep 2024 19:45:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1E3768D00E2 for ; Tue, 10 Sep 2024 19:45:35 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id D15E51A0B68 for ; Tue, 10 Sep 2024 23:45:34 +0000 (UTC) X-FDA: 82550462988.11.B52A045 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) by imf17.hostedemail.com (Postfix) with ESMTP id 19CF940006 for ; Tue, 10 Sep 2024 23:45:32 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Mh0qniMd; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3G9rgZgsKCJAuw4yB5yID7008805y.w86527EH-664Fuw4.8B0@flex--ackerleytng.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3G9rgZgsKCJAuw4yB5yID7008805y.w86527EH-664Fuw4.8B0@flex--ackerleytng.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726011857; a=rsa-sha256; cv=none; b=Aqm3qeqjQzPS09GoX4R4WQ03/gn2g9Jb878bSk/IVLzlYTZNhc1ohTOEEbZxziDVn1Y0LO fHyFY5fe6EQCugOfs98CrmZ41pVRlUtJksduC1fuv5CImtdd1et368Q1T17FPx5jLsmbhN jqXBt2CCmObLQBmE7P2X0dxSEml6r+c= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Mh0qniMd; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3G9rgZgsKCJAuw4yB5yID7008805y.w86527EH-664Fuw4.8B0@flex--ackerleytng.bounces.google.com designates 209.85.210.201 as permitted sender) smtp.mailfrom=3G9rgZgsKCJAuw4yB5yID7008805y.w86527EH-664Fuw4.8B0@flex--ackerleytng.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726011857; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AYJem9uK2cy9PiRW4XqF1AVoy187cj8pbxn6tsiytpU=; b=Q6yyvorxHk9OacntikhMaoY/iaRtiT1QsmyoOp4nQOZLNeYcY4iir+2IY9T19GvKZ2gExX 7/ODoYDqXT8F0dedPIRyesrA5aUK1lrUcQo1gCaDbSXZLa1guSUa2ZGkgwzmrSfXET/sOA BKsEMS3fwgCpXgILWQgpR1tdqdsr0eY= Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-718e34530dfso1602607b3a.3 for ; Tue, 10 Sep 2024 16:45:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1726011932; x=1726616732; darn=kvack.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=AYJem9uK2cy9PiRW4XqF1AVoy187cj8pbxn6tsiytpU=; b=Mh0qniMdxt1mje8BfNNJJuwDTS1otIxjEysTrFXpPiONFalZC9s6jB6Zbn08x8Dz04 Q2qNAiwGefA9Hw+wrX8P092IQ41r6QdWhs29g72msBx03IVUM5Ju179/ViqPvHLbLdV3 Z88xw40R8ne2pC1cWGnAy7g0NEYB3yt8NSgYHFeUBJ+h5AUz0uPaTe/QicitCpBJ+O5i GnKdgP5yxRm7vUDuvPH7fuJjFH7z0R+ZeFoyOfMxXrbygA9Z+pkNXWRaa4mrSOb3+u92 jO1z4IWS9DbbHW4BYoSH/jFW30JYPd/3nSPBes0Nu5/kYfd7/cBA4A0l+SYkRW62cAjZ DZCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726011932; x=1726616732; 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=AYJem9uK2cy9PiRW4XqF1AVoy187cj8pbxn6tsiytpU=; b=IwPhOBUuYmeKM6C2tkY7ikB2LiUzKmvQK4Juz1gxXYfQEJdjaB9p8J/tKuDt3KlPmB Ya4slYoX9ILMSq0wsyMPASyN8KOT5VULO0a+yxFwWpq9gHLZ3WNLRXEk2JfcJ+SVj8Am xIYkcZUosYX8YXirIufQ4zfC2X7t2nDnA88GFXVqVOgnNnS+sYy/9mCQKh3SudC3tF6c p7E7CjW5brfn752GUm/Ha3Uhr3XUkZv1tDjiT48iHET72pVBNXd9yN+QCv+bkjKAF/6A 5IcVEvQockgkExEWjjaz+/KkUfWvmPbGZCGvLAnuTWkXpQg8Wg8c0XXJ1WfLxMMBrMk8 8k3Q== X-Forwarded-Encrypted: i=1; AJvYcCXEvXF5juX1iPbpCPXchXTDo1j2WeLtvbtV/9vNTy3r+RrOsbc36mSftfEnmJnjCtkq59W11qyTow==@kvack.org X-Gm-Message-State: AOJu0YwsAyJCxGQ+FinECzkXdLoa0xTXmMmRbt6TVtNruhzc4Z2kiJsD YQQwufxtBZjBoAOnhwmJyFX+UfFZIsSjz/++E9wMqE/r5oeZOT+kagg0ZTKKtVtgInzRNBiFIQY OzfyVDtQOHPrEpAoY91Vi2Q== X-Google-Smtp-Source: AGHT+IHaymwmA0a5qHgrrgMyaOagseBsBxvzMqXn3tRr1+SR9wD08VNMmkUJlj2d4F4z5ptyADsmNrcNJBVUlk0nKg== X-Received: from ackerleytng-ctop.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:13f8]) (user=ackerleytng job=sendgmr) by 2002:aa7:9390:0:b0:706:3153:978a with SMTP id d2e1a72fcca58-7191722c371mr2134b3a.6.1726011931559; Tue, 10 Sep 2024 16:45:31 -0700 (PDT) Date: Tue, 10 Sep 2024 23:44:05 +0000 In-Reply-To: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.46.0.598.g6f2099f65c-goog Message-ID: <0ea30ee1128f7e6d033783034b6bc48dfbabb5db.1726009989.git.ackerleytng@google.com> Subject: [RFC PATCH 34/39] KVM: selftests: Add notes in private_mem_kvm_exits_test for mmap-able guest_memfd From: Ackerley Tng To: tabba@google.com, quic_eberman@quicinc.com, roypat@amazon.co.uk, jgg@nvidia.com, peterx@redhat.com, david@redhat.com, rientjes@google.com, fvdl@google.com, jthoughton@google.com, seanjc@google.com, pbonzini@redhat.com, zhiquan1.li@intel.com, fan.du@intel.com, jun.miao@intel.com, isaku.yamahata@intel.com, muchun.song@linux.dev, mike.kravetz@oracle.com Cc: erdemaktas@google.com, vannapurve@google.com, ackerleytng@google.com, qperret@google.com, jhubbard@nvidia.com, willy@infradead.org, shuah@kernel.org, brauner@kernel.org, bfoster@redhat.com, kent.overstreet@linux.dev, pvorel@suse.cz, rppt@kernel.org, richard.weiyang@gmail.com, anup@brainfault.org, haibo1.xu@intel.com, ajones@ventanamicro.com, vkuznets@redhat.com, maciej.wieczor-retman@intel.com, pgonda@google.com, oliver.upton@linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-fsdevel@kvack.org X-Rspamd-Queue-Id: 19CF940006 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ht15eo1n3qgdr77gionprhh6ktqzb4sf X-HE-Tag: 1726011932-790713 X-HE-Meta: U2FsdGVkX1/ADMHRA/RP45+7uYr4ZFCK/4kFzlXpz18FGjSRPlpgFbcX8WabvL0efNPmEE29v/v9S8cFbx3ZitKsd0dCJLQXrExuWQJ4Cimjf2qHGQlplBq20VjUTIPqGXXlxDK8JdY/KUbFOEkFG8Nkfih9Miuzzn5O2ixAzok4mJ0ax8eoOsWrDBUJwDHNNqPttvEFTyBgEUP13qp9BQGSomVMWJEFUEKhpAzH6jIX27faugfdGkj417sWfdYUNQiwIiQjReaoaIRJB7FrhLqCbQYSGRTTZlT7vc1mK6MPmbsOoaj6pbi4/kH0SPT5jH4/Z6DMquORSoY/ySBfkI0fwCYy01lFKSO6lQlDENFEoZZRjJLwp/SXisgHDsp+rNeo+Mikj1Y8uEP0w7HkjvsEHiEelzfY+y3DofedL0g2sNAaGPGybPrxDe+VvvNbCJYGqNtuTtskqoTCMxlCBRfS27vYbKsAp5QrY6/iCGsELvmw9j7RNXS6UDvBe3FD/ouRtQIF5D0ggNTgXxE8aB+tG3yJdIq6KXgVXjnEGQeBSFf5lZQwP3TqB2zIjzl2Ru4eziqf7UPS4GbIXypj3HVbnhl3gD88gdb06XZD/AieERHC9oPysjtqKt88yoUpm9CZV0EWvoIl101NgUldBEGtqUL/ktMbzA30b9/ogtWZQE0rCDMPZy3WzULpQzv7zQ3YmlQ8ihJs5RkQepVxpizr/knaeZDISQnBp9iPduHiMbcDB9LpM1EDkLnFBcY+48ONPoR6WE8MwEbzmBUAzzanD8bb+H865edlU26WBCPWF8vfAaWqhF48VSMfeyhTUIjVBgfbm3tJGWDlbtPoqSlgFMRB1Tr4OagnDJWAqO32cdHJ5o24L0Ewq/a60bUMxaSZwJXBtty7atFeI+DIpzTW39vp/PGVgCN4EPvxycK/XZqHBjX2zIeeGBUL5tm1Yc+sIDmk7cD7jmYthIR 7c/+UJgG GchmuPugwDu6zc/kc6JQDRnIuWF0qHtoI1XeOuAS6923NgZ1jUoT4WIVOGLE3lAfn8IOQmkxruEj2c+Qmele6r7qTrs2d9e6rtt2WPbObajHVpqxA9N3Ia+WC5Bh7imlRS/lnrjpErUMihDbbAf/6OgJhU192woynNXBbfvO52+RcVpJ6AAKDAm9tY3ba2GYnFLmdVfiA34MbNo4PDLiLGKgdAuiz4LQVU9AGBxfNtilsw6rPppbgOWnnuvMp5/WNzIAcmjmRN4nYXi+xOPX556tTuFtdWuUKVOarEjoL1XIcbgxqmcsjitV0rMjetn5dTo2Fd8x2TF1PVulo/n/Z8Sva3R7NBu1s7x8/wlQaR8TLriT4/Qe942aBBbiwgOwKMBCUJB9UGC6hrTqOh7zgoJUMJLm+c+HD/MSlSi9Oj3tZyhRO2B+y1thpk4sUlK2Opb7L5KP8epiLrUWl1EsKINgKvIAjdmkAb4FxLAmYIouIASypWJJ4CqdKowKW5W/pM7I1aejJy+aAfnP1188oEc4FbYtI/M1VsyHNmurr1h0oufJQx7NpBg2rUUerzWw2oRMu+4Y35+fJ2jsMHxiaKMMMdF1bbq8VVuszJCvJDtV8raF/6zVeEq1D9++q8bdZNFWojIdb/9kfk3ygMKWx8hUz142wJiDHEQkdNNfZ/KXg1QMCGcFLtMzA3KHG4IhqABgPFpSEedmQOzA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.137788, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Note in comments why madvise() is not needed before setting memory to private. Signed-off-by: Ackerley Tng --- .../selftests/kvm/x86_64/private_mem_kvm_exits_test.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/private_mem_kvm_exits_test.c b/tools/testing/selftests/kvm/x86_64/private_mem_kvm_exits_test.c index 13e72fcec8dd..f8bcfc897f6a 100644 --- a/tools/testing/selftests/kvm/x86_64/private_mem_kvm_exits_test.c +++ b/tools/testing/selftests/kvm/x86_64/private_mem_kvm_exits_test.c @@ -62,7 +62,11 @@ static void test_private_access_memslot_deleted(void) virt_map(vm, EXITS_TEST_GVA, EXITS_TEST_GPA, EXITS_TEST_NPAGES); - /* Request to access page privately */ + /* + * Request to access page privately. madvise(MADV_DONTNEED) not required + * since memory was never mmap()-ed from guest_memfd. Anonymous memory + * was used instead for this memslot's userspace_addr. + */ vm_mem_set_private(vm, EXITS_TEST_GPA, EXITS_TEST_SIZE); pthread_create(&vm_thread, NULL, @@ -98,7 +102,10 @@ static void test_private_access_memslot_not_private(void) virt_map(vm, EXITS_TEST_GVA, EXITS_TEST_GPA, EXITS_TEST_NPAGES); - /* Request to access page privately */ + /* + * Request to access page privately. madvise(MADV_DONTNEED) not required + * since the affected memslot doesn't use guest_memfd. + */ vm_mem_set_private(vm, EXITS_TEST_GPA, EXITS_TEST_SIZE); exit_reason = run_vcpu_get_exit_reason(vcpu);