From patchwork Mon Jan 16 04:04:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gavin Shan X-Patchwork-Id: 4044 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1010345wrn; Sun, 15 Jan 2023 20:07:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXsLkr4vaDziGTmea8MMNztlfUBPYzhoITL/gXbHaBIehSs6R9UYJLQRUmul2yEslWBrlEuq X-Received: by 2002:a17:90a:be10:b0:226:d7e8:e122 with SMTP id a16-20020a17090abe1000b00226d7e8e122mr36813480pjs.19.1673842078548; Sun, 15 Jan 2023 20:07:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673842078; cv=none; d=google.com; s=arc-20160816; b=lYVRfqquykFFn4TcdUE4yOghWgU15pFa/PYb+SwtCYLoHSnYSYb7D57hv/Uy97Hj1P r5td5MSA2aLec+4hNs9DiQNWWeaGd0FnKx/CFd4/nBhAu1lUfy8l29Rhf1cOKqWJlSup KnqFSQmqxcfi8sqIgRfZNX0owdpApqhIU6F9PiMad0jQxLxQWKgwaRuBlNBqTI4MYW0v 706z58LoIZdLBV1AFLggDbCvr2pVSRt+11/iZNwWuidQMfcf68GorDgKKA+JQ/NTFioa GWUMzpaBX7WUueAh9HlYARIm+nHgW2iOvfJSWBRug2W8emxDIgsXgZtIv7BN21kKhBXd RjZg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=PPbcjkK5NFxrKS7gt/P8CaZ7LsHJG99pgxGIGUkyjbE=; b=DDrUEJ/NpKmDRZgYNUFBukLq3qfviWfzdyNbm/Z938MCYiZJ4/11ppTjEAsSqn8PNT UPqezuJYJaIA1Lt6eN5yhjtIxTz4JOTicXhwOKjF74RcA3FLXQ640u4S0YYFZ5HNpG7G qz5nNp9X7zWNLNc3PFci6dblx+cwqIUKCuuxALydb+lxjwGOXX3fXEINEcDLp+wfPULb ou8cyJCQWr8gcPMa05M1jEfmgIJqMYL9yt22yki1N/CS2IqqYf1lPWV/YwgQ/l4AsBpe T924L94lATwfN5whTYXoRDMB13lOmITrhN8CCXVL4IUJkm+ytfeVDh8Umy8klpnX/T4s V5bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Pfp8JABQ; 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 z3-20020a631903000000b0049bef470e05si27567945pgl.528.2023.01.15.20.07.46; Sun, 15 Jan 2023 20:07:58 -0800 (PST) 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=Pfp8JABQ; 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 S231827AbjAPEFd (ORCPT + 99 others); Sun, 15 Jan 2023 23:05:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231691AbjAPEFb (ORCPT ); Sun, 15 Jan 2023 23:05:31 -0500 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 A8EC583C7 for ; Sun, 15 Jan 2023 20:04:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673841881; 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=PPbcjkK5NFxrKS7gt/P8CaZ7LsHJG99pgxGIGUkyjbE=; b=Pfp8JABQvKtee4K1WS4mVu+SwWKMRYzdWpG8KFChymQ6z7RAKv3GTEUF2Glozhuw+I78cu CadzTNzAX4kNqHRtWbMawaOci5tBP8s9y0UKpSCrnrXvyDT+N8Ps6fHtMQT2F2ejXqGVXf l7ny2/u8odeeBeJEOs1MzKT6r0l73/M= 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-617-bCJqG-YCNxyVRZqU4hIdUA-1; Sun, 15 Jan 2023 23:04:37 -0500 X-MC-Unique: bCJqG-YCNxyVRZqU4hIdUA-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A60001C05B16; Mon, 16 Jan 2023 04:04:36 +0000 (UTC) Received: from gshan.redhat.com (vpn2-54-98.bne.redhat.com [10.64.54.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F472492B05; Mon, 16 Jan 2023 04:04:16 +0000 (UTC) From: Gavin Shan To: kvmarm@lists.linux.dev Cc: kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, pbonzini@redhat.com, maz@kernel.org, corbet@lwn.net, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com, catalin.marinas@arm.com, will@kernel.org, ricarkol@google.com, eric.auger@redhat.com, yuzhe@nfschina.com, renzhengeek@gmail.com, ardb@kernel.org, peterx@redhat.com, seanjc@google.com, shan.gavin@gmail.com Subject: [PATCH 0/4] Improve dirty ring warning report Date: Mon, 16 Jan 2023 12:04:01 +0800 Message-Id: <20230116040405.260935-1-gshan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755150631038056381?= X-GMAIL-MSGID: =?utf-8?q?1755150631038056381?= It has been known case where no running VCPU context exists when the vgic/its tables are saved. There are other two unknown cases where we don't have the running VCPU context: (a) saving vgic3 LPI pending status and (b) saving vgic3 pending tables. Besides, the warning reports in mark_page_dirty_in_slot() is triggered even the dirty ring hasn't been enabled by the user space. It's not the unexpected behaviour. PATCH[1 - 2] Fixes the no-running VCPU context issue when vgic3 LPI and vgic3 pending table are saved. PATCH[3 - 4] Improve the warning reports by enabling them when the dirty ring has been enabled by the user space. Gavin Shan (4): KVM: arm64: Allow saving vgic3 LPI pending status in no running vcpu context KVM: arm64: Allow saving vgic3 pending tables in no running vcpu context KVM: Refactor mark_page_dirty_in_slot() KVM: Improve warning report in mark_page_dirty_in_slot() Documentation/virt/kvm/api.rst | 8 ++++++-- arch/arm64/kvm/vgic/vgic-its.c | 3 ++- arch/arm64/kvm/vgic/vgic-v3.c | 5 +++++ include/kvm/arm_vgic.h | 1 + include/linux/kvm_dirty_ring.h | 5 +++++ virt/kvm/kvm_main.c | 30 ++++++++++++++++++------------ 6 files changed, 37 insertions(+), 15 deletions(-)