From: Tao Cui <cui.tao@linux.dev>
To: Bibo Mao <maobibo@loongson.cn>, qemu-devel@nongnu.org
Cc: cui.tao@linux.dev, "Song Gao" <gaosong@loongson.cn>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@mailo.com>,
"Qiang Ma" <maqianga@uniontech.com>,
"Tao Cui" <cuitao@kylinos.cn>
Subject: Re: [PATCH 3/4] target/loongarch/kvm: remove redundant cpucfg failure traces
Date: Thu, 25 Jun 2026 11:33:46 +0800 [thread overview]
Message-ID: <f26f5a87-f60d-4dd7-9e6c-270ea9de7ad4@linux.dev> (raw)
In-Reply-To: <19b9d5f5-1304-6500-23d5-225f3c021422@loongson.cn>
在 2026/6/25 10:38, Bibo Mao 写道:
>
>
> On 2026/6/25 上午9:58, Tao Cui wrote:
>> From: Tao Cui <cuitao@kylinos.cn>
>>
>> kvm_get_one_reg() and kvm_set_one_reg() already trace on failure, so the
>> trace_kvm_failed_get_cpucfg()/trace_kvm_failed_put_cpucfg() calls in
>> kvm_loongarch_get_cpucfg() and kvm_loongarch_put_cpucfg() duplicate that.
>> Remove the calls and the now-unused trace events.
>>
>> Signed-off-by: Tao Cui <cuitao@kylinos.cn>
>> ---
>> target/loongarch/kvm/kvm.c | 6 ------
>> target/loongarch/trace-events | 2 --
>> 2 files changed, 8 deletions(-)
>>
>> diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
>> index fffb2d431a..6c3eea87b0 100644
>> --- a/target/loongarch/kvm/kvm.c
>> +++ b/target/loongarch/kvm/kvm.c
>> @@ -714,9 +714,6 @@ static int kvm_loongarch_get_cpucfg(CPUState *cs)
>> for (i = 0; i < 21; i++) {
>> ret = kvm_get_one_reg(cs, KVM_IOC_CPUCFG(i), &val);
>> - if (ret < 0) {
>> - trace_kvm_failed_get_cpucfg(strerror(errno));
> yeap, the trace is unnecessary, should we return immediately if there is error? otherwise the previous error will be overwritten.
>
You're right that the per-iteration ret assignmentoverwrites earlier errors. That's addressed in patch 4/4 ("fix cpucfg sync
error handling") of this series:
int r = kvm_get_one_reg(cs, KVM_IOC_CPUCFG(i), &val);
ret |= r;
if (!r) {
env->cpucfg[i] = (uint32_t)val;
}
I went with ret |= (accumulate) rather than returning immediately, to match
the existing kvm_loongarch_get_csr()/put_csr() loops in the same file which
also accumulate; it additionally skips storing cpucfg[i] on a failed read.
Happy to switch to an early return if you prefer that style.
Thanks,
Tao
>
>> - }
>> env->cpucfg[i] = (uint32_t)val;
>> }
>> return ret;
>> @@ -772,9 +769,6 @@ static int kvm_loongarch_put_cpucfg(CPUState *cs)
>> }
>> val = env->cpucfg[i];
>> ret = kvm_set_one_reg(cs, KVM_IOC_CPUCFG(i), &val);
>> - if (ret < 0) {
>> - trace_kvm_failed_put_cpucfg(strerror(errno));
>> - }
>> }
>> return ret;
>> }
>> diff --git a/target/loongarch/trace-events b/target/loongarch/trace-events
>> index dea11edc0f..829d8e0f53 100644
>> --- a/target/loongarch/trace-events
>> +++ b/target/loongarch/trace-events
>> @@ -9,7 +9,5 @@ kvm_failed_get_mpstate(const char *msg) "Failed to get mp_state from KVM: %s"
>> kvm_failed_put_mpstate(const char *msg) "Failed to put mp_state into KVM: %s"
>> kvm_failed_get_counter(const char *msg) "Failed to get counter from KVM: %s"
>> kvm_failed_put_counter(const char *msg) "Failed to put counter into KVM: %s"
>> -kvm_failed_get_cpucfg(const char *msg) "Failed to get cpucfg from KVM: %s"
>> -kvm_failed_put_cpucfg(const char *msg) "Failed to put cpucfg into KVM: %s"
>> kvm_arch_handle_exit(int num) "kvm arch handle exit, the reason number: %d"
>> kvm_set_intr(int irq, int level) "kvm set interrupt, irq num: %d, level: %d"
>>
>
next prev parent reply other threads:[~2026-06-25 3:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 1:58 [PATCH 0/4] target/loongarch/kvm: cpucfg and device attr fixes Tao Cui
2026-06-25 1:58 ` [PATCH 1/4] target/loongarch/kvm: fix uninitialized val and unchecked GET in cpucfg2 check Tao Cui
2026-06-25 2:48 ` Bibo Mao
2026-06-25 3:24 ` Tao Cui
2026-06-25 1:58 ` [PATCH 2/4] target/loongarch/kvm: pass device attr by reference to kvm_vcpu_ioctl Tao Cui
2026-06-25 2:32 ` Bibo Mao
2026-06-25 1:58 ` [PATCH 3/4] target/loongarch/kvm: remove redundant cpucfg failure traces Tao Cui
2026-06-25 2:38 ` Bibo Mao
2026-06-25 3:33 ` Tao Cui [this message]
2026-06-25 3:58 ` Bibo Mao
2026-06-25 1:58 ` [PATCH 4/4] target/loongarch/kvm: fix cpucfg sync error handling Tao Cui
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=f26f5a87-f60d-4dd7-9e6c-270ea9de7ad4@linux.dev \
--to=cui.tao@linux.dev \
--cc=cuitao@kylinos.cn \
--cc=gaosong@loongson.cn \
--cc=maobibo@loongson.cn \
--cc=maqianga@uniontech.com \
--cc=pbonzini@redhat.com \
--cc=philmd@mailo.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.