From patchwork Wed Jan 24 11:34:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13528958 Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (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 3A4E24F88E; Wed, 24 Jan 2024 11:35:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706096112; cv=none; b=HCKIyUJD3Nyj6w4DW+O3yS14hti4GiJacyA3AxMrZMN5psPttelEgha3pOI0CRewPyZKA3lkAltsOdDOYulVca2EGvAv3ISSH3cKR6P2BpXcSqdozkPB8qs+GLFT6KEOtxin+CxiNchadunKCFR7vyK99dyYrHn1PfiMWEO7BkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706096112; c=relaxed/simple; bh=rpPUI8/Ilc1h0gZrxlo0S9MkxaA5lzl3nhDeUQz8WlY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lj3UKjfudKDzddcqzGiSk8LnFucukWqi3ohhXeQIm6QDVY0HG108vU+Kx2AMdxJJzOddXsNBrc2DuQTMrqoeO7gbZm2tydd3kS988T1A0RCARjDmAfgYbijyq9cn+Jw27E39DyVSn6zFZvpLoirzlM6QPBjOZ4NAE6KwMhW3224= 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=Ce0zhmj4; arc=none smtp.client-ip=209.85.166.182 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="Ce0zhmj4" Received: by mail-il1-f182.google.com with SMTP id e9e14a558f8ab-3619e804f3aso19652625ab.2; Wed, 24 Jan 2024 03:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706096110; x=1706700910; 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=LzYCOce5vbS2RbT3cfrlWimjZLlkPfrhe1IV1KHmmpQ=; b=Ce0zhmj4yuRiYAr/IoZJWByO5qKyfC8f5L8ss1bm2bNlJflI147abq/Wxr4u5WZFXK uq18bBVumNcrYRPtj2xfdsLeeUu4c82X49r60KCf0NiOQD3FBSOYB5px08s/jzAQkwG/ DvFATjvj0vEzV/OwepZba6WcjdZyCWZ+k/FL3OW7SUJ9ZuFe0vquZmShDO5zHkXTmJCB 2UWQs/0eN9wJKjnZWAWflEuNizVawyu7KQVyrT0iEcHF0KT5Q2E0cPRwqJccyETjWZ9i Y8YGNze097+UHYMyLiXzPJbkrYOCV8WVMpP5StfESOF7OPnsKOnh7Tc3gwawA0k6DyOq E6PA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706096110; x=1706700910; 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=LzYCOce5vbS2RbT3cfrlWimjZLlkPfrhe1IV1KHmmpQ=; b=OJXQbwhYOYbmUIClOi9Rq0Tcip/I2qhCu1IbqaHSJwLM0109O9hvwl/EB0PZkg2cwO uIWve/VoSQFW0fqGzwFDFao9XnZfdIqsjmuzCs+BxKZnDq5FsGKC6Ieqm6kroHgJBedO NowQ4Eg2rGuhrxZb8MvIufhGBsnNRsNGtmDqR1pqrUABt5YbOwuqlhOittmja9ugA9Qs 4HIGnGjNvMK4gto9sB5KLslVBJa6LloHxSOplXSJEY0/KTjoQP5oaK47lhA2RhrktcT6 sWefoqrkOsz/Pmg3g2StvxaHgsG+mAZbkf4t99jdbvRrTnrW3i6WuxoEim4sqU4ZDHXP P2pw== X-Gm-Message-State: AOJu0YylRw3dHmN/mOuc5FqZEYgHeWosuoiLFPg4gRKsIGGFZYb1dyG0 WbVdEynGUW+vMfMU1kg31oRwRZb8In36a59+/FBVKP981/kQ4xxp X-Google-Smtp-Source: AGHT+IH5BookJEY65PdeNkId1YqameYAPF4mf8+ugNLT298Scx7hdAz+EfFd5LyUYZ9yWkhk/+XRNw== X-Received: by 2002:a05:6e02:506:b0:361:9727:7cbe with SMTP id d6-20020a056e02050600b0036197277cbemr1293077ils.117.1706096110011; Wed, 24 Jan 2024 03:35:10 -0800 (PST) Received: from localhost.localdomain ([43.132.141.3]) by smtp.gmail.com with ESMTPSA id c15-20020a63d50f000000b00578b8fab907sm11727820pgg.73.2024.01.24.03.35.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:35:09 -0800 (PST) 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 Cc: up2wing@gmail.com Subject: [v3 1/3] KVM: setup empty irq routing when create vm Date: Wed, 24 Jan 2024 19:34:44 +0800 Message-Id: <20240124113446.2977003-2-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240124113446.2977003-1-foxywang@tencent.com> References: <20240124113446.2977003-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 --- include/linux/kvm_host.h | 1 + virt/kvm/irqchip.c | 19 +++++++++++++++++++ virt/kvm/kvm_main.c | 4 ++++ 3 files changed, 24 insertions(+) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 4944136efaa2..e91525c0a4ea 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -2000,6 +2000,7 @@ int kvm_set_irq_routing(struct kvm *kvm, const struct kvm_irq_routing_entry *entries, unsigned nr, unsigned flags); +int kvm_setup_empty_irq_routing_lockless(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); diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c index 1e567d1f6d3d..90fc43bd0fe4 100644 --- a/virt/kvm/irqchip.c +++ b/virt/kvm/irqchip.c @@ -237,3 +237,22 @@ int kvm_set_irq_routing(struct kvm *kvm, return r; } + +int kvm_setup_empty_irq_routing_lockless(struct kvm *kvm) +{ + struct kvm_irq_routing_table *new; + u32 i, j; + + new = kzalloc(struct_size(new, map, 1), GFP_KERNEL_ACCOUNT); + if (!new) + return -ENOMEM; + + new->nr_rt_entries = 1; + for (i = 0; i < KVM_NR_IRQCHIPS; i++) + for (j = 0; j < KVM_IRQCHIP_NUM_PINS; j++) + new->chip[i][j] = -1; + + RCU_INIT_POINTER(kvm->irq_routing, new); + + return 0; +} diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 7db96875ac46..db1b13fc0502 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1242,6 +1242,10 @@ static struct kvm *kvm_create_vm(unsigned long type, const char *fdname) if (r) goto out_err; + r = kvm_setup_empty_irq_routing_lockless(kvm); + if (r) + goto out_err; + mutex_lock(&kvm_lock); list_add(&kvm->vm_list, &vm_list); mutex_unlock(&kvm_lock); From patchwork Wed Jan 24 11:34:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13528959 Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.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 ADACA1B817; Wed, 24 Jan 2024 11:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706096117; cv=none; b=D4g+P6fCW4gbdM7+nbcM2hVZS5AiAhJkUXC7VAiXD2x/8W0YHdFXINIngDdWJ/yofea6K//mMlknC8b/345i1myQeLRZcjW8xWvcrLQhjiV6H0cQRLhlnd9TEGn6NxPXKYgDeVXcvIcbb3SvZhrBCHUec7xXrevb7VpbuUFvxQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706096117; c=relaxed/simple; bh=wLkR7aEG/EhxVLXUVeeUJKpIDRx2DyXyAakTyAkuIO8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AiBUL0BNrIiPewaGeubPw41HWBED/MpVAGpmPO/lFFJfAvI1P4YWFvYV1tLGlzkL5664UOm09BgDUYH1INGljHrBhL3+ohmzBYcl6Ym+eZJ95YbZrDC/M1AzHd/icvnv4d56e4oyly88Ld36QoGSqiNYsBs3/mToyHaFyMQ1v1w= 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=dUYduI0H; arc=none smtp.client-ip=209.85.161.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="dUYduI0H" Received: by mail-oo1-f50.google.com with SMTP id 006d021491bc7-599abffe3e5so774064eaf.3; Wed, 24 Jan 2024 03:35:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706096115; x=1706700915; 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=fPGkmifTwwHLgO5fJhv34X15SDCvJK/C4nnS1+TZMW0=; b=dUYduI0HKFIe4nPWpdmXnQuA0FN44OTI7lvox5tItLB9NG+IS+PpyB1td5dhIaMXX/ e7acsTWrlHt8nWjMLWNi1vawgPXrMqp8AzCowmAnS0ZaWqPkSA3a27DgI0L82Dw7STR6 ycfcVfq+V8DQRROzAPawrmNNWA9Ozoo/M/DqY2C83CnRe3lYA+PwT3ujgbjkMZzf6JQT 2mCgLx2Q+/GFvhUT2mc92x7AKIscWsLfhEmp86CSuxRwD953+vghmPaEI9oLYhJi0Hou 6fOd0kjBGDzI6nwzRiNlWl7eVFmRhBu39aDIwfElInROxpD52vG1QJwf53cEdGLiTPct FHdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706096115; x=1706700915; 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=fPGkmifTwwHLgO5fJhv34X15SDCvJK/C4nnS1+TZMW0=; b=nVYPEXx9xQXLRMERyE50MhvcWIN3RXNmr4uMUxdZaBzcw9euBqG3kIFypg7dzZpJbo RqxuqM41DiiGMOPKng3b4oCBYY7t+hmUGG1x+j1Z20PHLv87ce3UJ2372BsMzpbJeDkR udGTsF3mwr1CbE8p7OGw0V7Pece9rT9Mlnx34MwXJoIAaa5cVR2nnA5BrVlsazEUojGC BdlksfHW9ENW8rJT4VjYn7VErcYUC4/zzkQluUn6+PtNiiPjWCiA5dlMRSKpcXdEsGCB WE4Ac811ncMiiYtcr7cOgwmPxo52KiKmK+/zqy1NeXo1X8BdSI9MnMmoY/MQmtn02KEG IBpA== X-Gm-Message-State: AOJu0YyzXVbBgsQ+BmmXkU1SYIyaQP1Glunzi7deecIab7T3ezNURZMk M7ajC8n50cH/K4T+CbOJJqBBmxrC6P7mdcNWY9tx8tp6MtZmNehA X-Google-Smtp-Source: AGHT+IGWjty74l8fVlCoR6RutAYoZpBySt69X9+suSm8CUshUTc6BYdpPnicibqzJe1IiFG6SXL2MQ== X-Received: by 2002:a05:6358:2c83:b0:175:bfae:a564 with SMTP id l3-20020a0563582c8300b00175bfaea564mr6725058rwm.38.1706096114720; Wed, 24 Jan 2024 03:35:14 -0800 (PST) Received: from localhost.localdomain ([43.132.141.3]) by smtp.gmail.com with ESMTPSA id c15-20020a63d50f000000b00578b8fab907sm11727820pgg.73.2024.01.24.03.35.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:35:14 -0800 (PST) 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 Cc: up2wing@gmail.com Subject: [v3 2/3] KVM: x86: don't setup empty irq routing when KVM_CAP_SPLIT_IRQCHIP Date: Wed, 24 Jan 2024 19:34:45 +0800 Message-Id: <20240124113446.2977003-3-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240124113446.2977003-1-foxywang@tencent.com> References: <20240124113446.2977003-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 16d076a1b91a..99bf53b94175 100644 --- a/arch/x86/kvm/irq_comm.c +++ b/arch/x86/kvm/irq_comm.c @@ -392,11 +392,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 cec0fc2a4b1c..6a2e786aca22 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6414,9 +6414,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 Wed Jan 24 11:34:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13528960 Received: from mail-oa1-f51.google.com (mail-oa1-f51.google.com [209.85.160.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 E0D442C689; Wed, 24 Jan 2024 11:35:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706096121; cv=none; b=BCVlgDj7e4oJXtd6Vs3h4DkCbgtXfz7pqoAJ4M+EJ7lrCP9rC5KwF5OWEvS1RxS37vcQ2xbOsgW35XkJAiGVV9Qv/PvNO5QsZb+1u4nkVDCyvjb8Q8pSoyue0ZXAkf0JgN6IsHdUa9qZ+9Jv1a/Ox996c8vlPEc0JGJpr06pBF4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706096121; c=relaxed/simple; bh=RW46AqXVXgdtflxt/tkQwZU7j0j/bAs5uWwQ7lFOUZk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LOaWMQyWWe7oTx5TKw8SiYd/Xm61rSdrNeoNGpvU+EeDhNzVWLIVS4LcTrMoenCSpri550wVG4Fby6s1WXbX3Ax/xcqDfcLLChdhZnHnGdJTCjEqFsfVCd1jrfGIwjqFU53xTkoAOkNJtN+NcSvvaxh8bbvRNfwiU8L5ZbulTBM= 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=h8cWIliy; arc=none smtp.client-ip=209.85.160.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="h8cWIliy" Received: by mail-oa1-f51.google.com with SMTP id 586e51a60fabf-2148e793e12so1029551fac.1; Wed, 24 Jan 2024 03:35:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706096119; x=1706700919; 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=8UmsTcmfc8pcbPs6rRpAkpag+IwA6bQ9uQr+vxsTK1Q=; b=h8cWIliyHpkcopGan7yha/HSFel/Peei8kr0PXMtTagEbV2949Gu9tjm+RKLxyHVuP kUH4OlfwiXEBEIiM/2j3pO7adKFH2jnO65pMDdEo7vy6vpayZrgiK42rZM8ukPonpggU B2vQPyYyhZW/jMGvwBhpP7oFGgHDF7AlmNq1rMZPxk/Hj/DkAPckddQMmTMPU4jqZ2We iXqJ9EIhUsf3OKmxEtuBVNkBIMFuyyppQmbqWVb0wegy04q1I7XZYnl+fWMDyGbCfrxd ++WWC9hjECgKHTeRtgHXmHBgC5fD5OKzOElEh+URibx840lFiwQEHcCn5+uB8+taK4P8 S+jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706096119; x=1706700919; 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=8UmsTcmfc8pcbPs6rRpAkpag+IwA6bQ9uQr+vxsTK1Q=; b=s6U4SUOsl6H1N51df6Npep15ZYA2gtEp8j+Bw9h4/DCavJ+3V4soHfa7JbWExX1vrv H7UoZVsG8r0dsKYZSmrXuePDaqDyAjW72ZHYp03Jv2fKyQPuxIueU8R/CIfjmgl/1H2s wjP13/hX7UJ9jWViGfhCjpU69dpsXCaZ+dfGr2g1N0cK+e4NT8oVlliMyVhrbm4e/mtH XmG60okmY4JHAZyXwQGhKqukYQx053/HelX587Lp7nWw5Mzf6ghoOtxR7q/3j7iXgeOu faAMpmLwzF7Xx0ZxDkwMUkTS4RMLcPOiFe4R0PF2DtWnN9isgV4JjeoJBkpKdcrQqq9k UZ5A== X-Gm-Message-State: AOJu0YwyktjMBxqdhmxz0E08fcSwgM0QXpjkjKoeuk8fhe59xRyhHF61 5Xj2RjKvbiAjX5WuLxBloipGywFEYJcSpp90b0JqgJ+8wgQ/jFlN X-Google-Smtp-Source: AGHT+IHFSZ4s7KNHUdwSzt9UuvcmiZa9gk9u/RzQP7n/d8l0ivf24HCuX8/5YDYLpIePfxpC0YTbsQ== X-Received: by 2002:a05:6870:1603:b0:1fb:d89:48c3 with SMTP id b3-20020a056870160300b001fb0d8948c3mr3178545oae.27.1706096119122; Wed, 24 Jan 2024 03:35:19 -0800 (PST) Received: from localhost.localdomain ([43.132.141.3]) by smtp.gmail.com with ESMTPSA id c15-20020a63d50f000000b00578b8fab907sm11727820pgg.73.2024.01.24.03.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 03:35:18 -0800 (PST) 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 Cc: up2wing@gmail.com Subject: [v3 3/3] KVM: s390: don't setup dummy routing when KVM_CREATE_IRQCHIP Date: Wed, 24 Jan 2024 19:34:46 +0800 Message-Id: <20240124113446.2977003-4-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240124113446.2977003-1-foxywang@tencent.com> References: <20240124113446.2977003-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 --- 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 acc81ca6492e..dec3c026a6c1 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -2999,14 +2999,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: {