Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp368434imn; Wed, 3 Aug 2022 07:19:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR4XfjiWtdKlPnu7xYMR1j4+lG/liS2Bj7Nh/IkAVJ7vzd5ifopKLKH7hH10LwCoOnPI9pVd X-Received: by 2002:a63:8742:0:b0:41b:d657:6570 with SMTP id i63-20020a638742000000b0041bd6576570mr15289585pge.516.1659536394272; Wed, 03 Aug 2022 07:19:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659536394; cv=none; d=google.com; s=arc-20160816; b=h1Zu+xWf2MX+OU2POdeQ0Bj0kIg8l7bOnPVtB3xaI/96zTrFFbV5Tl+yBh7k0psFJT Fdlw4TM0rU6Jlndw5ncMnKLQENix3FumbFTq4dM9JkUsUgZxVsZn3X3WADXh1kJ2XPXR w60J1D7/6P41b8tPe+TA4su1+ExZqFZ1JlQRSzX7RUb5E8cPmgfVkPHenKvvDCkWXOl1 KH2v9T4whIVsztAG0f6wuL/cz1QpTunynl6FmHmw5kPYyB2J4Ush1Zn+I4nOjPmDrpxD u37T4bIPx90hP5tv/7Zvxky81uVKE94gMqsPzDnMZMzQgyZJ/8+DBUk/Y8/33h0sQ0vD nLKA== 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=ZePUXx6jI2dMdCbhczqhF1SsVWBmNTOtinLHfHc2hPA=; b=LeLygvYm4uEX22sPco3fV6x4GwCgTvTGR0d8kLIMTd6pgqr0XhhvXAtM+5w/xUPs3f /17ranW85u9gP2M9TXhSvOmgTt/gz08sYx/AEA3ctD6Y2PAB9zyceL0iGsszDZI92aLc L24qyng2jdUtEzAf7nI7O3L6p3VdSqGXBbh6O5DkUBuGKQ0rM4rlXagugwOJvxCpkBIm 1sWgCIzr01WTuW5nh0hyb0QQTGReDyMkR4rm9xYgjTSJ9+FQiuhgLZyzZYzZAvHk2XNF x0AzgqVH3jLOKydoOL4OeUW+3uFxq2B5fOsWLZirxXEg1sl+TeoLw90o8/6tW2c3214l 44hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=B3n4j+Ms; 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 gv4-20020a17090b11c400b001f20ab3ecadsi1886324pjb.18.2022.08.03.07.19.37; Wed, 03 Aug 2022 07:19:54 -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=B3n4j+Ms; 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 S238397AbiHCNsR (ORCPT + 99 others); Wed, 3 Aug 2022 09:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238161AbiHCNrr (ORCPT ); Wed, 3 Aug 2022 09:47:47 -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 ESMTP id 414F540BC6 for ; Wed, 3 Aug 2022 06:46:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659534404; 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=ZePUXx6jI2dMdCbhczqhF1SsVWBmNTOtinLHfHc2hPA=; b=B3n4j+MshJ/TtWQUV5vONsaOervV22HNgL/pHEcR+4kEOjhGynFstyneLEtDO1jeK+mI4k q34NfxEviaEGTDsJgcXrNBLbmVBC+Cu4vqilz1cPVaxqq+cHcWCfqQcupuqDGIK/y8a4O+ BBbPjB7MBrZXE1SorBoAcZrjF22rX4M= 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-296-36ptAVxlPaO_Ji8o9BWlcg-1; Wed, 03 Aug 2022 09:46:39 -0400 X-MC-Unique: 36ptAVxlPaO_Ji8o9BWlcg-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 58D0C800DBE; Wed, 3 Aug 2022 13:46:39 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.195.93]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6E2E2166B2A; Wed, 3 Aug 2022 13:46:36 +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 v9 28/40] KVM: selftests: Fill in vm->vpages_mapped bitmap in virt_map() too Date: Wed, 3 Aug 2022 15:46:35 +0200 Message-Id: <20220803134635.399448-1-vkuznets@redhat.com> In-Reply-To: <20220803134110.397885-1-vkuznets@redhat.com> References: <20220803134110.397885-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 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(). 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.35.3