From patchwork Fri Sep 16 04:51:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 12978129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7294BC6FA86 for ; Fri, 16 Sep 2022 04:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=y8EOqZKz1uPO28c5cSSS3WZ/qTcJLhuy3y23sJDc+bw=; b=xQNIzMZzo9KZOz J/sDJdaEOGal9HiwxllS8beaOGN9PZiY4K2ADeX2QXvVZ7QHp2fdc9/e/fCr2dRzNxxlCW5xq+9C8 Cr5jT3zPffJb2WygYudO9RYxwbMMB8AM4aD3FG1n631Duvd6uA/2CT4Tbb2YatHC4Hc2cMEO4GOss 3yH5Ig9yqmJli/Tnyjo7MvcGVdKnwBU64V3HRny5sYfj7AjOK7OJCPGkl8nyOcnakIGS+xOstQMX7 zNIQBA2JqpTiIUfayLA/vkgQWOheYYJvEcpVooYIcgRfUu8AI5Lix0lqYltdWzclagdfb2hB/T6bU 0H6PCIe+ZtOawI4HmZmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oZ3Ke-007h2N-PH; Fri, 16 Sep 2022 04:52:04 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oZ3Ka-007gzP-GE for linux-arm-kernel@lists.infradead.org; Fri, 16 Sep 2022 04:52:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663303912; 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; bh=ZrlYoSR0t0sSR123GOVAJxEfCWOvnKpItP6M0/Vrog0=; b=DuJVWScgQz2ZW3OfD7onManL9DWNj4wgRXqVbzSdmb6fQMacSnrpxJkPWFzUPP4yBDqhbL bhOcdlqteJcNHcGoHVvswOrTS6Jf2paINpJxLyGyeqvOTmB7hd04cPILQSOOzAkQpBfQaX vzC/ZeznWbK2OudBC0macGUylyF58Yk= 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-495-HQsuENMbNjO1T32TYAyMaA-1; Fri, 16 Sep 2022 00:51:48 -0400 X-MC-Unique: HQsuENMbNjO1T32TYAyMaA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BFB52862FDF; Fri, 16 Sep 2022 04:51:47 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-126.bne.redhat.com [10.64.54.126]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2795D140EBF3; Fri, 16 Sep 2022 04:51:40 +0000 (UTC) From: Gavin Shan To: kvmarm@lists.cs.columbia.edu Cc: kvm@vger.kernel.org, linux-doc@vger.kernel.org, catalin.marinas@arm.com, linux-kselftest@vger.kernel.org, bgardon@google.com, shuah@kernel.org, corbet@lwn.net, maz@kernel.org, drjones@redhat.com, will@kernel.org, zhenyzha@redhat.com, dmatlack@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, peterx@redhat.com, oliver.upton@linux.dev, shan.gavin@gmail.com Subject: [PATCH v2 0/5] KVM: arm64: Enable ring-based dirty memory tracking Date: Fri, 16 Sep 2022 12:51:30 +0800 Message-Id: <20220916045135.154505-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220915_215200_632516_D661C3CF X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This series enables the ring-based dirty memory tracking for ARM64. The feature has been available and enabled on x86 for a while. It is beneficial when the number of dirty pages is small in a checkpointing system or live migration scenario. More details can be found from fb04a1eddb1a ("KVM: X86: Implement ring-based dirty memory tracking"). The generic part has been comprehensive, meaning there isn't too much work, needed to extend it to ARM64. - PATCH[1] introduces KVM_REQ_RING_SOFT_FULL for x86 - PATCH[2] enables the feature on ARM64 - PATCH[3-5] improves kvm/selftests/dirty_log_test v1: https://lore.kernel.org/lkml/20220819005601.198436-1-gshan@redhat.com Testing ======= (1) kvm/selftests/dirty_log_test (2) Live migration by QEMU Changelog ========= v2: * Introduce KVM_REQ_RING_SOFT_FULL (Marc) * Changelog improvement (Marc) * Fix dirty_log_test without knowing host page size (Drew) Gavin Shan (5): KVM: x86: Introduce KVM_REQ_RING_SOFT_FULL KVM: arm64: Enable ring-based dirty memory tracking KVM: selftests: Use host page size to map ring buffer in dirty_log_test KVM: selftests: Clear dirty ring states between two modes in dirty_log_test KVM: selftests: Automate choosing dirty ring size in dirty_log_test Documentation/virt/kvm/api.rst | 2 +- arch/arm64/include/uapi/asm/kvm.h | 1 + arch/arm64/kvm/Kconfig | 1 + arch/arm64/kvm/arm.c | 8 +++ arch/x86/kvm/x86.c | 5 +- include/linux/kvm_host.h | 1 + tools/testing/selftests/kvm/dirty_log_test.c | 53 ++++++++++++++------ tools/testing/selftests/kvm/lib/kvm_util.c | 2 +- virt/kvm/dirty_ring.c | 4 ++ 9 files changed, 59 insertions(+), 18 deletions(-)