From patchwork Tue Sep 10 23:44:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ackerley Tng X-Patchwork-Id: 13799504 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 9ADC2EE01F4 for ; Tue, 10 Sep 2024 23:46:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECD438D00EA; Tue, 10 Sep 2024 19:45:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E55C48D00E2; Tue, 10 Sep 2024 19:45:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAA9A8D00EA; Tue, 10 Sep 2024 19:45:29 -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 A74C08D00E2 for ; Tue, 10 Sep 2024 19:45:29 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 65CEE4071A for ; Tue, 10 Sep 2024 23:45:29 +0000 (UTC) X-FDA: 82550462778.18.B50CD93 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf05.hostedemail.com (Postfix) with ESMTP id 9320A10000B for ; Tue, 10 Sep 2024 23:45:27 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=OqKOybBf; spf=pass (imf05.hostedemail.com: domain of 3FtrgZgsKCIsprzt60tD82vv33v0t.r310x29C-11zAprz.36v@flex--ackerleytng.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3FtrgZgsKCIsprzt60tD82vv33v0t.r310x29C-11zAprz.36v@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726011875; a=rsa-sha256; cv=none; b=uzs9hxJGUdWIUHoRAKfRzpGMs1C9psPq1O4qrPjKviUN/sB1UcWoCjJtNbt4mipOyjrD4+ Vvta4HyS4saZqtqz/9EiyYw1wd1gZdPrMlXmCK7kvRxpUkPceaDz67cP3nF8eVwn50t6J1 rbWu7yc/KDEdB714UCqWsmyaY+A6lsw= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=OqKOybBf; spf=pass (imf05.hostedemail.com: domain of 3FtrgZgsKCIsprzt60tD82vv33v0t.r310x29C-11zAprz.36v@flex--ackerleytng.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3FtrgZgsKCIsprzt60tD82vv33v0t.r310x29C-11zAprz.36v@flex--ackerleytng.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726011875; 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=uwf1PxblOjz5NXZUaTh7zfbmgn6lBhrxKJq/6ZLohcs=; b=ZWK78U0pDMzUtz4hL1TITOxrxhUdf59nWwPNWztYJ9DfOXoP9ddx6ipWqUft3fblhRZ3EV gPgc7+vjGq+tOALd/pIu3x/y8J9Eoay260/BvOhc+z2Y+hcH7MILkUq+zZU7QuRTOdYMKV UWwfoOKPKHmfi0BnMh+ToZw4F4513Lo= Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e1a6d328eacso2912653276.3 for ; Tue, 10 Sep 2024 16:45:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1726011927; x=1726616727; 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=uwf1PxblOjz5NXZUaTh7zfbmgn6lBhrxKJq/6ZLohcs=; b=OqKOybBffYGtfH6+mUpVj0HcOA/ly+4lPENgWjbK4ud6RVtv3rGFNzTScMj29BawZL M1R1KrxzJyjNEp5csRX8vNifbgRuEk6IZa3dg3g+/oanN+10oUGR8+Lu1G0iqpJO5NZa 7tUDa6wL0ZU7dBdtCDVQJ0vZDPV7w0r+IGjkW4ikfscGxDhsn5vHkXJ4IL5ndPmQGAci HPfVuCZ/Xu0UIYZoO1ai/wl5DC8oUF9e+2GzPi3zTE4Fg5t1fqTvplRINuYZ4mPEzX7U 11pPYPzOvarj7Avxs3t1sf7uC3WH7H0MrboqiebtzircWIDrseAgX81GYPgVx5KpSTIh XZdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726011927; x=1726616727; 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=uwf1PxblOjz5NXZUaTh7zfbmgn6lBhrxKJq/6ZLohcs=; b=EdM19PNYAxiGf4rajIpnO02Sz55JOGHKxl4brp4ux0jVvXVxg3r+6H4xxThlQtjHYZ igAL0yaB3E9kPPdWzViSV4r9MzumHrLr3NzoD0L+driwIMCQ6mkbsKDnR1E2mrBTsfHU RJRwXnnTx9m55QY3eX6XOJHa/tdMIP4NmWaRutqtT68uxq13huxwRuubUtQpKTh8eW5S RlX9joXQMQzrHKWuXwJ74sJbxAKr7SwCmOvtsaD/mRa9a0DS6fBrvyLHEGWw+Lyt01A5 rs1kVgZGnnB7h5vaWgWm9wzFd+LMlH3lTzkj/5ADPlX+VX639mizengsiaPE5/uYcoqK mqYw== X-Forwarded-Encrypted: i=1; AJvYcCVFXwgdApfoPFD+8nBIsbER9uzheJWBprBi7En03GGCsP8e64uq2fENPRf/bz/+KJLmCT7Zrywh+w==@kvack.org X-Gm-Message-State: AOJu0YwJxM19D9ubRPDtymhNrHnArrAMD+GHcvvFr7Dstm+coCoEsUJP CPYowyMKwKLAnz9MTpFmzJM3qG8xvkBj9fDhkrUT0RpP2ISVsWUNfdYi1P0yK+phqvDAjDki1ud dhtUll+RFoUP+DDr7tb0kkA== X-Google-Smtp-Source: AGHT+IFHLL/JWASNEnEkZcv6PFIj58I/J8+OY1FCIRm5r4Bk9ay3Th/8kINWVB3DiXd8md6IPOJl8xsEmDXgV5bz6w== X-Received: from ackerleytng-ctop.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:13f8]) (user=ackerleytng job=sendgmr) by 2002:a25:aa43:0:b0:e16:55e7:5138 with SMTP id 3f1490d57ef6-e1d8c022ba7mr1649276.0.1726011926642; Tue, 10 Sep 2024 16:45:26 -0700 (PDT) Date: Tue, 10 Sep 2024 23:44:02 +0000 In-Reply-To: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.46.0.598.g6f2099f65c-goog Message-ID: <6faf6d63a98531539b05ea36728e51ff51bb3cde.1726009989.git.ackerleytng@google.com> Subject: [RFC PATCH 31/39] KVM: selftests: Allow vm_set_memory_attributes to be used without asserting return value of 0 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-Stat-Signature: yddi8a3zyrufsicnrajcjwhrtk4drkbd X-Rspamd-Queue-Id: 9320A10000B X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1726011927-14029 X-HE-Meta: U2FsdGVkX19ZAzfKH//ZCbqJgw+BkRRrjQ/MNSdmNeofNNj/3MuPwgrC8buHYC8MUjiV9PSUSnHRO9FLIZyV1hnQD77fXfjWjFbNq0emCghUDOZg1t5YGfv/T2pajhVa4yHu8JbgsQgkdA/RCsv7X6uX87nOaYIZu/lLEOctZ3e2CUmNRW8IkpZYIBC6IeV5VkQw2VeJHWKxMBT8mPtug/IrdBD/Jg1naUyr6Fd1xdbTkLTIrMAUNIiCPiRH5qf8woxRj4azA+BZEoxdUqeJcyMaaXT9z0OousBXURi3ZK7PVm3gPbean5hqDGftu7u5PbnBI6K31aihfTbgP9h6+qgkuuw/rXXR411hjwJ/O6r54PbofUbwOvQvZwgULWx3VslXI7gfStV1Bt7PFU6fAUY4mRf8OtWF5zogF/a6Qz3iotUyL1J+0xB5GkQsD3z4cVTzKE1Ngn7kRJo3sjGhz6pPBfO5pT+IToTPpFB1TJNFfeo9jlruRHy/CdrW7FdI4NWs9k51I3ju6YtPIerYFQq+ELQVaykXyOg0QeUp9gWEyeT28vmEN0tWzKdZKK6Zz1S6nMh/5d9qr+r5bcuVOgq8RcVSW+kn6xlsdwGEA7JP70XPbt06/ysl3IxTe5WfjyqoR3ZsnveI1y/BaisYy4sTYUjxG6T+JQkzPogX53QBerCfOWhFADkeCmGDA0vHPkErUiqTKm7Xihu9F9xu0831H3+ErVeYZlg/8eBGnVYn6rMg1u33ZFs5wZNF2PtiRyc4LC9/dTCxvj4KWIM034uhU1c2a+9Atdg0Uqsmh+Vklik6oO0Ot4m0HDo6iWFOe8s4ieXyiIV13HcmC36lf7JqoiyG+DZFYikthCAYZCFptcfoWJNbTLyVkRtZqSt6cqCshuiaSuwz9IGkCFRdJujM2zc9XGlfQrHsxcytaaBAm0MDr76xt/rUb4PpGTaVyPYhoSRmkLbo/rF0NbF cB7SNN9z HCyzlEtSDEQJNCT13XOAGhyUoMIuBws3gdqbL57R2KihY0KhCwbsgEv2k7sw1JvhaKODdKSJH9/oBOt23atNlzJujQO0bfSn1qKQwR3faf2J0UiGvIrlRN05LSWGUkDoauyttns40nig1oEJlVZDpVwA+27zHwgHA70QqCbexhVQ+NmvHWA0deBbg6bqj1qv1jYlUI4kQThFV97D30HLKxAZ13A41+uPh7Bpg7uNzBrEdb1f+9A5meuP6bT89iwV81y3KiQ3D/R8mF9Eay1rPjkJVeOI7N9jDTe7ajaZ8TWdOCwzWswtXGodlozLCiiEB3wppa0WgBAaBJMdmknUvSEUbqs5lU/h5INvUEFjNTBuICIYmcBB6ZRu4+aJi2SJTJFKRU8kpLAxZ7y0FaxzAKiwQxgdmkF0a+zB26LF8I250xdwCtdGVo8DVKZXG+yAK6ikpB8AX9JrnsKXLEUlKdOhdXmrI92fvQ6w+fHsrebUfqXPkqMFRtJgfQXxKbEpgFCYAVAOoK57cj818IZ050pmK/oL07tEwbfecZfxryjONIOHXtZ4+V6z2Tngd37ZCeLnw4RVPYoiT8dMOYj5sAHpeFgA0HpRZXa5JDLmEw3TlY/PC7aIczko5xQW7dL+3Eg3FabzyVpU46ZQlKVd4xg7HId+YrFr0AjP9I8b1jqhYhKCUZ44WiNnQ4LE2NM1AEpEOo1BdsARBPa8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.027282, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: No functional change intended. Signed-off-by: Ackerley Tng --- tools/testing/selftests/kvm/include/kvm_util.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/include/kvm_util.h b/tools/testing/selftests/kvm/include/kvm_util.h index 63c2aaae51f3..d336cd0c8f19 100644 --- a/tools/testing/selftests/kvm/include/kvm_util.h +++ b/tools/testing/selftests/kvm/include/kvm_util.h @@ -374,8 +374,8 @@ static inline void vm_enable_cap(struct kvm_vm *vm, uint32_t cap, uint64_t arg0) vm_ioctl(vm, KVM_ENABLE_CAP, &enable_cap); } -static inline void vm_set_memory_attributes(struct kvm_vm *vm, uint64_t gpa, - uint64_t size, uint64_t attributes) +static inline int __vm_set_memory_attributes(struct kvm_vm *vm, uint64_t gpa, + uint64_t size, uint64_t attributes) { struct kvm_memory_attributes attr = { .attributes = attributes, @@ -391,7 +391,15 @@ static inline void vm_set_memory_attributes(struct kvm_vm *vm, uint64_t gpa, TEST_ASSERT(!attributes || attributes == KVM_MEMORY_ATTRIBUTE_PRIVATE, "Update me to support multiple attributes!"); - vm_ioctl(vm, KVM_SET_MEMORY_ATTRIBUTES, &attr); + return __vm_ioctl(vm, KVM_SET_MEMORY_ATTRIBUTES, &attr); +} + +static inline void vm_set_memory_attributes(struct kvm_vm *vm, uint64_t gpa, + uint64_t size, uint64_t attributes) +{ + int ret = __vm_set_memory_attributes(vm, gpa, size, attributes); + + __TEST_ASSERT_VM_VCPU_IOCTL(!ret, "KVM_SET_MEMORY_ATTRIBUTES", ret, vm); }