From nobody Sat Nov 30 10:47:17 2024 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (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 DC287130495 for ; Mon, 9 Sep 2024 23:19:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725923954; cv=none; b=IVHZ+uI6lQ6Vra7lR22DHW6NsZaPBBBiLiwkHombL0o3zE39+nNc5HuVSRjxrsPEDw0J16LTnuJN+S12AUyeb/d4m98afGbSJUt/9nR175HRPzIquPQ/Ct3/87Vb6nJ6nTJayUukP/9l5ZLOR5XwgwObK/IUaRLJnpU8zaaxnTo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725923954; c=relaxed/simple; bh=Knlly1UiaXRGEzPixfJLe8iKOl23J9M2bOChjJKWJBA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=MivU2aP1ay6XbeN0buM60KJy97zh59Vx+Q1++iSuZ5f+J3Zr83Srx0kl43UsIJ3j33GgrXs6emTPav3xWVFe1J9fC6he/EHY1u/LQZzjKjYOPaehylP173LQQ5yMRJrKhfgGL9Vs0zDUaS0DXibF/s0nXXd6n+7+1vosnepKVmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=runfKUP0; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="runfKUP0" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1725923950; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=chp+yovhyTsetuFlGaROcWrUCF7VpX8MgZ8KKDRJoRA=; b=runfKUP0ngU7IMdjKm5h/rIhJ9TJEWgfeYJfoH9j31CVNeSomZghRhBSs4qgirl3k3Ib3u qyKyUlRYy10X9K9aoKa3NVC0jVbcLLjLYcH59k7KqZpugremKpaIg9LUKpNhGKY6bJDgrs GyKr2h7XUFktFnsFUX8zZvvgYma7ryQ= From: Sean Anderson To: Radhey Shyam Pandey , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org Cc: Robert Hancock , linux-kernel@vger.kernel.org, Michal Simek , linux-arm-kernel@lists.infradead.org, Sean Anderson Subject: [PATCH net] net: xilinx: axienet: Schedule NAPI in two steps Date: Mon, 9 Sep 2024 19:19:04 -0400 Message-Id: <20240909231904.1322387-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" As advised by Documentation/networking/napi.rst, masking IRQs after calling napi_schedule can be racy. Avoid this by only masking/scheduling if napi_schedule_prep returns true. Additionally, since we are running in an IRQ context we can use the irqoff variant as well. Fixes: 9e2bc267e780 ("net: axienet: Use NAPI for TX completion path") Fixes: cc37610caaf8 ("net: axienet: implement NAPI and GRO receive") Signed-off-by: Sean Anderson Reviewed-by: Shannon Nelson --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/ne= t/ethernet/xilinx/xilinx_axienet_main.c index 9eb300fc3590..4f67072d5149 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -1222,9 +1222,10 @@ static irqreturn_t axienet_tx_irq(int irq, void *_nd= ev) u32 cr =3D lp->tx_dma_cr; =20 cr &=3D ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK); - axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, cr); - - napi_schedule(&lp->napi_tx); + if (napi_schedule_prep(&lp->napi_tx)) { + axienet_dma_out32(lp, XAXIDMA_TX_CR_OFFSET, cr); + __napi_schedule_irqoff(&lp->napi_tx); + } } =20 return IRQ_HANDLED; @@ -1266,9 +1267,10 @@ static irqreturn_t axienet_rx_irq(int irq, void *_nd= ev) u32 cr =3D lp->rx_dma_cr; =20 cr &=3D ~(XAXIDMA_IRQ_IOC_MASK | XAXIDMA_IRQ_DELAY_MASK); - axienet_dma_out32(lp, XAXIDMA_RX_CR_OFFSET, cr); - - napi_schedule(&lp->napi_rx); + if (napi_schedule_prep(&lp->napi_rx)) { + axienet_dma_out32(lp, XAXIDMA_RX_CR_OFFSET, cr); + __napi_schedule_irqoff(&lp->napi_rx); + } } =20 return IRQ_HANDLED; --=20 2.35.1.1320.gc452695387.dirty