Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp5517069rwb; Wed, 21 Sep 2022 08:49:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7GNmdoxcs/u8tuSHJhj2l/7BpggSWwjJdeVe1QTkQZ7XRSn4JPlUu9zu6lsMS7dY+zmc0B X-Received: by 2002:a62:ce07:0:b0:540:da19:bf6d with SMTP id y7-20020a62ce07000000b00540da19bf6dmr29477273pfg.31.1663775360403; Wed, 21 Sep 2022 08:49:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663775360; cv=none; d=google.com; s=arc-20160816; b=Lxs9gavTpkTxkAeBI7EyD45GedJzsvvJyXzdKAqBiEoyO+Np5X3etdNnqMDEAESszm QpWz8FXNSf6wp7NTVACPgv0n70jO3xD0q+9Y8jgvCbkduziZqJuDLbKjlflWWCI0XeNW XYSY8cNgGwtuoOoztup4it2tFgqP1oWnYvzMAh/x9YtmUiAy1nMc7Gwt+UX2BplIkDgy VczzHdAd1O35rSG+rvGpmphQpkksNYOwxQyNJl2JF9oho6+g8XpQncOb86EMp34QuSGO 5szziAYbKYW7/nH+4xDvyjQcKhVyROgj40JlpGQg/Kgm5G2zWSmZZjyakgDPO3xfzcrV vRAA== 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=9PZVfEnUZFTUo4VN/kH3PmajRGyXyHYhSJ4LlUD5Dk4=; b=u3cw2pl0PGMS/E9MU7axDTGdlEpWjFWeLMZHhI/KWoVH9QgpG8k8a82S1ZXFTh5luw NE5GIfQZY+RXLwtI/3cD1cUN5xMelNR4pa6ki3orZgkpDqhB6oBZwSDfKcGrAB0Abz86 QfGA+xRTiHxXUYEyGezU8Sm/tzuUvQSRPSyIPEkUc13uXtg/ngFE+3Fp+jktjdnUnqJq sGAF9bYy6BNR5woRmJyyVpmO83IJs2/KDzoZP0zkDyDT1QFUJFmHghnQty8o6R7ZTSqx 3ibbmfYOu61p3O7ah3PAHuU6MgMf0MUjAsX1gWpptiub/Vl+wsrF3EVml1xTDTQFYCnH WrSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hzFaNY1l; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h186-20020a636cc3000000b00438a419218asi3026728pgc.796.2022.09.21.08.49.08; Wed, 21 Sep 2022 08:49:20 -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=hzFaNY1l; 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 S231462AbiIUP21 (ORCPT + 99 others); Wed, 21 Sep 2022 11:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231370AbiIUP1c (ORCPT ); Wed, 21 Sep 2022 11:27:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D67A099B57 for ; Wed, 21 Sep 2022 08:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663773954; 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=9PZVfEnUZFTUo4VN/kH3PmajRGyXyHYhSJ4LlUD5Dk4=; b=hzFaNY1lbfyNhVVroh2kM6wkl4ZugesgMm4+u+GR/uILOzy/2Clqw+7fY3zx9tnlaMyGP+ say3zRBdh/FgKgUUZgoPQB54esF1uzZjx2uZ9SZBj7/ZzFFWBfBCqLR3nBy810HOg3CxS7 jUwPwHG9PW+qRP0sSn1s7Vo9yuKepaw= 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-44-gWOXq5eUO6aY11dJ1IV8VQ-1; Wed, 21 Sep 2022 11:25:50 -0400 X-MC-Unique: gWOXq5eUO6aY11dJ1IV8VQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4E460803D4A; Wed, 21 Sep 2022 15:25:50 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.194.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D0A72166B26; Wed, 21 Sep 2022 15:25:48 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini Cc: Sean Christopherson , Wanpeng Li , Jim Mattson , Michael Kelley , Siddharth Chandrasekaran , Yuan Yao , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 27/39] KVM: selftests: Fill in vm->vpages_mapped bitmap in virt_map() too Date: Wed, 21 Sep 2022 17:24:24 +0200 Message-Id: <20220921152436.3673454-28-vkuznets@redhat.com> In-Reply-To: <20220921152436.3673454-1-vkuznets@redhat.com> References: <20220921152436.3673454-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.6 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 Similar to vm_vaddr_alloc(), virt_map() needs to reflect the mapping in vm->vpages_mapped. While on it, remove unneeded code wraping in vm_vaddr_alloc(). Reviewed-by: Andrew Jones 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 9889fe0d8919..ad9e15d4c6a9 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1214,8 +1214,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; @@ -1288,6 +1287,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); } } -- 2.37.3