[RFC,v11,18/29] KVM: selftests: Drop unused kvm_userspace_memory_region_find() helper
Message ID | 20230718234512.1690985-19-seanjc@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2093205vqt; Tue, 18 Jul 2023 17:08:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlFjzVBiX0L0qhTcnxvm90mfgVr0wPSlHmBlpQKbIyOpd0AaZnmnE0m/g3zvVo1iktN1TQey X-Received: by 2002:a17:90a:7185:b0:25e:d727:6fb4 with SMTP id i5-20020a17090a718500b0025ed7276fb4mr13668678pjk.2.1689725318540; Tue, 18 Jul 2023 17:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689725318; cv=none; d=google.com; s=arc-20160816; b=Ks9z2sMW4LLmHm3HOXRg427rAivdZDzb0Qu8r3mit6C76GCwelJb1EQi+qildba1Aj fFo46g0UC7UnwqzqDTelfhZb1DPeYsrzTVSANGjfH1QwZkPmEq6NVBCjLzif4zY6O4Jj juckBJpUhkN7g2+Wl0k3ZXnbIgMQYSimZ22Upv1Bsvfc+Vj9d8IcaHctizXOWJF4cxBU Pmpl5xew/Rh+2ikwg+McXSurrxEykccQRTzKgZrCu8UTrY60ua3iQsLSrqFSzGrWmAiY AMOCc/ogBN/89aqtRjBGn4drcd4hDYYCpTEzeJiCvhEQquGC9ANzpr0CUn7hFRzV12X0 hD+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=jNVa/iQ+AVctjdypzscw/wZ/omqP7xdpmmirAsZhWLw=; fh=D6d5aNryYQiYyjenfSFWOT3594jRd4xJmyqVXmIxeQo=; b=mh8xMzk6zs/iif6JlD893gKghmNEMtSxAF7DbQ7DRQZkohfEEOKuJt9+q6eQfzveTO TA8BB4emlM5spbM3PepvjAGVArRMgPMG/Fdt/KjuQTdzTTCNrB/oQLEpH8aLt6HkSKbn eG7JuWNSIlrX01Ln8CImj1CgPqwLTEy412dAjjKEr5iiXnwjpqZNJj2euPvuHgkxTDAw MVmzSD+Qt/1Wmpmn6tUBjEsP/9BPuH5Yqxet2O4/uSN1admdWJckUDp7L1yw7kOE8Mdp qSEFlGOXPom8LZ3aSFi7QgC50tTzPMYSW95lqqVvxhUBYn7hZqCD1IyRBJ1yM76xWd3O ZtTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=S9i20yQ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a17090ad90500b0025ea1c0edb1si258261pjv.146.2023.07.18.17.08.25; Tue, 18 Jul 2023 17:08:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=S9i20yQ7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231583AbjGRXwP (ORCPT <rfc822;chrisben.tianve@gmail.com> + 99 others); Tue, 18 Jul 2023 19:52:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbjGRXv1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Jul 2023 19:51:27 -0400 Received: from mail-pl1-x649.google.com (mail-pl1-x649.google.com [IPv6:2607:f8b0:4864:20::649]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7101BE7 for <linux-kernel@vger.kernel.org>; Tue, 18 Jul 2023 16:49:38 -0700 (PDT) Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-1b9de7951easo32356745ad.0 for <linux-kernel@vger.kernel.org>; Tue, 18 Jul 2023 16:49:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689724146; x=1692316146; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=jNVa/iQ+AVctjdypzscw/wZ/omqP7xdpmmirAsZhWLw=; b=S9i20yQ7jB4hVddDMJ4CkO5T1TWmd4hfWWkq8Xl9LowlAEQdj2ZBN4AmHJWPyNUeoT CkrrWKNwK4ZqQLVQM2y6BQWzimiT4YCPNLG/XY2OgxS9elbM94AeEwd6oVkZtS5CMdNQ enYmJItt+taFRfJF03P5U3tsXYvhEykGsai5MRAd/rpILORWE8Nwwq/35e1lrZlSdKCf nnux/I5fy00kI9O4nAFwoaKQfkECwHaMBer7UN6aWCOBJCp2NOyFIamjX8g6Muuevcj+ zN2G8rzvgNhVTfZL/D1gpgeoLq9Z9aveGPtzRcTPzuDzimSMVNdowxyXn99BRYpLpXYL a5VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689724146; x=1692316146; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jNVa/iQ+AVctjdypzscw/wZ/omqP7xdpmmirAsZhWLw=; b=ayagM2UZh50MHkTrO9CbfahQxRcNAWz4Uk592mAQ+dFbq24GHNrRCcfT7Tzz+ys66j nsDPrWqkdklP/ndXhxD9IV/2uxXjgHWqennHqNDF3VesqvqPO51cLT6O2k/Jxje23THp l39CWMh4qlNKvlt/KH07RdWN1lMnDSxN7+foSLAJwm5TGJNsCCJlhEGKS0sefQZg+RWU oOI1lnu6+KXrtTHu0G6/jU1yhQggcwGh5fqhivX3jOu0lmWp+zEViBodb03LWY6vGRCl bFoOeOX8GewIA3UJ1u+zSdiHVxfcdcpWmIeMDp+rbgsiDQ955Ty0KPPAH3RUOauqfKgj ccXw== X-Gm-Message-State: ABy/qLZNnp9/pXk3u4O/HCabdNHFrtHPGkDovBnDcOy4HRUMTuI8TWuR 9D7pnAuqCI6mgpyrJdURI68Tw0cTS2Q= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:d503:b0:1b8:8c7:31e6 with SMTP id b3-20020a170902d50300b001b808c731e6mr17710plg.1.1689724146247; Tue, 18 Jul 2023 16:49:06 -0700 (PDT) Reply-To: Sean Christopherson <seanjc@google.com> Date: Tue, 18 Jul 2023 16:45:01 -0700 In-Reply-To: <20230718234512.1690985-1-seanjc@google.com> Mime-Version: 1.0 References: <20230718234512.1690985-1-seanjc@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230718234512.1690985-19-seanjc@google.com> Subject: [RFC PATCH v11 18/29] KVM: selftests: Drop unused kvm_userspace_memory_region_find() helper From: Sean Christopherson <seanjc@google.com> To: Paolo Bonzini <pbonzini@redhat.com>, Marc Zyngier <maz@kernel.org>, Oliver Upton <oliver.upton@linux.dev>, Huacai Chen <chenhuacai@kernel.org>, Michael Ellerman <mpe@ellerman.id.au>, Anup Patel <anup@brainfault.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Sean Christopherson <seanjc@google.com>, "Matthew Wilcox (Oracle)" <willy@infradead.org>, Andrew Morton <akpm@linux-foundation.org>, Paul Moore <paul@paul-moore.com>, James Morris <jmorris@namei.org>, "Serge E. Hallyn" <serge@hallyn.com> Cc: 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-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng <chao.p.peng@linux.intel.com>, Fuad Tabba <tabba@google.com>, Jarkko Sakkinen <jarkko@kernel.org>, Yu Zhang <yu.c.zhang@linux.intel.com>, Vishal Annapurve <vannapurve@google.com>, Ackerley Tng <ackerleytng@google.com>, Maciej Szmigiero <mail@maciej.szmigiero.name>, Vlastimil Babka <vbabka@suse.cz>, David Hildenbrand <david@redhat.com>, Quentin Perret <qperret@google.com>, Michael Roth <michael.roth@amd.com>, Wang <wei.w.wang@intel.com>, Liam Merwick <liam.merwick@oracle.com>, Isaku Yamahata <isaku.yamahata@gmail.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771805415202520332 X-GMAIL-MSGID: 1771805415202520332 |
Series |
KVM: guest_memfd() and per-page attributes
|
|
Commit Message
Sean Christopherson
July 18, 2023, 11:45 p.m. UTC
Drop kvm_userspace_memory_region_find(), it's unused and a terrible API
(probably why it's unused). If anything outside of kvm_util.c needs to
get at the memslot, userspace_mem_region_find() can be exposed to give
others full access to all memory region/slot information.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
.../selftests/kvm/include/kvm_util_base.h | 4 ---
tools/testing/selftests/kvm/lib/kvm_util.c | 29 -------------------
2 files changed, 33 deletions(-)
Comments
On 7/19/23 01:45, Sean Christopherson wrote: > Drop kvm_userspace_memory_region_find(), it's unused and a terrible API > (probably why it's unused). If anything outside of kvm_util.c needs to > get at the memslot, userspace_mem_region_find() can be exposed to give > others full access to all memory region/slot information. > > Signed-off-by: Sean Christopherson <seanjc@google.com> > --- > .../selftests/kvm/include/kvm_util_base.h | 4 --- > tools/testing/selftests/kvm/lib/kvm_util.c | 29 ------------------- > 2 files changed, 33 deletions(-) > > diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h > index 07732a157ccd..6aeb008dd668 100644 > --- a/tools/testing/selftests/kvm/include/kvm_util_base.h > +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h > @@ -753,10 +753,6 @@ vm_adjust_num_guest_pages(enum vm_guest_mode mode, unsigned int num_guest_pages) > return n; > } > > -struct kvm_userspace_memory_region * > -kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start, > - uint64_t end); > - > #define sync_global_to_guest(vm, g) ({ \ > typeof(g) *_p = addr_gva2hva(vm, (vm_vaddr_t)&(g)); \ > memcpy(_p, &(g), sizeof(g)); \ > diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c > index 9741a7ff6380..45d21e052db0 100644 > --- a/tools/testing/selftests/kvm/lib/kvm_util.c > +++ b/tools/testing/selftests/kvm/lib/kvm_util.c > @@ -586,35 +586,6 @@ userspace_mem_region_find(struct kvm_vm *vm, uint64_t start, uint64_t end) > return NULL; > } > > -/* > - * KVM Userspace Memory Region Find > - * > - * Input Args: > - * vm - Virtual Machine > - * start - Starting VM physical address > - * end - Ending VM physical address, inclusive. > - * > - * Output Args: None > - * > - * Return: > - * Pointer to overlapping region, NULL if no such region. > - * > - * Public interface to userspace_mem_region_find. Allows tests to look up > - * the memslot datastructure for a given range of guest physical memory. > - */ > -struct kvm_userspace_memory_region * > -kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start, > - uint64_t end) > -{ > - struct userspace_mem_region *region; > - > - region = userspace_mem_region_find(vm, start, end); > - if (!region) > - return NULL; > - > - return ®ion->region; > -} > - > __weak void vcpu_arch_free(struct kvm_vcpu *vcpu) > { > Will queue this. Paolo
diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index 07732a157ccd..6aeb008dd668 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -753,10 +753,6 @@ vm_adjust_num_guest_pages(enum vm_guest_mode mode, unsigned int num_guest_pages) return n; } -struct kvm_userspace_memory_region * -kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start, - uint64_t end); - #define sync_global_to_guest(vm, g) ({ \ typeof(g) *_p = addr_gva2hva(vm, (vm_vaddr_t)&(g)); \ memcpy(_p, &(g), sizeof(g)); \ diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 9741a7ff6380..45d21e052db0 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -586,35 +586,6 @@ userspace_mem_region_find(struct kvm_vm *vm, uint64_t start, uint64_t end) return NULL; } -/* - * KVM Userspace Memory Region Find - * - * Input Args: - * vm - Virtual Machine - * start - Starting VM physical address - * end - Ending VM physical address, inclusive. - * - * Output Args: None - * - * Return: - * Pointer to overlapping region, NULL if no such region. - * - * Public interface to userspace_mem_region_find. Allows tests to look up - * the memslot datastructure for a given range of guest physical memory. - */ -struct kvm_userspace_memory_region * -kvm_userspace_memory_region_find(struct kvm_vm *vm, uint64_t start, - uint64_t end) -{ - struct userspace_mem_region *region; - - region = userspace_mem_region_find(vm, start, end); - if (!region) - return NULL; - - return ®ion->region; -} - __weak void vcpu_arch_free(struct kvm_vcpu *vcpu) {