Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp296160pxb; Wed, 23 Mar 2022 18:42:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJykcgy/2GIB/vsSl7DWwCUdv38DJ40xJyDp0gEYhC0xbuVb1uaT3pqnYG5l3mYPv6AZOqn7 X-Received: by 2002:a17:906:9c90:b0:6df:9eea:cda3 with SMTP id fj16-20020a1709069c9000b006df9eeacda3mr3169149ejc.89.1648086130808; Wed, 23 Mar 2022 18:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648086130; cv=none; d=google.com; s=arc-20160816; b=lSMN+v/WzTJYmRnQOStLp8/SguQp90LCa/jbK5YCjF3MhtMuK6cQprzDxvMs7nx5dK kDUW/IKoKWNT/0bA6sGjSpTumpTcdFIvXS1x2BSFb3tKObomd1FcizgBMbaoZ9NcbN1Z LXLjhujoLvPH+xDS7BF1CNUfInpLx4+JfVuxUuX7LMJ73wHZbtKNfEhkHMmA/0JE6cDs ZSuCvppyrnDuffYA2XY2bgUZX/YOTJ34U6APwUswlJAtc/p8ZnZrUdkyqgla5veFbgkb LAJnC5P3SEQm0PVIeKagIlL6UYztouEVNeGzKEX2SyZNkoP66oMQ+f3uqTkljtqvmZDL NJUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :reply-to:dkim-signature; bh=vksLZSJ/1XSsrv5+Q44yzVYsU90jJzgSeUJqyoBHB3k=; b=oxl0Z8gi7AcjNM/eo+otVegSQuIRsmY5cCaDMLSHRe1TusipBm+EyiD9rMiHEYiQ7P r0gfUaCSvd4vhd3rMz4Csd583dKtRl195Avi5UGJtPSQ4s9R1mXHwlB0LMysV4X+VXo1 d61Qh3LgKDKoyDZoTCXAbH8b8uSqwVrKLAdadjGNkMshWuKKOt48L7NCjD1PZoIx7b+e w4ghP1O24wLwcXHv3JKKcQoecgeaCgi6VAt3pxL+33vtDQwcskTS4nH4cJIgshZJxkqX xax3wDOhJFTgTnHcY3cTfSkWWUVoHavmNlX4mm3qfxA5yJoQwTUzv721lm7RRueRLHSU eZLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="Mol/t6dj"; 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 k23-20020a508ad7000000b00418e8ed6aacsi17752966edk.481.2022.03.23.18.41.45; Wed, 23 Mar 2022 18:42:10 -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=@google.com header.s=20210112 header.b="Mol/t6dj"; 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 S243218AbiCWSu5 (ORCPT + 99 others); Wed, 23 Mar 2022 14:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233341AbiCWSuz (ORCPT ); Wed, 23 Mar 2022 14:50:55 -0400 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76990606C7 for ; Wed, 23 Mar 2022 11:49:25 -0700 (PDT) Received: by mail-pj1-x104a.google.com with SMTP id q71-20020a17090a17cd00b001c653c3b564so1525496pja.9 for ; Wed, 23 Mar 2022 11:49:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:message-id:mime-version:subject:from:to:cc; bh=vksLZSJ/1XSsrv5+Q44yzVYsU90jJzgSeUJqyoBHB3k=; b=Mol/t6djA6xfgUtihD1s4EYkxSSzamZSlq8W+dA2jAHEMVwdF9WxvpkKB8lwCoJMDY 9wuW/UVP7U3AarQBF6lE4gimtHGT9ecsTfJo6IiQB5MU7bqvoiYg4e4VVxCGM3FL/TiY rFZqb6pGu0w+U3LTN5nFohLXarkpEHjAFQ+U4UbrePmi7F0lVs3S/quSQWLI7bwTqYHP VE8gTIP50G9ETEPEMG+DS358KFjYb956uzEsMtyWR/yejP+8EEE/oaSlpFi8szXttbyL M3iHQCK6BErBslrSku1TrBtmpcRYQh4FdJUtSrAfmpJGOA8YKjEJSOr03FSJhaWko0vl Ebfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:message-id:mime-version:subject :from:to:cc; bh=vksLZSJ/1XSsrv5+Q44yzVYsU90jJzgSeUJqyoBHB3k=; b=OXy+Nw1+0RRWp6ZV9DlK1xQtnq8RIdoJFbACCQWJlUnR9YYi12DveJNjXh/uNcNgzM JyopRbEZ3ZYVqXCdhX+0vdEs44Pe0Ox5bkfstFgNNf6UpfchY/1N3kaxu7Tuh5ZpGbol jpPI+HETNDprvy2CQK7djPRa/DA3UtQFpeXFre0sbX7Fbn/l7Y+vKJAgfmWNMeOwAUQ7 +RGcqSwVp8kyvjPH3vBWqesgN05mDsKH3fpse9XM7HhQrWi/ETzIFBHuNrLKxT4K7qZf y04PqPIxW3Bnv5tDqlc9OchTTLgmtEe004ofMtMxI29Hh9EY760ddTADhttRwA03Y88y PT7Q== X-Gm-Message-State: AOAM530EzcNh/EStme/84GvLEFSa7iMKMBp06Cn21D2LF2lbDIC8SWUP nuGJjTk005pOUf8jG6RRquLHDZgUgfaV X-Received: from mizhang-super.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1071]) (user=mizhang job=sendgmr) by 2002:a17:90a:d3d1:b0:1bb:fdc5:182 with SMTP id d17-20020a17090ad3d100b001bbfdc50182mr13515326pjw.206.1648061364908; Wed, 23 Mar 2022 11:49:24 -0700 (PDT) Reply-To: Mingwei Zhang Date: Wed, 23 Mar 2022 18:49:10 +0000 Message-Id: <20220323184915.1335049-1-mizhang@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog Subject: [PATCH 0/4] Verify dirty logging works properly with page stats From: Mingwei Zhang To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Gardon , Mingwei Zhang , David Matlack , Jing Zhang , Peter Xu Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_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 This patchset is to verify if dirty logging works properly by checking page stats from the per-VM interface. We discovered one performance bug in disallowed_hugepage_adjust() which prevents KVM from recovering large pages for the guest. The selftest logic added later could help validate the problem. The patchset borrowes two patches come from Ben's series: "[PATCH 00/13] KVM: x86: Add a cap to disable NX hugepages on a VM" [1], which completes the selftest library functions to use the stats interface. [1] https://lore.kernel.org/all/20220310164532.1821490-2-bgardon@google.com/T/ Ben Gardon (2): selftests: KVM: Dump VM stats in binary stats test selftests: KVM: Test reading a single stat Mingwei Zhang (2): KVM: x86/mmu: explicitly check nx_hugepage in disallowed_hugepage_adjust() selftests: KVM: use dirty logging to check if page stats work correctly arch/x86/kvm/mmu/mmu.c | 14 +- .../selftests/kvm/dirty_log_perf_test.c | 52 +++++ .../selftests/kvm/include/kvm_util_base.h | 2 + .../selftests/kvm/kvm_binary_stats_test.c | 6 + tools/testing/selftests/kvm/lib/kvm_util.c | 196 ++++++++++++++++++ 5 files changed, 268 insertions(+), 2 deletions(-) -- 2.35.1.894.gb6a874cedc-goog