From: Aneesh Kumar K.V <aneesh.kumar@kernel.org>
To: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: kvm@vger.kernel.org, Suzuki K Poulose <Suzuki.Poulose@arm.com>,
Steven Price <steven.price@arm.com>,
Will Deacon <will@kernel.org>,
Julien Thierry <julien.thierry.kdev@gmail.com>
Subject: Re: [PATCH kvmtool 2/2] cpu: vmexit: Handle KVM_EXIT_MEMORY_FAULT correctly
Date: Tue, 11 Feb 2025 22:21:50 +0530 [thread overview]
Message-ID: <yq5awmdwwhjt.fsf@kernel.org> (raw)
In-Reply-To: <Z6s+67ICINiO96US@arm.com>
Alexandru Elisei <alexandru.elisei@arm.com> writes:
> Hi,
>
> On Tue, Feb 11, 2025 at 01:08:52PM +0530, Aneesh Kumar K.V (Arm) wrote:
>> Linux kernel documentation states:
>>
>> "Note! KVM_EXIT_MEMORY_FAULT is unique among all KVM exit reasons in
>> that it accompanies a return code of '-1', not '0'! errno will always be
>> set to EFAULT or EHWPOISON when KVM exits with KVM_EXIT_MEMORY_FAULT,
>> userspace should assume kvm_run.exit_reason is stale/undefined for all
>> other error numbers." "
>>
>> Update the KVM_RUN ioctl error handling to correctly handle
>> KVM_EXIT_MEMORY_FAULT.
>
> I've tried to follow how kvmtool handles KVM_EXIT_MEMORY_FAULT before and after
> this patch.
>
> Before: calls die_perror().
> After: prints more information about the error, in kvm_cpu_thread().
>
> Is that what you want? Because "correctly handle KVM_EXIT_MEMORY_FAULT" can be
> interpreted as kvmtool resolving the memory fault, which is something that
> kvmtool does not do.
>
That is correct. The changes to enable the handling of
KVM_EXIT_MEMORY_FAULT is not yet part of upstream [1]. But then the
return value for KVM_RUN ioctl() is defined as part of
Documentation/virt/kvm/api.rst in the Linux kernel.
[1] https://gitlab.arm.com/linux-arm/kvmtool-cca/-/blob/cca/v4/arm/kvm-cpu.c?ref_type=heads#L247
>
> Also, can you update kvm_exit_reasons with KVM_EXIT_MEMORY_FAULT, because
> otherwise kvm_cpu_thread() will segfault when it tries to access
> kvm_exit_reasons[KVM_EXIT_MEMORY_FAULT].
>
Will update.
-aneesh
next prev parent reply other threads:[~2025-02-11 16:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-11 7:38 [PATCH kvmtool 1/2] cpu: vmexit: Handle KVM_EXIT_UNKNOWN exit reason correctly Aneesh Kumar K.V (Arm)
2025-02-11 7:38 ` [PATCH kvmtool 2/2] cpu: vmexit: Handle KVM_EXIT_MEMORY_FAULT correctly Aneesh Kumar K.V (Arm)
2025-02-11 11:48 ` Will Deacon
2025-02-11 16:56 ` Aneesh Kumar K.V
2025-02-11 12:13 ` Alexandru Elisei
2025-02-11 16:51 ` Aneesh Kumar K.V [this message]
2025-02-11 11:47 ` [PATCH kvmtool 1/2] cpu: vmexit: Handle KVM_EXIT_UNKNOWN exit reason correctly Will Deacon
2025-02-11 16:58 ` Aneesh Kumar K.V
2025-02-11 12:12 ` Alexandru Elisei
2025-02-11 17:04 ` Aneesh Kumar K.V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yq5awmdwwhjt.fsf@kernel.org \
--to=aneesh.kumar@kernel.org \
--cc=Suzuki.Poulose@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=julien.thierry.kdev@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=steven.price@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox