Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp480963rwb; Tue, 4 Oct 2022 06:44:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM45BhcjOOcDP52WsCRsJ7cRFswG1l/3i15md/zLkZgpjnFwA9h+dhEKIUHrGwsL3i3Wy8sh X-Received: by 2002:a17:906:db03:b0:741:337e:3600 with SMTP id xj3-20020a170906db0300b00741337e3600mr19857331ejb.343.1664891087983; Tue, 04 Oct 2022 06:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664891087; cv=none; d=google.com; s=arc-20160816; b=zQeMH4UWfuuEbBNsZOoTNuLJ1SdKCGZrDa3D9ZE7MdJzPNqf+WuSY+csg3brs4wCyI LS73KtoqTPd/cJ2zDVxVUhxhuGXSaB/7MMIVP/RwOrKyTT9dlF4bFAWas7rWn8HDkbw7 qaxNg52jtm1YZWLKrnbzTT20Pg0I++9Zo+7kpZxURqhW8DvU5ezU9O0kffsweAbZPgJz aI1+GAothqdnwCAD+6/8QLPWPweoGq3yYtDlEZ995PKopl6VHxOT+lOHLcDSfqaBTI+a J7sqS3dhj1LlzYe3cvVyIdXl1Kew2HTsbUYURl05TrrhwjdEEuQLLmo8NB+yKttz/EjS wffg== 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=T38oQqeOm7KtBq1w8VpYMp3AX9lLfoN3XidGdJlVtJTcXu2gO9/SIPQl8mdHySMLWa 6d58shIzGLBPBlJx051FrgrYGx5T8kiu7Aa6sOb23RlO+LP+fsJ2NX3r1EKrtDDPElCN Na8TuBI7mInwyjMKGwVgU0RIFCILOgA3H2TJI8A5zSrsxLCG6lRhikZudI2xFYdX/cKH x1hG2YkFiiPe7xBng6nfdwq+/fqUCxvgbrXKxPG337u8JHZxqaCV9ppjEj2EAhLVFib3 890QMy41YQHN7Luewd55LlvsZ7z+yzLHsuRKseDvbo4z7gi5TtosyQF4yU/i+bJykOHc 3rew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XoE+NWHk; 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 dn2-20020a17090794c200b007878f030816si10377395ejc.109.2022.10.04.06.44.22; Tue, 04 Oct 2022 06:44:47 -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=XoE+NWHk; 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 S230090AbiJDMnx (ORCPT + 99 others); Tue, 4 Oct 2022 08:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbiJDMnZ (ORCPT ); Tue, 4 Oct 2022 08:43:25 -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 380FB5E56A for ; Tue, 4 Oct 2022 05:42:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664887285; 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=XoE+NWHkz077CrK7A0fUKRZDIsAdn1IgCapGs8xtEpQPT7cXP3JATS/X2un6E5ZsNoPigJ wizr03qWBOL35vK4SvUTOtFKkddtI/XWw09oUiBoMvRhol7QoEKLYlDbm4g6lB3PCcD+ZJ vpcuGk9GJsCgCksD8dpiHGKWB6J7+/c= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-353-RNnswTBsOwWbwYXDwvMVxg-1; Tue, 04 Oct 2022 08:41:24 -0400 X-MC-Unique: RNnswTBsOwWbwYXDwvMVxg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BBDCC381078C; Tue, 4 Oct 2022 12:41:23 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.40.192.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F7247AE5; Tue, 4 Oct 2022 12:41:21 +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 v11 34/46] KVM: selftests: Fill in vm->vpages_mapped bitmap in virt_map() too Date: Tue, 4 Oct 2022 14:39:44 +0200 Message-Id: <20221004123956.188909-35-vkuznets@redhat.com> In-Reply-To: <20221004123956.188909-1-vkuznets@redhat.com> References: <20221004123956.188909-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.5 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=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(). 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