From 07cee3d981d8f3a283a72c86d5ec580a2f4dc5b7 Mon Sep 17 00:00:00 2001 From: Sean Khan Date: Tue, 2 Jul 2024 20:44:35 -0400 Subject: [PATCH] qca-nss-drv: Rework smp_affinity logic Reworked flawed smp_affinity logic. It was assumed that all 'nss_*' IRQs needed to be equally balanced across all CPUs. However, what ends up happening most of the time is messing with scheduling, thrashing, missed cache and high context switching. For each core: 1. nss_empty_buf_sos 2. nss_empty_buf_queue 3. nss_queue0 The IRQs should be kept on the same CPU. Doing so allows NSS cores to properly feed and empty the queues. Signed-off-by: Sean Khan --- qca-nss-drv/Makefile | 2 +- qca-nss-drv/files/qca-nss-drv.init | 40 +++++++++++------------------- 2 files changed, 15 insertions(+), 27 deletions(-) diff --git a/qca-nss-drv/Makefile b/qca-nss-drv/Makefile index e542cd1..32b33da 100644 --- a/qca-nss-drv/Makefile +++ b/qca-nss-drv/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=qca-nss-drv -PKG_RELEASE:=5 +PKG_RELEASE:=6 PKG_SOURCE_URL:=https://git.codelinaro.org/clo/qsdk/oss/lklm/nss-drv.git PKG_SOURCE_PROTO:=git diff --git a/qca-nss-drv/files/qca-nss-drv.init b/qca-nss-drv/files/qca-nss-drv.init index ddb1727..6aea6a8 100644 --- a/qca-nss-drv/files/qca-nss-drv.init +++ b/qca-nss-drv/files/qca-nss-drv.init @@ -1,20 +1,6 @@ #!/bin/sh /etc/rc.common # vim: set syn=bash # shellcheck disable=2155,3010,3019,3043,3057,3060 -# Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -###################################################################### START=94 PROG="qca-nss-drv" @@ -106,32 +92,34 @@ set_affinity() { enable_rps() { # NSS Core 0 : 4 nss queues to each core - set_affinity "nss_queue0" 1 1 - set_affinity "nss_queue1" 2 1 - set_affinity "nss_queue2" 3 1 - set_affinity "nss_queue3" 0 1 + set_affinity "nss_queue0" 0-3 1 + set_affinity "nss_queue1" 1 1 + set_affinity "nss_queue2" 2 1 + set_affinity "nss_queue3" 3 1 # NSS Core 1 : 1 nss queue to 3rd core - set_affinity "nss_queue0" 2 2 + set_affinity "nss_queue0" 3 2 # NSS Core 0 : 2 nss sos/queues to last core - set_affinity "nss_empty_buf_sos" 3 1 - set_affinity "nss_empty_buf_queue" 3 1 + set_affinity "nss_empty_buf_sos" 0-3 1 + set_affinity "nss_empty_buf_queue" 0-3 1 # NSS Core 1 : 1 nss sos to last core - set_affinity "nss_empty_buf_sos" 2 2 + set_affinity "nss_empty_buf_sos" 3 2 # USB 3.0 : pin to 3rd core - set_affinity "xhci-hcd:usb1" 2 1 + set_affinity "xhci-hcd:usb1" 1,3 1 # TCL Completion, REO Dest, ERR, Exception and h2rxdma # are offloaded, so balance remaining IRQs accordingly. # PPDU IRQ : pin to 2nd and 3rd core - set_affinity 'ppdu-end-interrupts-mac1' 1 1 - set_affinity 'ppdu-end-interrupts-mac3' 2 1 + set_affinity 'ppdu-end-interrupts-mac1' 1 1 + set_affinity 'ppdu-end-interrupts-mac3' 2 1 + + set_affinity 'ath10k_pci' 0-3 1 # Enable NSS RPS - sysctl -w dev.nss.rps.enable=1 > /dev/null 2> /dev/null + sysctl -w dev.nss.rps.enable=1 >/dev/null 2>&1 } start() {