Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3070412pxa; Tue, 18 Aug 2020 06:01:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzdwdKqUW6XmMjbN6/1pXBVhOexrvwazYt29SNxRoup8433867CDf2ciItyyXb8dxY4jQ+ X-Received: by 2002:a17:906:7798:: with SMTP id s24mr19965320ejm.45.1597755705467; Tue, 18 Aug 2020 06:01:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597755705; cv=none; d=google.com; s=arc-20160816; b=bQCFz4TYIAIM3QgeUqvxK/IgApv7bOawzvXz67dMmvGePEc9xB/fZL8lhku4DQzeKk phhJiO8OMf3WH/2jAhGvxLgdJqKC0E/OUYC/FyI3ewTwT79eSv9vkm/j5Mx+vAPUtse+ vAv89PzwFup/DkOHXOobc/ROv6hkh5XauGyuDZtSX9KjnJY4yZGwCdnlDLBFjyFMIsHQ icq6NSzthfw7Xu97D+HI7nI9TwZ3cqNJ8ZSZIXXlOsJEDh08PQA4eXh5KM2It9MTQq9O tKnJaUHSN83FYjYW/Bdquk7EZgHEFf0llgbBgbpZzHPfw86seXeY37P4CenWzCXQD8rW l1Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Z+rIDQ3LCEsRXHFLM30heMBvoe3N38rCr0O2UdmhFbY=; b=FMQUrpnOwnksbenpRo/W26i/kjH/uIYay2gFDcv6jzRweCVkUYFqVjX/a2ew1ZEB8V Ed6dWvKCiVOEFNTvAqB6Gm7ph0HjYEh+ARvYVJSDcJSP59YZd40sLZW/p+rI8U2Fp4cE HxIv2STscE7TjF0HjwE2hEZ8NvUS1SrFVCxhfEnk/xNjmHpLeZwYJn/suVh0uGpEaVur 2A0HoguRnvFby0FCxnzfe1icfG0zl1G0Hr5a4uRoBN8U8sgfm4KhxrzEWfEpi452Qy3r Fi7OeAZ8bPHNPhh1UuZ7tiDx+sqnGXnx1w3RFmcnX72LL1fhrSEtf87HHvSCWO82iheY WfMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s22si13144848ejv.358.2020.08.18.06.01.18; Tue, 18 Aug 2020 06:01:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726652AbgHRNA0 (ORCPT + 99 others); Tue, 18 Aug 2020 09:00:26 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:49356 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726353AbgHRNA0 (ORCPT ); Tue, 18 Aug 2020 09:00:26 -0400 Received: from fsav101.sakura.ne.jp (fsav101.sakura.ne.jp [27.133.134.228]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 07ID020B090337; Tue, 18 Aug 2020 22:00:02 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav101.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav101.sakura.ne.jp); Tue, 18 Aug 2020 22:00:02 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav101.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 07ID01QS090334 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 18 Aug 2020 22:00:01 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH] lockdep: Introduce CONFIG_LOCKDEP_LARGE To: Dmitry Vyukov Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , LKML , syzkaller References: <1595640639-9310-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp> <46674d71-1e41-cb68-ed99-72c25a73dfef@i-love.sakura.ne.jp> <37b60b14-4eb6-36b3-1195-97c2d27b7ed8@i-love.sakura.ne.jp> <8fc12fea-bf70-874e-fc19-067d504fa5cc@i-love.sakura.ne.jp> From: Tetsuo Handa Message-ID: <03ea22ab-3795-1672-f655-dc53f2734b8c@i-love.sakura.ne.jp> Date: Tue, 18 Aug 2020 21:59:58 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter, Ingo and Will. Would you answer (Q1) and (Q2)? On 2020/08/18 21:02, Dmitry Vyukov wrote: > On Tue, Aug 18, 2020 at 1:07 PM Tetsuo Handa > wrote: >> >> On 2020/08/18 18:57, Dmitry Vyukov wrote: >>> On Tue, Aug 4, 2020 at 4:36 AM Tetsuo Handa >>> wrote: >>>> >>>> Hello, Peter, Ingo and Will. >>>> >>>> (Q1) Can we change the capacity using kernel config? >>>> >>>> (Q2) If we can change the capacity, is it OK to specify these constants >>>> independently? (In other words, is there inter-dependency among >>>> these constants?) >>> >>> >>> I think we should do this. >>> syzbot uses a very beefy kernel config and very broad load. >>> We are hitting "BUG: MAX_LOCKDEP_ENTRIES too low!" for the part 428 >>> days and already hit it 96K times. It's just harming overall kernel >>> testing: >>> https://syzkaller.appspot.com/bug?id=3d97ba93fb3566000c1c59691ea427370d33ea1b >>> >>> I think it's better if exact values are not hardcoded, but rather >>> specified in the config. Today we are switching from 4K to 8K, but as >>> we enable more configs and learn to reach more code, we may need 16K. >> >> For short term, increasing the capacity would be fine. But for long term, I doubt. >> >> Learning more locks being held within one boot by enabling more configs, I suspect >> that it becomes more and more timing dependent and difficult to hold all locks that >> can generate a lockdep warning. >> >>> >>> >>>> (Q3) Do you think that we can extend lockdep to be used as a tool for auditing >>>> locks held in kernel space and rebuilding lock dependency map in user space? >>> >>> This looks like lots of work. Also unpleasant dependencies on >>> user-space. If there is a user-space component, it will need to be >>> deployed to _all_ of kernel testing systems and for all users of >>> syzkaller. And it will also be a dependency for reproducers. Currently >>> one can run a C reproducer and get the errors message from LOCKDEP. It >>> seems that a user-space component will make it significantly more >>> complicated. >> >> My suggestion is to detach lockdep warning from realtime alarming. >> >> Since not all locks are always held (e.g. some locks are held only if exceeding >> some threshold), requiring all locks being held within one boot sounds difficult. >> Such requirement results in flaky bisection like "Fix bisection: failed" in >> https://syzkaller.appspot.com/bug?id=b23ec126241ad0d86628de6eb5c1cff57d282632 . >> >> Then, I'm wishing that we could build non-realtime alarming based on all locks held >> across all boots on each vmlinux file. > > Unless I am missing something, deployment/maintenance story for this > for syzbot, syzkaller users, other kernel testing, reproducer > extraction, bisection, resproducer hermeticity is quite complicated. I > don't see it outweighing any potential benefit in reporting quality. What I'm imaging is: do not try to judge lock dependency problems within syzkaller (or other kernel testing) kernels. That is, no reproducer for lock dependency problems, no bisection for lock dependency problems. Utilize their resources for gathering only, and create lock dependency (like kcov data) in some dedicated userspace component. > > I also don't see how it will improve reproducer/bisection quality: to > confirm presence of a bug we still need to trigger all cycle edges > within a single run anyway, it does not have to be a single VM, but > still needs to be a single test case. And this "having all edges > within a single test case" seems to be the root problem. I don't see > how this proposal addresses this problem. > >>>> On 2020/07/25 14:23, Tetsuo Handa wrote: >>>>>> Also somebody may use it to _reduce_ size of the table for a smaller kernel. >>>>> >>>>> Maybe. But my feeling is that it is very rare that the kernel actually deadlocks >>>>> as soon as lockdep warned the possibility of deadlock. >>>>> >>>>> Since syzbot runs many instances in parallel, a lot of CPU resource is spent for >>>>> checking the same dependency tree. However, the possibility of deadlock can be >>>>> warned for only locks held within each kernel boot, and it is impossible to hold >>>>> all locks with one kernel boot. >>>>> >>>>> Then, it might be nice if lockdep can audit only "which lock was held from which >>>>> context and what backtrace" and export that log like KCOV data (instead of evaluating >>>>> the possibility of deadlock), and rebuild the whole dependency (and evaluate the >>>>> possibility of deadlock) across multiple kernel boots in userspace. >>>> >>