Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp706766pxv; Thu, 15 Jul 2021 14:02:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ8Xr/a8IcTiKIKgJoOlbg1gZ4ev35LkHOF2dADGR0U2I2YEdKbRr7wapO8XJUjaR1gviP X-Received: by 2002:a17:906:2287:: with SMTP id p7mr7656397eja.181.1626382950535; Thu, 15 Jul 2021 14:02:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626382950; cv=none; d=google.com; s=arc-20160816; b=CsAXrdwvcsU4u1oYJZaVvg50YPDWpHzj+hnJnQUlaXl/uTIgHoGOg5yovPR9e9CtRD xLvigSPUh1kxYk11bVxqwG9mAqlmOFgsNC/AWaSQAf1SRQNXe/YSy3k1RbX41niEA+kb 6gzkRab1Bd7Zo9Q6QDr2J1ZpHoovoe5hY4K57GaCq1I7J9bMxnwHx7EYJfWa46Fh9vF8 jgccUNGCA3obyjw/EvrLfd9jHrJw4lPFRxKpcEQcNSGiPDFKJZhfTo4BqCXIO6va5J9d s8BiG8h+KQHBDJ9XtiGESY2wFd1rGntQXC2YHNL4QBs1mpumSO8X5gSZUO4NrSSlV3kR oNyQ== 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=wP9jbU8yE9Be9C4wSriAP7HZME9fWO6vXEg3FioeXXU=; b=UxAaReGgNifSKuH0pK/B0Ym31YEfur1VhwSRe5cB5aK0DKY5VISt0qEowZz7ue0vdd hWkipV9ObpFeqNEamEkKNoHkSanLNjnoR+OLiaEbppf4GYvGWmSM8w8a2GJ42m/xyjhM lNtElq0l0iAj2KztPmD6VcWBI5SCxwtGszKalgH+JwKmD1vLVMmapG/3lQWv5KkiP9Ep qtGuBWMGODWbjOUOL2NiqLk1Fto1cdt+D9CYKr/fpS6Af1p0+0zwFHuvuKBxAZdgAdIn zYlq4JIBpMGyA5gurVuAzcI7cCx8b8Uhb3jUrSLlH/3rkTdo11uD7AS4/3F0HfMwimpg /hew== 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 r26si7505713ejz.423.2021.07.15.14.02.07; Thu, 15 Jul 2021 14:02:30 -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 S232160AbhGOQf3 (ORCPT + 99 others); Thu, 15 Jul 2021 12:35:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:43132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231648AbhGOQfM (ORCPT ); Thu, 15 Jul 2021 12:35:12 -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 1208E613FD; Thu, 15 Jul 2021 16:32:19 +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 1m44HZ-00DYjr-Ei; Thu, 15 Jul 2021 17:32:17 +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, Srivatsa Vaddagiri , Shanker R Donthineni , James Morse , Suzuki K Poulose , Alexandru Elisei , kernel-team@android.com Subject: [PATCH 08/16] KVM: arm64: Add tracepoint for failed MMIO guard check Date: Thu, 15 Jul 2021 17:31:51 +0100 Message-Id: <20210715163159.1480168-9-maz@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210715163159.1480168-1-maz@kernel.org> References: <20210715163159.1480168-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, 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 638827c8842b..c2a23457552b 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1229,8 +1229,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