Dept works with waits preceeding an event, that might lead a deadlock.
Once the event has been handled, it's hard to ensure further waits
actually contibute to deadlock until next turn, which will start when
a sleep associated with that map happens.

So let Dept start tracking dependency when a sleep happens and stop
tracking dependency once the event e.i. wake up, has been handled.

Signed-off-by: Byungchul Park <byungchul.p...@lge.com>
---
 kernel/dependency/dept.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c
index cc1b3a3..1c91db8 100644
--- a/kernel/dependency/dept.c
+++ b/kernel/dependency/dept.c
@@ -2325,6 +2325,12 @@ void dept_event(struct dept_map *m, unsigned long e_f, 
unsigned long ip,
                do_event((void *)m, c, READ_ONCE(m->wgen), ip);
                pop_ecxt((void *)m);
        }
+
+       /*
+        * Keep the map diabled until the next sleep.
+        */
+       WRITE_ONCE(m->wgen, 0);
+
        dept_exit(flags);
 }
 EXPORT_SYMBOL_GPL(dept_event);
@@ -2447,6 +2453,11 @@ void dept_event_split_map(struct dept_map_each *me,
                pop_ecxt((void *)me);
        }
 
+       /*
+        * Keep the map diabled until the next sleep.
+        */
+       WRITE_ONCE(me->wgen, 0);
+
        dept_exit(flags);
 }
 EXPORT_SYMBOL_GPL(dept_event_split_map);
-- 
1.9.1

Reply via email to