Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3876551pxb; Mon, 4 Oct 2021 11:34:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRmHi0ejVKkh+meToSbmcOz2grn2WS2r8Ocpmh/qGHph7SEXQhFTuszGFLVXGBnC5LdEjB X-Received: by 2002:a17:906:6a8c:: with SMTP id p12mr18898481ejr.486.1633372456248; Mon, 04 Oct 2021 11:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633372456; cv=none; d=google.com; s=arc-20160816; b=zHoqz6+XbbpEew5GUU1cxkBNBxTpLdOnDJJpqHZStv3TI/XEd7GjVa4WVaqFnvIxtX y6DRI1LbmHgx6WtCuTDrGWcviu9tIUDxr/nC9VH/k4/hvih064qmcjz0jz4n56SZbHtB 36iKT8z9Wusz49IiZED/WJqvGfeVo/c1Bqep2iLFEfEob4JwJtKxKiYHDnSExhROD83J ZOH2V7pTDd960lKKklGEUadAlJbS6hgni2o4EAm8hMP3qc6AySzyXBCZs5bC7Rf5Q6EF 8ergMJA7gR95z8fDdJmJVroIXTcCQ9eSHPQn0RBL/FeA/Orjw+DrjVI2EQy8aUcbUclG qRTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZyWvvVVEwyHOI3qDUZ4UxKiFPn+53PZxJJC3CvOpGM4=; b=zitgtM8rFraZDC/3Zwej0xhTzGlT4ojomnbBaQzYPtPlEsBRhOLHEtI2buhjDCEesG RMYTl2KrMacrI8JaeNSY+JBjaCPyZQcIzI1H3vZg6Gn/WAVQIC63EYuhcV7Hgp8IX/Fk IxLTBLBBKsurgJ72UZnYubjoitpMsjOwr6TFVWqO0FECyoB9EyVaRh4rS74BaJYyLddc zbIdvoGhZscfEuiZLbisjxfE3O4fZ+CcB1/h/P1SAky62X8YaMpEi13cSuY7zjLgsAWL +aJqJvpuTjWCMOnZ+rbN/nrNFqJxxpmLqniKzrD4QS0nclsS7rw8xXFpT9oLMKJj83WN l/IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si21174315edh.626.2021.10.04.11.33.50; Mon, 04 Oct 2021 11:34:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234190AbhJDRvY (ORCPT + 99 others); Mon, 4 Oct 2021 13:51:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:32912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235347AbhJDRu4 (ORCPT ); Mon, 4 Oct 2021 13:50:56 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A3A0F61269; Mon, 4 Oct 2021 17:49:04 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mXS5F-00EhBv-UP; Mon, 04 Oct 2021 18:49:01 +0100 From: Marc Zyngier To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: will@kernel.org, qperret@google.com, dbrazdil@google.com, Steven Price , Andrew Jones , Fuad Tabba , Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: [PATCH v2 08/16] KVM: arm64: Add tracepoint for failed MMIO guard check Date: Mon, 4 Oct 2021 18:48:41 +0100 Message-Id: <20211004174849.2831548-9-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211004174849.2831548-1-maz@kernel.org> References: <20211004174849.2831548-1-maz@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, will@kernel.org, qperret@google.com, dbrazdil@google.com, steven.price@arm.com, drjones@redhat.com, tabba@google.com, vatsa@codeaurora.org, sdonthineni@nvidia.com, james.morse@arm.com, suzuki.poulose@arm.com, alexandru.elisei@arm.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to make debugging easier, expose a new trace point that triggers when a MMIO check fails. Signed-off-by: Marc Zyngier --- arch/arm64/kvm/mmu.c | 4 +++- arch/arm64/kvm/trace_arm.h | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 2470a55ca675..8c38d856533f 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1275,8 +1275,10 @@ bool kvm_check_ioguard_page(struct kvm_vcpu *vcpu, gpa_t ipa) ret = __check_ioguard_page(vcpu, ipa & PAGE_MASK); spin_unlock(&vcpu->kvm->mmu_lock); - if (!ret) + if (!ret) { + trace_kvm_failed_mmio_check(*vcpu_pc(vcpu), ipa); kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu)); + } return ret; } diff --git a/arch/arm64/kvm/trace_arm.h b/arch/arm64/kvm/trace_arm.h index 33e4e7dd2719..e40cfeb251ad 100644 --- a/arch/arm64/kvm/trace_arm.h +++ b/arch/arm64/kvm/trace_arm.h @@ -89,6 +89,23 @@ TRACE_EVENT(kvm_access_fault, TP_printk("IPA: %lx", __entry->ipa) ); +TRACE_EVENT(kvm_failed_mmio_check, + TP_PROTO(unsigned long vcpu_pc, unsigned long ipa), + TP_ARGS(vcpu_pc, ipa), + + TP_STRUCT__entry( + __field( unsigned long, vcpu_pc ) + __field( unsigned long, ipa ) + ), + + TP_fast_assign( + __entry->vcpu_pc = vcpu_pc; + __entry->ipa = ipa; + ), + + TP_printk("PC: %lx IPA: %lx", __entry->vcpu_pc, __entry->ipa) +); + TRACE_EVENT(kvm_irq_line, TP_PROTO(unsigned int type, int vcpu_idx, int irq_num, int level), TP_ARGS(type, vcpu_idx, irq_num, level), -- 2.30.2