[PATCH] src: fix incorrect build conditional for KVM MSR code
From: Daniel P. Berrangé <berrange@redhat.com> The condition WITH_LINUX_KVM_H && (defined(__linux__) || defined(__FreeBSD__)) is redundant. If the meson check for linux/kvm.h succeeded, we must be on a Linux host and cannot be on a FreeBSD host. Remove these redundant OS conditions from the MSR code. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virhostcpu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c index c3b4f87de1..09395ddb04 100644 --- a/src/util/virhostcpu.c +++ b/src/util/virhostcpu.c @@ -1328,8 +1328,7 @@ virHostCPUGetMicrocodeVersion(virArch hostArch G_GNUC_UNUSED) #if WITH_LINUX_KVM_H && defined(KVM_GET_MSRS) && \ - (defined(__i386__) || defined(__x86_64__)) && \ - (defined(__linux__) || defined(__FreeBSD__)) + (defined(__i386__) || defined(__x86_64__)) static int virHostCPUGetMSRFromKVM(unsigned long index, uint64_t *result) @@ -1585,8 +1584,7 @@ virHostCPUGetTscInfo(void) } #endif /* WITH_LINUX_KVM_H && defined(KVM_GET_MSRS) && \ - (defined(__i386__) || defined(__x86_64__)) && \ - (defined(__linux__) || defined(__FreeBSD__)) */ + (defined(__i386__) || defined(__x86_64__)) */ int virHostCPUReadSignature(virArch arch, -- 2.51.1
In summary: They are not incorrect, just redundant/misleading/overly verbose. On Mon, Nov 24, 2025 at 15:09:15 +0000, Daniel P. Berrangé via Devel wrote:
From: Daniel P. Berrangé <berrange@redhat.com>
The condition
WITH_LINUX_KVM_H && (defined(__linux__) || defined(__FreeBSD__))
is redundant. If the meson check for linux/kvm.h succeeded, we must be on a Linux host and cannot be on a FreeBSD host. Remove these redundant OS conditions from the MSR code.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virhostcpu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
On Tue, Nov 25, 2025 at 08:41:11AM +0100, Peter Krempa wrote:
In summary: They are not incorrect, just redundant/misleading/overly verbose.
Yes, ok, i'll reword that $SUBJECT.
On Mon, Nov 24, 2025 at 15:09:15 +0000, Daniel P. Berrangé via Devel wrote:
From: Daniel P. Berrangé <berrange@redhat.com>
The condition
WITH_LINUX_KVM_H && (defined(__linux__) || defined(__FreeBSD__))
is redundant. If the meson check for linux/kvm.h succeeded, we must be on a Linux host and cannot be on a FreeBSD host. Remove these redundant OS conditions from the MSR code.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- src/util/virhostcpu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrangé -
Peter Krempa