From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D65F260A47 for ; Tue, 11 Feb 2025 16:59:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739293143; cv=none; b=fZf4jLbb6TtSITg4exqHiHxolDI/cU5S7tkifmRyY5/eIOSWocsNte4UdTl89hV1KsATTB1niQyc9f+fQzdy/QyrPrJbQIVooDsigoikbfQQd8A94IMquWa5DbD9jxvJNYg/0SWciV3anWHloyYy410rNSNNJzKQ03CC059fTjk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739293143; c=relaxed/simple; bh=JQA1ZjBbMig6m4l8yPGiWj4x8bKWBoAZdxf1nTQk12A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=YgceQ2YP69ItXC/sCoMCqgcVmY5rnTgOurLIGaJsvWPcSESHxnZNHXqCN6QxpSqNhevI1X/EZSylJB4jEYGuYXUjpG7Z2V9VdiVrchqxlfPjrz1Fhr797KseQepYWTSVwqMjuDmVqcIVsMMxLsuDkA21D6ZMvFPeNjIHmoDXjpQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NEj8xtK8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NEj8xtK8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D17ACC4CEE5; Tue, 11 Feb 2025 16:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1739293142; bh=JQA1ZjBbMig6m4l8yPGiWj4x8bKWBoAZdxf1nTQk12A=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NEj8xtK8TNeiRfoxOGkHey0B2xnQJB/yJbXx+Fsls8qcXVVCVfFaxEbP2HxkyBOFa tocIPNS+f9Li1qZw+bwQpBzTl7MEpIxLu1zgBsXX79NcNBCDA8p3dh4RJoZsqlxMEf YY0pZYWe62VLZSUaPkRgbU2G2KezAGvImDQ9CjKbeskF1zh8ctvQvYN2lGpWgMaf6q a2mcXgNzZRO4tZDbhf8UmZJ5zY+xugzxAdTtNixh7XPzK5x+GcAacFgqobvJaJpkkX Fr1vleom9aOZZkGDZo38zVujBpE/9McPfWhRVjYw6sRrNL0R+FjGV0041AGeYhX2cU zRcYdXuBfDAxg== X-Mailer: emacs 31.0.50 (via feedmail 11-beta-1 I) From: Aneesh Kumar K.V To: Will Deacon Cc: kvm@vger.kernel.org, Suzuki K Poulose , Steven Price , Julien Thierry Subject: Re: [PATCH kvmtool 1/2] cpu: vmexit: Handle KVM_EXIT_UNKNOWN exit reason correctly In-Reply-To: <20250211114756.GC8965@willie-the-truck> References: <20250211073852.571625-1-aneesh.kumar@kernel.org> <20250211114756.GC8965@willie-the-truck> Date: Tue, 11 Feb 2025 22:28:57 +0530 Message-ID: Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Will Deacon writes: > On Tue, Feb 11, 2025 at 01:08:51PM +0530, Aneesh Kumar K.V (Arm) wrote: >> The return value for the KVM_RUN ioctl is confusing and has led to >> errors in different kernel exit handlers. A return value of 0 indicates >> a return to the VMM, whereas a return value of 1 indicates resuming >> execution in the guest. Some handlers mistakenly return 0 to force a >> return to the guest. > > Oops. Did any of those broken handlers reach mainline? > Not that I noticed. We do have patches in review. https://lore.kernel.org/all/20241212155610.76522-18-steven.price@arm.com >> This worked in kvmtool because the exit_reason defaulted to >> 0 (KVM_EXIT_UNKNOWN), and kvmtool did not error out on an unknown exit >> reason. However, forcing a KVM panic on an unknown exit reason would >> help catch these bugs early. >> >> Signed-off-by: Aneesh Kumar K.V (Arm) >> --- >> kvm-cpu.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/kvm-cpu.c b/kvm-cpu.c >> index f66dcd07220c..66e30ba54e26 100644 >> --- a/kvm-cpu.c >> +++ b/kvm-cpu.c >> @@ -170,6 +170,7 @@ int kvm_cpu__start(struct kvm_cpu *cpu) >> >> switch (cpu->kvm_run->exit_reason) { >> case KVM_EXIT_UNKNOWN: >> + goto panic_kvm; >> break; > > The break is no longer needed. > ok. -aneesh