Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@linux.ibm.com>
To: Janosch Frank <frankja@linux.ibm.com>,
	Claudio Imbrenda <imbrenda@linux.ibm.com>
Cc: KVM <kvm@vger.kernel.org>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	linux-s390 <linux-s390@vger.kernel.org>,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	David Hildenbrand <david@kernel.org>,
	Steffen Eiden <seiden@linux.ibm.com>,
	Andreas Grapentin <gra@linux.ibm.com>,
	Marc Zyngier <maz@kernel.org>
Subject: [PATCH 1/2] KVM: s390: Use a unique s390dbf name per VM
Date: Fri,  4 Dec 2026 10:11:30 +0100	[thread overview]
Message-ID: <20261204091131.150681-2-borntraeger@linux.ibm.com> (raw)
In-Reply-To: <20261204091131.150681-1-borntraeger@linux.ibm.com>

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


  reply	other threads:[~2026-12-04  9:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-12-04  9:21   ` [PATCH 1/2] KVM: s390: Use a unique s390dbf name per VM 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

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=20261204091131.150681-2-borntraeger@linux.ibm.com \
    --to=borntraeger@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=david@kernel.org \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=gra@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=imbrenda@linux.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=seiden@linux.ibm.com \
    --cc=svens@linux.ibm.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