From: Sean Christopherson <seanjc@google.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>
Cc: linux-kernel@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, Yury Norov <yury.norov@gmail.com>,
Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [PATCH] KVM: VMX: don't include '<linux/find.h>' directly
Date: Tue, 17 Dec 2024 08:37:27 -0800 [thread overview]
Message-ID: <Z2Goxx27WL-G-13y@google.com> (raw)
In-Reply-To: <20241217070539.2433-2-wsa+renesas@sang-engineering.com>
+Yury and Rasmus
On Tue, Dec 17, 2024, Wolfram Sang wrote:
> The header clearly states that it does not want to be included directly,
I definitely don't object to the KVM change, but the if y'all expect developers
to actually honor the "rule", it needs to have teeth. As evidenced by a similar
rule in arch/x86/include/asm/bitops.h that also gets ignored, an #error that's
buried under an include guard and triggers on a macro that's never #undef'd is
quite useless.
$ git grep "include <asm/bitops.h>"
arch/x86/include/asm/spinlock.h:#include <asm/bitops.h>
arch/x86/kernel/unwind_frame.c:#include <asm/bitops.h>
arch/x86/kernel/unwind_guess.c:#include <asm/bitops.h>
include/linux/bitops.h:#include <asm/bitops.h>
include/linux/count_zeros.h:#include <asm/bitops.h>
net/core/net-traces.c:#include <asm/bitops.h>
E.g.
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index 262b6596eca5..381ca834985d 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -8,7 +8,11 @@
#include <linux/bitops.h>
#include <linux/cleanup.h>
#include <linux/errno.h>
+
+#define __LINUX_BITMAP_INCLUDE_FIND_H
#include <linux/find.h>
+#undef __LINUX_BITMAP_INCLUDE_FIND_H
+
#include <linux/limits.h>
#include <linux/string.h>
#include <linux/types.h>
diff --git a/include/linux/find.h b/include/linux/find.h
index 68685714bc18..d9494ff3126b 100644
--- a/include/linux/find.h
+++ b/include/linux/find.h
@@ -1,11 +1,11 @@
+#ifndef __LINUX_BITMAP_INCLUDE_FIND_H
+#error Please do not include <linux/find.h> directly, include <linux/bitmap.h> instead.
+#endif
+
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LINUX_FIND_H_
#define __LINUX_FIND_H_
-#ifndef __LINUX_BITMAP_H
-#error only <linux/bitmap.h> can be included directly
-#endif
-
#include <linux/bitops.h>
unsigned long _find_next_bit(const unsigned long *addr1, unsigned long nbits,
> only via '<linux/bitmap.h>'. Replace the include accordingly.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> arch/x86/kvm/vmx/posted_intr.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx/posted_intr.h b/arch/x86/kvm/vmx/posted_intr.h
> index 1715d2ab07be..ad9116a99bcc 100644
> --- a/arch/x86/kvm/vmx/posted_intr.h
> +++ b/arch/x86/kvm/vmx/posted_intr.h
> @@ -2,7 +2,7 @@
> #ifndef __KVM_X86_VMX_POSTED_INTR_H
> #define __KVM_X86_VMX_POSTED_INTR_H
>
> -#include <linux/find.h>
> +#include <linux/bitmap.h>
> #include <asm/posted_intr.h>
>
> void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu);
> --
> 2.45.2
>
next prev parent reply other threads:[~2024-12-17 16:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-17 7:05 [PATCH] KVM: VMX: don't include '<linux/find.h>' directly Wolfram Sang
2024-12-17 16:37 ` Sean Christopherson [this message]
2024-12-17 18:18 ` Wolfram Sang
2024-12-19 11:21 ` Wolfram Sang
2024-12-19 12:58 ` Paolo Bonzini
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=Z2Goxx27WL-G-13y@google.com \
--to=seanjc@google.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=wsa+renesas@sang-engineering.com \
--cc=x86@kernel.org \
--cc=yury.norov@gmail.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