From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755775AbdESKai (ORCPT ); Fri, 19 May 2017 06:30:38 -0400 Received: from merlin.infradead.org ([205.233.59.134]:49218 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752145AbdESKah (ORCPT ); Fri, 19 May 2017 06:30:37 -0400 Date: Fri, 19 May 2017 12:30:25 +0200 From: Peter Zijlstra To: Byungchul Park Cc: mingo@kernel.org, tglx@linutronix.de, walken@google.com, boqun.feng@gmail.com, kirill@shutemov.name, linux-kernel@vger.kernel.org, linux-mm@kvack.org, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, willy@infradead.org, npiggin@gmail.com, kernel-team@lge.com Subject: Re: [PATCH v6 05/15] lockdep: Implement crossrelease feature Message-ID: <20170519103025.zb5impbsek77ahwa@hirez.programming.kicks-ass.net> References: <1489479542-27030-1-git-send-email-byungchul.park@lge.com> <1489479542-27030-6-git-send-email-byungchul.park@lge.com> <20170519080708.GG28017@X58A-UD3R> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170519080708.GG28017@X58A-UD3R> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 19, 2017 at 05:07:08PM +0900, Byungchul Park wrote: > On Tue, Mar 14, 2017 at 05:18:52PM +0900, Byungchul Park wrote: > > Lockdep is a runtime locking correctness validator that detects and > > reports a deadlock or its possibility by checking dependencies between > > locks. It's useful since it does not report just an actual deadlock but > > also the possibility of a deadlock that has not actually happened yet. > > That enables problems to be fixed before they affect real systems. > > > > However, this facility is only applicable to typical locks, such as > > spinlocks and mutexes, which are normally released within the context in > > which they were acquired. However, synchronization primitives like page > > locks or completions, which are allowed to be released in any context, > > also create dependencies and can cause a deadlock. So lockdep should > > track these locks to do a better job. The 'crossrelease' implementation > > makes these primitives also be tracked. > > Excuse me but I have a question... > > Only for maskable irq, can I assume that hardirq are prevented within > hardirq context? I remember that nested interrupts were allowed in the > past but not recommanded. But what about now? I'm curious about the > overall direction of kernel and current status. It would be very > appriciated if you answer it. So you're right. In general enabling IRQs from hardirq context is discouraged but allowed. However, if you were to do that with a lock held that would instantly make lockdep report a deadlock, as the lock is then both used from IRQ context and has IRQs enabled. So from a locking perspective you can assume no nesting, but from a state tracking pov we have to deal with the nesting I think (although it is very rare). You're asking this in relation to the rollback thing, right? I think we should only save the state when hardirq_context goes from 0->1 and restore on 1->0. If you're asking this for another reason, please clarify.