From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752973AbcBCJlw (ORCPT ); Wed, 3 Feb 2016 04:41:52 -0500 Received: from mx2.parallels.com ([199.115.105.18]:33140 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751442AbcBCJlt (ORCPT ); Wed, 3 Feb 2016 04:41:49 -0500 Subject: Re: + kernel-locking-lockdepc-make-lockdep-initialize-itself-on-demand.patch added to -mm tree To: Ingo Molnar , References: <56b11d2d.vVw1kB2la7Y+70xF%akpm@linux-foundation.org> <20160203074430.GA32652@gmail.com> CC: , , , , , Peter Zijlstra , Thomas Gleixner From: Andrey Ryabinin Message-ID: <56B1CB7F.5070207@virtuozzo.com> Date: Wed, 3 Feb 2016 12:42:23 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160203074430.GA32652@gmail.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-ClientProxiedBy: US-EXCH2.sw.swsoft.com (10.255.249.46) To US-EXCH.sw.swsoft.com (10.255.249.47) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/2016 10:44 AM, Ingo Molnar wrote: > Yuck, I don't really like this. > > Lockdep initialization must happen early on, and it should happen in a well > defined place, not be opportunistic (and relatively random) like this, making it > dependent on config options and calling contexts. > > Also, in addition to properly ordering UBSAN initialization, how about fixing the > silent crash by adding a lockdep warning to that place instead of an auto-init? > > The warning will turn lockdep off safely and will generate an actionable kernel > message and stackdump upon which the init ordering fix can be done. > Something like this already done for DEBUG_LOCKDEP=y (except it initializes lockdep instead of turning it off). look_up_lock_class(): ... #ifdef CONFIG_DEBUG_LOCKDEP /* * If the architecture calls into lockdep before initializing * the hashes then we'll warn about it later. (we cannot printk * right now) */ if (unlikely(!lockdep_initialized)) { lockdep_init(); lockdep_init_error = 1; lock_init_error = lock->name; save_stack_trace(&lockdep_init_trace); } #endif Silent crash happens only in DEBUG_LOCKDEP=n && LOCKDEP=y combination. So, what about simply removing this #ifdef (and the other one in lockdep_info() )? I