Message ID | 1646377603-19730-23-git-send-email-byungchul.park@lge.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | DEPT(Dependency Tracker) | expand |
On Fri, Mar 04, 2022 at 04:06:41PM +0900, Byungchul Park wrote: > Dept already prevents creating dependencies between different depths of > the class indicated by *_lock_nested() when the lock acquisitions happen > consecutively. > > lock A0 with depth > lock_nested A1 with depth + 1 > ... > unlock A1 > unlock A0 > > Dept does not create A0 -> A1 dependency in this case, either. > > However, once another class cut in, the code becomes problematic. When > Dept tries to create real dependencies, it does not only create real > ones but also wrong ones between different depths of the class. > > lock A0 with depth > lock B > lock_nested A1 with depth + 1 > ... > unlock A1 > unlock B > unlock A0 > > Even in this case, Dept should not create A0 -> A1 dependency. > > So let Dept not create wrong dependencies between different depths of > the class in any case. > > Reported-by: 42.hyeyoo@gmail.com > Signed-off-by: Byungchul Park <byungchul.park@lge.com> > --- > kernel/dependency/dept.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c > index 5d4efc3..cc1b3a3 100644 > --- a/kernel/dependency/dept.c > +++ b/kernel/dependency/dept.c > @@ -1458,14 +1458,7 @@ static void add_wait(struct dept_class *c, unsigned long ip, > > eh = dt->ecxt_held + i; > if (eh->ecxt->class != c || eh->nest == ne) > - break; > - } > - > - for (; i >= 0; i--) { > - struct dept_ecxt_held *eh; > - > - eh = dt->ecxt_held + i; > - add_dep(eh->ecxt, w); > + add_dep(eh->ecxt, w); > } > > if (!wait_consumed(w) && !rich_stack) { > -- > 1.9.1 > > Works as expected, Thanks! I would report if there is anything else interesting. Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
On Fri, Mar 04, 2022 at 11:39:29AM +0000, Hyeonggon Yoo wrote: > Works as expected, Thanks! > I would report if there is anything else interesting. Thanks a lot! What you have done is helpful. Thanks, Byungchul > Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> > > -- > Thank you, You are awesome! > Hyeonggon :-)
diff --git a/kernel/dependency/dept.c b/kernel/dependency/dept.c index 5d4efc3..cc1b3a3 100644 --- a/kernel/dependency/dept.c +++ b/kernel/dependency/dept.c @@ -1458,14 +1458,7 @@ static void add_wait(struct dept_class *c, unsigned long ip, eh = dt->ecxt_held + i; if (eh->ecxt->class != c || eh->nest == ne) - break; - } - - for (; i >= 0; i--) { - struct dept_ecxt_held *eh; - - eh = dt->ecxt_held + i; - add_dep(eh->ecxt, w); + add_dep(eh->ecxt, w); } if (!wait_consumed(w) && !rich_stack) {
Dept already prevents creating dependencies between different depths of the class indicated by *_lock_nested() when the lock acquisitions happen consecutively. lock A0 with depth lock_nested A1 with depth + 1 ... unlock A1 unlock A0 Dept does not create A0 -> A1 dependency in this case, either. However, once another class cut in, the code becomes problematic. When Dept tries to create real dependencies, it does not only create real ones but also wrong ones between different depths of the class. lock A0 with depth lock B lock_nested A1 with depth + 1 ... unlock A1 unlock B unlock A0 Even in this case, Dept should not create A0 -> A1 dependency. So let Dept not create wrong dependencies between different depths of the class in any case. Reported-by: 42.hyeyoo@gmail.com Signed-off-by: Byungchul Park <byungchul.park@lge.com> --- kernel/dependency/dept.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)