Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1282045rwb; Thu, 19 Jan 2023 08:42:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXs3zF8//EFUUCbhIvf9NPXxWOOEeYEEGjlfyV+qr++vqyGy7jfW+X738a/J1FHIKY1TCqwX X-Received: by 2002:aa7:d7d9:0:b0:49e:7791:a734 with SMTP id e25-20020aa7d7d9000000b0049e7791a734mr1271703eds.35.1674146563277; Thu, 19 Jan 2023 08:42:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674146563; cv=none; d=google.com; s=arc-20160816; b=M88Ltg5iunC1ZfNwaGDI+fMNx2yFUoZxWjvGF6D9ZdLX1K7iFfhMhBjRB0HzHsyo+s 5DmhzJhXDaZcwSltnz0kE6+Wmnc40J0xEDI8p+CfcNDAscy/IgSsUZnS4fSgIFQgBR92 0uOXx91YSfa2CYaXDGZF8t0HyjwAFg0RhJte0AzffsnBHBHP60GvLCQ6HIxWdevktFTi aQOppM/9sTvgvhNT7yA1RljvVQdTzIaN8Jf4MJykAUR5Hfd4Mb9ZJcddlInoe+hNR4Wv tLADuyc24jT5aN6i4UXJUwxgJ0rnhPj6voKR1GCg9D8tejTqFsBShgWgt9RmPpjCM96M er7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=COC0cQf3RM+28HjrZuFfI8U9iEnmOUqpakV5+y8hXro=; b=bSCJ4tGmuUf+L2tG3oKAUX4v1uQFoK5WoDE6qeD7xsPs3fQHJRg2DvNB1t6CN0Y8zE r9CjBLjQcIS+gFjU9kYs/LFj5uVxyKdFM7cQsp4SKMPZyfypmpQt8PryEvrU23mBWKVo zLjiPr8boX09bLzheD9tZByeyYhvwsZZ1nMZSCdIYMeEZHUHUeVF+INf1J9RYjTMFyAl 5fQUULdrQvu0TJXFBZut0cnPNCdGOsZRLaf3yVdP5AqtPNhjy1egHSTjHJhZVvhS95vY q3pYlLfQ9SxOBYDzhJNBkNZU5MLnQ7qvVdeJZ8lwmmRMhcZmtM2m6hZNYbImSIfQdjEN lwRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=iYhnq31F; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a056402255300b0049e475c817asi7243497edb.479.2023.01.19.08.42.30; Thu, 19 Jan 2023 08:42:43 -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=@google.com header.s=20210112 header.b=iYhnq31F; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230415AbjASPT2 (ORCPT + 45 others); Thu, 19 Jan 2023 10:19:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230368AbjASPTZ (ORCPT ); Thu, 19 Jan 2023 10:19:25 -0500 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB4DC829AE for ; Thu, 19 Jan 2023 07:19:23 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id e10so1752740pgc.9 for ; Thu, 19 Jan 2023 07:19:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=COC0cQf3RM+28HjrZuFfI8U9iEnmOUqpakV5+y8hXro=; b=iYhnq31FqaCsdLQsRmrrrSLPknKuzg5EDi5FnG0XJsMCKleZzOOmIahMB3jDftuROY H59Ix3pMjUGC32cz0psGxHXSEcTHd8pi8Qrq+kL8J6jfZ8xhUtDMh+Tzue4FsbiOkW3y URS8YujQKNW9cPaYrDJPmzT15CUqXfqdqGhoCrQgkaPR9Ed8OGrN+9NyH3H7m/5QBEWV hIkBu9SKzujHSZQFK9WfBMq0uvlOQq4I2fvhIczyLYxMGFewOAWWJfkfA27Q1PUGyPZi 3iQ2BSwglss6M0QPQ5mSnVR3fNPSvjfiFE54E9yOscLqQ2KH5BZGDbWYFbMsy5huTIVf XMJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=COC0cQf3RM+28HjrZuFfI8U9iEnmOUqpakV5+y8hXro=; b=ruvAmTe62SlC+emo1rqoDXnZexaN2YGEIlUQC07SDsHQ7/vfUxddVzrxNxo+7KzeSk mz4FO7VGoV/WXWTx5GKqvcQg9Xu+zv5gSY2jvT4uY4qdIddeY8aEG3RoxpKOvHvTznsZ AS7E8ljJ6BuUO58YhGjZuTwoc+lUKb/mdXchfH8HAhPQariz4te/hAN26bPXtyhq+U5A APsom25XyatPUmkuGdHUWjLKIKRDZPjXYy7hQ00zK2oXZ2lp8h2WdGBlRViycaONt0ce 4FL/BNNooXNfhsdz/mogSwQ33nwl7AA67dUJnVZSuXhk71jgSjRiHIrQ4qRqIslmrIKi qp9g== X-Gm-Message-State: AFqh2krfiJg9gxV8YIBrtv6ioTFZE7x2PItiSZBlGJjA/xLO1PBHcY7G WKCosaGaxKnOtXaYK8gPNMn38g== X-Received: by 2002:aa7:9041:0:b0:58b:cb1b:978f with SMTP id n1-20020aa79041000000b0058bcb1b978fmr1888929pfo.1.1674141562945; Thu, 19 Jan 2023 07:19:22 -0800 (PST) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id x2-20020aa79a42000000b0058d9730ede0sm8638923pfj.210.2023.01.19.07.19.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 07:19:22 -0800 (PST) Date: Thu, 19 Jan 2023 15:19:18 +0000 From: Sean Christopherson To: Gavin Shan Cc: kvmarm@lists.linux.dev, 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, shan.gavin@gmail.com Subject: Re: [PATCH 4/4] KVM: Improve warning report in mark_page_dirty_in_slot() Message-ID: References: <20230116040405.260935-1-gshan@redhat.com> <20230116040405.260935-5-gshan@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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 On Thu, Jan 19, 2023, Gavin Shan wrote: > Hi Sean, > > On 1/18/23 2:42 AM, Sean Christopherson wrote: > > On Mon, Jan 16, 2023, Gavin Shan wrote: > > > There are two warning reports about the dirty ring in the function. > > > We have the wrong assumption that the dirty ring is always enabled when > > > CONFIG_HAVE_KVM_DIRTY_RING is selected. > > > > No, it's not a wrong assumption, becuase it's not an assumption. The intent is > > to warn irrespective of dirty ring/log enabling. The orignal code actually warned > > irrespective of dirty ring support[1], again intentionally. The > > CONFIG_HAVE_KVM_DIRTY_RING check was added because s390 can mark pages dirty from > > an worker thread[2] and s390 has no plans to support the dirty ring. > > > > The reason for warning even if dirty ring isn't enabled is so that bots can catch > > potential KVM bugs without having to set up a dirty ring or enable dirty logging. > > > > [1] 2efd61a608b0 ("KVM: Warn if mark_page_dirty() is called without an active vCPU") > > [2] e09fccb5435d ("KVM: avoid warning on s390 in mark_page_dirty") > > > > Thanks for the linker. I was confused when looking at the code, but now it's clear to > me. Thanks for your explanation. How about to add a comment there? > > /* > * The warning is expected when the dirty ring is configured, > * but not enabled. > */ That's not correct either. By design, the warning can also fire if the dirty ring is enabled. KVM's rule is that writes to guest memory always need to be done in the context of a running vCPU, with the recently added exception of kvm_arch_allow_write_without_running_vcpu(). That intent of the warning is to enforce that rule regardless of the state of the VM. Concretely, I think you can just drop patches 3 and 4, and just fix the arm64 issues.