Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp308833lqb; Thu, 14 Mar 2024 11:47:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVg2tV8v811FaxLRG6EnTAE7SQ27nrYv89slS/cQ0P8LEFFUa+XqOUr7p761ZaTuKvz6wUIFARsev1nK6L08T/gWTLwJm4MewihTemiaQ== X-Google-Smtp-Source: AGHT+IG6D6IKUUCFrcWcpyhBY3Hbq7WrluBL+c/4/f2iSfZgg/wjtDUs2I5DjSJJAP0Kr9j5NsDO X-Received: by 2002:a05:6870:9720:b0:220:dc43:f9f2 with SMTP id n32-20020a056870972000b00220dc43f9f2mr1725381oaq.38.1710442060360; Thu, 14 Mar 2024 11:47:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710442060; cv=pass; d=google.com; s=arc-20160816; b=j/iSG9sB3SBJriVAIklrehuFBC/wthe9k9veUK69Ayx7+7zBQE5kRLaZpAiS14T0Iz +punNpOp7b6bbsqj0yjFM+Pai24KU6VgN8Gf5ZAjQFVMN+6k47BxNDXhk0Lc9AY8vPm1 9XM7i/ESTy8RI6xAboCNYeAoh3ICSAc+wCMCLbGYni9Mp3NFns7UquLPMWED46Jf7jVo xfEJceZOIyQ536Hw2mzrHhBLAF4Nn+TWN2WmjTw1UHOhLLmMa7Ij/umheTWTK1RtzARz M6nUMb5J3GFqSzxyetNse0jrPjB/G/ri5GKZbCmtPFgktWANwQx9zp5L9b++nytpB1Ud Srzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=OZ7McmVCO2ymxB6+HOLhtc/J+b/9JQikt3bFUhj7vHM=; fh=YL5DNUcEMSLUuewpjd1gAFE8ONkyMdqTNBIZ0ExjbVg=; b=Iocg8uDsjnvTL1tfTTXuBGWMRFB9B+/sDXeV7WEuKr8ikmZ13lPJOQ0+ZJY1Emqej3 3C8TEY2VLS5cnGfH7AaoL/tUBde6o+fn7ZH9zgLYkUbtEdbw0S7h37rbfpqFXRI5c5Av 1YjK3PJ779Dd4QohqyjYYMQ5hjFPGwGiw8mN0L4XVaKKx9FfJgwYIxD1wor6dQuY3RjQ WRXqnc4pGHIXcC7anCcahNqzI4KDGugHjvQPNWe4lyqySd6zDUqiSSPctRdZBRsSvkV8 o/J8kbzILJHihJcsxxSEuI4ac6w2NeYVdk6+SuBnk9+DQEuUm05z5XDG2rZpVDBXFrq3 hVgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pcgIDNo6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-103666-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e15-20020a630f0f000000b005e4f1095585si1043311pgl.688.2024.03.14.11.47.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 11:47:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103666-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pcgIDNo6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-103666-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 5333E2866E3 for ; Thu, 14 Mar 2024 18:27:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D0DE74C12; Thu, 14 Mar 2024 18:27:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pcgIDNo6" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B66FD1A38D0; Thu, 14 Mar 2024 18:27:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710440856; cv=none; b=uEMakciQGoqU96NluZsVAosGoACRx+mI9vMfM7NJeFG+TojDvQYNZhkcWnj03SwKyA0OBW9Ipa+tdsCVqxTrs/acGoVl1s+uDvKIhxLhbKEM3tyxHOafQAqi/WwVl8wpn+NLJfT7UuadOVUOuBZOO76vKf18KoxwXlUrR1DytLc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710440856; c=relaxed/simple; bh=wvZQ6EkK3Zr78gZKY6mbHSxOYjMQ/6C07pm5tHfcalc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PPG6gHrMruWzQSGGUi2CRrahFsAQjZChMQUDwgvtCpIRtmSZ6DfWFhzJ4BUViennWyiRskm9HBiAwVsCwCJfkGax/xMHEyJM309smc7JfhqW2K//wFBo+02pMZTFneYCgg2ujxD4KmYJxSNWte8thVXU3pv/Xa/xbIL4HsY6J/Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pcgIDNo6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FD3CC433C7; Thu, 14 Mar 2024 18:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710440856; bh=wvZQ6EkK3Zr78gZKY6mbHSxOYjMQ/6C07pm5tHfcalc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pcgIDNo6+Jx9g1FVdyq37yqerQyrpShtUOjQ9n27jtT7YMvFQeCuV1qZCgb3XcWQK Q/v3tSCHmPIW56Zim33p+Env+4YdDQ5ztgPOHSZblgNt+Rv3GNKuzlRGtbcyC6jgj4 /af/RGyDWDWZirAiycP/RBEe58UHQvEe45XUragt5UhSnnTk3kM0COQ25ickIbMGkP EGQ5Mq8rpuCWU09X2cKeOeJiuTCSnT6SdndVccRrpIm9eGM15t5TpZmzKZ8ANms1Om 3nW5JwaAM1NxFDPdn05JGGb0VsDv2KFc3PU+Z+qi0kPracqutTqUlTyvdwEtCHres0 BA13Ud52d9jNA== Date: Thu, 14 Mar 2024 11:27:34 -0700 From: Jakub Kicinski To: Shradha Gupta Cc: Haiyang Zhang , Shradha Gupta , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-rdma@vger.kernel.org" , "netdev@vger.kernel.org" , Eric Dumazet , Paolo Abeni , Ajay Sharma , Leon Romanovsky , Thomas Gleixner , Sebastian Andrzej Siewior , KY Srinivasan , Wei Liu , Dexuan Cui , Long Li , Michael Kelley Subject: Re: [PATCH] net :mana : Add per-cpu stats for MANA device Message-ID: <20240314112734.5f1c9f7e@kernel.org> In-Reply-To: <20240314025720.GA13853@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1709823132-22411-1-git-send-email-shradhagupta@linux.microsoft.com> <20240307072923.6cc8a2ba@kernel.org> <20240307090145.2fc7aa2e@kernel.org> <20240308112244.391b3779@kernel.org> <20240311041950.GA19647@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20240314025720.GA13853@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> 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-Transfer-Encoding: 7bit On Wed, 13 Mar 2024 19:57:20 -0700 Shradha Gupta wrote: > Default interrupts affinity for each queue: > > 25: 1 103 0 2989138 Hyper-V PCIe MSI 4138200989697-edge mana_q0@pci:7870:00:00.0 > 26: 0 1 4005360 0 Hyper-V PCIe MSI 4138200989698-edge mana_q1@pci:7870:00:00.0 > 27: 0 0 1 2997584 Hyper-V PCIe MSI 4138200989699-edge mana_q2@pci:7870:00:00.0 > 28: 3565461 0 0 1 Hyper-V PCIe MSI 4138200989700-edge mana_q3 > @pci:7870:00:00.0 > > As seen the CPU-queue mapping is not 1:1, Queue 0 and Queue 2 are both mapped > to cpu3. From this knowledge we can figure out the total RX stats processed by > each CPU by adding the values of mana_q0 and mana_q2 stats for cpu3. But if > this data changes dynamically using irqbalance or smp_affinity file edits, the > above assumption fails. > > Interrupt affinity for mana_q2 changes and the affinity table looks as follows > 25: 1 103 0 3038084 Hyper-V PCIe MSI 4138200989697-edge mana_q0@pci:7870:00:00.0 > 26: 0 1 4012447 0 Hyper-V PCIe MSI 4138200989698-edge mana_q1@pci:7870:00:00.0 > 27: 157181 10 1 3007990 Hyper-V PCIe MSI 4138200989699-edge mana_q2@pci:7870:00:00.0 > 28: 3593858 0 0 1 Hyper-V PCIe MSI 4138200989700-edge mana_q3@pci:7870:00:00.0 > > And during this time we might end up calculating the per-CPU stats incorrectly, > messing up the understanding of CPU usage by MANA driver that is consumed by > monitoring services. Like Stephen said, forget about irqbalance for networking. Assume that the IRQs are affinitized and XPS set, correctly. Now, presumably you can use your pcpu stats to "trade queues", e.g. 4 CPUs / 4 queues, if CPU 0 insists on using queue 1 instead of queue 0, you can swap the 0 <> 1 assignment. That's just an example of an "algorithm", maybe you have other use cases. But if the problem is "user runs broken irqbalance" the solution is not in the kernel...