* [PATCH 0/2] KVM: s390: fix longstanding s390 debug feature bug
@ 2026-12-04 9:11 Christian Borntraeger
2026-12-04 9:11 ` [PATCH 1/2] KVM: s390: Use a unique s390dbf name per VM Christian Borntraeger
2026-12-04 9:11 ` [PATCH 2/2] KVM: s390: arm64: Use a sequence number in the s390dbf name Christian Borntraeger
0 siblings, 2 replies; 5+ messages in thread
From: Christian Borntraeger @ 2026-12-04 9:11 UTC (permalink / raw)
To: Janosch Frank, Claudio Imbrenda
Cc: KVM, Christian Borntraeger, linux-s390, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev, Sven Schnelle,
David Hildenbrand, Steffen Eiden, Andreas Grapentin, Marc Zyngier
There is a longstanding bug in s390 kvm that was already fixed by
the arm on s390 variant.
If a process creates 2 VMs the s390 debug feature does not work:
debugfs: 'kvm-<pid>' already exists in 's390dbf'
Fix this for s390 and change the arm64 variant to match the numbering.
Christian Borntraeger (2):
KVM: s390: Use a unique s390dbf name per VM
KVM: s390: arm64: Use a sequence number in the s390dbf name
arch/s390/kvm/arm64/arm.c | 3 ++-
arch/s390/kvm/s390/s390.c | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
--
2.53.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] KVM: s390: Use a unique s390dbf name per VM
2026-12-04 9:11 [PATCH 0/2] KVM: s390: fix longstanding s390 debug feature bug Christian Borntraeger
@ 2026-12-04 9:11 ` Christian Borntraeger
2026-12-04 9:21 ` sashiko-bot
2026-12-04 9:11 ` [PATCH 2/2] KVM: s390: arm64: Use a sequence number in the s390dbf name Christian Borntraeger
1 sibling, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2026-12-04 9:11 UTC (permalink / raw)
To: Janosch Frank, Claudio Imbrenda
Cc: KVM, Christian Borntraeger, linux-s390, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev, Sven Schnelle,
David Hildenbrand, Steffen Eiden, Andreas Grapentin, Marc Zyngier
The per-VM s390dbf area is named "kvm-<pid>". When one process creates
more than one VM, the second debug_register() will fail with
debugfs: 'kvm-<pid>' already exists in 's390dbf'
The VM is still created, but no debugging can be done.
Append a sequence number that goes up by one for each VM created, so
every VM gets its own directory: "kvm-<pid>-<n>".
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
---
arch/s390/kvm/s390/s390.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/s390/kvm/s390/s390.c b/arch/s390/kvm/s390/s390.c
index ee8e61a828bb8..60521c58cfdc8 100644
--- a/arch/s390/kvm/s390/s390.c
+++ b/arch/s390/kvm/s390/s390.c
@@ -3239,7 +3239,8 @@ void kvm_arch_free_vm(struct kvm *kvm)
int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
{
gfp_t alloc_flags = GFP_KERNEL_ACCOUNT | __GFP_ZERO;
- char debug_name[16];
+ static atomic_t vm_seq = ATOMIC_INIT(0);
+ char debug_name[32];
int i, rc;
mutex_init(&kvm->arch.pv.import_lock);
@@ -3265,7 +3266,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
if (!kvm->arch.sca)
goto out_err;
- snprintf(debug_name, sizeof(debug_name), "kvm-%u", current->pid);
+ snprintf(debug_name, sizeof(debug_name), "kvm-%u-%u", current->pid,
+ atomic_inc_return(&vm_seq));
kvm->arch.dbf = debug_register(debug_name, 32, 1, 7 * sizeof(long));
if (!kvm->arch.dbf)
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] KVM: s390: arm64: Use a sequence number in the s390dbf name
2026-12-04 9:11 [PATCH 0/2] KVM: s390: fix longstanding s390 debug feature bug Christian Borntraeger
2026-12-04 9:11 ` [PATCH 1/2] KVM: s390: Use a unique s390dbf name per VM Christian Borntraeger
@ 2026-12-04 9:11 ` Christian Borntraeger
2026-12-04 9:19 ` sashiko-bot
1 sibling, 1 reply; 5+ messages in thread
From: Christian Borntraeger @ 2026-12-04 9:11 UTC (permalink / raw)
To: Janosch Frank, Claudio Imbrenda
Cc: KVM, Christian Borntraeger, linux-s390, Heiko Carstens,
Vasily Gorbik, Alexander Gordeev, Sven Schnelle,
David Hildenbrand, Steffen Eiden, Andreas Grapentin, Marc Zyngier
The per-VM s390dbf area is named "kvm-arm64-<pid>-<random>". Two VMs of
the same process can still get the same random number, and debugfs then
fails to create the second directory.
Use the new s390 scheme.
Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
---
arch/s390/kvm/arm64/arm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/s390/kvm/arm64/arm.c b/arch/s390/kvm/arm64/arm.c
index bd9d85235f438..6fd0ba2061dcc 100644
--- a/arch/s390/kvm/arm64/arm.c
+++ b/arch/s390/kvm/arm64/arm.c
@@ -106,6 +106,7 @@ static int kvm_vm_type_ipa_size_shift(unsigned long type)
int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
{
+ static atomic_t vm_seq = ATOMIC_INIT(0);
char debug_name[32];
int ret;
@@ -121,7 +122,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
bitmap_zero(kvm->arch.vcpu_features, KVM_VCPU_MAX_FEATURES);
snprintf(debug_name, sizeof(debug_name), "kvm-arm64-%u-%u",
- current->pid, get_random_u32());
+ current->pid, atomic_inc_return(&vm_seq));
kvm->arch.dbf = debug_register(debug_name, 32, 1, 7 * sizeof(long));
if (!kvm->arch.dbf)
return -ENOMEM;
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] KVM: s390: arm64: Use a sequence number in the s390dbf name
2026-12-04 9:11 ` [PATCH 2/2] KVM: s390: arm64: Use a sequence number in the s390dbf name Christian Borntraeger
@ 2026-12-04 9:19 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-04 9:19 UTC (permalink / raw)
To: Christian Borntraeger
Cc: KVM, linux-s390, Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: s390: arm64: missing Fixes trailer for kvm_arch_init_vm()
dbf naming fix
--
commit 273944c4d557f17d2e09e91c6c7ba23952b5c156
Author: Christian Borntraeger <borntraeger@linux.ibm.com>
> KVM: s390: arm64: Use a sequence number in the s390dbf name
>
> The per-VM s390dbf area is named "kvm-arm64-<pid>-<random>". Two VMs of
> the same process can still get the same random number, and debugfs then
> fails to create the second directory.
>
> Use the new s390 scheme.
>
> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
[Severity: Low]
This fixes a debugfs directory name collision in kvm_arch_init_vm().
Should this include:
Fixes: 90246e7d1476 ("KVM: s390: arm64: Implement vm/vcpu create destroy")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204091131.150681-1-borntraeger@linux.ibm.com?part=2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] KVM: s390: Use a unique s390dbf name per VM
2026-12-04 9:11 ` [PATCH 1/2] KVM: s390: Use a unique s390dbf name per VM Christian Borntraeger
@ 2026-12-04 9:21 ` sashiko-bot
0 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-04 9:21 UTC (permalink / raw)
To: Christian Borntraeger
Cc: KVM, linux-s390, Heiko Carstens, Vasily Gorbik, Alexander Gordeev
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: s390: missing Fixes trailer for s390dbf name collision fix
--
commit 44f60dc949bf9736d39d3d369619a275bbd044f6
Author: Christian Borntraeger <borntraeger@linux.ibm.com>
> KVM: s390: Use a unique s390dbf name per VM
>
> The per-VM s390dbf area is named "kvm-<pid>". When one process creates
> more than one VM, the second debug_register() will fail with
>
> debugfs: 'kvm-<pid>' already exists in 's390dbf'
>
> The VM is still created, but no debugging can be done.
>
> Append a sequence number that goes up by one for each VM created, so
> every VM gets its own directory: "kvm-<pid>-<n>".
>
> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
[Severity: Low]
This fixes the s390dbf directory name collision when a process creates more
than one VM. Should this include a Fixes tag for the commit that introduced
the PID-only naming?
Fixes: b0c632db637d ("KVM: s390: arch backend for the kvm kernel module")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204091131.150681-1-borntraeger@linux.ibm.com?part=1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-12-04 9:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 9:11 [PATCH 0/2] KVM: s390: fix longstanding s390 debug feature bug Christian Borntraeger
2026-12-04 9:11 ` [PATCH 1/2] KVM: s390: Use a unique s390dbf name per VM Christian Borntraeger
2026-12-04 9:21 ` sashiko-bot
2026-12-04 9:11 ` [PATCH 2/2] KVM: s390: arm64: Use a sequence number in the s390dbf name Christian Borntraeger
2026-12-04 9:19 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox