[PATCH] kvm: drop work around for kernel header typo.

Nan Wang posted 1 patch 3 years, 12 months ago
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220207122814.4044094-1-wangnan.light@bytedance.com
Maintainers: Marcelo Tosatti <mtosatti@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
target/i386/kvm/kvm.c | 4 ----
1 file changed, 4 deletions(-)
[PATCH] kvm: drop work around for kernel header typo.
Posted by Nan Wang 3 years, 12 months ago
From: "wangnan.light" <wangnan.light@bytedance.com>

Kernel header once had a typo(linux commit caa057a2cad6), qemu have to work around it with
hardcode macro(qemu commit 6f131f13e68d). Now kernel fix it(linux commit 766d3571d8e5),
so we can remove redundant code.

Signed-off-by: wangnan.light <wangnan.light@bytedance.com>
---
 target/i386/kvm/kvm.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 2c8feb4a6f..f65ed37591 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2403,10 +2403,6 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
         int disable_exits = kvm_check_extension(s, KVM_CAP_X86_DISABLE_EXITS);
         int ret;
 
-/* Work around for kernel header with a typo. TODO: fix header and drop. */
-#if defined(KVM_X86_DISABLE_EXITS_HTL) && !defined(KVM_X86_DISABLE_EXITS_HLT)
-#define KVM_X86_DISABLE_EXITS_HLT KVM_X86_DISABLE_EXITS_HTL
-#endif
         if (disable_exits) {
             disable_exits &= (KVM_X86_DISABLE_EXITS_MWAIT |
                               KVM_X86_DISABLE_EXITS_HLT |
-- 
2.11.0


Re: [PATCH] kvm: drop work around for kernel header typo.
Posted by Peter Maydell 3 years, 12 months ago
On Mon, 7 Feb 2022 at 12:35, Nan Wang <wangnan.light@bytedance.com> wrote:
>
> From: "wangnan.light" <wangnan.light@bytedance.com>
>
> Kernel header once had a typo(linux commit caa057a2cad6), qemu have to work around it with
> hardcode macro(qemu commit 6f131f13e68d). Now kernel fix it(linux commit 766d3571d8e5),
> so we can remove redundant code.

The other relevant git commit hash worth mentioning here is
QEMU commit 77d361b13c19f, which is where we updated our copy of
the kernel headers to a version that included that fix. You
might also mention when these fixes happened, which was back in 2018.

> Signed-off-by: wangnan.light <wangnan.light@bytedance.com>
> ---
>  target/i386/kvm/kvm.c | 4 ----
>  1 file changed, 4 deletions(-)
>
> diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
> index 2c8feb4a6f..f65ed37591 100644
> --- a/target/i386/kvm/kvm.c
> +++ b/target/i386/kvm/kvm.c
> @@ -2403,10 +2403,6 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
>          int disable_exits = kvm_check_extension(s, KVM_CAP_X86_DISABLE_EXITS);
>          int ret;
>
> -/* Work around for kernel header with a typo. TODO: fix header and drop. */
> -#if defined(KVM_X86_DISABLE_EXITS_HTL) && !defined(KVM_X86_DISABLE_EXITS_HLT)
> -#define KVM_X86_DISABLE_EXITS_HLT KVM_X86_DISABLE_EXITS_HTL
> -#endif
>          if (disable_exits) {
>              disable_exits &= (KVM_X86_DISABLE_EXITS_MWAIT |
>                                KVM_X86_DISABLE_EXITS_HLT |

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

(Side note, I'm surprised that kernel fix was allowed in -- it breaks any
userspace code that was relying on the typo'd #define name, which
would have been easily avoidable by just defining both names. But that
was years ago now, so it's done...)

thanks
-- PMM