From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B9A43D0C03 for ; Thu, 14 May 2026 21:54:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795647; cv=none; b=qKYRT9B9Jt4kImoliJ2yB6O6uEpRy1dhWrBRgBbO5opxuBfncucnylVlSms7prVNU64opOsCpgOXtZjTi9zboFBcK+26at3508RABAqPZ3YzR07yhkgNeRHQx9uH9BlwGmvXZaobaxT5k+In1DafAmCfjh68JK44/BASgDS0q7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778795647; c=relaxed/simple; bh=dTA/3VR9EH1sMFnfWIiA6Io9L1zUxuNockTCKHiOFxY=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Pg692R7zO1+u/BwMJywbr14rIc2gccWFpSkb2qPSw0HV3KqDk14sr0yOfUmA/PYp7G/jC9jUPagLCPizmaOwxfr6y3+ia+ofdGZg8yU7PYqlcHma/3drqY4meS2c4aCcbT4lTtqBbF/LNoiW/IrBHyGD5Mqix/XWl9WjvhrsYXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=SzNulJe+; arc=none smtp.client-ip=209.85.214.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="SzNulJe+" Received: by mail-pl1-f202.google.com with SMTP id d9443c01a7336-2bd5b20aaa6so13346585ad.2 for ; Thu, 14 May 2026 14:54:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778795643; x=1779400443; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=9oYhOatBSTmYuzHR8azx31RA/Ba7pTesr7fCEDkJz5c=; b=SzNulJe+2zTaydoWpaVvUlC2Z4r9xumpue/Tl7hqVsY5/Zf4IIvB2JQS7pkKk3LJGa xM7uHjcYpuKBDq32bVqFLtaaC1XB1H2titmu3nLNNO+YxdCXoYQAEBzU5sdTt+uUqjk2 UgXMInHWc/lGhpNgZsyoDn1Fmaf+bKbPkdaFjw/VqCfPbB5tG+u6dYD4RRcY593yjDfJ VG8igONsAtTaTmKj6r270UpdbFZTXHSukLEzm3BJ5HB7Ez/JXymNpBH5JLTx59S+nD7n ++hYltk+EBpspg6t2Ppdt6IvP765Uya7d7uZp2xHsuNbmFDBLTfKM+kg27B+4yZmBWVw x6VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778795643; x=1779400443; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9oYhOatBSTmYuzHR8azx31RA/Ba7pTesr7fCEDkJz5c=; b=kKhnJDC5zuNtJ/lK67WSq0gImoNxE+VZka5lnpeU9/Byp38H+7GguLWoX0z2jKe3Gu LkIAlfCCtTNkslFd1HZutGER4R8Wm9zo2+USkIgeD7/yTyp1HYe6S3Cz5uRm5UM/KbgC 303da3Pn3Yp5s1AU+MckEUpuC9nSn+BOU+6GYf/eNlA+cCfruvKSN8HwHt6jFx/pmobm 0UW1l+zTpkSdD5WNk9gArkWMA0DOA92JGtEvvY8+4+wqI0VYy+ty4Q/rgOmBYs/x5ZFL DgfBuVFZknA4EORiCX4kjx4oWemCVy4IqrLdQpiAWYfbJt7fSMGag51F9US85YtiFKEY WPhQ== X-Forwarded-Encrypted: i=1; AFNElJ+TYArK0GKb7WTbwa1ItjT7/jmVdBHzc/vlmuiW5r3eqfimYEIMvwBc31DA3mAj4Sj/eAGlz0FfMv2eSTo=@vger.kernel.org X-Gm-Message-State: AOJu0Yy/d1eoDp3Xd91u6Zm53UGum9+13w/mAWY9JFt6kAp0xdV+cXFq iIMk0k3RN7vIXI6tHfYCSSxgEJGx8faBm0q4WOd5DSN2vIvAOAXtU/ixsmdw/IUPKhSThFaKawJ Sxu+Yew== X-Received: from pgbdn13.prod.google.com ([2002:a05:6a02:e0d:b0:c82:7498:e3b5]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a20:244d:b0:3b1:884a:c3d5 with SMTP id adf61e73a8af0-3b22ebd8ce1mr963273637.24.1778795642494; Thu, 14 May 2026 14:54:02 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 14 May 2026 14:53:45 -0700 In-Reply-To: <20260514215355.1648463-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260514215355.1648463-1-seanjc@google.com> X-Mailer: git-send-email 2.54.0.563.g4f69b47b94-goog Message-ID: <20260514215355.1648463-6-seanjc@google.com> Subject: [PATCH v2 05/15] KVM: x86: Trace hypercall register *after* truncating values for 32-bit From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , Vitaly Kuznetsov , Kiryl Shutsemau , David Woodhouse , Paul Durrant Cc: Dave Hansen , Rick Edgecombe , kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Yosry Ahmed , Kai Huang , Binbin Wu Content-Type: text/plain; charset="UTF-8" When tracing hypercalls, invoke the tracepoint *after* truncating the register values for 32-bit guests so as not to record unused garbage (in the extremely unlikely scenario that the guest left garbage in a register after transitioning from 64-bit mode to 32-bit mode). Fixes: 229456fc34b1 ("KVM: convert custom marker based tracing to event traces") Reviewed-by: Yosry Ahmed Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 209eae67ab18..23b3957b9ae0 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10430,8 +10430,6 @@ int ____kvm_emulate_hypercall(struct kvm_vcpu *vcpu, int cpl, ++vcpu->stat.hypercalls; - trace_kvm_hypercall(nr, a0, a1, a2, a3); - if (!op_64_bit) { nr &= 0xFFFFFFFF; a0 &= 0xFFFFFFFF; @@ -10440,6 +10438,8 @@ int ____kvm_emulate_hypercall(struct kvm_vcpu *vcpu, int cpl, a3 &= 0xFFFFFFFF; } + trace_kvm_hypercall(nr, a0, a1, a2, a3); + if (cpl) { ret = -KVM_EPERM; goto out; -- 2.54.0.563.g4f69b47b94-goog