Message ID | 20221021153521.1216911-35-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 s2csp766080wrr; Fri, 21 Oct 2022 08:40:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Kt86UUai7ldWXV9CyWat3UaxGIVPL0IrYh3MwgaeapEGV1MDlawendJOZw11VFwUZiUz2 X-Received: by 2002:a05:6402:510d:b0:45d:a888:d831 with SMTP id m13-20020a056402510d00b0045da888d831mr17574364edd.315.1666366856514; Fri, 21 Oct 2022 08:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666366856; cv=none; d=google.com; s=arc-20160816; b=Hr5vddolIt2qP6JF0RDX5ZeRffkMro4mNSVREo5ET0rr1AvHWou9bgenxh5bYEwL98 vUK6GTbUTsLuY1oky/5r+AIIaSxAL8dJC4K/2i7Ii5mDkOmG+0l19yWUZP91sugaFNR8 z0j35FONJlP5hCzkSocLdPvRP7OnZZhzbT7p/ND3h8ocB7pKNcYxdyFlXCptFpPhOz2V +GmmCrfiV2XQ9j7fIY7xAMjgi8vsDHA1mwog7TqbDo9vruD/dLscY/AGAxiZbJxRBWNc VGZ8RmeqXD0q0qJfVfvHZkQXjIXy5tY/ESKNExVxKG5ule5/8SkPI+r1X4Qe5vVIGLfh q/og== 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=AfPo1SkqF+q33wC7mFWVqNV07r+kv2fyctgZe6sC0iQ=; b=q8Hj+IPS8YiV6Pp1jKhjFwgK/7ThI6jLkkWQZpjRH9oBENQNA3FSRCk8DatRp63y0k 0mepQgSR8IRFy1IP0+dYXMPScHG5ZDoQydXgJZGQGLXJBmqYnKJIxkoKCqxitA09Zt2g ENn/Ehxia0AzA9F1AlQjEV0eDYlY8FOG3bMSc6qSsWV6BLy6Z/7K77Sv62hLRbQmhDMM W6P7dIjT+5Oc3rt8Zfjgr8jOP6YQIYxgan0GBqhq3NvDdebvQhov/vu4JbqK9T3Yykt/ jQIj6hepEfMJ1ceronpcrt8kj5hlO485ejaWDjrjONHSGPL4ocdrybLKZWJD8WeL984y ld7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UYhqrN5L; 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 js6-20020a17090797c600b0078b2fed72b9si16585708ejc.111.2022.10.21.08.40.30; Fri, 21 Oct 2022 08:40:56 -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=UYhqrN5L; 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 S231255AbiJUPjs (ORCPT <rfc822;mntrajkot1@gmail.com> + 99 others); Fri, 21 Oct 2022 11:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbiJUPhj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 21 Oct 2022 11:37:39 -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 21FC826ED97 for <linux-kernel@vger.kernel.org>; Fri, 21 Oct 2022 08:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666366613; 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=AfPo1SkqF+q33wC7mFWVqNV07r+kv2fyctgZe6sC0iQ=; b=UYhqrN5LOV6NhSHRYjsJgepVrCveS+ZBGkyXfgQwNO+yV7I7QwlQ+aqk/xdUl7n7qyoD90 A5Ygubh5GURxcm67ePXepmjTV80ziq3xTB7GL2AlyH9BruYbkhR0M84NYxUup+jqVdHbLR BLOESdK7IJck5PdzyuialbPxQ7934hM= 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-339-PyI9dHfaOAyjTks9RJA8xw-1; Fri, 21 Oct 2022 11:36:50 -0400 X-MC-Unique: PyI9dHfaOAyjTks9RJA8xw-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 1201A3C1E721; Fri, 21 Oct 2022 15:36:50 +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 B3E08400EA8B; Fri, 21 Oct 2022 15:36:47 +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 34/46] KVM: selftests: Fill in vm->vpages_mapped bitmap in virt_map() too Date: Fri, 21 Oct 2022 17:35:09 +0200 Message-Id: <20221021153521.1216911-35-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=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: <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?1747312293121203228?= X-GMAIL-MSGID: =?utf-8?q?1747312293121203228?= |
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
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 <andrew.jones@linux.dev> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> --- tools/testing/selftests/kvm/lib/kvm_util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Comments
On Fri, Oct 21, 2022, Vitaly Kuznetsov wrote: > 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(). "wrapping", this is dangerously close to getting someone fired ;-)
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); } }