From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (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 5C3463A7585 for ; Thu, 9 Apr 2026 23:56:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775778999; cv=none; b=HF7V9oYc4Swtp0xZfFi+N+K2l04M52yAQL5pbCa3CtipXS3wCgxKrMBt+Dgx68s7721frFTxiYIzqt2CPbaojAisW3bsnOXd7gZZZpYgm4CQGJJ94Xfr3JKItofCVmKaHA/qkoc76w2l7aEF9Zr/1tiy5SmvpEkzGMGqQWVzLNE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775778999; c=relaxed/simple; bh=DYr12vLfExXRMWPWKvGZY5DxUYvnsl8thA9aDxIwhL8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=l/QMcEwVCOibYc1GzM6An9fij/M9FdMEokt8PauqI9I8fVyddvY/T2whi5c7m3jvGb0CgvrWnodJahf8zOp/89RhLyZuTecTTgQvnf/EFbgsnKREwVarFnbbgkCzOV742NrfesOR3vFFbih8kc2LrfHvBPN3vuA3m5D/4WYgWrY= 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=iQ6DS6pq; arc=none smtp.client-ip=209.85.210.201 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="iQ6DS6pq" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-82cd9fa609aso1006097b3a.3 for ; Thu, 09 Apr 2026 16:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1775778998; x=1776383798; 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=MY6cHx08IW2xR2d+249NoYIhXN7g9YeiGpAZRuys1QY=; b=iQ6DS6pqNMi2wT0RffS9dMEpGBB87lAhyKIOOhA+GXc1sYEeY4aui1KmauVxD+pNqz ylpqWHS/xhrsdcGMSe6z56YSrTElZk5w53WawsZj7RZt//UoYHBT8WbuHzAH09epzc/l B1Roi//ad69m2A9oE3vOI7C3sudUkavPTJs993EcY2vZj5dO/8cPXfYd3Ar7l5kwsBcY +RlOYBQZftkmD9loIgqfbJSpcncoo6vU01Bcd6+6Nwxkw4gdt9qCFT6v69143qsNnPQ4 1FvHw+h0Rx/ctqOfxhxcnN+zGGB4wAEcwSuWf5O56xYVSXomCRoeUKO39q+CrJkPfsKC xhJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775778998; x=1776383798; 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=MY6cHx08IW2xR2d+249NoYIhXN7g9YeiGpAZRuys1QY=; b=oaztMzylWOY557S9xz5q/ylBq7PAjsFBk9SfuizeVVrQI/zv7s+ZVQXAUdS0Hy1LEh 8DU2kmoC+xC7zWvKYDVBJ6j1jHnLfrJXnbVHgFR1TzM9/vY8/X2ElpFJ2W/PTiJKIWcp LCkt2JIXU3Ji7bjMjBB4Zi/fk2XQuozCtxIvrE2YhB5dbjFi0IVqhf+ALdE1fqhXa97p vG2KsIBA9/ZJHpHlOt3/pgDPlGLsAZ4riiHmYCUToFr5UahAuHpEGnmLIlousuYhia37 MKu9jGWKOJeSjCec3EZbDnQ3ExhwuJJosHEFurJDVUzCiM7I7yewb1vVvm/RVIl7aooL Lhsw== X-Forwarded-Encrypted: i=1; AJvYcCWILqUqQGAkGKDzor0/OMgtNHOkAQiOleDeXBHxhk8QKTBkVuZW+5tdtOH4v5xHXF65h0LujSfVni1O3g4=@vger.kernel.org X-Gm-Message-State: AOJu0Yxiww/WiCcNQUAUX7ZeS+C9boKLfJo0Vgay55mYHmUNoPtca3Bv htKTvhWkZf6VZayNlXS2XynpO4WgxLKf7rnYkdSqifMHVZrxJD/EMKOnq7mjYaHkOiNJYDb89ai kpcCt2Q== X-Received: from pfbfe20.prod.google.com ([2002:a05:6a00:2f14:b0:82c:6ce1:4e6]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:f0a:b0:81f:4884:4fed with SMTP id d2e1a72fcca58-82f0c24e21emr1046257b3a.7.1775778997441; Thu, 09 Apr 2026 16:56:37 -0700 (PDT) Reply-To: Sean Christopherson Date: Thu, 9 Apr 2026 16:56:16 -0700 In-Reply-To: <20260409235622.2052730-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: <20260409235622.2052730-1-seanjc@google.com> X-Mailer: git-send-email 2.53.0.1213.gd9a14994de-goog Message-ID: <20260409235622.2052730-6-seanjc@google.com> Subject: [PATCH 05/11] KVM: x86: Trace hypercall register *after* truncating values for 32-bit From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , Vitaly Kuznetsov , David Woodhouse , Paul Durrant Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Yosry Ahmed 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") 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 0a1b63c63d1a..34ee79c1cbf3 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -10438,8 +10438,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; @@ -10448,6 +10446,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.53.0.1213.gd9a14994de-goog