From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E575C433F5 for ; Tue, 10 May 2022 11:18:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AFFDA6B0072; Tue, 10 May 2022 07:18:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A88F56B0073; Tue, 10 May 2022 07:18:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9027B6B0074; Tue, 10 May 2022 07:18:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7AD916B0072 for ; Tue, 10 May 2022 07:18:30 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4375521943 for ; Tue, 10 May 2022 11:18:30 +0000 (UTC) X-FDA: 79449585180.21.99B28EA Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf20.hostedemail.com (Postfix) with ESMTP id E3DC71C00A6 for ; Tue, 10 May 2022 11:18:20 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id e24so15602834pjt.2 for ; Tue, 10 May 2022 04:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=NAG18UO/tcE+S05MnOeuxuMLEaWaJn7EzeFBAyc6xEI=; b=iKT7QYiaUQ8dZ1P3vmShQW0ThVsrrDG5/CHhH/XmT3yWc177RjBTpxPmI7ZnEwzEhE quwHAvT9et0uXnC+VeaF/RTEzIk3VWuucB3BscSJARj6R1SHVuDtx8nmpcBeubrE81yX 7zSenZfp0IdwKCZMvLQgd/TsfOYG5EmlQHpZz/lHMA4prCoXa1Cj7XPxmOukbMNMYII6 24jlbaFxEDzG2z4ln1f5RWkc2QRFMPTfIL92VcBsJS13KAS4Zl99c1tWdQJIncUqnMFS D6PGzf33NyyF8CklTafXFDAQEAloy0EPGB7csfjbZRvjrY+eNMV2ZsbFAD8+53kjZzWr Gpeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=NAG18UO/tcE+S05MnOeuxuMLEaWaJn7EzeFBAyc6xEI=; b=6mZX07/CLnpIxnJuyL+WMyhp1TnU2V+Y3ZNg4iVOsTDSpRGbgYU09ufbOnXYhdqtqt LO1Oljtj26i28EKDRK+9JF+roSaSjJ1fT6Br9goimmfbogWTvGvO0Z+2fmwGjbJGUouA /IhAI6duslK5PBLRTXLZ9aOOtOeepaJLcdsue0/WrtMWHfM/J8mybPCTi4G+hcijdciJ 2MHIKLxVca2krVfOcEmKOkyK2AnIUFxoQtwEhTRsyQZG0cflChDhx36wO5PWCBYhwQmb b4hnbqCcUOszShN6DKpMBkl6wz6IYinXPUpqTKTXCPyq6hB14AW7Eqr5kR6Sj9cYgedl 8RNA== X-Gm-Message-State: AOAM530kNfIcjg15Rvs8aRWRlXgDVWswVaMFMEvKMeXOdLyge61UvLuo bHaFyxo7K2BvkwqB8S36bZI= X-Google-Smtp-Source: ABdhPJyar+0k/7nbZhwkZK7IxG/e7t/vnNzB2lZg7PhgLGknkbHzom5aqgDBwikrS+PFFHTrbWguMg== X-Received: by 2002:a17:902:f68a:b0:15e:b12d:f4a1 with SMTP id l10-20020a170902f68a00b0015eb12df4a1mr20067951plg.166.1652181508606; Tue, 10 May 2022 04:18:28 -0700 (PDT) Received: from hyeyoo ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id h70-20020a638349000000b003c68eddba62sm4542314pge.89.2022.05.10.04.18.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 04:18:27 -0700 (PDT) Date: Tue, 10 May 2022 20:18:12 +0900 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Byungchul Park Cc: torvalds@linux-foundation.org, damien.lemoal@opensource.wdc.com, linux-ide@vger.kernel.org, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, mingo@redhat.com, linux-kernel@vger.kernel.org, peterz@infradead.org, will@kernel.org, tglx@linutronix.de, rostedt@goodmis.org, joel@joelfernandes.org, sashal@kernel.org, daniel.vetter@ffwll.ch, chris@chris-wilson.co.uk, duyuyang@gmail.com, johannes.berg@intel.com, tj@kernel.org, tytso@mit.edu, willy@infradead.org, david@fromorbit.com, amir73il@gmail.com, gregkh@linuxfoundation.org, kernel-team@lge.com, linux-mm@kvack.org, akpm@linux-foundation.org, mhocko@kernel.org, minchan@kernel.org, hannes@cmpxchg.org, vdavydov.dev@gmail.com, sj@kernel.org, jglisse@redhat.com, dennis@kernel.org, cl@linux.com, penberg@kernel.org, rientjes@google.com, vbabka@suse.cz, ngupta@vflare.org, linux-block@vger.kernel.org, paolo.valente@linaro.org, josef@toxicpanda.com, linux-fsdevel@vger.kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz, jack@suse.com, jlayton@kernel.org, dan.j.williams@intel.com, hch@infradead.org, djwong@kernel.org, dri-devel@lists.freedesktop.org, airlied@linux.ie, rodrigosiqueiramelo@gmail.com, melissa.srw@gmail.com, hamohammed.sa@gmail.com Subject: Re: [PATCH RFC v6 00/21] DEPT(Dependency Tracker) Message-ID: References: <1651795895-8641-1-git-send-email-byungchul.park@lge.com> <20220509001637.GA6047@X58A-UD3R> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509001637.GA6047@X58A-UD3R> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: E3DC71C00A6 X-Stat-Signature: nh9jq5wjdnaz7eecxnuubowjzshid9n4 X-Rspam-User: Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=iKT7QYia; spf=pass (imf20.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1652181500-436705 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, May 09, 2022 at 09:16:37AM +0900, Byungchul Park wrote: > On Sat, May 07, 2022 at 04:20:50PM +0900, Hyeonggon Yoo wrote: > > On Fri, May 06, 2022 at 09:11:35AM +0900, Byungchul Park wrote: > > > Linus wrote: > > > > > > > > On Wed, May 4, 2022 at 1:19 AM Byungchul Park wrote: > > > > > > > > > > Hi Linus and folks, > > > > > > > > > > I've been developing a tool for detecting deadlock possibilities by > > > > > tracking wait/event rather than lock(?) acquisition order to try to > > > > > cover all synchonization machanisms. > > > > > > > > So what is the actual status of reports these days? > > > > > > > > Last time I looked at some reports, it gave a lot of false positives > > > > due to mis-understanding prepare_to_sleep(). > > > > > > Yes, it was. I handled the case in the following way: > > > > > > 1. Stage the wait at prepare_to_sleep(), which might be used at commit. > > > Which has yet to be an actual wait that Dept considers. > > > 2. If the condition for sleep is true, the wait will be committed at > > > __schedule(). The wait becomes an actual one that Dept considers. > > > 3. If the condition is false and the task gets back to TASK_RUNNING, > > > clean(=reset) the staged wait. > > > > > > That way, Dept only works with what actually hits to __schedule() for > > > the waits through sleep. > > > > > > > For this all to make sense, it would need to not have false positives > > > > (or at least a very small number of them together with a way to sanely > > > > > > Yes. I agree with you. I got rid of them that way I described above. > > > > > > > IMHO DEPT should not report what lockdep allows (Not talking about > > No. > > > wait events). I mean lockdep allows some kind of nested locks but > > DEPT reports them. > > You have already asked exactly same question in another thread of > LKML. That time I answered to it but let me explain it again. > > --- > > CASE 1. > > lock L with depth n > lock_nested L' with depth n + 1 > ... > unlock L' > unlock L > > This case is allowed by Lockdep. > This case is allowed by DEPT cuz it's not a deadlock. > > CASE 2. > > lock L with depth n > lock A > lock_nested L' with depth n + 1 > ... > unlock L' > unlock A > unlock L > > This case is allowed by Lockdep. > This case is *NOT* allowed by DEPT cuz it's a *DEADLOCK*. > Yeah, in previous threads we discussed this [1] And the case was: scan_mutex -> object_lock -> kmemleak_lock -> object_lock And dept reported: object_lock -> kmemleak_lock, kmemleak_lock -> object_lock as deadlock. But IIUC - What DEPT reported happens only under scan_mutex and It is not simple just not to take them because the object can be removed from the list and freed while scanning via kmemleak_free() without kmemleak_lock and object_lock. Just I'm still not sure that someone will fix the warning in the future - even if the locking rule is not good - if it will not cause a real deadlock. > --- > > The following scenario would explain why CASE 2 is problematic. > > THREAD X THREAD Y > > lock L with depth n > lock L' with depth n > lock A > lock A > lock_nested L' with depth n + 1 > lock_nested L'' with depth n + 1 > ... ... > unlock L' unlock L'' > unlock A unlock A > unlock L unlock L' > > Yes. I need to check if the report you shared with me is a true one, but > it's not because DEPT doesn't work with *_nested() APIs. > Sorry, It was not right just to say DEPT doesn't work with _nested() APIs. > Byungchul [1] https://lore.kernel.org/lkml/20220304002809.GA6112@X58A-UD3R/ -- Thanks, Hyeonggon