From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795964466; b=5D9EvtLswzylEdBdDgw89YiWg5bkzfjerb6ejcJ62ew+kVRvBzNKgFiQ4x9/0SM8mp0f +VQoXPKvz+CfYg+FRTfyYfX+XEiWXaXVkkWlaGUXw/oFEVsf24rI27oUB2pvyn6ZPgNPo /Vuqgxcv/7R1KvVlG8JHqlqfFKSRS29R+iiaGVe00qiN/2LIjO+ElNS1RRDV0ISsFL6uS kc1ZiMSaper7lzCmHHYajUkn7A7G4Zp0aVCPqitcSfXMMemwVKdnGdZgzvy0vAQhoDsYl nW6Ggja2gfcomVvTqFKGTFrJ/ksmhCbNVUdGAgnrJrrQOzvle5HnX3Cs+y6dO3agk6g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795964466; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=q6z6YcDGlhBVEjWPA9LlnPFpsOA3dGj7VO+SSk7Q1Gs=; b=JDcp5xfgljHY2Hk7l3psIAdrU8Cy1TTF3LKGLiPo5psRYqrNjugcW6D4mJnrpQtYwvk9 zwhEj5CAAwTQGj//L+ZEBN2jyis1t87m6z/1MHsOhAeojQcnJueM0ssxnU+iSEDvKW/9x ZEsQ4+Du3mAbTBdevu9SDdCJGx+p+5baRPCAA3pdOurWTsox9AWzVMZl5PgDCt2I5MluI /QSpxYyl55Nhtop1iz7OMPbu0+BVkFIDXhvbh8kAwlb5UC9b+/CDs6X7fx/OZvLy1fm/e Fezg0nLxXicryeNWBK/WJiPe75rZC8VBhUBrMeVlG1D0IVCVYkvP2hCRuV4iePoDKiQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YqHAq+lt; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04417606A327; Sun, 29 Nov 2026 15:01:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=YqHAq+lt Received: by smtp.kernel.org (Postfix) with ESMTPSA id 200091F000C1; Sun, 29 Nov 2026 15:01:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795964465; bh=q6z6YcDGlhBVEjWPA9LlnPFpsOA3dGj7VO+SSk7Q1Gs=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=YqHAq+ltt3tmn8Vw0OHZ/wdCG6b0bmvJnEB2+olIh7yBJUitrIQYgsid034ydeUXC +HqpLPGTJlIKN20UvqfEGc9HMRQdLpophCzEAQA1+tbJjAo9Sjm3mpP2g8ITzHUh8O ssrj+wsVu7uUO8+u6CKlXuHT/tb/ozltRUjobmeQQWSsiUURo7CbpUCiQAl54UzyoD 8McEgjUWg73oSv2nFicHgAowA69mdb7vIoj6TY8XSz+wJpasgjLN+KbSj8ZarbxQjL yvihZxjq1hzE2fbJzc4aVkDlHbtXptemcs+QQ2D5ussQJhNF7yA6XwEEtjmv6H2KHa VYvJLdUU4CB9w== Date: Sun, 29 Nov 2026 20:30:56 +0530 From: Manivannan Sadhasivam To: Thomas Gleixner , mhklinux@outlook.com Cc: haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, lpieralisi@kernel.org, kwilczynski@kernel.org, robh@kernel.org, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org Subject: Re: [PATCH v4 1/1] PCI: hv: Spread load across CPUs when selecting effective affinity CPU Message-ID: References: <20261101021928.52649-1-mhklinux@outlook.com> X-Mailing-List: linux-hyperv@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261101021928.52649-1-mhklinux@outlook.com> + Thomas (for inputs on IRQ affinity) On Sat, Oct 31, 2026 at 07:19:28PM -0700, Michael Kelley wrote: > In a system with multiple devices with the same configuration (such as > NVMe controllers), the affinity masks are the same for all such devices. > Linux typically must select a single CPU from each mask to be the effective > affinity. If a fixed algorithm is used, such as picking the first CPU > in the mask, interrupts from multiple devices are assigned to the same > CPUs, while other CPUs are not assigned any interrupts, producing an > interrupt load imbalance. > > On x86, the "APIC" IRQ chip avoids this problem by spreading the > interrupts across the CPUs in an affinity mask. It tracks the number > of IRQs assigned to each CPU, and chooses the CPU in the mask that > has the fewest assignments. Because Hyper-V vPCI device IRQs eventually > parent to APIC, the spreading done by APIC accrues to Hyper-V vPCI > devices, so all is good in x86 systems. > > On arm64, the "ITS" IRQ chip for the GICv3+ITS does the same kind of > spreading for LPI interrupts. But Hyper-V provides guest VMs only with > a virtual GICv3, not including an ITS or LPI support. IRQs for vPCI > devices on arm64 are mapped to SPIs and parented to the "GICv3" IRQ > chip. The GICv3 IRQ chip always chooses the first CPU in the affinity > mask as the effective affinity, producing an interrupt load imbalance > for Hyper-V vPCI devices in arm64 systems. > > The Hyper-V vPCI driver already has an arm64-specific IRQ chip to > allocate and managed SPIs for use by vPCI devices. Solve the imbalance > problem by extending this IRQ chip to implement a "set affinity" > function that tracks SPIs assigned to each CPU, and chooses the > least-loaded CPU as the effective affinity. Then invoke the parent > IRQ chip (GICv3) to actually set that single CPU as the effective > affinity in the virtual GICv3 hardware. As a result, IRQs are spread > across CPUs like on x86 and interrupt load imbalances are avoided. > I'd like to get Thomas's opinion here. He already helped us implement the IRQ affinity support in DWC driver [1]. From my initial look, this patch mostly duplicates the GIC ITS LPI implementation. So I need an Ack from Thomas to confirm this is the correct approach. - Mani [1] https://patch.msgid.link/20251128212055.1409093-3-rrendec@redhat.com -- மணிவண்ணன் சதாசிவம்