From patchwork Fri Apr 26 04:15:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13644113 Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) (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 AA5F98288A; Fri, 26 Apr 2024 04:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714104994; cv=none; b=mTK/71cSlp6xxcfIz4JgBNzo72MTd/AoG9Beu6Wr4MGFCJUj9WOCMT0gy24fQxBMK66c8GPnwQdADHTLQRFr2quR6zcYEmna+4pKLDHrDANvDwMzMkE03wGwZrAchnGneuWeLMOwZCTliZDpi8Qn/9jlUiftW3m9UPZrw2vWcCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714104994; c=relaxed/simple; bh=JcKMXuYEQh40cczWYml11k2EtrXtg012AhMqdwi07Ag=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=V2bAVXOcADiMHkW7uJ+U1LPHVB04yus/s65omlI6w+5EFlqk6BXcz3GiYzbxqugyQsXpOAkWuM2JS1i1u07MIteUiAn3uX1ePwR9VmyWFwWrd5nZW4yF4kQPZZlI/gIU++nDpGe9SJSDNUh2tgbOXrjiRkep2FEzGuDdGHlad4I= 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=ksN6WRSA; arc=none smtp.client-ip=209.85.214.180 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="ksN6WRSA" Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1e3f17c6491so14612605ad.2; Thu, 25 Apr 2024 21:16:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714104992; x=1714709792; 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=TghmkCSzFoqsw5QCAxEDwkPGZav8YlUmggnIBuM83cU=; b=ksN6WRSAiR+kqS5XcmNtvDHftjBW1ggqPRIRsnJlJDagsEXokHE/OrMhREvyxNPqKc NoGI43Xbwa7x3pqlSsFkC7IEbeUgy9Pr9gdTYJYOcj6eX6SLAgTQEZ/YtSJQTtYskAWZ fWsjlO/wvZM/+KlB/2zI3d7AsyAj6HTYEkhROySRzQ40yRnJrv0GMlhNbfGs7g43opjN 1lfKlju9I9ZZbYcZvQ2WD5nxeGgotLr4dDYiJXSH1ShuNMqE13DSvGlm5GfZfKOJvIAm YDLECPiBfwaQqIWBmVE4WoemPhD4EP700TV6crm0qBoG8YuSAQOt8LzeJFEiPHNfpmZg n3/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714104992; x=1714709792; 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=TghmkCSzFoqsw5QCAxEDwkPGZav8YlUmggnIBuM83cU=; b=YSfXode6jhIMcm3iKPYzoVY5Msnn5iG5/pLg8wPaCstsfuBcIVNz0q1xHCv6eXyeUp nKHOQPBJ+79/FFEq6VOsU9H59Sab5kIz8mZ33WI+RAi1QvzIPp0ADguVUiZpXZIxQj3K 8T5V6A8BSV7M31OMBo18BRpKuc95xtJuHMBjJAcVwINAY2WHRC3/4zjSRJ3PFZWHCOs8 wiYh7SVRyDQyWZrAmJNvK9sRWSoiPltDYDNXhrcwUFSp0YtUJ71uk9rxcFXu0Kkc39xp hpdTszbuBhhnG3OOdZeXlvFMHf/m+qF5hCbgcii8EdPGsKN7PNKbgWagLCgLjxLvqYMO 2Izg== X-Forwarded-Encrypted: i=1; AJvYcCWMTSvAk3JKuI9Kx/8CRowGz0WpZdcZTPZCmxMCFJjeFzT0kEvmVanZNP4f7s4+r3k3qpL9s5ZAwvQsn7u07g3oaAlHvAy55b6UAZ6wweS1QWGhzRsTS/KynukWd0o8b07c X-Gm-Message-State: AOJu0YwElDrXB0osDzd9gFECeV8fol7gCzJ+jWU9GdIvj2ZUfLLssc6Y ykczNukJ73grRW+Gc3wthVM94PQzQf4UGgOTbLw7ZCv7sCNCep3m X-Google-Smtp-Source: AGHT+IEhA6D1ThaJJdeC1CSGAsZcA+jHq7zl+B7k5wz3ml29MUQ6uN9m56IeW/U9eyYoNpzicygfVA== X-Received: by 2002:a17:902:784f:b0:1e2:a31e:2062 with SMTP id e15-20020a170902784f00b001e2a31e2062mr1547422pln.53.1714104991748; Thu, 25 Apr 2024 21:16:31 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.8]) by smtp.gmail.com with ESMTPSA id x13-20020a170902ec8d00b001e9684b0e07sm9426780plg.173.2024.04.25.21.16.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 21:16:31 -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: [v4 RESEND 1/3] KVM: setup empty irq routing when create vm Date: Fri, 26 Apr 2024 12:15:57 +0800 Message-Id: <20240426041559.3717884-2-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240426041559.3717884-1-foxywang@tencent.com> References: <20240426041559.3717884-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 48f31dcd318a..9256539139ef 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_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..266bab99a8a8 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; + 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..b5f4fa9d050d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1285,6 +1285,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 Fri Apr 26 04:15:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13644114 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (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 DC23A8288A; Fri, 26 Apr 2024 04:16:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714105000; cv=none; b=DWAbTWOzpjdPt4TH9PhADAlL0Jsj5xGX270LQ+nU6MucGtFdlHAi1KTCvDfu9NEQlsMSelPMoX/zGxdLpy2dcJSDKKdk8qvH69hHDNcjvSciP8kyS4sPAt5jFftdK3RaPn68Fgt7Vx04aZumZNpBwHTADpgrGQEVe4+mA+n4iYo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714105000; c=relaxed/simple; bh=ff+g84K7inAIdzVwporLJbQLKqNwcOlgSp3tPVrcevA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YqwiOILneZM9lJCo87yH4f528lRo9H5/vNtRLFQEdM6Wkejn3I1LYqJIGnRP6d+DBPh2DCddy/w5Ezi1ahvRWcfy4BbRFecy0S6XvQbArAn3Adbaq08JgMhePS34I+DucqH9mW6E1ZnziQ++ewdcFc38TMaXC0uaRdtPuKjlrS0= 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=e+VWwqlh; arc=none smtp.client-ip=209.85.214.170 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="e+VWwqlh" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1e86d56b3bcso15836145ad.1; Thu, 25 Apr 2024 21:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714104997; x=1714709797; 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=e+VWwqlhZB3sTU+LLFx29DJnuMjs4THTFs3wpFdthmuoTlI48Z6PjLsptd0JU7j55V T0LnhfxRUeU69Ba0plL9vA8F4j7asqt+IkusvJdWfqP8dI9c69RjgAZK07Bzeib3xBri u5Kxcq1wdJBCEnvo5DW4W0oMJyqlPdb38EwIKRYDvXAkjnJ/o0tco8rq+pwDl+kOMFhc JZsRqfrmqHEXcYmx4PJqltO1ECMXDNJHPmevnpui/TIUEG9aYoGyZJ9Ry7n3tLi0XmZC jTRHJKa+0EW/BAs+w/7TYSRfneLHz1q8lu04ptAEg4zuFpmsyyrStzUy5ZVIIN5AyZ5c GFPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714104997; x=1714709797; 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=FmDrkUwxTAtHqc3luC0x4sagK8N3/7d9U6atdj7/f+nV0mig5SkKf3wm+pW/JjzjQU Zr2oLDemVo6fEhID8tsgIBoqiuurUfkxpE/toWl5jKMrzXz7W8PRO+XYFErVXM42IgEV lCQaY06pND2rdSkG3NDoEGbuWG4Vwg7feZjb8cnzJDgsx9RSi92c8Ujg7eBRPMotLcr2 C4sRPnKZT/yNgfomWDNsRfnrSBVkjOOmzXbVVANF5f7AA1wxjElsqUA0uRP34XsFesYB RZMFy3jAlnSfsjkoPM26Cjbw+E93KGjqf/77mSGO6sQnmF32ttMVKB8ph1UXzOY+8BSB 70IQ== X-Forwarded-Encrypted: i=1; AJvYcCUh0HAgzlvmIBzLLI0uqVpf5hqlIZJHg1kkwAE+OGZ8fWhiRxq0SB2SNgcxESOWSWpTAPehOlNHtzrW9JG21ndEjtJwo/Jz7+4UpWH51WinzWBUCWB2QOOa0HcQWGL3aWVE X-Gm-Message-State: AOJu0YxqA09b4hkQ7SxXbWR9ZU6AUJGx3jer+Iief8Bf5O7hKXkOy55c I97CpTn0ix61gphdWLVmZCFwdkRgIfvoEY2+yj0Zooce23rSQSE+ X-Google-Smtp-Source: AGHT+IHcIzbPlTZjAQRVHlRvpqRHxQ5QJteedLdEq3Fm1shILV1ZygbVzKpk0l6Yi9wINhdbThGNNQ== X-Received: by 2002:a17:902:a383:b0:1e8:26e4:d084 with SMTP id x3-20020a170902a38300b001e826e4d084mr1435914pla.60.1714104997033; Thu, 25 Apr 2024 21:16:37 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.8]) by smtp.gmail.com with ESMTPSA id x13-20020a170902ec8d00b001e9684b0e07sm9426780plg.173.2024.04.25.21.16.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 21:16:36 -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: [v4 RESEND 2/3] KVM: x86: don't setup empty irq routing when KVM_CAP_SPLIT_IRQCHIP Date: Fri, 26 Apr 2024 12:15:58 +0800 Message-Id: <20240426041559.3717884-3-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240426041559.3717884-1-foxywang@tencent.com> References: <20240426041559.3717884-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 Fri Apr 26 04:15:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yi Wang X-Patchwork-Id: 13644115 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (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 1888683CBA; Fri, 26 Apr 2024 04:16:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714105004; cv=none; b=aMEpjfT/jEYryWhsye9F5VOKbAGi1nnsC+7xm/b020g35Zmi/et5/yzd0/GolzbOWttH4dmmiLY+3vTY8Kwb00UoAWbTp80yGktkSEI4SA8NJQ0/6dADtHWO+jQYohfMtxPwJVJyEDe9om9K+mkf1ytRi+p6xDlcGWiRFht9ucY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714105004; c=relaxed/simple; bh=hbWQ3Mur+/ECvEanbvX6901lMYP+yzm6OHJl+SocuvU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=R0NR49qkNjVvbolw2RLBj1LIntp+CeS/ky37Bt0k0rmcjRvQGN5F7Cr9CZzahDvQMyD7Js1Pwv3FOasLVWoKmMG48F7mQJMkJvmCNEsLT7ZKEa3i8NKZyaCEtqCWMwmXQ1M8HOayyUdFmkYlUwgiMBvOpzE6NTz2bl7JKpQyPFU= 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=Fh6Ntgu0; arc=none smtp.client-ip=209.85.214.175 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="Fh6Ntgu0" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1e3ca4fe4cfso13025455ad.2; Thu, 25 Apr 2024 21:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714105002; x=1714709802; 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=Fh6Ntgu0iT27SZQZ+PLIYQpl9uOoyqSQGnRfm6zRB9ICftihTXNT8xyElhOvb45/JQ ul7iLVOpcsqh3m8KEnx8U1kqN59ykfKIMLM9IV9IVQKbcb/rmZ7kvJy+nJmbkRNAGwiX gylOb+JH0g24URvmhD90LBDvfWA6W+nBGvo561m3ONNRsomakDzqLGDToskj5oy6XEyu HqzXMrLMgAKtFZcsrUqyHDKee66R4F3bCadpbW9i6o9tOYPL39qF2v4R92vv6CQs/wMO FpCbzKcMPE3KyvMjHnSCZ8rSR5eBPCWIWHudoIH+znXcixI41uXA/ztHwTjHYO8O0NRQ eKMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714105002; x=1714709802; 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=KEwd6SGBgFcNIUoKtxY5M/ZBstLb3Bau8mj3cdXvOFhbln1P8jb4PMOgkIyLOCuKnN zFsxALz5Z98E/V8Z900VZbdKUqsIm5inIq22nLHeE0tpxtyV2YNVhz0/ahS//71cVQTl ryZLe2fbllKoFX2KoteDFr7mqnT1A5FYnH/M8RRiQlaOcaI0ZwHCX2WKpRk2lggtEh/G kiSJLs0Y7GROHOw0ew5yuud7XZh4X8nX9jByH6+W1xY3c89JkvgNvoOAlCdMgmdzjjAD YSuJ2cn0ktfJ+M3E3GnmtQ/7AkZxQAWh6aXincruPbkop0H7GEw1dB7WL3WZ+6GVVZV0 l9vg== X-Forwarded-Encrypted: i=1; AJvYcCWW/G6AK1t716rVNEVGt9R66h5aPELCReV2xqYdzGVh0Hd4ZMqS8GkludyykxUAN44GenxWHvzkRqdwVIynQ3krrsPlPfSMSdSk+DyV6HEEmp/Q0jGPasIcujqti1a5fP/M X-Gm-Message-State: AOJu0Ywm0wbXHmGH76FzJ2kml8ppdjHRzqq9hF/FPzmPKLcQP4keYLHs QBc98oMwzwZz5FxK/kXFupQrV9+Ln3fb0yKmgUazoj9YgbFkKu7S X-Google-Smtp-Source: AGHT+IF2R6ZxZ7uWv/ssydB7/h/Ru3mALSufbWP9vudXmlWAUmpZgQkyyDbCqHwK1+c9dIHVZxCUyg== X-Received: by 2002:a17:902:6bc4:b0:1dd:878d:9dca with SMTP id m4-20020a1709026bc400b001dd878d9dcamr1369903plt.48.1714105002418; Thu, 25 Apr 2024 21:16:42 -0700 (PDT) Received: from localhost.localdomain ([43.132.141.8]) by smtp.gmail.com with ESMTPSA id x13-20020a170902ec8d00b001e9684b0e07sm9426780plg.173.2024.04.25.21.16.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 21:16:42 -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: [v4 RESEND 3/3] KVM: s390: don't setup dummy routing when KVM_CREATE_IRQCHIP Date: Fri, 26 Apr 2024 12:15:59 +0800 Message-Id: <20240426041559.3717884-4-foxywang@tencent.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240426041559.3717884-1-foxywang@tencent.com> References: <20240426041559.3717884-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 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: {