Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp2040836rdf; Mon, 6 Nov 2023 03:04:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzPgF4/Fs4GSS9Agaztihc8s9YDNYo+wQU06B8/WaGbLtTmjGHmg0fartlZHB/2wccLwzu X-Received: by 2002:a05:6a21:4983:b0:181:1549:f1fa with SMTP id ax3-20020a056a21498300b001811549f1famr6864825pzc.28.1699268663994; Mon, 06 Nov 2023 03:04:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699268663; cv=none; d=google.com; s=arc-20160816; b=CSJN/LKexS5s9oFDCIFWYx/j1B0be/yRhafwCpfbkm5jcngu+3XdM7NljLIfKIrsL7 kbzswCDW1Hfvk2xX8z0ycSVfzeZnUbAyEGAflce8wFCitstwLGeUZw30LG+dJEPCKmQj CrGSXD7cD++mHDlkxC99/M9QIpPT81DDBkoBO90NPW441Kep7ds+s3dbvPQG3q/Wn9lg AJQDs6syrKu92WTzlt6n9rfNbif6M07x1yhq0av9Kv7L5u/emStbzqS5ALGXhG77OBa8 SeT80lsUEZ4j//Ipy4f5bWgPRKntB6BxHwoAKh+WTuB62S6m5kKspImGh98TH3aGo5X9 tKMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=MQ8TONDIpPhmTy6Gjm0dgeV6egeVVxfnh06xkrQleLY=; fh=6NDLbPegWN39ihzRI+XD38qv7OUBTPlYZUUvtWMZU2Q=; b=UAdAT9UBgIGSx7Pq6+7x2CsN+4Ol3hoyhAUSWJI3r/s5Z65FO+5Ibn6wCYqgK4eZHD 8yt+8hYV8V3M6QfDYJq6mKMcJpnRgYksbaO2f3YPeN3WupxEYwDn/SbiWuMwMdFlMLm+ 4Y7Qgcv5rFcG99oslo6xvyBXLAwq/K6V+0P5ECjyM+w5U/NtbepHA9TWxcgXZeFMhtYf leY4+exgwREQIgo+sa3Q/JPDCIDjMlLr6Tk5NOgKN7evU5axLEZREUBVlK8GuqQcTtsx CfF+YGW0ZmwZ4PzOBTfwQu6/5DlV3OADW2W4LPv8fcpXf9sxxjZNLOXJg4QLex4h3pR/ W0qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TonV0kcq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id u24-20020a63df18000000b00557531eafb0si7686791pgg.559.2023.11.06.03.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Nov 2023 03:04:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=TonV0kcq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A68AA80A366E; Mon, 6 Nov 2023 03:04:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230284AbjKFLDy (ORCPT + 99 others); Mon, 6 Nov 2023 06:03:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231230AbjKFLDw (ORCPT ); Mon, 6 Nov 2023 06:03:52 -0500 Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B699DB for ; Mon, 6 Nov 2023 03:03:49 -0800 (PST) Received: by mail-qv1-xf29.google.com with SMTP id 6a1803df08f44-66d134a019cso30970516d6.3 for ; Mon, 06 Nov 2023 03:03:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1699268628; x=1699873428; 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=MQ8TONDIpPhmTy6Gjm0dgeV6egeVVxfnh06xkrQleLY=; b=TonV0kcqKq1XY1Ybr3NXfEZUxfWiPs619VEWGjQyvxDcke1wV+eXBbxsGimGZt5nrT Bh+NlZWUA+4UZzYVihMFMDzLd1uW9iuuvsDON9B3VlGmg1AsnYauXfFrxr7rc0MeLAd0 WbDSvbaxbi8sxaVirHWVy19hlezi6XqgnuoUxH+ofN5STYZi7InmsMWNlUt6EChdCDJ9 MeyNLF5DVIpi4uLkxN52z83Zasid1RCGNmI680HjJ+YK3GbnUjCSdRECrmaaWw5L+fGL 2RRWgINqlNPQ7BC7k1RyScqYG4RVaa6U+iitbOKUoi5UubBS571J3wl8+TIYOOHP7WhA tjOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699268628; x=1699873428; 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=MQ8TONDIpPhmTy6Gjm0dgeV6egeVVxfnh06xkrQleLY=; b=hP7UccMe6x/nFjfA9CuGTuXBpzWf1o3f8KPHHnTFuv0qtuKIRcu2qnLkv0M0kTTo8y xHK0tps6tDNV4G04T6331EM/Q+h7/68sI3A5rc+8kbVhdKwQqirxc5FeBmr9zW0lgZcd AlCGfwol9WojIjsmWGe+7sLpxCEakxwv2N9x2Z79hngRWZi5Lcnz91O++OioUM9LfoZC FSamIddB8FaD6Frzp0xMtWzQeDOSamKaRN9y74/2k1YnRxXFInIdkdxnug0DfwStg5AX MMtOrHeFu8wK3Zojz/dK2vLN9VzHs/Y52wQHBCFzgkVOAcVSf5WzMaxtiAB2RJ3+Xg/i XT/w== X-Gm-Message-State: AOJu0YxTasstb7gjjyKRUe97mP3ZMmkvA5Fs7wr92dLWgxqYZ27yJjcL QzXbkYr5S+8ffJCIRWXR4aydkuLEvQ1MfTHukZsIUg== X-Received: by 2002:a0c:f1ca:0:b0:66d:28a5:d153 with SMTP id u10-20020a0cf1ca000000b0066d28a5d153mr26974988qvl.47.1699268628158; Mon, 06 Nov 2023 03:03:48 -0800 (PST) MIME-Version: 1.0 References: <20231105163040.14904-1-pbonzini@redhat.com> <20231105163040.14904-24-pbonzini@redhat.com> In-Reply-To: <20231105163040.14904-24-pbonzini@redhat.com> From: Fuad Tabba Date: Mon, 6 Nov 2023 11:03:12 +0000 Message-ID: Subject: Re: [PATCH 23/34] KVM: selftests: Convert lib's mem regions to KVM_SET_USER_MEMORY_REGION2 To: Paolo Bonzini Cc: Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Sean Christopherson , Alexander Viro , Christian Brauner , "Matthew Wilcox (Oracle)" , Andrew Morton , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Xiaoyao Li , Xu Yilun , Chao Peng , Jarkko Sakkinen , Anish Moorthy , David Matlack , Yu Zhang , Isaku Yamahata , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , Vlastimil Babka , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A. Shutemov" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 06 Nov 2023 03:04:17 -0800 (PST) On Sun, Nov 5, 2023 at 4:33=E2=80=AFPM Paolo Bonzini = wrote: > > From: Sean Christopherson > > Use KVM_SET_USER_MEMORY_REGION2 throughout KVM's selftests library so tha= t > support for guest private memory can be added without needing an entirely > separate set of helpers. > > Note, this obviously makes selftests backwards-incompatible with older KV= M > versions from this point forward. > > Signed-off-by: Sean Christopherson > Message-Id: <20231027182217.3615211-26-seanjc@google.com> > Signed-off-by: Paolo Bonzini > --- Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba Cheers, /fuad > .../selftests/kvm/include/kvm_util_base.h | 2 +- > tools/testing/selftests/kvm/lib/kvm_util.c | 19 ++++++++++--------- > 2 files changed, 11 insertions(+), 10 deletions(-) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/= testing/selftests/kvm/include/kvm_util_base.h > index 967eaaeacd75..9f144841c2ee 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util_base.h > +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h > @@ -44,7 +44,7 @@ typedef uint64_t vm_paddr_t; /* Virtual Machine (Guest)= physical address */ > typedef uint64_t vm_vaddr_t; /* Virtual Machine (Guest) virtual address = */ > > struct userspace_mem_region { > - struct kvm_userspace_memory_region region; > + struct kvm_userspace_memory_region2 region; > struct sparsebit *unused_phy_pages; > int fd; > off_t offset; > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/s= elftests/kvm/lib/kvm_util.c > index f09295d56c23..3676b37bea38 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -453,8 +453,9 @@ void kvm_vm_restart(struct kvm_vm *vmp) > vm_create_irqchip(vmp); > > hash_for_each(vmp->regions.slot_hash, ctr, region, slot_node) { > - int ret =3D ioctl(vmp->fd, KVM_SET_USER_MEMORY_REGION, &r= egion->region); > - TEST_ASSERT(ret =3D=3D 0, "KVM_SET_USER_MEMORY_REGION IOC= TL failed,\n" > + int ret =3D ioctl(vmp->fd, KVM_SET_USER_MEMORY_REGION2, &= region->region); > + > + TEST_ASSERT(ret =3D=3D 0, "KVM_SET_USER_MEMORY_REGION2 IO= CTL failed,\n" > " rc: %i errno: %i\n" > " slot: %u flags: 0x%x\n" > " guest_phys_addr: 0x%llx size: 0x%llx", > @@ -657,7 +658,7 @@ static void __vm_mem_region_delete(struct kvm_vm *vm, > } > > region->region.memory_size =3D 0; > - vm_ioctl(vm, KVM_SET_USER_MEMORY_REGION, ®ion->region); > + vm_ioctl(vm, KVM_SET_USER_MEMORY_REGION2, ®ion->region); > > sparsebit_free(®ion->unused_phy_pages); > ret =3D munmap(region->mmap_start, region->mmap_size); > @@ -1014,8 +1015,8 @@ void vm_userspace_mem_region_add(struct kvm_vm *vm, > region->region.guest_phys_addr =3D guest_paddr; > region->region.memory_size =3D npages * vm->page_size; > region->region.userspace_addr =3D (uintptr_t) region->host_mem; > - ret =3D __vm_ioctl(vm, KVM_SET_USER_MEMORY_REGION, ®ion->regio= n); > - TEST_ASSERT(ret =3D=3D 0, "KVM_SET_USER_MEMORY_REGION IOCTL faile= d,\n" > + ret =3D __vm_ioctl(vm, KVM_SET_USER_MEMORY_REGION2, ®ion->regi= on); > + TEST_ASSERT(ret =3D=3D 0, "KVM_SET_USER_MEMORY_REGION2 IOCTL fail= ed,\n" > " rc: %i errno: %i\n" > " slot: %u flags: 0x%x\n" > " guest_phys_addr: 0x%lx size: 0x%lx", > @@ -1097,9 +1098,9 @@ void vm_mem_region_set_flags(struct kvm_vm *vm, uin= t32_t slot, uint32_t flags) > > region->region.flags =3D flags; > > - ret =3D __vm_ioctl(vm, KVM_SET_USER_MEMORY_REGION, ®ion->regio= n); > + ret =3D __vm_ioctl(vm, KVM_SET_USER_MEMORY_REGION2, ®ion->regi= on); > > - TEST_ASSERT(ret =3D=3D 0, "KVM_SET_USER_MEMORY_REGION IOCTL faile= d,\n" > + TEST_ASSERT(ret =3D=3D 0, "KVM_SET_USER_MEMORY_REGION2 IOCTL fail= ed,\n" > " rc: %i errno: %i slot: %u flags: 0x%x", > ret, errno, slot, flags); > } > @@ -1127,9 +1128,9 @@ void vm_mem_region_move(struct kvm_vm *vm, uint32_t= slot, uint64_t new_gpa) > > region->region.guest_phys_addr =3D new_gpa; > > - ret =3D __vm_ioctl(vm, KVM_SET_USER_MEMORY_REGION, ®ion->regio= n); > + ret =3D __vm_ioctl(vm, KVM_SET_USER_MEMORY_REGION2, ®ion->regi= on); > > - TEST_ASSERT(!ret, "KVM_SET_USER_MEMORY_REGION failed\n" > + TEST_ASSERT(!ret, "KVM_SET_USER_MEMORY_REGION2 failed\n" > "ret: %i errno: %i slot: %u new_gpa: 0x%lx", > ret, errno, slot, new_gpa); > } > -- > 2.39.1 > >