Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp852620rdd; Wed, 10 Jan 2024 01:08:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlhX3V1B14P5WYNtyD71RmI+Hod+ZsGH0QSZqJI4/kSGqJKIPo5nBToEueSojC5nlekWyH X-Received: by 2002:ac8:7e87:0:b0:429:9e31:2116 with SMTP id w7-20020ac87e87000000b004299e312116mr1004117qtj.95.1704877716875; Wed, 10 Jan 2024 01:08:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704877716; cv=none; d=google.com; s=arc-20160816; b=PuC0Cee3RTeK28+tIoCiwHqRJEngTVkTD4NJbkhKaqaCeLvsR0DKrwbJRmHizFsUVI Vl26ywJNr5zgAIUU9BJITOJdgpQTNP0vbu4EfSPh37zM1AjVb88zUB0yN3fHXC7buw9b so9IhTv6clCwRnLkcoGIMWoTG8OAunryMb+CA9Y2YYiFwRum5GUCA13TMxiQG2tF9kcr M9FMqu/zvodHf8jn1VzhyI4MntQ1WifG3eUEvUryn+6A8T55hZ5PGekj/lfxU6VW6Ba7 tx5CiV4AXVwZwEYrjzZx1kJee0Me2dJnnSkERXhwTkB2AyBYARnxi1dHgGAcpZG6V0aK J5yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature:dkim-filter; bh=VGPAJ+VlAmIxbqE8tAHckUZUwj1fM6R7OZbw7bjWzS8=; fh=u19+ut/rTxNsC2B4evTZCl8anNCf5V5kiD5ybrCLvWw=; b=J9BmLH8nJscvcAtjVwdyJ+yjYkutfbZifNg1UM2u7FCz4bgXStOMT8OGtcBtyrdajO NVKpCU6VmMuIaISXKGdCZx3CprUbtsD7XuNPZM4AvLoEfVWIEQE5H1yCqq1eJbEygWD2 5AhMNrWv4cv1D1sfJRuNrcp7v1Tnx97TSHXgAA/iJFICYxs2y7AB7baopXHJ0e3u1F0D AqhYvYjyRh72yYjCu4wEGT1vmE1lgCu23eN04GN2aOVNNiGO031Uua0tJK2A2qhdQqSr 1uTKjD/N1iJGH3rTVQMesDE+/ENNLoMXzn311oVkG7GuQqV5XQrQhFJdjIRXX3GWkwzh Nl2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=BuAxzrXT; spf=pass (google.com: domain of linux-kernel+bounces-21876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f1-20020a05620a280100b0078320568c0esi3975213qkp.743.2024.01.10.01.08.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 01:08:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21876-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=@linux.microsoft.com header.s=default header.b=BuAxzrXT; spf=pass (google.com: domain of linux-kernel+bounces-21876-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.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 952CB1C218D4 for ; Wed, 10 Jan 2024 09:08:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7BC943C46C; Wed, 10 Jan 2024 09:08:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="BuAxzrXT" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 50B863B199; Wed, 10 Jan 2024 09:08:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: by linux.microsoft.com (Postfix, from userid 1099) id D83FA20B3CC1; Wed, 10 Jan 2024 01:08:19 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com D83FA20B3CC1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1704877699; bh=VGPAJ+VlAmIxbqE8tAHckUZUwj1fM6R7OZbw7bjWzS8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BuAxzrXTnPC0ZeAKe/PvtdnWrbkAIpLsexS72rloAJrewEhopaweCME4r5BwZRptA gYFE9eMieWSfoUvTFmvUM29QV5ovH8/8qZGpPWGr9JqI6kWok81hDPXl5piWT+99zO XA9NZ17spy7tGGiVBmZRsQXbWwICS7wJJeqHeDiw= Date: Wed, 10 Jan 2024 01:08:19 -0800 From: Souradeep Chakrabarti To: Haiyang Zhang Cc: Michael Kelley , KY Srinivasan , "wei.liu@kernel.org" , Dexuan Cui , "davem@davemloft.net" , "edumazet@google.com" , "kuba@kernel.org" , "pabeni@redhat.com" , Long Li , "yury.norov@gmail.com" , "leon@kernel.org" , "cai.huoqing@linux.dev" , "ssengar@linux.microsoft.com" , "vkuznets@redhat.com" , "tglx@linutronix.de" , "linux-hyperv@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-rdma@vger.kernel.org" , Souradeep Chakrabarti , Paul Rosswurm Subject: Re: [PATCH 3/4 net-next] net: mana: add a function to spread IRQs per CPUs Message-ID: <20240110090819.GA5436@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1704797478-32377-1-git-send-email-schakrabarti@linux.microsoft.com> <1704797478-32377-4-git-send-email-schakrabarti@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) On Tue, Jan 09, 2024 at 08:20:31PM +0000, Haiyang Zhang wrote: > > > > -----Original Message----- > > From: Michael Kelley > > Sent: Tuesday, January 9, 2024 2:23 PM > > To: Souradeep Chakrabarti ; KY Srinivasan > > ; Haiyang Zhang ; > > wei.liu@kernel.org; Dexuan Cui ; > > davem@davemloft.net; edumazet@google.com; kuba@kernel.org; > > pabeni@redhat.com; Long Li ; yury.norov@gmail.com; > > leon@kernel.org; cai.huoqing@linux.dev; ssengar@linux.microsoft.com; > > vkuznets@redhat.com; tglx@linutronix.de; linux-hyperv@vger.kernel.org; > > netdev@vger.kernel.org; linux-kernel@vger.kernel.org; linux- > > rdma@vger.kernel.org > > Cc: Souradeep Chakrabarti ; Paul Rosswurm > > > > Subject: RE: [PATCH 3/4 net-next] net: mana: add a function to spread IRQs per > > CPUs > > > > [Some people who received this message don't often get email from > > mhklinux@outlook.com. Learn why this is important at > > https://aka.ms/LearnAboutSenderIdentification ] > > > > From: Souradeep Chakrabarti Sent: > > Tuesday, January 9, 2024 2:51 AM > > > > > > From: Yury Norov > > > > > > Souradeep investigated that the driver performs faster if IRQs are > > > spread on CPUs with the following heuristics: > > > > > > 1. No more than one IRQ per CPU, if possible; > > > 2. NUMA locality is the second priority; > > > 3. Sibling dislocality is the last priority. > > > > > > Let's consider this topology: > > > > > > Node 0 1 > > > Core 0 1 2 3 > > > CPU 0 1 2 3 4 5 6 7 > > > > > > The most performant IRQ distribution based on the above topology > > > and heuristics may look like this: > > > > > > IRQ Nodes Cores CPUs > > > 0 1 0 0-1 > > > 1 1 1 2-3 > > > 2 1 0 0-1 > > > 3 1 1 2-3 > > > 4 2 2 4-5 > > > 5 2 3 6-7 > > > 6 2 2 4-5 > > > 7 2 3 6-7 > > > > I didn't pay attention to the detailed discussion of this issue > > over the past 2 to 3 weeks during the holidays in the U.S., but > > the above doesn't align with the original problem as I understood > > it. I thought the original problem was to avoid putting IRQs on > > both hyper-threads in the same core, and that the perf > > improvements are based on that configuration. At least that's > > what the commit message for Patch 4/4 in this series says. > > > > The above chart results in 8 IRQs being assigned to the 8 CPUs, > > probably with 1 IRQ per CPU. At least on x86, if the affinity > > mask for an IRQ contains multiple CPUs, matrix_find_best_cpu() > > should balance the IRQ assignments between the CPUs in the mask. > > So the original problem is still present because both hyper-threads > > in a core are likely to have an IRQ assigned. > > > > Of course, this example has 8 IRQs and 8 CPUs, so assigning an > > IRQ to every hyper-thread may be the only choice. If that's the > > case, maybe this just isn't a good example to illustrate the > > original problem and solution. But even with a better example > > where the # of IRQs is <= half the # of CPUs in a NUMA node, > > I don't think the code below accomplishes the original intent. > > > > Maybe I've missed something along the way in getting to this > > version of the patch. Please feel free to set me straight. :-) > > > > Michael > > I have the same question as Michael. Also, I'm asking Souradeep > in another channel: So, the algorithm still uses up all current > NUMA node before moving on to the next NUMA node, right? > > Except each IRQ is affinitized to 2 CPUs. > For example, a system with 2 IRQs: > IRQ Nodes Cores CPUs > 0 1 0 0-1 > 1 1 1 2-3 > > Is this performing better than the algorithm in earlier patches? like below: > IRQ Nodes Cores CPUs > 0 1 0 0 > 1 1 1 2 > The details for this approach has been shared by Yury later in this thread. The main intention with this approach is kernel may pick any sibling for the IRQ. > Thanks, > - Haiyang