From patchwork Wed Jun 30 21:47:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 12352835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8F25C11F65 for ; Wed, 30 Jun 2021 21:48:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8D34A61185 for ; Wed, 30 Jun 2021 21:48:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232432AbhF3Vux (ORCPT ); Wed, 30 Jun 2021 17:50:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232397AbhF3Vuw (ORCPT ); Wed, 30 Jun 2021 17:50:52 -0400 Received: from mail-qt1-x849.google.com (mail-qt1-x849.google.com [IPv6:2607:f8b0:4864:20::849]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A4DAC061756 for ; Wed, 30 Jun 2021 14:48:23 -0700 (PDT) Received: by mail-qt1-x849.google.com with SMTP id c17-20020ac87dd10000b0290250fd339409so2037713qte.6 for ; Wed, 30 Jun 2021 14:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=MWYYk9Sr8HKYlfAS2NHSlFPP/eKAy+6T+SEm5ULRBgE=; b=q+c1Q3WcUvx9b5dZrgTHagM+IM3jIXcjW40U79ExET56cSUFS2poOMLEtjQuvyUa3d +E+8lRvLOEA65qIxRru5VVAWYC7AHlPCo0ccaYGaltik+EheZUkoj4ozlE6m0DyPm+cy USx/H9SYRAF6d53fZBlbJMnZG2I7phaLYYG8SGGTRNwnmTrkqPt67kgqP4DRrklWs92A O6Gq3VcfR7NSwZeb0s72SY4G5Rco/BfjFaCAKxnKBYdSQTW2Vn7hK5ez2LB/WXVroiOx owxLPBGQzJTRl8G5KXB/H1CuGmbsRzWAkSd8E4W0ZjAz7QYdvryRME46YHUtcd+qX8tu BPdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=MWYYk9Sr8HKYlfAS2NHSlFPP/eKAy+6T+SEm5ULRBgE=; b=ufDWIf1R263wEew9c7squgbQC27ai9vwnGZpLnEfPWKt46tFmKKZ9/qdifivKQwwLU eiDhG3boiFwkc+4+2x9Xes1qnlNXwUDkqOZ9OMAnnz4zCPDZnAgEANPMyQ8WyHvEpZX2 BGbYTg1g1SVR4iP8A7pndpS/Thv84KpjST3tD9/wNFUw2ZIGlJlyPnhV8jd2Xf81KvDi DkOrpdmUhnEJv7zmNce/TGLZOcGcI+RGSF4EBULSvHlaP2whdtRgHU7Ogx81VQHzG0VL EmNSq7Te9BMQcefs/cMCTibUqUz72Pvsa+HWR277YoPiQqXayVuwxwTz1dV0CZ+YKkmL Wk0Q== X-Gm-Message-State: AOAM531LIIbjVM1F+4GS3as96lh0tUKvrdFWJYB139MMFJ1wS8duvUgz BH8nOuXK0KNq4bFr2kC1SS3iC3II2Wq/YT1SMDrSSGnt3czTBO3qNZ9rOnblNkIUoAPSNUzBDwb iyzPeSOXf02jECH8YrZHRqJspsRPg4AKrMB35arxQoSZ6B06KaInk6RGWRCumAgw= X-Google-Smtp-Source: ABdhPJySf6pu89+nwMZgxjcqOXquBVQqyRpYf27QInfPRVYjrw70yBB+TIUWLuKxKlWtGN8YDSkhZYlM74eaLw== X-Received: from dmatlack-heavy.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:19cd]) (user=dmatlack job=sendgmr) by 2002:a0c:dd8c:: with SMTP id v12mr15116890qvk.23.1625089702229; Wed, 30 Jun 2021 14:48:22 -0700 (PDT) Date: Wed, 30 Jun 2021 21:47:58 +0000 In-Reply-To: <20210630214802.1902448-1-dmatlack@google.com> Message-Id: <20210630214802.1902448-3-dmatlack@google.com> Mime-Version: 1.0 References: <20210630214802.1902448-1-dmatlack@google.com> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog Subject: [PATCH v2 2/6] KVM: x86/mmu: Fix use of enums in trace_fast_page_fault From: David Matlack To: kvm@vger.kernel.org Cc: Ben Gardon , Joerg Roedel , Jim Mattson , Wanpeng Li , Vitaly Kuznetsov , Sean Christopherson , Paolo Bonzini , Junaid Shahid , Andrew Jones , Matthew Wilcox , Yu Zhao , David Hildenbrand , Andrew Morton , David Matlack Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Enum values have to be exported to userspace since the formatting is not done in the kernel. Without doing this perf maps RET_PF_FIXED and RET_PF_SPURIOUS to 0, which results in incorrect output: $ perf record -a -e kvmmmu:fast_page_fault --filter "ret==3" -- ./access_tracking_perf_test $ perf script | head -1 [...] new 610006048d25877 spurious 0 fixed 0 <------ should be 1 Fix this by exporting the enum values to userspace with TRACE_DEFINE_ENUM. Fixes: c4371c2a682e ("KVM: x86/mmu: Return unique RET_PF_* values if the fault was fixed") Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmutrace.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/mmu/mmutrace.h b/arch/x86/kvm/mmu/mmutrace.h index efbad33a0645..55c7e0fcda52 100644 --- a/arch/x86/kvm/mmu/mmutrace.h +++ b/arch/x86/kvm/mmu/mmutrace.h @@ -244,6 +244,9 @@ TRACE_EVENT( __entry->access) ); +TRACE_DEFINE_ENUM(RET_PF_FIXED); +TRACE_DEFINE_ENUM(RET_PF_SPURIOUS); + TRACE_EVENT( fast_page_fault, TP_PROTO(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, u32 error_code,