Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2256346pxp; Mon, 21 Mar 2022 15:07:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKMal+l7Iw3z84evMBXtkah+eWa6thsCs7xOcbwUfKb4ozzYdmH+CNJieZtTM4iwpbG7Nk X-Received: by 2002:a63:d64d:0:b0:374:6edc:989c with SMTP id d13-20020a63d64d000000b003746edc989cmr19483170pgj.434.1647900453146; Mon, 21 Mar 2022 15:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647900453; cv=none; d=google.com; s=arc-20160816; b=Y3HiAHOLbOe3/x21fjKnnQFq6JhoplFq3ZcsEzUCKqT83ceyuYE1aEygZ8nALBdRBV cPfBYZb14s78BJL2miPDSYdItzn1m99QmN8/LdObhsq0udRd7H3RNNfrL/PN9kwY3CG+ X22AjovSgLjKhGmqH7DWvVBhQueR/Cvsc9Jow2LFvcKgPDvcDV56635uqaIG7gL3X2DH QNx3Hslmi5TKQsRh85IwvI8q3OvTDbAU/m3YSnfMtlBfIzDZXheS8nA3PBgKfUAsiBDM 2CjPkg3ye0aLP35zlOJAmXpknKq3w5GBef8GDeMvY/ka56OEU/CpuoPIa7o0bUMYIzJ+ 4+OA== 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=0Nq8284D+/PxlSogpvG3jG7KOFOCyftBrmKWrE5ZPmz/Jbt033zp9gwXAtcUMhW+ie QwdkH8kfCov1FQwdV2OqPc6x3xvIuAWwAxMfowXoeCV+Xy80BPqT7IrZ8aMf2r+W04/s jXSShfVKKP2xE1N3E6/RRKR2DvUlL/8HRkJcr63qO1WOeGKzYUmSBp9mjnGUmLjbJF3V QsSPVZ2zO2nHdhBaV2e5dDqE52TwbioOYYEU7CpYr/yCCBFyfwBG3erXJfOrnR48B9qG hQwLkZ/nV6kzyuAt1ivadvxKLHe7wchlSLiUDinSa96wQdZszqjCULuOFTsq5/P/zu/I h8tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=gSwfSIzd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w24-20020a170902d71800b00153b2d16510si11303328ply.280.2022.03.21.15.07.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:07:33 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=gSwfSIzd; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1F8C73612B3; Mon, 21 Mar 2022 14:30:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242101AbiCUA2F (ORCPT + 99 others); Sun, 20 Mar 2022 20:28:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234559AbiCUA2F (ORCPT ); Sun, 20 Mar 2022 20:28:05 -0400 Received: from mail-pg1-x54a.google.com (mail-pg1-x54a.google.com [IPv6:2607:f8b0:4864:20::54a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C5F0DE910 for ; Sun, 20 Mar 2022 17:26:41 -0700 (PDT) Received: by mail-pg1-x54a.google.com with SMTP id z10-20020a634c0a000000b0036c5eb39076so6619408pga.18 for ; Sun, 20 Mar 2022 17:26:41 -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=gSwfSIzdqD5scy88k1Ask13XrPPk0tjFpkIl+D/qDCh4rUVNM82SuDTRYhdU6aYvrv xtz+rBdoSrGFv2yFWdyQB33Uhb2WIK+kLFiN1toCSPE2yT8CCK7JrNY29nMvpz6xT3LJ AiMjx5FbnXVooaM53zgB5DAgGak5uuyMy6HH6XopU7hbPNVEiZWu7upyAqjmajQeUEdB 8STDcUpcAKOXoU8Qhu/dMstGg2NPwAkT1DMsmHgnilrDL/mn95g2YdxLr5gBwQrBeP99 UtM7aQ3xVNgjPXm67mAEmjZfb9utG4B3LJ7kL34i8AY/tBX/FIWgTQutidvArslq8Gvw gYFQ== 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=pjv4l7H+h1euKXSKDV66opSi2ysX8XQPQnOeDG0vUqL6n3O0tFhBsh9NhE7L5SEoqp Ogqyet/TaYd+kTX05ea5crEPX5iNlLNeEKtk4escH2OyTaVTX+x8U/6WMDI+0BRlmUNC tlh9a4nxEWw+kZMzUJMlS766suP1mApJ88ouZAJ9GXhjiUHEMXcXQ3faQLGtX1fJxgYA hklyElkwQ14NblHQ+izxxme0aA0wL45ZD38Vddp2AQwve3xsg65t0QgfKFuNzsoUxGCD cBrAzT21srZaS5WUk1Iyz+gEGNZLLMOELrjbUOPrZL5xpyVn/Jx9Vt7HihnT+c82VGd2 Sy2A== X-Gm-Message-State: AOAM530EFabJnKQV+E2v5RH8Uyr2Q/GLNiYCSQRy6kw6eljfOuct91hV AuSlLXDyz7uqWLZW/ZXuU43QS5JSUNV8 X-Received: from mizhang-super.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1071]) (user=mizhang job=sendgmr) by 2002:a05:6a00:1248:b0:4f7:db0:4204 with SMTP id u8-20020a056a00124800b004f70db04204mr21033266pfi.27.1647822400512; Sun, 20 Mar 2022 17:26:40 -0700 (PDT) Reply-To: Mingwei Zhang Date: Mon, 21 Mar 2022 00:26:34 +0000 Message-Id: <20220321002638.379672-1-mizhang@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.35.1.894.gb6a874cedc-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 , Ben Gardon Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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