Thread (7 messages) flat view 7 messages, 2 authors, 2020-12-16

Re: [PATCH net-next v5 2/3] net: implement threaded-able napi poll loop support

From: Jakub Kicinski <kuba@kernel.org>
Date: 2020-12-16 01:54:31

On Tue, 15 Dec 2020 17:25:14 -0800 Wei Wang wrote:
+void napi_enable(struct napi_struct *n)
+{
+	bool locked = rtnl_is_locked();
Maybe you'll prove me wrong but I think this is never a correct
construct.
+	BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state));
+	smp_mb__before_atomic();
+	clear_bit(NAPI_STATE_SCHED, &n->state);
+	clear_bit(NAPI_STATE_NPSVC, &n->state);
+	if (!locked)
+		rtnl_lock();
Why do we need the lock? Can't we assume the caller of napi_enable()
has the sole ownership of the napi instance? Surely clearing the other
flags would be pretty broken as well, so the napi must had been
disabled when this is called by the driver.
+	WARN_ON(napi_set_threaded(n, n->dev->threaded));
+	if (!locked)
+		rtnl_unlock();
+}
+EXPORT_SYMBOL(napi_enable);
Let's switch to RFC postings and get it in for 5.12 :(
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help