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 X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33C3AC433DF for ; Fri, 14 Aug 2020 16:11:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DED2D20791 for ; Fri, 14 Aug 2020 16:11:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="Y6z5CY1n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DED2D20791 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5E3C96B0003; Fri, 14 Aug 2020 12:11:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5BA6B6B0005; Fri, 14 Aug 2020 12:11:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CFB76B0006; Fri, 14 Aug 2020 12:11:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0245.hostedemail.com [216.40.44.245]) by kanga.kvack.org (Postfix) with ESMTP id 374FE6B0003 for ; Fri, 14 Aug 2020 12:11:09 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E7E57181AEF21 for ; Fri, 14 Aug 2020 16:11:08 +0000 (UTC) X-FDA: 77149663416.24.nest88_0e046a326ffe Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id B68CD1A4A0 for ; Fri, 14 Aug 2020 16:11:08 +0000 (UTC) X-HE-Tag: nest88_0e046a326ffe X-Filterd-Recvd-Size: 5187 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf20.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Aug 2020 16:11:07 +0000 (UTC) Received: from paulmck-ThinkPad-P72.home (unknown [50.45.173.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0CCB72078D; Fri, 14 Aug 2020 16:11:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597421467; bh=1eHtnTQKd6vwBqrROLmEzpSpv+XROEYdwyl4yv71Ks8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=Y6z5CY1nwi7oy57gblgg9EAFAoluxSg6wt4kSl2xd4o66tgT04GaKNVnM+9ED/gV0 wUTN14LksC3gedJTY60VNrKRLnpO3SY7UcY/xYH40sU+YxoYi4rFKMtvPM9ki/pFgk 29u7pPcFm2QM3eIcNWhmVBOnRVYgtat6UnBX+hh4= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id C4F1E3522A0E; Fri, 14 Aug 2020 09:11:06 -0700 (PDT) Date: Fri, 14 Aug 2020 09:11:06 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Thomas Gleixner , Michal Hocko , Uladzislau Rezki , LKML , RCU , linux-mm@kvack.org, Andrew Morton , Vlastimil Babka , Matthew Wilcox , "Theodore Y . Ts'o" , Joel Fernandes , Sebastian Andrzej Siewior , Oleksiy Avramchenko Subject: Re: [RFC-PATCH 1/2] mm: Add __GFP_NO_LOCKS flag Message-ID: <20200814161106.GA13853@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200813095840.GA25268@pc636> <874kp6llzb.fsf@nanos.tec.linutronix.de> <20200813133308.GK9477@dhcp22.suse.cz> <87sgcqty0e.fsf@nanos.tec.linutronix.de> <20200813182618.GX2674@hirez.programming.kicks-ass.net> <20200813185257.GF4295@paulmck-ThinkPad-P72> <20200813220619.GA2674@hirez.programming.kicks-ass.net> <875z9m3xo7.fsf@nanos.tec.linutronix.de> <20200814083037.GD3982@worktop.programming.kicks-ass.net> <20200814141425.GM4295@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200814141425.GM4295@paulmck-ThinkPad-P72> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: B68CD1A4A0 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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 Fri, Aug 14, 2020 at 07:14:25AM -0700, Paul E. McKenney wrote: > On Fri, Aug 14, 2020 at 10:30:37AM +0200, Peter Zijlstra wrote: > > On Fri, Aug 14, 2020 at 01:59:04AM +0200, Thomas Gleixner wrote: [ . . . ] > > > > 3. Reusing existing GFP_ flags/values/whatever to communicate > > > > the raw-context information that was to be communicated by > > > > the new GFP_ flag. > > > > > > > > 4. Making lockdep forgive acquiring spinlocks while holding > > > > raw spinlocks, but only in CONFIG_PREEMPT_NONE=y kernels. > > > > Uhh, !CONFIG_PREEMPT_RT, the rest is 'fine'. > > I would be OK with either. In CONFIG_PREEMPT_NONE=n kernels, the > kfree_rcu() code could use preemptible() to determine whether it was safe > to invoke the allocator. The code in kfree_rcu() might look like this: > > mem = NULL; > if (IS_ENABLED(CONFIG_PREEMPT_NONE) || preemptible()) > mem = __get_free_page(...); > > Is your point is that the usual mistakes would then be caught by the > usual testing on CONFIG_PREEMPT_NONE=n kernels? Just to make sure we are talking about the same thing, please see below for an untested patch that illustrates how I was interpreting your words. Was this what you had in mind? Thanx, Paul ------------------------------------------------------------------------ diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 62a382d..42d0ff1 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -579,7 +579,7 @@ do { \ # define lockdep_assert_preemption_disabled() do { } while (0) #endif -#ifdef CONFIG_PROVE_RAW_LOCK_NESTING +#ifdef CONFIG_PROVE_RAW_LOCK_NESTING_EFFECTIVE # define lockdep_assert_RT_in_threaded_ctx() do { \ WARN_ONCE(debug_locks && !current->lockdep_recursion && \ diff --git a/include/linux/lockdep_types.h b/include/linux/lockdep_types.h index bb35b44..70867d58 100644 --- a/include/linux/lockdep_types.h +++ b/include/linux/lockdep_types.h @@ -20,7 +20,7 @@ enum lockdep_wait_type { LD_WAIT_FREE, /* wait free, rcu etc.. */ LD_WAIT_SPIN, /* spin loops, raw_spinlock_t etc.. */ -#ifdef CONFIG_PROVE_RAW_LOCK_NESTING +#ifdef PROVE_RAW_LOCK_NESTING_EFFECTIVE LD_WAIT_CONFIG, /* CONFIG_PREEMPT_LOCK, spinlock_t etc.. */ #else LD_WAIT_CONFIG = LD_WAIT_SPIN, diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index e068c3c..e02de40 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1215,6 +1215,9 @@ config PROVE_RAW_LOCK_NESTING If unsure, select N. +config PROVE_RAW_LOCK_NESTING_EFFECTIVE + def_bool PROVE_RAW_LOCK_NESTING && !PREEMPTION + config LOCK_STAT bool "Lock usage statistics" depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT