From patchwork Tue Nov 1 14:54:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 13725 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp3023419wru; Tue, 1 Nov 2022 08:02:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Qqw6QSQqzGm2GJg3JhuoD4wrNkIy1bNTjVXn3rlSoSoK+tN/fTlUmdQh/1D5Ykmn2Y0Ba X-Received: by 2002:a05:6402:2751:b0:443:d90a:43d4 with SMTP id z17-20020a056402275100b00443d90a43d4mr19859619edd.368.1667314939797; Tue, 01 Nov 2022 08:02:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667314939; cv=none; d=google.com; s=arc-20160816; b=t+/5N1EPnxuBCaBKgfoSZyWcNYGGH8jGi1USkuv7BoKqtu6t8VFIsILDjXPU0bvRN1 Z5Kl73OcELRxwWte8MAjOYMwUSHT8Ekq8SxIetZp+9Oq0/QhFeAVK9wl0u0rq/bxmBYs VeqZn53/FUF0LYWywyMhOtOpYKrC/c/4agSvPq05LQAbHJHiTpOwYJ4hUcjxBy0zCpEk bejcedj5neTrM9xLhgXxL5IS+rab1qjHTgs/RpcbOSxfY1SBnG/dOjrWa5BUzeMtsXJP x7doL71m7qlQ2goueRgED82scm3HN0zLWcD0HBgqqVvtWHpoXfBTtmTjnmIgkLl6bCFn Nakg== 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=7puXFXv1DG8mFUtGfN+hbNIIoLLWZiDM4OzPtCAwHnA=; b=NtKdFuviJvIToHUH6deebkvEv2W2dkGyGnESdSP/QveYhKoViBvCibXIFOWIvFG57n 2aq/QhxGAKgZOAg2jcykafoRojaHxDzD9lx6EnZrTCXfwAplxGiWYJL3mOxA+03mG0wb jufWw7WmG2nk7ONJaPu6FOSJVaK2QpBm+mYvhBG0mPCwTlegBfe1s6zLT/hetPOHOZ4u 9L5A97TEQOCf0qFIMNXhmzeFyNRCvgw1Xrq8D8gW1MyJC461JvVGyAIfns6uapjlOn2N /fvyMADCQIRQHqfb1TAhQnlxErSCm2MlIcNHzpanZAdC8FdWAHcaCF/ibhHMLMpgKPfe aVuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=etYcSPKa; 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 g11-20020a17090669cb00b00783e7d72fc0si9553596ejs.272.2022.11.01.08.01.54; Tue, 01 Nov 2022 08:02:19 -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=etYcSPKa; 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 S231319AbiKAPBV (ORCPT + 99 others); Tue, 1 Nov 2022 11:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230086AbiKAPBF (ORCPT ); Tue, 1 Nov 2022 11:01:05 -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 59A751DDE7 for ; Tue, 1 Nov 2022 07:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667314602; 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=7puXFXv1DG8mFUtGfN+hbNIIoLLWZiDM4OzPtCAwHnA=; b=etYcSPKa/d9TChdgstJIHCqRymcRZnDlo+Pm/GovZnC95qAMJFWBu2N5BA+/8g6EdJ0qq5 oaLfnTQyvAV88xZdRu0x0mF2Q0+E0Mxwe3m0f79xyyjzWiSk/LY/k3ez1iGJH0P8bhMYmX w0En9OpV1ftJDnIeVKtxOG0ZbKQZIrA= 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-549-tOQTKxiRP_uhix1cMQetdQ-1; Tue, 01 Nov 2022 10:56:39 -0400 X-MC-Unique: tOQTKxiRP_uhix1cMQetdQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B5AF80600A; Tue, 1 Nov 2022 14:56:23 +0000 (UTC) Received: from ovpn-194-149.brq.redhat.com (ovpn-194-149.brq.redhat.com [10.40.194.149]) by smtp.corp.redhat.com (Postfix) with ESMTP id 68F8DC15BB9; Tue, 1 Nov 2022 14:56:09 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Wanpeng Li , Jim Mattson , Michael Kelley , Siddharth Chandrasekaran , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v13 34/48] KVM: selftests: Fill in vm->vpages_mapped bitmap in virt_map() too Date: Tue, 1 Nov 2022 15:54:12 +0100 Message-Id: <20221101145426.251680-35-vkuznets@redhat.com> In-Reply-To: <20221101145426.251680-1-vkuznets@redhat.com> References: <20221101145426.251680-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-3.1 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748306429999487773?= X-GMAIL-MSGID: =?utf-8?q?1748306429999487773?= Similar to vm_vaddr_alloc(), virt_map() needs to reflect the mapping in vm->vpages_mapped. While on it, remove unneeded code wrapping in vm_vaddr_alloc(). Reviewed-by: Andrew Jones Reviewed-by: Sean Christopherson Signed-off-by: Vitaly Kuznetsov --- tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/selftests/kvm/lib/kvm_util.c index 3578b9a7cc2f..29f743086ecc 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1256,8 +1256,7 @@ vm_vaddr_t vm_vaddr_alloc(struct kvm_vm *vm, size_t sz, vm_vaddr_t vaddr_min) virt_pg_map(vm, vaddr, paddr); - sparsebit_set(vm->vpages_mapped, - vaddr >> vm->page_shift); + sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift); } return vaddr_start; @@ -1330,6 +1329,8 @@ void virt_map(struct kvm_vm *vm, uint64_t vaddr, uint64_t paddr, virt_pg_map(vm, vaddr, paddr); vaddr += page_size; paddr += page_size; + + sparsebit_set(vm->vpages_mapped, vaddr >> vm->page_shift); } }