[v12,35/46] KVM: selftests: Export vm_vaddr_unused_gap() to make it possible to request unmapped ranges
Message ID | 20221021153521.1216911-36-vkuznets@redhat.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp765929wrr; Fri, 21 Oct 2022 08:40:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6IS8JaLkyMY6YYj1HE22n6r184sxLxe1rqVwaYUyTcbdVBH7cqWuAnmg60sVeg+tV6Huvu X-Received: by 2002:a17:907:3f8f:b0:78d:f741:7f5a with SMTP id hr15-20020a1709073f8f00b0078df7417f5amr16040405ejc.71.1666366839940; Fri, 21 Oct 2022 08:40:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666366839; cv=none; d=google.com; s=arc-20160816; b=0HWO+xdNMQhDLlUNFD0XmdzGy1lVtHNxmLkJjkioArDClI7cXn44W4sjFjQDmWW4HI Eg5oA8Tfon8LKTd4GxZ/cr0Zw5sPBFoiUfYj7p34N73IxMwOqjPq+sFAvWV5LqXHWpvy SJlbpxB6qmW1ggxXJ4DuO9mHF74qkSBYLfgdcbEz8wXDV7yfrSXz82MaMg17FIe5SHwE YngyrHOb5GjBb4rA/Ax7FPivldk6BV0gL4fatKxIfsFH88TodM6aC+MPhF9rkQTOwCgo Rj1FvMQGr0eKxAZyegWISSrstQ4s7ze8gpCXFf81Ymd/90quUytl1f5FxlYxlfu+wd2z FuYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Yi5yw2AGvHWBFWfiHAngzM1J9kKMfyu4CC2JqKEbs/A=; b=POJ5zMAloRtNX/8Xcn3DLgX95tBZDEfvoXixDibzf52KIb2+aT4HfvHfAcEj+RsgzT 91DgPg3RT7hqK1dsSj9HARUHqI6NxKULV1MfO6VDh3AYMYPTnfLYytWyypdXFO6+BMt0 jPXBguoEmO7M57zXWNW9B9juEqi+HWIsRwL5bi9IGYuYkhg9+dFMdpNtEALSeBk+f0pd 0hnNYd5eCwKcPpOpMx+frtDUiOked1AtxPY3bjMajJvr6faKYmeeYto3QNfLfqy7Kmej HcrY1VjFf1PiFyFchUFY9kHeFTPb1k7PA7il7O5nRtWGDbCk6kuOEsvNopGZe1zB8zcb Fw2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EulQ7Uq9; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr8-20020a170907720800b0078b3edae43csi22281272ejc.37.2022.10.21.08.40.14; Fri, 21 Oct 2022 08:40:39 -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=@redhat.com header.s=mimecast20190719 header.b=EulQ7Uq9; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231124AbiJUPjf (ORCPT <rfc822;mntrajkot1@gmail.com> + 99 others); Fri, 21 Oct 2022 11:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231231AbiJUPid (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Oct 2022 11:38:33 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D65227A894 for <linux-kernel@vger.kernel.org>; Fri, 21 Oct 2022 08:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666366617; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Yi5yw2AGvHWBFWfiHAngzM1J9kKMfyu4CC2JqKEbs/A=; b=EulQ7Uq99+yeFOlM6JDkIeU5q9fvkVJzzCvVrCzfBXxCkoxoiSqmHNBMSvepDMBkyV1pf4 GIy1Qju9vcgrNoq8y7dpLYFtnA75G0+4AwZlS4QF42iH80CRAW7pjXOcRZ1uNOfwgygxSd 0I295LRl0e/E/uWnH3AjAKOkYCtZdMU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-473-fN82i759N8ucfmL8uRP78Q-1; Fri, 21 Oct 2022 11:36:53 -0400 X-MC-Unique: fN82i759N8ucfmL8uRP78Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EAE42857AB7; Fri, 21 Oct 2022 15:36:52 +0000 (UTC) Received: from ovpn-192-65.brq.redhat.com (ovpn-192-65.brq.redhat.com [10.40.192.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62B42400EA8B; Fri, 21 Oct 2022 15:36:50 +0000 (UTC) From: Vitaly Kuznetsov <vkuznets@redhat.com> To: kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>, Sean Christopherson <seanjc@google.com> Cc: Wanpeng Li <wanpengli@tencent.com>, Jim Mattson <jmattson@google.com>, Michael Kelley <mikelley@microsoft.com>, Siddharth Chandrasekaran <sidcha@amazon.de>, Yuan Yao <yuan.yao@linux.intel.com>, Maxim Levitsky <mlevitsk@redhat.com>, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v12 35/46] KVM: selftests: Export vm_vaddr_unused_gap() to make it possible to request unmapped ranges Date: Fri, 21 Oct 2022 17:35:10 +0200 Message-Id: <20221021153521.1216911-36-vkuznets@redhat.com> In-Reply-To: <20221021153521.1216911-1-vkuznets@redhat.com> References: <20221021153521.1216911-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747312275802410097?= X-GMAIL-MSGID: =?utf-8?q?1747312275802410097?= |
Series |
KVM: x86: hyper-v: Fine-grained TLB flush + L2 TLB flush features
|
|
Commit Message
Vitaly Kuznetsov
Oct. 21, 2022, 3:35 p.m. UTC
Currently, tests can only request a new vaddr range by using
vm_vaddr_alloc()/vm_vaddr_alloc_page()/vm_vaddr_alloc_pages() but
these functions allocate and map physical pages too. Make it possible
to request unmapped range too.
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
tools/testing/selftests/kvm/include/kvm_util_base.h | 1 +
tools/testing/selftests/kvm/lib/kvm_util.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/kvm/include/kvm_util_base.h b/tools/testing/selftests/kvm/include/kvm_util_base.h index e42a09cd24a0..a34bdf97bf7c 100644 --- a/tools/testing/selftests/kvm/include/kvm_util_base.h +++ b/tools/testing/selftests/kvm/include/kvm_util_base.h @@ -383,6 +383,7 @@ void vm_mem_region_set_flags(struct kvm_vm *vm, uint32_t slot, uint32_t flags); void vm_mem_region_move(struct kvm_vm *vm, uint32_t slot, uint64_t new_gpa); void vm_mem_region_delete(struct kvm_vm *vm, uint32_t slot); struct kvm_vcpu *__vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id); +vm_vaddr_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min); vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min); vm_vaddr_t vm_vaddr_alloc_pages(struct kvm_vm *vm, int nr_pages); vm_vaddr_t vm_vaddr_alloc_page(struct kvm_vm *vm); diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 29f743086ecc..fdb5836461ab 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1151,8 +1151,8 @@ struct kvm_vcpu *__vm_vcpu_add(struct kvm_vm *vm, uint32_t vcpu_id) * TEST_ASSERT failure occurs for invalid input or no area of at least * sz unallocated bytes >= vaddr_min is available. */ -static vm_vaddr_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz, - vm_vaddr_t vaddr_min) +vm_vaddr_t vm_vaddr_unused_gap(struct kvm_vm *vm, size_t sz, + vm_vaddr_t vaddr_min) { uint64_t pages = (sz + vm->page_size - 1) >> vm->page_shift;