From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] accel/kvm: Factor kvm_cpu_synchronize_put() out
Date: Tue, 7 Oct 2025 12:34:44 -0700 [thread overview]
Message-ID: <1c8d0e1e-46a3-443c-9308-c6a4686979d1@linaro.org> (raw)
In-Reply-To: <20251007081616.68442-4-philmd@linaro.org>
On 10/7/25 01:16, Philippe Mathieu-Daudé wrote:
> The same code is duplicated 3 times: factor a common method.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> accel/kvm/kvm-all.c | 47 ++++++++++++++++++---------------------------
> 1 file changed, 19 insertions(+), 28 deletions(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 9060599cd73..de79f4ca099 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2935,22 +2935,32 @@ void kvm_cpu_synchronize_state(CPUState *cpu)
> }
> }
>
> -static void do_kvm_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg)
> +static bool kvm_cpu_synchronize_put(CPUState *cpu, KvmPutState state,
> + const char *desc)
> {
> Error *err = NULL;
> - int ret = kvm_arch_put_registers(cpu, KVM_PUT_RESET_STATE, &err);
> + int ret = kvm_arch_put_registers(cpu, state, &err);
> if (ret) {
> if (err) {
> - error_reportf_err(err, "Restoring resisters after reset: ");
> + error_reportf_err(err, "Restoring resisters %s: ", desc);
> } else {
> - error_report("Failed to put registers after reset: %s",
> + error_report("Failed to put registers %s: %s", desc,
> strerror(-ret));
> }
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
For the to-do list: the arch routine really should be using error_setg_errno, not
deferring the test of errno to here. But it seems i386 is the only target that actually
sets errp.
r~
prev parent reply other threads:[~2025-10-07 19:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 8:16 [PATCH 0/3] accel/kvm: Cleanups around kvm_arch_put_registers() Philippe Mathieu-Daudé
2025-10-07 8:16 ` [PATCH 1/3] accel/kvm: Do not expect more then KVM_PUT_FULL_STATE Philippe Mathieu-Daudé
2025-10-07 8:20 ` Harsh Prateek Bora
2025-10-07 8:16 ` [PATCH 2/3] accel/kvm: Introduce KvmPutState enum Philippe Mathieu-Daudé
2025-10-07 8:30 ` Harsh Prateek Bora
2025-10-07 8:16 ` [PATCH 3/3] accel/kvm: Factor kvm_cpu_synchronize_put() out Philippe Mathieu-Daudé
2025-10-07 13:30 ` Andrew Jones
2025-10-07 13:53 ` Philippe Mathieu-Daudé
2025-10-07 19:34 ` Richard Henderson [this message]
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=1c8d0e1e-46a3-443c-9308-c6a4686979d1@linaro.org \
--to=richard.henderson@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).