From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6DF23009E1; Mon, 18 Aug 2025 08:50:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755507060; cv=none; b=PA0KGECTNLJVwGUlNl/MVxkEGznwZ/BJ1TVEupBI7GpjnkWos3mebMIH+wq0Ll8qiULd627V3I4EbIXXAwbYgNP8bkWTCq8PzBOPkgASCj1ZwIJQSqe0ehSn/LtDvWy4iJ6KoLI+v4gG6oo80GgKbAE0xmfgbYDYo4A3GElMbtY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755507060; c=relaxed/simple; bh=pbAuN88+fAvtq6e9c1Cuomlr5CexTJYFwYsjbKKxSv0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=u9vnUlC1ZFHK8kJUmeAcT/ceV0W3DP7zwETRNWxVu3vBSccWiaQF3J0ZgLKqi6msvSZcVCw1kFL0AQdney5ehuqHEMcJWcIWf04Nl2lFs1pVbhcbULZFSwhABuryo299v5hof4MlvEu86ELsQrPifV6A/8a7nrfQzJ8fvbrMpsY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu Received: from localhost (mailhub4.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4c55HS397Bz9sW6; Mon, 18 Aug 2025 10:20:04 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FMMyCDZPktia; Mon, 18 Aug 2025 10:20:04 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4c55HS1ztdz9sW4; Mon, 18 Aug 2025 10:20:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2F1EB8B765; Mon, 18 Aug 2025 10:20:04 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ymC4Y2tOtNpK; Mon, 18 Aug 2025 10:20:04 +0200 (CEST) Received: from PO20335.idsi0.si.c-s.fr (unknown [10.25.207.160]) by messagerie.si.c-s.fr (Postfix) with ESMTP id F2BA48B763; Mon, 18 Aug 2025 10:20:03 +0200 (CEST) From: Christophe Leroy To: Herve Codina , Qiang Zhao , Shengjiu Wang , Xiubo Li , Fabio Estevam , Nicolin Chen , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Christophe Leroy , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH v3 0/4] ASoC: fsl: fsl_qmc_audio: Reduce amount of interrupts Date: Mon, 18 Aug 2025 10:19:59 +0200 Message-ID: X-Mailer: git-send-email 2.49.0 Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1755505199; l=2329; i=christophe.leroy@csgroup.eu; s=20211009; h=from:subject:message-id; bh=pbAuN88+fAvtq6e9c1Cuomlr5CexTJYFwYsjbKKxSv0=; b=kYoKb+1G4M+oBNjPSIblYLyr02FxdpGXktGAtambWltq8gWdILmpYrw9TuWcteLPOJ82HWcGW zHtiikDuJHPBlwm+8sNkaJ/GwOEiXWLXie2LYf+BV8zuMn5tZMMOKBw X-Developer-Key: i=christophe.leroy@csgroup.eu; a=ed25519; pk=HIzTzUj91asvincQGOFx6+ZF5AoUuP9GdOtQChs7Mm0= Content-Transfer-Encoding: 8bit This series reduces significantly the amount of interrupts on fsl_qmc_audio device. Patches 1 and 2 are preparatory patches. Patch 3 is the main change Patch 4 is a cleanup which is enabled by previous patch Changes in v3: - Properly check the buffer descriptor is unused (Patch 1, comment from Herve Codina) - Fixed copy/paste error (patch 2, comment from Herve Codina) - Fixed build failure (patch 2, comment from Herve Codina and Test robot) Changes in v2: - Don't remove UB bit (Patch 1, comment from Herve Codina) - Make sure audio channels are ordered on TDM bus (Patch 2, new patch, comment from Herve Codina) - Drop struct qmc_dai_chan (patch 4, new patch) Backgroup (copied from patch 3): In non-interleaved mode, several QMC channels are used in sync. More details can be found in commit 188d9cae5438 ("ASoC: fsl: fsl_qmc_audio: Add support for non-interleaved mode.") At the time being, an interrupt is requested on each channel to perform capture/playback completion, allthough the completion is really performed only once all channels have completed their work. This leads to a lot more interrupts than really needed. Looking at /proc/interrupts shows ~3800 interrupts per second when using 4 capture and 4 playback devices with 5ms periods while only 1600 (200 x 4 + 200 x 4) periods are processed during one second. The QMC channels work in sync, the one started first is the one finishing first and the one started last is the one finishing last, so when the last one finishes it is guaranteed that the other ones are finished as well. Therefore only request completion processing on the last QMC channel. On my board with the above exemple, on a kernel started with 'threadirqs' option, the QMC irq thread uses 16% CPU time with this patch while it uses 26% CPU time without this patch. Christophe Leroy (4): soc: fsl: qmc: Only set completion interrupt when needed ASoc: fsl: fsl_qmc_audio: Ensure audio channels are ordered in TDM bus ASoC: fsl: fsl_qmc_audio: Only request completion on last channel ASoc: fsl: fsl_qmc_audio: Drop struct qmc_dai_chan drivers/soc/fsl/qe/qmc.c | 44 +++++++++--- sound/soc/fsl/fsl_qmc_audio.c | 125 +++++++++++++++------------------- 2 files changed, 87 insertions(+), 82 deletions(-) -- 2.49.0