From patchwork Mon May 6 10:17:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13655262 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 21756142652; Mon, 6 May 2024 10:18:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990710; cv=none; b=l6Y3OOmvaVaS7Q/9rENPh+XTw5SWrk/c2z2i39u5gAVPD8zDVLe3RcigWPwJ1bO2Vnhn2rlfeCtS4lL6CUGtA+D5EnstorxjO/xIrjjSzT7eF8XrwMrMNCxKe24DnJiTPG8NV+3Ve9KKmxj57v7E7mrdg+yOMkENQCeTtYHdGiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990710; c=relaxed/simple; bh=2SV8hvvR18gCursA15Qb0T+vbllKSA4vn8ie5U+muzs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Q3Fm3t85oqCSKgQDszZ7vif1EnCULtNr0wSHI4lKRSqEnuMXOTmjuVunrAOsLcp+J5i//1aamv0Wvm7i8DPTmFVd89/mwPl2Pio54LeP0j4ZfTsh5lBj7ZieW5nrOQct44HdeoQyam+4sUU/hkgmK/ceDQ45/jQXxKgq/DKOLBA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=UjN6Tqlc; arc=none smtp.client-ip=209.85.216.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UjN6Tqlc" Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-2ad8fb779d2so1321097a91.0; Mon, 06 May 2024 03:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714990708; x=1715595508; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o9bizzlFKkW+X7zXOFueofhPZfnb9FC5f94YiJnWK6U=; b=UjN6TqlcBBo7Rd0ekgyugyKUeQngHmxFq+vqly5fqIpTXipi9WdhDGnZPfNq4OVNLa 0f34SoxxGZMHKgg5iTo0Hxf/NkvMK6lUUaw0lSv6lX9/LaUu+q78gRwLHPGBzEq3xEaT 07qbVikjERXaA36vOx1G8KP/ErT7JkLfrHnKgdj1YgUR9CKOKrloqZXxGQTuEwZv1285 NGJkjOQctjon/YvIPGOQlzIpS9aZUTz25M70PokT+fz1FeVG04tRiakuUzzE6LYeFZQI yYjz51a4ojGX87+Z/yoHw5fSPg30wSLyCwdMo4xp4Npvm3pkWLNxxkBT0rGx7xmakv0F AxXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714990708; x=1715595508; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o9bizzlFKkW+X7zXOFueofhPZfnb9FC5f94YiJnWK6U=; b=AMLnDpJJdW1nEjWuCbrUMMGHxTePTQF8Lnclh05R45pJYhfH+gQcorFpcMWmggrLRG 4OK4GeFAJwXci17dxVbLitkuGATzs+elZ7JT1y3gZKPEOASA5J7mOBtWDLO4JDddSSjA RMog75IVtT46kiWnIQWUBh4ryaak6XTemulAP3mrtYR/ojURg5VlqfOO3X+ULDJUK1Ek 2h4xnB+YVNd10k4IYwWOItAru2Hl8ry5GkDOaNtdPY+5W2sFhOJqVKmtVnlLKEAS2gei gU3oR2n6gBdwt6GgoXwFgltprkn9WwAfbLd+C6E6nZ8OeP8aP3pvNJ37JSb6uoZplk5z LWjg== X-Forwarded-Encrypted: i=1; AJvYcCXpUu88jWf1spA4Z45p7XBDirKX/gcP4lnszHDVxZEaSrKjbRso9S8FYgAJ4fvvbNNP+b//zboRBAI7btZJPcW8r8eqVxpg8lq0oQfXDOos9wCvijdDJE7bdigPv4X0NhuE X-Gm-Message-State: AOJu0Yy7DnHaWNgAujcEKNxWZt3zhgoUp0mqY/xgfKYKW38kkfk3J35R KlPGdqrycI42L/P32qSvNcULPeby9hsOvfkwakxkuTPUANbG9uRx X-Google-Smtp-Source: AGHT+IFquGoUNfMy6p5hJLXHS/bcYf20+a142u6IzKcRp9f37VGywJyIGJYHuvCO0lsZEarpxaKoKQ== X-Received: by 2002:a17:90a:f597:b0:2b0:e2cf:118b with SMTP id ct23-20020a17090af59700b002b0e2cf118bmr7460458pjb.33.1714990708372; Mon, 06 May 2024 03:18:28 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.9]) by smtp.gmail.com with ESMTPSA id co18-20020a17090afe9200b002af8f746f28sm9747820pjb.14.2024.05.06.03.18.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 03:18:28 -0700 (PDT) From: Yi Wang X-Google-Original-From: Yi Wang To: seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wanpengli@tencent.com, foxywang@tencent.com, oliver.upton@linux.dev, maz@kernel.org, anup@brainfault.org, atishp@atishpatra.org, borntraeger@linux.ibm.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, weijiang.yang@intel.com Cc: up2wing@gmail.com Subject: [v5 1/3] KVM: setup empty irq routing when create vm Date: Mon, 6 May 2024 18:17:49 +0800 Message-Id: <20240506101751.3145407-2-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240506101751.3145407-1-foxywang@tencent.com> References: <20240506101751.3145407-1-foxywang@tencent.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Yi Wang Add a new function to setup empty irq routing in kvm path, which can be invoded in non-architecture-specific functions. The difference compared to the kvm_setup_empty_irq_routing() is this function just alloc the empty irq routing and does not need synchronize srcu, as we will call it in kvm_create_vm(). Using the new adding function, we can setup empty irq routing when kvm_create_vm(), so that x86 and s390 no longer need to set empty/dummy irq routing when creating an IRQCHIP 'cause it avoid an synchronize_srcu. Signed-off-by: Yi Wang Acked-by: Christian Borntraeger --- include/linux/kvm_host.h | 2 ++ virt/kvm/irqchip.c | 23 +++++++++++++++++++++++ virt/kvm/kvm_main.c | 9 ++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 48f31dcd318a..a5f12b667ca5 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -2100,6 +2100,7 @@ int kvm_set_irq_routing(struct kvm *kvm, const struct kvm_irq_routing_entry *entries, unsigned nr, unsigned flags); +int kvm_init_irq_routing(struct kvm *kvm); int kvm_set_routing_entry(struct kvm *kvm, struct kvm_kernel_irq_routing_entry *e, const struct kvm_irq_routing_entry *ue); @@ -2108,6 +2109,7 @@ void kvm_free_irq_routing(struct kvm *kvm); #else static inline void kvm_free_irq_routing(struct kvm *kvm) {} +int kvm_init_irq_routing(struct kvm *kvm) {} #endif diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c index 1e567d1f6d3d..ec1fda7fffea 100644 --- a/virt/kvm/irqchip.c +++ b/virt/kvm/irqchip.c @@ -237,3 +237,26 @@ int kvm_set_irq_routing(struct kvm *kvm, return r; } + +/* + * Alloc empty irq routing. + * Called only during vm creation, because we don't synchronize_srcu here. + */ +int kvm_init_irq_routing(struct kvm *kvm) +{ + struct kvm_irq_routing_table *new; + int chip_size; + + new = kzalloc(struct_size(new, map, 1), GFP_KERNEL_ACCOUNT); + if (!new) + return -ENOMEM; + + new->nr_rt_entries = 1; + + chip_size = sizeof(int) * KVM_NR_IRQCHIPS * KVM_IRQCHIP_NUM_PINS; + memset(new->chip, -1, chip_size); + + RCU_INIT_POINTER(kvm->irq_routing, new); + + return 0; +} diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index ff0a20565f90..4100ebdd14fe 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1233,6 +1233,11 @@ static struct kvm *kvm_create_vm(unsigned long type, const char *fdname) goto out_err_no_irq_srcu; refcount_set(&kvm->users_count, 1); + + r = kvm_init_irq_routing(kvm); + if (r) + goto out_err_no_irq_routing; + for (i = 0; i < kvm_arch_nr_memslot_as_ids(kvm); i++) { for (j = 0; j < 2; j++) { slots = &kvm->__memslots[i][j]; @@ -1308,9 +1313,11 @@ static struct kvm *kvm_create_vm(unsigned long type, const char *fdname) out_err_no_disable: kvm_arch_destroy_vm(kvm); out_err_no_arch_destroy_vm: - WARN_ON_ONCE(!refcount_dec_and_test(&kvm->users_count)); for (i = 0; i < KVM_NR_BUSES; i++) kfree(kvm_get_bus(kvm, i)); + kvm_free_irq_routing(kvm); +out_err_no_irq_routing: + WARN_ON_ONCE(!refcount_dec_and_test(&kvm->users_count)); cleanup_srcu_struct(&kvm->irq_srcu); out_err_no_irq_srcu: cleanup_srcu_struct(&kvm->srcu); From patchwork Mon May 6 10:17:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13655263 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B430E143727; Mon, 6 May 2024 10:18:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990715; cv=none; b=dZ04TGklzP3rx4v/kFHFnyFQlP2wApNMoiJ1Rmx7XZU0Vc9StOSko+i7lhYiSKvikwPrqP8NMCJ2CJKG6vL8KiMLUFivUt/kPON8ZY1VnlQFOWkQR2JLETYGfPnK5GYoxnYEu5dTYeK6YCT5GCq3Z7xJ+wO/guL6i3IHHXzl39c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990715; c=relaxed/simple; bh=ff+g84K7inAIdzVwporLJbQLKqNwcOlgSp3tPVrcevA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r2mr7T6UCrVJBtiBiGKGI1xzfwicDGgHfNbP9Pulil6cFjCWsxR90nGK7aJ73Neip/YpeFFCYh0QE9BtCLrP9c9CrokpRse1/y0FHozKjbGLZ6LQoaNKSXqAX3zUPGntmJA6lznX6jBtq4PHpepjVLJgkXm0hPCq9UxCEjpegEM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=imoW8yWn; arc=none smtp.client-ip=209.85.216.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="imoW8yWn" Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-2b2b42b5126so1596253a91.3; Mon, 06 May 2024 03:18:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714990713; x=1715595513; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8kpDmc07j9B+bsWzL0IUg31Cez5Uca1vji9WOl0EX0Q=; b=imoW8yWnVm3ideL/1IHMFfkVroBSNRUj5IPqzVNugWHoOcLz7SoG9YmPIKwQ4iXbwt /B1RxE8zwBXrU8WuYjIZzkmZX49/wn37D+asdHQ/sHCC142dVMfon+FDKGHZ7Op1s4oO MY129U+42/3qyrHAQgtTqfl91JbEHUVZlaZUXFb1QwvHm99c77rTR96DEsp60EXaLI9o iUXXIMbC+QI5xsMRaWqE8FbmqGpwqGa1rIy2dCU9IB2BFosI8dS+h+c27dl7foOQqxU7 HIh3Jg8QnX86DyGqCwU5Z/rw0Nw/TaRPGzFxV7Qwxacec3Q/bC56IbQKHIrjyoSzlAu2 mmcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714990713; x=1715595513; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8kpDmc07j9B+bsWzL0IUg31Cez5Uca1vji9WOl0EX0Q=; b=PpJNlPyzuEDScLP7bha83IZMfyQDmgClDeK1s7HTXEned1IYstYEGIAT3vHeJPfTE1 EHLUMShn4g5wCW9fKDx+VhA1JoJ/lL//RMbAyUANLCUQ+5W+oFWRtpx2WspliIraDXyY 6UybWG5CL++LuyW5BQ4JMg4rHpTgFGyPtYbKZ+18GaC8CwLIS1f0jkldCXjtiKt0dWhN 7D2N6Lm19ubklM7N/5F4sSCXqmnf39O52OIXeBJDc4a2oyA55aAybbufVze5apdZCv5b eImFKdGmhrGWC+wiWQRTZiKfgBwWRkJAlDZQVV/hHOkEWRERXQD0nXDDp3bByqdOtqaZ EHzg== X-Forwarded-Encrypted: i=1; AJvYcCUKsgEPa93x3rW9o4MKX5tnte9cxPcRh14IcN/RzelsMlQwqxnWmjQFfJ3jNO6pm7oVKEgjAqzIG270jmn988MrQbCo7GrqD9anPmiqkHMErQqEqHIgZvFmdi1uEnMszOC0 X-Gm-Message-State: AOJu0YxP4JV2P7dOGIk6UPjJS0ZsAHXyqMyqntwDASZy87k9GgZyCy4O gefm9GWRjXNbbstsKzjmwAuQ5JgJ73qV6OLVi3OSOz/EihlXSGKW X-Google-Smtp-Source: AGHT+IEUCmARAOaOm8tiHqB8SAbzVfrCzOTh7Dt11wYbbGJ3HynNT04r6tq4Rq0Atbzws3wyYjAHtg== X-Received: by 2002:a17:90a:890d:b0:2b2:3376:b9e with SMTP id u13-20020a17090a890d00b002b233760b9emr8696215pjn.9.1714990713017; Mon, 06 May 2024 03:18:33 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.9]) by smtp.gmail.com with ESMTPSA id co18-20020a17090afe9200b002af8f746f28sm9747820pjb.14.2024.05.06.03.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 03:18:32 -0700 (PDT) From: Yi Wang X-Google-Original-From: Yi Wang To: seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wanpengli@tencent.com, foxywang@tencent.com, oliver.upton@linux.dev, maz@kernel.org, anup@brainfault.org, atishp@atishpatra.org, borntraeger@linux.ibm.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, weijiang.yang@intel.com Cc: up2wing@gmail.com Subject: [v5 2/3] KVM: x86: don't setup empty irq routing when KVM_CAP_SPLIT_IRQCHIP Date: Mon, 6 May 2024 18:17:50 +0800 Message-Id: <20240506101751.3145407-3-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240506101751.3145407-1-foxywang@tencent.com> References: <20240506101751.3145407-1-foxywang@tencent.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Yi Wang We found that it may cost more than 20 milliseconds very accidentally to enable cap of KVM_CAP_SPLIT_IRQCHIP on a host which has many vms already. The reason is that when vmm(qemu/CloudHypervisor) invokes KVM_CAP_SPLIT_IRQCHIP kvm will call synchronize_srcu_expedited() and might_sleep and kworker of srcu may cost some delay during this period. As we have set up empty irq routing when creating vm, so this is no need now. Signed-off-by: Yi Wang --- arch/x86/kvm/irq.h | 1 - arch/x86/kvm/irq_comm.c | 5 ----- arch/x86/kvm/x86.c | 3 --- 3 files changed, 9 deletions(-) diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h index c2d7cfe82d00..76d46b2f41dd 100644 --- a/arch/x86/kvm/irq.h +++ b/arch/x86/kvm/irq.h @@ -106,7 +106,6 @@ void __kvm_migrate_timers(struct kvm_vcpu *vcpu); int apic_has_pending_timer(struct kvm_vcpu *vcpu); int kvm_setup_default_irq_routing(struct kvm *kvm); -int kvm_setup_empty_irq_routing(struct kvm *kvm); int kvm_irq_delivery_to_apic(struct kvm *kvm, struct kvm_lapic *src, struct kvm_lapic_irq *irq, struct dest_map *dest_map); diff --git a/arch/x86/kvm/irq_comm.c b/arch/x86/kvm/irq_comm.c index 68f3f6c26046..6ee7ca39466e 100644 --- a/arch/x86/kvm/irq_comm.c +++ b/arch/x86/kvm/irq_comm.c @@ -397,11 +397,6 @@ int kvm_setup_default_irq_routing(struct kvm *kvm) static const struct kvm_irq_routing_entry empty_routing[] = {}; -int kvm_setup_empty_irq_routing(struct kvm *kvm) -{ - return kvm_set_irq_routing(kvm, empty_routing, 0, 0); -} - void kvm_arch_post_irq_routing_update(struct kvm *kvm) { if (!irqchip_split(kvm)) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 91478b769af0..01270182757b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6527,9 +6527,6 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, goto split_irqchip_unlock; if (kvm->created_vcpus) goto split_irqchip_unlock; - r = kvm_setup_empty_irq_routing(kvm); - if (r) - goto split_irqchip_unlock; /* Pairs with irqchip_in_kernel. */ smp_wmb(); kvm->arch.irqchip_mode = KVM_IRQCHIP_SPLIT; From patchwork Mon May 6 10:17:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13655264 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3FC7E14387F; Mon, 6 May 2024 10:18:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990719; cv=none; b=paulGUQMmSVHkGrI5oFWWmn/AnY1i91oaGTH/Tq1Sa5zTkp6t/vgLTIvO7ynuqZnuRE4zRtA/i7XBl4NOXFJVA/CvP49F2aOKIIrW6GwqvPjNl2UXzaGHcnQMhMPJPIY3x5zh7vgDBFP1c4tXTTOz/fyjQKkFw/QA9Se2czPcrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714990719; c=relaxed/simple; bh=hbWQ3Mur+/ECvEanbvX6901lMYP+yzm6OHJl+SocuvU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DBSUhcjPIb2beK0LaDhX5tR6lSSdF0RzWIxHEhbqh75aOfxc9mgBeu/iu3ZcSXD9uQwGUXbku3kuSXTkKN0IqSLTrYDAh1NV+qLt8YW9//rYsYEZ0DJ43Bqa9/2PyUU1wGY9asLWeF5C0ufu6yq2T7bhXHFc+iwTSlTI1/p7RGE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jHFjbKxM; arc=none smtp.client-ip=209.85.216.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jHFjbKxM" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2b4a7671abaso1101449a91.0; Mon, 06 May 2024 03:18:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714990717; x=1715595517; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=31KekFIOIpF99+poRc8QNtBNYMF8yQuGd++gmF2U7xs=; b=jHFjbKxMaggi45CIZpdkMay8B8tVb3kc0DV/ZGWTK7L/BwtiS4Ks6Wp1+kNud6viaP Xvgufqme6x0n1eW9/mAA8jJq/Q01PEQbPTKNPyQPz0ToffhjjeMAZtVjRQI5ZflrI4P7 8sTiZfttkc/3gGAPPnJIckuilD54Mjw953yY2EgkQI9QJXCORCJmkMwGu1RvY/nnosAk iNclr/HGDykZYQMlba9QLi3xuvabOSWaaP5jzwmFDt94j1aap6apYP4EEveCSVdrH4pk 59oGWJNM7jHCHHPyxFP/sH24CEtqjC6UzS1Xsp239q03UUmFtlIYkq34lXes0KeXT+XN /bNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714990717; x=1715595517; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=31KekFIOIpF99+poRc8QNtBNYMF8yQuGd++gmF2U7xs=; b=IMDjC+H6HybqKdvmUhK7DHoj7EjOhMjRSImEOuhqMoC4ZrCsZrtPg6wMbCS+KUcp/H IUUJdew8cDabvQu0snxZpe4WLE5rBZmKmCsWM6wbBex5oNFB9aqABwCcCM6pnbsfXC8Y RuL5GAXdhssu+exM+k1IeDyeUXnNTVtoX9gu/G0FUzWF9YntPqiOsQIxKMIBaPVRkGUg xz+GyDigZCS1CS3i79sWztaqNYd3LsadM2R8Hyx7YaKgAoYw8gkXtMozXvdsg1e+x25Q uAdtogCYY8K8jnTejtdLDrZzTOc7zQ1jblncqSscx//3RfYx9toAE1a3vUTVLy/a0BGW +OPQ== X-Forwarded-Encrypted: i=1; AJvYcCWXrQenckIrXNezrrNEwwvrvVHxrJ06jRvd5tyrVLKSsEuS9/7UVpXiyGbKlOn/zLly1KNWLC3hsimOtdOcIWHrci7roEYtf8Jsz57NKDEEWMnWGBd4Bxl7zG9nbHIQaYtp X-Gm-Message-State: AOJu0Yw6OErzyzib/ALW+bWrbbVQWXAbkgBfQxOUSsqH/Z3qMaDN3Puu rKbodtp8TT6XuYq3QzM2ku877mZLyMAbOkIPaI6iw0GDUWq8fa0m X-Google-Smtp-Source: AGHT+IHB3HRfjhiqL/tX1CDXXr1K19EOnmaHDdUrdFkmoVBi0L0LlA2/KoxLijSD5Hshni/CHzqqmQ== X-Received: by 2002:a17:90a:a906:b0:2b3:df47:d743 with SMTP id i6-20020a17090aa90600b002b3df47d743mr8017623pjq.9.1714990717546; Mon, 06 May 2024 03:18:37 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.9]) by smtp.gmail.com with ESMTPSA id co18-20020a17090afe9200b002af8f746f28sm9747820pjb.14.2024.05.06.03.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 03:18:37 -0700 (PDT) From: Yi Wang X-Google-Original-From: Yi Wang To: seanjc@google.com, pbonzini@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wanpengli@tencent.com, foxywang@tencent.com, oliver.upton@linux.dev, maz@kernel.org, anup@brainfault.org, atishp@atishpatra.org, borntraeger@linux.ibm.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, weijiang.yang@intel.com Cc: up2wing@gmail.com Subject: [v5 3/3] KVM: s390: don't setup dummy routing when KVM_CREATE_IRQCHIP Date: Mon, 6 May 2024 18:17:51 +0800 Message-Id: <20240506101751.3145407-4-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240506101751.3145407-1-foxywang@tencent.com> References: <20240506101751.3145407-1-foxywang@tencent.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Yi Wang As we have setup empty irq routing in kvm_create_vm(), there's no need to setup dummy routing when KVM_CREATE_IRQCHIP. Signed-off-by: Yi Wang Acked-by: Christian Borntraeger Signed-off-by: Yi Wang Acked-by: Christian Borntraeger Signed-off-by: Sean Christopherson --- arch/s390/kvm/kvm-s390.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 5147b943a864..ba7fd39bcbf4 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -2998,14 +2998,7 @@ int kvm_arch_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) break; } case KVM_CREATE_IRQCHIP: { - struct kvm_irq_routing_entry routing; - - r = -EINVAL; - if (kvm->arch.use_irqchip) { - /* Set up dummy routing. */ - memset(&routing, 0, sizeof(routing)); - r = kvm_set_irq_routing(kvm, &routing, 0, 0); - } + r = 0; break; } case KVM_SET_DEVICE_ATTR: {