Thread (5 messages) 5 messages, 2 authors, 2017-12-11

Re: [PATCH v2 1/5] mac80211_hwsim: wait for deferred radio deletion on mod unload

From: Benjamin Beichler <hidden>
Date: 2017-12-11 13:07:21

Am 11.12.2017 um 13:57 schrieb Johannes Berg:
On Mon, 2017-12-11 at 13:54 +0100, Benjamin Beichler wrote:
quoted
Am 11.12.2017 um 12:46 schrieb Johannes Berg:
quoted
quoted
+	spin=5Flock=5Fbh(&hwsim=5Fdelete=5Flock);
+	while (!list=5Fempty(&delete=5Fradios)) {
+		pr=5Fdebug("mac80211=5Fhwsim: wait for deferred radio remove\n");
+		spin=5Funlock=5Fbh(&hwsim=5Fdelete=5Flock);
+		flush=5Fwork(&list=5Fentry(&delete=5Fradios,
+				       struct mac80211=5Fhwsim=5Fdata, list)
+			   ->destroy=5Fwork);
This can't possibly be right ... you're locking the list=5Fempty which is
a trivial pointer comparison, but not the actual list=5Fentry() ...
Maybe the first spin=5Flock is not needed, but since flush=5Fwork wait for
the completion of the task, which at the end also deletes the item from
the list, holding any spin=5Flock would be wrong.
But not holding it while taking things that are on the list also seems
wrong.
Since at this place (Netlink is already unregistered so no new deletion
requests) the only user of the delete list is the code deferred work
items (which take itself the lock). Nonetheless, with a separate
workqueue this is no problem anymore.
quoted
quoted
I'd also prefer you actually didn't leave the problem in part as you
describe - and a new workqueue probably isn't that much overhead and
should introduce *less* new code than this, so IMHO that's worth it.
I totally agree with you, but I don't know the actual policy for
creating workqeues. I could also simply call flush=5Fscheduled=5Fwork,
because we may have enough time at module unload. Some modules also do
it, but the description an some mailing threads mark it like
evil/deprecated. Which solution do you prefer=3F
Let's go with a new workqueue.
Ok, I prepare a patch in the next few days.
johannes
-- 
M.Sc. Benjamin Beichler

Universit=C3=A4t Rostock, Fakult=C3=A4t f=C3=BCr Informatik und Elektrotechnik
Institut f=C3=BCr Angewandte Mikroelektronik und Datentechnik

University of Rostock, Department of CS and EE
Institute of Applied Microelectronics and CE

Richard-Wagner-Stra=C3=9Fe 31
18119 Rostock
Deutschland/Germany

phone: +49 (0) 381 498 - 7278
email: Benjamin.Beichler@uni-rostock.de
www: http://www.imd.uni-rostock.de/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help