* [kvm-unit-tests PATCH 0/2] Fix Clang 24 -Wunused-but-set-global warnings
@ 2026-10-22 20:44 Yosry Ahmed
2026-10-22 20:44 ` [kvm-unit-tests PATCH 1/2] chr-testdev: Remove unused in_vq Yosry Ahmed
2026-10-22 20:44 ` [kvm-unit-tests PATCH 2/2] x86/desc: Remove unused exception flag Yosry Ahmed
0 siblings, 2 replies; 4+ messages in thread
From: Yosry Ahmed @ 2026-10-22 20:44 UTC (permalink / raw)
To: Paolo Bonzini, Thomas Huth, Andrew Jones; +Cc: Greg Thelen, kvm, Yosry Ahmed
Building kvm-unit-tests with Clang 24 fails with -Werror due to the new
-Wunused-but-set-global warning flagging static variables that are
written to but never read in lib/chr-testdev.c and lib/x86/desc.c.
Remove both unused variables.
Yosry Ahmed (2):
chr-testdev: Remove unused in_vq
x86/desc: Remove unused exception flag
lib/chr-testdev.c | 3 +--
lib/x86/desc.c | 2 --
2 files changed, 1 insertion(+), 4 deletions(-)
base-commit: 5a221342a025948fa7d84f0c404748f6ba57f3ad
--
2.56.0.257.gf7497c7d27-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* [kvm-unit-tests PATCH 1/2] chr-testdev: Remove unused in_vq
2026-10-22 20:44 [kvm-unit-tests PATCH 0/2] Fix Clang 24 -Wunused-but-set-global warnings Yosry Ahmed
@ 2026-10-22 20:44 ` Yosry Ahmed
2026-10-23 9:58 ` Andrew Jones
2026-10-22 20:44 ` [kvm-unit-tests PATCH 2/2] x86/desc: Remove unused exception flag Yosry Ahmed
1 sibling, 1 reply; 4+ messages in thread
From: Yosry Ahmed @ 2026-10-22 20:44 UTC (permalink / raw)
To: Paolo Bonzini, Thomas Huth, Andrew Jones; +Cc: Greg Thelen, kvm, Yosry Ahmed
in_vq is assigned in chr_testdev_init() from vqs[0], but kvm-unit-tests
only writes to the character device via out_vq and never consumes input
from the host. Clang 24 warns on this with -Wunused-but-set-global:
lib/chr-testdev.c:15:26: error: variable 'in_vq' set but not used
[-Werror,-Wunused-but-set-global]
Remove the unused variable.
Fixes: b412ad0d39a1 ("Introduce chr-testdev")
Co-developed-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Yosry Ahmed <yosry@kernel.org>
---
lib/chr-testdev.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/chr-testdev.c b/lib/chr-testdev.c
index b3c641a833feb..c23fd92a46308 100644
--- a/lib/chr-testdev.c
+++ b/lib/chr-testdev.c
@@ -12,7 +12,7 @@
#define TESTDEV_NAME "chr-testdev"
static struct virtio_device *vcon;
-static struct virtqueue *in_vq, *out_vq;
+static struct virtqueue *out_vq;
static struct spinlock lock;
static void __testdev_send(char *buf, unsigned int len)
@@ -65,6 +65,5 @@ void chr_testdev_init(void)
return;
}
- in_vq = vqs[0];
out_vq = vqs[1];
}
--
2.56.0.257.gf7497c7d27-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [kvm-unit-tests PATCH 1/2] chr-testdev: Remove unused in_vq
2026-10-22 20:44 ` [kvm-unit-tests PATCH 1/2] chr-testdev: Remove unused in_vq Yosry Ahmed
@ 2026-10-23 9:58 ` Andrew Jones
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Jones @ 2026-10-23 9:58 UTC (permalink / raw)
To: Yosry Ahmed; +Cc: Paolo Bonzini, Thomas Huth, Greg Thelen, kvm
On Thu, Oct 22, 2026 at 08:44:12PM +0000, Yosry Ahmed wrote:
> in_vq is assigned in chr_testdev_init() from vqs[0], but kvm-unit-tests
> only writes to the character device via out_vq and never consumes input
> from the host. Clang 24 warns on this with -Wunused-but-set-global:
>
> lib/chr-testdev.c:15:26: error: variable 'in_vq' set but not used
> [-Werror,-Wunused-but-set-global]
>
> Remove the unused variable.
>
> Fixes: b412ad0d39a1 ("Introduce chr-testdev")
> Co-developed-by: Greg Thelen <gthelen@google.com>
> Signed-off-by: Greg Thelen <gthelen@google.com>
> Signed-off-by: Yosry Ahmed <yosry@kernel.org>
> ---
> lib/chr-testdev.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/lib/chr-testdev.c b/lib/chr-testdev.c
> index b3c641a833feb..c23fd92a46308 100644
> --- a/lib/chr-testdev.c
> +++ b/lib/chr-testdev.c
> @@ -12,7 +12,7 @@
> #define TESTDEV_NAME "chr-testdev"
>
> static struct virtio_device *vcon;
> -static struct virtqueue *in_vq, *out_vq;
> +static struct virtqueue *out_vq;
> static struct spinlock lock;
>
> static void __testdev_send(char *buf, unsigned int len)
> @@ -65,6 +65,5 @@ void chr_testdev_init(void)
> return;
> }
>
> - in_vq = vqs[0];
> out_vq = vqs[1];
> }
> --
> 2.56.0.257.gf7497c7d27-goog
>
Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [kvm-unit-tests PATCH 2/2] x86/desc: Remove unused exception flag
2026-10-22 20:44 [kvm-unit-tests PATCH 0/2] Fix Clang 24 -Wunused-but-set-global warnings Yosry Ahmed
2026-10-22 20:44 ` [kvm-unit-tests PATCH 1/2] chr-testdev: Remove unused in_vq Yosry Ahmed
@ 2026-10-22 20:44 ` Yosry Ahmed
1 sibling, 0 replies; 4+ messages in thread
From: Yosry Ahmed @ 2026-10-22 20:44 UTC (permalink / raw)
To: Paolo Bonzini, Thomas Huth, Andrew Jones; +Cc: Greg Thelen, kvm, Yosry Ahmed
exception is set to true in exception_handler() but is never read
because exception recovery redirects regs->rip to
exception_handler_longjmp(). Clang 24 warns on this with
-Wunused-but-set-global:
lib/x86/desc.c:483:13: error: variable 'exception' set but not used
[-Werror,-Wunused-but-set-global]
Remove the unused variable.
Fixes: 932ba2d2f530 ("x86: simplify test_for_exception trigger functions")
Co-developed-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Yosry Ahmed <yosry@kernel.org>
---
lib/x86/desc.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/lib/x86/desc.c b/lib/x86/desc.c
index f4cdfbc92c560..b5d4056260a1d 100644
--- a/lib/x86/desc.c
+++ b/lib/x86/desc.c
@@ -480,7 +480,6 @@ void setup_alt_stack(void)
}
#endif
-static bool exception;
static jmp_buf *exception_jmpbuf;
static void exception_handler_longjmp(void)
@@ -491,7 +490,6 @@ static void exception_handler_longjmp(void)
static void exception_handler(struct ex_regs *regs)
{
/* longjmp must happen after iret, so do not do it now. */
- exception = true;
regs->rip = (unsigned long)&exception_handler_longjmp;
regs->cs = read_cs();
}
--
2.56.0.257.gf7497c7d27-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-23 9:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-22 20:44 [kvm-unit-tests PATCH 0/2] Fix Clang 24 -Wunused-but-set-global warnings Yosry Ahmed
2026-10-22 20:44 ` [kvm-unit-tests PATCH 1/2] chr-testdev: Remove unused in_vq Yosry Ahmed
2026-10-23 9:58 ` Andrew Jones
2026-10-22 20:44 ` [kvm-unit-tests PATCH 2/2] x86/desc: Remove unused exception flag Yosry Ahmed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox