From patchwork Mon Apr 14 16:07:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 14050672 X-Patchwork-Delegate: kuba@kernel.org Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9C4A218DB26 for ; Mon, 14 Apr 2025 16:08:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744646892; cv=none; b=TlGLbxGHPtpiF6kijmftkgkzwWdD+7j9lUbWNsw2rBPdpT7JXrhLMg6PxQn+7jayORPQ9/9wNIusg6N+KhCeIgAkyfmCZ7aJnUnYkwZ054ycexZvfwdas3Cd2mGJdBQeyvW7FCnHdGSRRrwJfIw/nSMrTI4elNZ/CcjP9juLZ8Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744646892; c=relaxed/simple; bh=HHiVQTH+atgT4xOQAN37uuJt5UAHAio4xUM9Rqa92CU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jl3A9QuGd7UkCaWskTZrBqkFCGP8mGvp82j2qK6YJzNoJtJS2863tRCtBy1ypa35z8cQde0NmynPLMWxSq1qbXBZzP7gIU7rNgjYirmWUouPVFEPygq4eF5HRV94hpWjmjkSi8LVrqaqsXHWAkzkmzWESbYT6yel6/e7HHSffig= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3dpH8Au+; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ZywAtazY; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3dpH8Au+"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ZywAtazY" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1744646888; 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: in-reply-to:in-reply-to:references:references; bh=Aht/WxYRxsU2RswlJxtNzoWOPHgqB8qiJPYiwhb18pU=; b=3dpH8Au+ToIfW9BIFnc7AaITX1XQPlwXoRZyvL2x2AJE/jahNFOKxt4kc5+sTKTuRgdiqU vwzYx0X+0CNxlnPO34mLIntKHvyfRWRD68Bx95IpUvGXdgeLTgg5ci7aKjxV03qt0IirzC 6h2DPUcjiEPgQJxvOwwSLZcU7LUQvhHMub80IYZUwTS/dJ7SxZBLxpbdy1MPwADNrZNPEW 0YVb+WW7SKc8ivxKEjygSnHXQUhVgIx5FCvH4gtNPAXtLLJlBBYseOvPMdkrEh7kX26unN 8Jm3C7Ncd9uAKI0GKNZ515C8cuUWCUkgWfqRUF2urRxijKzTZiD3YScx4WIvOg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1744646888; 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: in-reply-to:in-reply-to:references:references; bh=Aht/WxYRxsU2RswlJxtNzoWOPHgqB8qiJPYiwhb18pU=; b=ZywAtazYo1ouehJF936eyFEGqF9KuC3ZxBLPIJ4P4kfQiDBe/CWqEg6ywAhYQ57qydzM3O c1G6mhxYBjRDv5CA== To: netdev@vger.kernel.org, linux-rt-devel@lists.linux.dev Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Thomas Gleixner , Sebastian Andrzej Siewior , Jesper Dangaard Brouer , Ilias Apalodimas Subject: [PATCH net-next v2 01/18] net: page_pool: Don't recycle into cache on PREEMPT_RT Date: Mon, 14 Apr 2025 18:07:37 +0200 Message-ID: <20250414160754.503321-2-bigeasy@linutronix.de> In-Reply-To: <20250414160754.503321-1-bigeasy@linutronix.de> References: <20250414160754.503321-1-bigeasy@linutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org With preemptible softirq and no per-CPU locking in local_bh_disable() on PREEMPT_RT the consumer can be preempted while a skb is returned. Avoid the race by disabling the recycle into the cache on PREEMPT_RT. Cc: Jesper Dangaard Brouer Cc: Ilias Apalodimas Signed-off-by: Sebastian Andrzej Siewior --- net/core/page_pool.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 7745ad924ae2d..ba8803c2c0b20 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -805,6 +805,10 @@ static bool page_pool_napi_local(const struct page_pool *pool) const struct napi_struct *napi; u32 cpuid; + /* On PREEMPT_RT the softirq can be preempted by the consumer */ + if (IS_ENABLED(CONFIG_PREEMPT_RT)) + return false; + if (unlikely(!in_softirq())) return false;