[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR filter
From: |
Zhao Liu |
Subject: |
Re: [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR filter related functions |
Date: |
Tue, 16 Jul 2024 11:35:27 +0800 |
Hi Zide,
On Mon, Jul 15, 2024 at 03:18:07PM -0700, Chen, Zide wrote:
> Date: Mon, 15 Jul 2024 15:18:07 -0700
> From: "Chen, Zide" <zide.chen@intel.com>
> Subject: Re: [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR
> filter related functions
>
> On 7/14/2024 9:49 PM, Zhao Liu wrote:
> > @@ -5274,13 +5272,13 @@ void kvm_arch_update_guest_debug(CPUState *cpu,
> > struct kvm_guest_debug *dbg)
> > }
> > }
> >
> > -static bool kvm_install_msr_filters(KVMState *s)
> > +static int kvm_install_msr_filters(KVMState *s)
> > {
> > uint64_t zero = 0;
> > struct kvm_msr_filter filter = {
> > .flags = KVM_MSR_FILTER_DEFAULT_ALLOW,
> > };
> > - int r, i, j = 0;
> > + int ret, i, j = 0;
> >
> > for (i = 0; i < KVM_MSR_FILTER_MAX_RANGES; i++) {
>
> Nit: Since it's a clean up patch, how about replace
> KVM_MSR_FILTER_MAX_RANGES with ARRAY_SIZE(msr_handlers), to make the
> code consistent in other places to refer to the array size of
> msr_handlers[].
Yes, that's fine, I'll add a new small trivial patch to clean up this.
> > KVMMSRHandlers *handler = &msr_handlers[i];
> > @@ -5304,18 +5302,18 @@ static bool kvm_install_msr_filters(KVMState *s)
> > }
> > }
> >
> > - r = kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter);
> > - if (r) {
> > - return false;
> > + ret = kvm_vm_ioctl(s, KVM_X86_SET_MSR_FILTER, &filter);
> > + if (ret) {
> > + return ret;
> > }
> >
> > - return true;
> > + return 0;
> > }
>
> Nit: Seems ret is not needed here, and can directly return kvm_vm_ioctl();
Yes, good catch!
Thanks for you review!
Zhao
- [PATCH v3 0/8] [PATCH v3 0/8] target/i386: Misc cleanup on KVM PV defs, outdated comments and error handling, Zhao Liu, 2024/07/15
- [PATCH v3 1/8] target/i386/kvm: Add feature bit definitions for KVM CPUID, Zhao Liu, 2024/07/15
- [PATCH v3 2/8] target/i386/kvm: Remove local MSR_KVM_WALL_CLOCK and MSR_KVM_SYSTEM_TIME definitions, Zhao Liu, 2024/07/15
- [PATCH v3 3/8] target/i386/kvm: Only save/load kvmclock MSRs when kvmclock enabled, Zhao Liu, 2024/07/15
- [PATCH v3 4/8] target/i386/kvm: Save/load MSRs of kvmclock2 (KVM_FEATURE_CLOCKSOURCE2), Zhao Liu, 2024/07/15
- [PATCH v3 5/8] target/i386/kvm: Drop workaround for KVM_X86_DISABLE_EXITS_HTL typo, Zhao Liu, 2024/07/15
- [PATCH v3 6/8] target/i386/confidential-guest: Fix comment of x86_confidential_guest_kvm_type(), Zhao Liu, 2024/07/15
- [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR filter related functions, Zhao Liu, 2024/07/15
- [PATCH v3 8/8] target/i386/kvm: Clean up error handling in kvm_arch_init(), Zhao Liu, 2024/07/15