From patchwork Thu Jan 19 21:25:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Gardon X-Patchwork-Id: 4270 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp555561wrn; Thu, 19 Jan 2023 13:34:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXuZGmy3Ei0LsFUExBrek9yAHl/cnq38KVC6CfODLMr0eyzVKWlQDbQvYI8bXNwGJA24m75V X-Received: by 2002:a17:90b:1907:b0:227:1e67:d588 with SMTP id mp7-20020a17090b190700b002271e67d588mr12869747pjb.23.1674164072487; Thu, 19 Jan 2023 13:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674164072; cv=none; d=google.com; s=arc-20160816; b=lFf9wgxaw2zvDTCgTpHX8R/nY9Mkq6SV9kkx5CNcyDE6DB7G7Yc+Iuu2AArR5O09YH mzzuYMoy2q/AC0knXu9pfeT/7AvGD1LSquGhhsJnTuV62qobTeB0v/19rGre8yzOZQse +eayzaUJpSBrYy1qp/xCcFtBw1Obz0NTJvWgDtO2FIJeUfGT2YxZGF7gYx5V43ShcJr5 skr9OtVCm1bbVWBl4BsppMD/GtTtSScYEwrJU9p7Zqb3b4dBQqsrC9mdI/I+s5A7avUt f3oN7trbhfTRfIDrmLMNYlTlrQZdcZeTEGGQm74Boy4QXsTBEHcGZGvTwQOmRWlAvuiF +dTg== 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:message-id:mime-version:date :dkim-signature; bh=vgnyLDNSgvwVcu8AmZopvdgW3ASujbk2oM4NuNZjZP0=; b=swHugG7fBybg9fMFyEsgqckM3LTdLpz5kgMaz5Hj7mGlNolvuq+AA35fZWehwy1HjZ FEjBemOCThbugXkJ22fYPqyI0eitXuV8y1dnAikPmZz/Bx1Gj517J5MciHpvwy1pFKpc inQ+8+tLC9IJabyG4FT5sojB14CjlSRMuBSipdhG7irJkmmjK+HfMTjtb9DnrX+fTro0 LSC+Rrrg4jH1IziW7qgaM247VUX5IJRpqPWKofPGnagGuflFTqn8wADyJwUVaQ+IVgZp rWAwuXzDJhr+EtrhNqwGQ2eAPsTXwPhDpiQsMBefmnGbnvhabvska+HXd6opTFWVTGee v8hQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=g898MByq; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020a17090ab10a00b002239c987051si280514pjq.128.2023.01.19.13.34.20; Thu, 19 Jan 2023 13:34:32 -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=g898MByq; 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 S230146AbjASVcu (ORCPT + 99 others); Thu, 19 Jan 2023 16:32:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231187AbjASVbK (ORCPT ); Thu, 19 Jan 2023 16:31:10 -0500 Received: from mail-pf1-x449.google.com (mail-pf1-x449.google.com [IPv6:2607:f8b0:4864:20::449]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FBFBA791C for ; Thu, 19 Jan 2023 13:25:29 -0800 (PST) Received: by mail-pf1-x449.google.com with SMTP id 24-20020aa79118000000b00580476432deso1460907pfh.23 for ; Thu, 19 Jan 2023 13:25:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=vgnyLDNSgvwVcu8AmZopvdgW3ASujbk2oM4NuNZjZP0=; b=g898MByqpR4QSdftZPPM8wJDP652HbA9+ZoMck6HqIY8547fIVJkQecY35bALgkuPd PwVfUBLHI/Pc1DE+zmAXJ9FoEqn7DOqt7PwrqU6yyZSn7YCmGVfH2QIQmUWB7Xp4j5no DkjiYEr8kDHWxOVqs3B22PKilcSQ65XNsUUM1RaWm9kTSjcjeQewFvrsBsr9jhq8B54m Dm4z3FlRDZzfXGw1sxpe76q8kM+QRApZA/E16DnbeYu5tG2boGFuHaPhKsL2sNLhSru+ 8f92Y8e1sIWEb0uLYDXnx0XLEfL83kjSWOuL1N78+JcgqIlRhHGLkx97xR4ZklUL0T++ RVTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vgnyLDNSgvwVcu8AmZopvdgW3ASujbk2oM4NuNZjZP0=; b=h+aWHTEPV7LPfB+yMgtSa8LKP7ws+MxdlV55XdSeICo6FipCmwsVt+4VpneBYezzih Man1kohVv5XFZiq2hlCWiB/ILST3/Smh3R3Ow7Fhgv+1A60PU/z7KeUxFusjY5aI51MT yGFYNrjyEDr/li9zELH2sk1nlM37b6G9uqNaSyrdibmdfUy0pwH+jouOXXXzYdBohwow G8vL/6yMlfbTfB5JwGx5fiYr5lw+2JeTbMBpLIRyJWgH8LpZBTpaFb/nGDnbhThlXOch vPGRllk/PBp4GcU+tdO8MQznrZayxX7b3tdujbTqh+oNl2gd8SR2hSEsCJOXxIcK3ie7 j6aw== X-Gm-Message-State: AFqh2kr7NvlielZOmzLCHCjJU7XK+P8dkS4E2jCZvo5MUtz4XYi7Z0Ms MI2A8S50AOpaPzOSe7kk1dy3INpTUOgHE30aONgVD8qIZFdheQ7ntjkhp+Pc5tQRpJ7myuHxjV/ Dk8f80t3g2sLl8UQ7t9j/e3a+pPieEDfco7aP1/FKuIkxWzDwnRHZV3imNojwUv1fX2ZNPNQD X-Received: from sweer.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:e45]) (user=bgardon job=sendgmr) by 2002:a17:90a:d505:b0:229:1740:1051 with SMTP id t5-20020a17090ad50500b0022917401051mr1239826pju.111.1674163513524; Thu, 19 Jan 2023 13:25:13 -0800 (PST) Date: Thu, 19 Jan 2023 21:25:08 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.39.1.405.gd4c25cc71f-goog Message-ID: <20230119212510.3938454-1-bgardon@google.com> Subject: [PATCH 0/2] selftests: KVM: Add a test for eager page splitting From: Ben Gardon To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Paolo Bonzini , Peter Xu , Sean Christopherson , David Matlack , Vipin Sharma , Ricardo Koller , Ben Gardon 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,USER_IN_DEF_DKIM_WL autolearn=unavailable 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?1755488266583395375?= X-GMAIL-MSGID: =?utf-8?q?1755488266583395375?= David Matlack recently added a feature known as eager page splitting to x86 KVM. This feature improves vCPU performance during dirty logging because the splitting operation is moved out of the page fault path, avoiding EPT/NPT violations or allowing the vCPU threads to resolve the violation in the fast path. While this feature is a great performance improvement, it does not have adequate testing in KVM selftests. Add a test to provide coverage of eager page splitting. Patch 1 is a quick refactor to be able to re-use some code from dirty_log_perf_test. Patch 2 adds the actual test. Please ignore the RFC version of this series. It was not meant as an RFC and did not include a cover letter. Ben Gardon (2): selftests: KVM: Move dirty logging functions to memstress.(c|h) selftests: KVM: Add page splitting test tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/dirty_log_perf_test.c | 84 +---- .../selftests/kvm/include/kvm_util_base.h | 2 + .../testing/selftests/kvm/include/memstress.h | 8 + tools/testing/selftests/kvm/lib/kvm_util.c | 5 + tools/testing/selftests/kvm/lib/memstress.c | 72 ++++ .../kvm/x86_64/page_splitting_test.c | 314 ++++++++++++++++++ 7 files changed, 409 insertions(+), 77 deletions(-) create mode 100644 tools/testing/selftests/kvm/x86_64/page_splitting_test.c