[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/10] qemu-vmsr-helper: fix socket loop breakage
From: |
Paolo Bonzini |
Subject: |
[PULL 09/10] qemu-vmsr-helper: fix socket loop breakage |
Date: |
Wed, 31 Jul 2024 13:18:05 +0200 |
Between v5 and v6 of the series, the socket loop of qemu-vmsr-helper was
changed to
allow sending multiple requests on the same socket. Unfortunately, the
condition
of the while loop is botched and the loop will never be entered. Clean it up,
and
also unify the handling of error reporting.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
tools/i386/qemu-vmsr-helper.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/tools/i386/qemu-vmsr-helper.c b/tools/i386/qemu-vmsr-helper.c
index ebf562c3ff8..585eaf88b37 100644
--- a/tools/i386/qemu-vmsr-helper.c
+++ b/tools/i386/qemu-vmsr-helper.c
@@ -227,19 +227,17 @@ static void coroutine_fn vh_co_entry(void *opaque)
&peer_pid,
&local_err);
if (r < 0) {
- error_report_err(local_err);
goto out;
}
- while (r < 0) {
+ for (;;) {
/*
* Read the requested MSR
* Only RAPL MSR in rapl-msr-index.h is allowed
*/
- r = qio_channel_read_all(QIO_CHANNEL(client->ioc),
- (char *) &request, sizeof(request),
&local_err);
- if (r < 0) {
- error_report_err(local_err);
+ r = qio_channel_read_all_eof(QIO_CHANNEL(client->ioc),
+ (char *) &request, sizeof(request),
&local_err);
+ if (r <= 0) {
break;
}
@@ -261,11 +259,15 @@ static void coroutine_fn vh_co_entry(void *opaque)
sizeof(vmsr),
&local_err);
if (r < 0) {
- error_report_err(local_err);
break;
}
}
+
out:
+ if (local_err) {
+ error_report_err(local_err);
+ }
+
object_unref(OBJECT(client->ioc));
g_free(client);
}
--
2.45.2
- [PULL 00/10] i386, tests/vm changes for QEMU 9.1-rc, Paolo Bonzini, 2024/07/31
- [PULL 01/10] tests/vm/openbsd: Install tomli, Paolo Bonzini, 2024/07/31
- [PULL 02/10] target/i386: Change unavail from u32 to u64, Paolo Bonzini, 2024/07/31
- [PULL 03/10] target/i386/cpu: Remove unnecessary SGX feature words checks, Paolo Bonzini, 2024/07/31
- [PULL 04/10] target/i386/cpu: Explicitly express SGX_LC and SGX feature words dependency, Paolo Bonzini, 2024/07/31
- [PULL 05/10] target/i386/cpu: Add dependencies of CPUID 0x12 leaves, Paolo Bonzini, 2024/07/31
- [PULL 07/10] target/i386: Fix typo that assign same value twice, Paolo Bonzini, 2024/07/31
- [PULL 08/10] target/i386: Clean up error cases for vmsr_read_thread_stat(), Paolo Bonzini, 2024/07/31
- [PULL 06/10] target/i386/cpu: Mask off SGX/SGX_LC feature words for non-PC machine, Paolo Bonzini, 2024/07/31
- [PULL 09/10] qemu-vmsr-helper: fix socket loop breakage,
Paolo Bonzini <=
- [PULL 10/10] qemu-vmsr-helper: implement --verbose/-v, Paolo Bonzini, 2024/07/31
- Re: [PULL 00/10] i386, tests/vm changes for QEMU 9.1-rc, Richard Henderson, 2024/07/31