qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Zhao Liu <zhao1.liu@intel.com>
To: "Chen, Zide" <zide.chen@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Eduardo Habkost <eduardo@habkost.net>,
	"Michael S . Tsirkin" <mst@redhat.com>,
	Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Xiaoyao Li <xiaoyao.li@intel.com>,
	Pankaj Gupta <pankaj.gupta@amd.com>,
	qemu-devel@nongnu.org, kvm@vger.kernel.org
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	[thread overview]
Message-ID: <ZpXqf7Pc5shZ8osj@intel.com> (raw)
In-Reply-To: <f8f2cfb9-1128-4e1f-a152-3f88587927a1@intel.com>

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




  reply	other threads:[~2024-07-16  3:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15  4:49 [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  4:49 ` [PATCH v3 1/8] target/i386/kvm: Add feature bit definitions for KVM CPUID Zhao Liu
2024-07-15  4:49 ` [PATCH v3 2/8] target/i386/kvm: Remove local MSR_KVM_WALL_CLOCK and MSR_KVM_SYSTEM_TIME definitions Zhao Liu
2024-07-15  4:49 ` [PATCH v3 3/8] target/i386/kvm: Only save/load kvmclock MSRs when kvmclock enabled Zhao Liu
2024-07-15  4:49 ` [PATCH v3 4/8] target/i386/kvm: Save/load MSRs of kvmclock2 (KVM_FEATURE_CLOCKSOURCE2) Zhao Liu
2024-07-15  4:49 ` [PATCH v3 5/8] target/i386/kvm: Drop workaround for KVM_X86_DISABLE_EXITS_HTL typo Zhao Liu
2024-07-15  4:49 ` [PATCH v3 6/8] target/i386/confidential-guest: Fix comment of x86_confidential_guest_kvm_type() Zhao Liu
2024-07-15  4:49 ` [PATCH v3 7/8] target/i386/kvm: Clean up return values of MSR filter related functions Zhao Liu
2024-07-15 22:18   ` Chen, Zide
2024-07-16  3:35     ` Zhao Liu [this message]
2024-07-15  4:49 ` [PATCH v3 8/8] target/i386/kvm: Clean up error handling in kvm_arch_init() Zhao Liu

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=ZpXqf7Pc5shZ8osj@intel.com \
    --to=zhao1.liu@intel.com \
    --cc=eduardo@habkost.net \
    --cc=kvm@vger.kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pankaj.gupta@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=xiaoyao.li@intel.com \
    --cc=zide.chen@intel.com \
    /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).