From nobody Sat Nov 30 06:50:25 2024 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 14FD51BBBFC for ; Wed, 11 Sep 2024 20:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726087354; cv=none; b=JkL/Kk5oAlwOlwSHkvP4Eck93KW8AerVDbf67nAZJ5XA79fb1QNXw1ays16kD8Q4NSkksMvWRZO28GUS9pjp4+gflXlE/RK+GOP/DWYW+7gc5FMlYip6Qz6IojdGXSjDLEYWj8gyTu9OpnSQvG+NneL7ylbKurVGBUVE8S6Pd7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726087354; c=relaxed/simple; bh=hbb0RaWzaTd3JfZQZX9GdrY3DUCQafK7uAfY73KOAY8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=rbnOmgSynBmQB6ph6Gj1CUrV8h0qFbIhRq0ZQqsK1Ist2pYGSo6Nrjkn1s7jILzItBwz8IyPqyZGnMNZMxVuRR00Vh+AcDy5xutb71zTUiz9b7mxmMpkc2Yl6JOPHTKwnXe7u0XY7mVTmjmY7ZrQjD8JRyhNEb/OVtNEuIqMv1Q= 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=laorYpjR; arc=none smtp.client-ip=209.85.219.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="laorYpjR" Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-e1d351c9fb5so949179276.1 for ; Wed, 11 Sep 2024 13:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1726087351; x=1726692151; 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=ZQRYVtp40gN2JN3r5ECO8yPdv4xFpWyP5ZtXJGFNMpg=; b=laorYpjROjDj9OQcJFqIYfrpyeuZVvMBvuAlQE9vO5E3PwwQrWfqeRl9CmvpOsfDAF oBZT4JeOv9AjsJ83/LFI5hY01ft2H8z8/pyU5KJke0GvjpIjoXPn7TL+R0crzMymOchj KZnT75pxrgCyILgAjoNgJ/xhFYD1GpHl3dJ9gGQptoCkmXw7jBTGROI0/PI1v9iAtq91 EWc6eqHAB9gujZTu64gmS7pzs01+/Nowqwn06VzSRJUhoGlUcz1jff9vhx7/zlhNRPxY KBPb0RwAyH/mu6UPp42je5y/JWjGyjMzPg1wzZoXdOpeE4sjIYULZGBqX2dUpXkf7Tyx oCEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726087351; x=1726692151; 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=ZQRYVtp40gN2JN3r5ECO8yPdv4xFpWyP5ZtXJGFNMpg=; b=IR9a36NPy5EIvqc/XAQ0Sqe2txxRSQ0P2jK6E8LL5i0eID/pwysT/iO1XEW29FsfsZ NHG2O9QYiDL8f4yoeh+3UYH0JuWP2wYLQMXkR/J7L4eoaYoGD7RwR2J/dKyYbTC0bfSA GXDXzxaJbwo/e2HRMMydDNg1jBmKN7AUtP5PX9jPhRiuLXxD27ootd+/hDt8zgD2O3/i 8rbgSQ2Yl8vvsbiT6ICJo78nt2GYPgYJrDmqcxjbeXR4dV234zZE3Bos8ySDqmLkDiPB JxVI1MKAaUdtJV8N0hr8ZFebA0m5e0EoWYvJPuvOaUaq2dX4ECrTIsnBEgXhueG+W7yy 4LNw== X-Forwarded-Encrypted: i=1; AJvYcCVaMmdxsoSPstHR+ZaBoB8VGEzLkWhKUlR0l7QMo7lwA6vUHZjGi4i6Hj/HNqKGQPcTq6kUGfF2TXNEqcY=@vger.kernel.org X-Gm-Message-State: AOJu0YyTCLcQGUhhn9+6LU/gfdT9wWbyAbnMCmGOcpyHmsGC6sxQdcNZ tFWjUzIv3LFuPbdZvrFwvxUY4pT1ITV6B0nIz76ngMpMWOX9b2Io7U6WI1UW9HyikQS+Cd/1sZL Iuw== X-Google-Smtp-Source: AGHT+IH8ZQwfCbzagdZgU+EpISSX/A630EuGAq7pLp9hJDXsMNgEZzJ88I5801BwyQ8RRGJvBOpit5rNgP4= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:c711:0:b0:e0b:af9b:fb79 with SMTP id 3f1490d57ef6-e1d9dbc1dc5mr2910276.3.1726087350958; Wed, 11 Sep 2024 13:42:30 -0700 (PDT) Reply-To: Sean Christopherson Date: Wed, 11 Sep 2024 13:41:50 -0700 In-Reply-To: <20240911204158.2034295-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: <20240911204158.2034295-1-seanjc@google.com> X-Mailer: git-send-email 2.46.0.598.g6f2099f65c-goog Message-ID: <20240911204158.2034295-6-seanjc@google.com> Subject: [PATCH v2 05/13] KVM: selftests: Check for a potential unhandled exception iff KVM_RUN succeeded From: Sean Christopherson To: Marc Zyngier , Oliver Upton , Anup Patel , Paolo Bonzini , Christian Borntraeger , Janosch Frank , Claudio Imbrenda Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Sean Christopherson , James Houghton Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Don't check for an unhandled exception if KVM_RUN failed, e.g. if it returned errno=3DEFAULT, as reporting unhandled exceptions is done via a ucall, i.e. requires KVM_RUN to exit cleanly. Theoretically, checking for a ucall on a failed KVM_RUN could get a false positive, e.g. if there were stale data in vcpu->run from a previous exit. Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/kvm_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/kvm_util.c b/tools/testing/sel= ftests/kvm/lib/kvm_util.c index 56b170b725b3..0e25011d9b51 100644 --- a/tools/testing/selftests/kvm/lib/kvm_util.c +++ b/tools/testing/selftests/kvm/lib/kvm_util.c @@ -1719,7 +1719,8 @@ int _vcpu_run(struct kvm_vcpu *vcpu) rc =3D __vcpu_run(vcpu); } while (rc =3D=3D -1 && errno =3D=3D EINTR); =20 - assert_on_unhandled_exception(vcpu); + if (!rc) + assert_on_unhandled_exception(vcpu); =20 return rc; } --=20 2.46.0.598.g6f2099f65c-goog