[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF7b7moeOeJEv+zPQ-VQrP8M+O7r8Ru3GZjfrAKj25Hc0pQGnw@mail.gmail.com>
Date: Mon, 15 Jul 2024 14:37:22 -0700
From: Anish Moorthy <amoorthy@...gle.com>
To: James Houghton <jthoughton@...gle.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Marc Zyngier <maz@...nel.org>,
Oliver Upton <oliver.upton@...ux.dev>, James Morse <james.morse@....com>,
Suzuki K Poulose <suzuki.poulose@....com>, Zenghui Yu <yuzenghui@...wei.com>,
Sean Christopherson <seanjc@...gle.com>, Shuah Khan <shuah@...nel.org>, Peter Xu <peterx@...hat.org>,
Axel Rasmussen <axelrasmussen@...gle.com>, David Matlack <dmatlack@...gle.com>, kvm@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, kvmarm@...ts.linux.dev
Subject: Re: [RFC PATCH 02/18] KVM: Add KVM_CAP_USERFAULT and KVM_MEMORY_ATTRIBUTE_USERFAULT
Not to nitpick an RFC, but since the stuff in this patch seems less
likely to change I think you should avoid using #ifdefs
For instance
On Wed, Jul 10, 2024 at 4:43 PM James Houghton <jthoughton@...gle.com> wrote:
> +static inline bool kvm_userfault_enabled(struct kvm *kvm)
> +{
> +#ifdef CONFIG_KVM_USERFAULT
> + return !!rcu_access_pointer(kvm->userfault_ctx);
> +#else
> + return false;
> +#endif
> +}
can be
> +static inline bool kvm_userfault_enabled(struct kvm *kvm)
> +{
> + if (IS_ENABLED(CONFIG_KVM_USERFAULT)) {
> + return !!rcu_access_pointer(kvm->userfault_ctx);
> + } else {
> + return false;
> + }
> +}
(however kernel style tells you to write that :), the cap-supported
check can be moved into kvm_vm_ioctl_enable_userfault(), etc
Powered by blists - more mailing lists