Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp67832lqp; Mon, 10 Jun 2024 18:54:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUucSdogxU87weJNEN4/FQmrBUxbPyatT9gR7KA+tVGOEWf3lgwoMq11oxgpZz4+GA5kgOvjmxXqkqWziNkBePqcw5/2SkXMk19J7cOaw== X-Google-Smtp-Source: AGHT+IF1K5WG3RYu/xzlDHWN+//lO9yMRMoR1jv0Z2RaqSmYlvNYIdZDCBdMje0J+Fz0xFyqVuoh X-Received: by 2002:a05:622a:15c3:b0:441:202c:13b2 with SMTP id d75a77b69052e-441202c13fbmr32013971cf.27.1718070867485; Mon, 10 Jun 2024 18:54:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718070867; cv=pass; d=google.com; s=arc-20160816; b=S5bagO0TXmN0CZcuLAa3CundcQk6EA1RBSCrKsczlr6TdiWMnKD6uVVdA6OgH62B/5 Wk3Fecj/u63JzMopBh8IOvtHo4pwZTPHi23VL8edHFXhIi1SzJ/ZDvky3RWeooI6Bt/H 3MWt9xnsV8TG90EeaNo619/ElkrgKgB+IzwXZjj3NoUKvsQBeq3ojGH6r9fwk2OVr9YE BAmH/oOm8QyPROyGl78MsZhtlim1uct56ZfQOFepLc6Zwf8u4wohea0dcVku/0pot2HS 3ntbM7vk/Q0mWKIA+iowuIfqO+4YjlFLgjx3Tceysi5YJkhhAOeJcswfEmly66QQ6C+/ iUaA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=oXxtw6aEa7wurRX+fjmWBEMlIOgC9GtbLTKqpS66fEw=; fh=4hE6o2RVQOTksEyCJBdRr9ZeHRS45A9JnccpxprkGIU=; b=vcr9flSEPNwlflxK2h176VEO6180dmtzRJUTM8WoFGOq2suIHRxoDGjrkKJiVULyNY Nx2Ad5CTiYgCY5P941LWQ8Bw695YQMWxggamnMM+BUbjpd4BY9Fp565RNzMM4RTFAyqI hLs5zDTBT5hACBH8m5g2KgWgB4eloGE/g04RyEhjdp/lrHRNQtgqyTCdNllN4LUVcDI+ jZ+w8CmBz3inCjQYaYV6HpdFyxVCYWKaIBg0ysOSCDora/spNuDYhbx+kZV/itKzn0t2 XsmD8ZU2HiJ1F+Hiyq7nMDAtupYBb3mYw3NGjKDBDcGY/1eAw7vEbYtW60ODbPzTAiWf +L5Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VpJnbOBu; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d75a77b69052e-4414f0a7540si2461151cf.428.2024.06.10.18.54.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 18:54:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=VpJnbOBu; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-209165-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209165-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 397281C220B0 for ; Tue, 11 Jun 2024 01:54:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 204C2B657; Tue, 11 Jun 2024 01:54:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VpJnbOBu" Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) (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 CFCE58467; Tue, 11 Jun 2024 01:54:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718070858; cv=none; b=lkmQGw2f7gJwDvMKSIyJd+caOjqKwtB+5EVVU5uTRSqnF9bSDOMRPzkvrmhG7tauNuwtyEVTbWOgpd9prVvzU3cetjLrDr1ZVpQzlN9Ho68i3eVtuV8VftSvDIprmRLtEhc7Qcqcz1Ekrw7yh6Zyulj86xf4jrUl1Q/t7H5Fqvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718070858; c=relaxed/simple; bh=RMOWDbcLC6kh+q8ipKT+7Rt/jChd0OU5J4NwCfdYe2U=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=RsgLDORyJt3geXZWzRuO5KcSuiP1PZsTg+3kTwD+7lq/yTMU4+zWtH5HgP4nn+w82yUxe4pp/4a/KHe06UTEZ6rOrCOF8u3NJcajydDhccyMBD7ga7xlRRcO2YCJ24FOy3j2avWGLceociorrNsf4xtDf/D6US8KwsaZrEkGoDY= 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=VpJnbOBu; arc=none smtp.client-ip=209.85.219.177 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 Received: by mail-yb1-f177.google.com with SMTP id 3f1490d57ef6-dfaff6bee06so3147142276.1; Mon, 10 Jun 2024 18:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718070855; x=1718675655; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=oXxtw6aEa7wurRX+fjmWBEMlIOgC9GtbLTKqpS66fEw=; b=VpJnbOBufbUaQ5vWyioJvIyvMCPuazy+oSzuNHj6oZD6IjsRT33+rPxw4mWkWp2SoI uQ9UcMsyFHpW6db+q/6ySzRzSrZk5ZA2wvo443kKqyWSNWXIsyfUdcYodA/WQQbBjDh1 ZsQFMDzjkAFwPFdu9u8Q1LTZI1y/33uZDRLqxDc3IkCGCd/tM/x/qGEmVWw9sNC7s0hf pf3GDX2a04KyVgsJik8tdxE1evZQQ4ONmC9lXn+5aQ9TforYzBbQ8bPccBdQnPSJTmtS 4pEDJfBXquGdad7ROVPHw1e2BUUdiO3L10YNTq+g8LdyGpUtXDGMpgCE1srI/I1VdlQn +Mww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718070855; x=1718675655; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oXxtw6aEa7wurRX+fjmWBEMlIOgC9GtbLTKqpS66fEw=; b=GNyo5eh1MgFH3+NP5/Q1fLwjBv38krkviEe72VEYKexlpWuGYbGHDONNamSwE2oXaV SoKO8wqZhky4aCtWetlct7muFgriqGIM0E/ZZrqCxHJn5leLquFP7YuYQayBixzSRLHf Kjgqy2z4IVGBsOFA+ArjlDoJdicRpfiE5ltLV/C1utHov4QNFzonnSUqdj7fPv2QHbT3 sHMEZhtrmnZ0ofVe+9VthaEmgFYl6z3TAXP687NP0oh/u+n0GnxHJiLmRvjQQJylog6e FxISUxpoOSgx3A6i+dLxVMnuIPYmWPlZQAha35JKDS4VdFiaVK8mLuZ6jVWZhd7pfhiI 9KVw== X-Forwarded-Encrypted: i=1; AJvYcCV0H9qPJQ9SrleL0oNIxy+Wq4UW6VaBpE/D1d3ESYvFBEmA90V9Yu4wXISPCQJ24xvXr8fNzTlUkn8EfWWnZ1tzaYA2FeS6oSpGNboeMgpPg/1f6FjZJlCtJW6DLXoQA270 X-Gm-Message-State: AOJu0YwhxP/cvt/bFcJBF7Oq5kgvXR9IerUIvGM8aLywtfyr5Ukr13/n fWxo3jOnV5TUprJvlukWYZ8guTAVIykX6k6OEx0bZ2XmgBGjBxCMwjSfD14Wu8dsfX1dLKStvpK m6cD+hj6rOYEaRRcKl1+IZUoAwFY= X-Received: by 2002:a25:2e41:0:b0:dfa:56e1:9eb5 with SMTP id 3f1490d57ef6-dfaf659080cmr10665536276.48.1718070855459; Mon, 10 Jun 2024 18:54:15 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240506101751.3145407-1-foxywang@tencent.com> <20240506101751.3145407-3-foxywang@tencent.com> In-Reply-To: From: Yi Wang Date: Tue, 11 Jun 2024 09:54:04 +0800 Message-ID: Subject: Re: [v5 2/3] KVM: x86: don't setup empty irq routing when KVM_CAP_SPLIT_IRQCHIP To: Sean Christopherson Cc: 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Jun 11, 2024 at 8:25=E2=80=AFAM Sean Christopherson wrote: > > On Mon, May 06, 2024, Yi Wang wrote: > > 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[] =3D {}; > > empty_routing is unused after this patch and can+should be removed, e.g. > > arch/x86/kvm/irq_comm.c:398:43: error: =E2=80=98empty_routing=E2=80=99 de= fined but not used [-Werror=3Dunused-const-variable=3D] > 398 | static const struct kvm_irq_routing_entry empty_routing[] =3D {}; > > I'll fix this up when applying, too. Many thanks for your work, Sean. --- Best wishes Yi Wang