lkml.org 
[lkml]   [2020]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/2] KVM: async_pf: Cleanup kvm_setup_async_pf()
Date
Sean Christopherson <sean.j.christopherson@intel.com> writes:

>
> I'd also be in favor of changing the return type to a boolean. I think
> you alluded to it earlier, the current semantics are quite confusing as they
> invert the normal "return 0 on success".

Yes, will do a follow-up.

KVM/x86 code has an intertwined mix of:
- normal 'int' functions ('0 on success')
- bool functions ('true'/'1' on success)
- 'int' exit handlers ('1'/'0' on success depending if exit to userspace
was required)
- ...

I think we can try to standardize this to:
- 'int' when error is propagated outside of KVM (userspace, other kernel
subsystem,...)
- 'bool' when the function is internal to KVM and the result is binary
('is_exit_required()', 'was_pf_injected()', 'will_have_another_beer()',
...)
- 'enum' for the rest.
And, if there's a good reason for making an exception, require a
comment. (leaving aside everything returning a pointer, of course as
these are self-explanatory -- unless it's 'void *' :-))

>
> For this patch:
>
> Reviewed-by: Sean Christopherson <sean.j.christopherson@intel.com>
>

Thank you!

--
Vitaly

\
 
 \ /
  Last update: 2020-06-11 10:31    [W:0.066 / U:1.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site