Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp312723pxb; Wed, 23 Mar 2022 19:09:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybPJpDGTywSb7DanoP9RCn/j7jkih18q4BROYl5G7Xypaq5uBPr6COW4qCAXVoriC3qojr X-Received: by 2002:a63:fc12:0:b0:385:f767:34d8 with SMTP id j18-20020a63fc12000000b00385f76734d8mr2243519pgi.172.1648087765864; Wed, 23 Mar 2022 19:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648087765; cv=none; d=google.com; s=arc-20160816; b=LXv2vX6GUN9xHmtsBW23DArEbAyIP0iAEdLiun0i0lhc9RrTUsdoliY01bE41ZUGqT SSTX2n9q9y2wpsvVT8vJs8c0KEwt8m3ulBmOM8ZYKL8cgLdeLYJFD1njRwmD961EdFDf +FRzYTl0LFwNbEXBGbQ+gplCAQLq0/VWVP3Ows0tGX3Y5RjyHq3dEpcpOGvEYlJnXq24 UYwYDitoJaT3gKxp4g2MDCSa9sfXcdEd9ac7u/KYwzFY24Naqcb+GYPzI9VbDpqvDV01 Ehxvw+T98MvKMswBVyhYyNafns7gOFJdQ0+xW9Z0qC7F+hY+ZxTjjrU3JiJfhQdNNRLw dynQ== 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:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=slbs+omTj8xyRVbCkc6cD/g6x3OLZjyKyltZ5xxXewk=; b=w23mppaSrkHQJWiqsp51YIhwKxQHOvRg/5exXnAL0QTPIlf0kIj0fsm2DyKVuKuQ+7 cuHQiSfjueBJV9tjFKDXDZA7lPBWnZHnOjcHZoH+OriOfDv3nk2Wja6L1xrZ596OUodL 0PDHnROwbGufxnIZmVbj2YLFFJMoo2WhHjTyGKza0P3NlVDPOQYOHWyT3a9/4IQ905q4 Z9vYp6GNBjheB787RssgIzN1N6XhVcClHCdU+uBGEBlC/7QNC4A8IzyIBLy6CjMyjLaW Gv+R2nbM3liJaEUHiKenmWtIJlIRvEE0rl2Xr7qCPlLlooZrAXHlsiOni4bSYAhERO/p ryiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=JOgyL7wv; 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 m11-20020a633f0b000000b003816043f06bsi20951885pga.608.2022.03.23.19.09.11; Wed, 23 Mar 2022 19:09:25 -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=JOgyL7wv; 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 S1344048AbiCWSu7 (ORCPT + 99 others); Wed, 23 Mar 2022 14:50:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344032AbiCWSu5 (ORCPT ); Wed, 23 Mar 2022 14:50:57 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF89C606DD for ; Wed, 23 Mar 2022 11:49:26 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id d7-20020a17090ad98700b001c6834c71ffso1540995pjv.1 for ; Wed, 23 Mar 2022 11:49:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=slbs+omTj8xyRVbCkc6cD/g6x3OLZjyKyltZ5xxXewk=; b=JOgyL7wv6R8OMnIGun2hdLU6NtSAivXpQTUW4Tl2D/z/uPw4YxriqKwTLYk4wf590a Bosvzj4LJOxmE8QH5fFPbuBjFziPfr64viJZZ4i217n8OygNOi0pD2YsgwFbt0McL2c7 0h8Jo39B1xmKIrXl0QiL0/kbxUb5HhiIuSKc80XSYXjE9O3ba55Ld4KjVkmu7wWIJV5f 22QzRQTo8Sf7AHBpfaHo+YJwpbXzCRmf+ADazmAxkVP7R8SXsCWXypH9IJCyY11TFkAc GefZsQcIY75ToGGtbqCQy8w24Paf3EUlaCkJJuQ5oCUC2o6CmLHokr6N8Bd0TqHmPoVA QEow== 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:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=slbs+omTj8xyRVbCkc6cD/g6x3OLZjyKyltZ5xxXewk=; b=fqe0Ten+toE5RrOg6308n5k2ptycz9hmOdxOMBjx2F0pa+qznKwZhg17NVK58Jp+/s /YRCUkythWXSsqCS1jJyN47Ox2jhbHa812dkMioadBYRw7V36/Qx4XDhoyLvpAPxx+tR KdkRB58rABJLWObUu+po0AyA3Lw2fIWysAbHIY0SWPhj9fcufGWyiMQFSMb2yPjRDkbo BntLyksTYmz96GxpLkaQVm7hItkttaz5qimKtXESgma1iCTO14aWX8aEj3W10iXyGWi0 1QVRbqt5qaRAlzkUm6LWTkh/Dt5+NPnRG9oCddiPY3fJ6yOIdlkTbjS5e0e6dqMbKlPH 4hwQ== X-Gm-Message-State: AOAM531+3nBv68Ruz3K7jB7ccf8dnuTz8YBRBov0hEkD09uUu6+yNOhj 8FEJV8U5TRC2lRj4dFlMsD5woxeToxtq X-Received: from mizhang-super.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1071]) (user=mizhang job=sendgmr) by 2002:a05:6a00:2310:b0:4fa:7eb1:e855 with SMTP id h16-20020a056a00231000b004fa7eb1e855mr1170187pfh.14.1648061366233; Wed, 23 Mar 2022 11:49:26 -0700 (PDT) Reply-To: Mingwei Zhang Date: Wed, 23 Mar 2022 18:49:11 +0000 In-Reply-To: <20220323184915.1335049-1-mizhang@google.com> Message-Id: <20220323184915.1335049-2-mizhang@google.com> Mime-Version: 1.0 References: <20220323184915.1335049-1-mizhang@google.com> X-Mailer: git-send-email 2.35.1.1021.g381101b075-goog Subject: [PATCH v2 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/ v2 -> v1: - Update the commit message. [dmatlack] - Update the comments in patch 3/4 to clarify the motivation. [bgardon] - Add another iteration in dirty_log_perf_test to regain pages [bgardon] v1: https://lore.kernel.org/all/20220321002638.379672-1-mizhang@google.com/ 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 | 53 +++++ .../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, 269 insertions(+), 2 deletions(-) -- 2.35.1.1021.g381101b075-goog