Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751987AbdGMLXg (ORCPT ); Thu, 13 Jul 2017 07:23:36 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:33006 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbdGMLXe (ORCPT ); Thu, 13 Jul 2017 07:23:34 -0400 MIME-Version: 1.0 In-Reply-To: <20170713111209.ji6w3trt45icpuf6@hirez.programming.kicks-ass.net> References: <1495616389-29772-7-git-send-email-byungchul.park@lge.com> <20170711161232.GB28975@worktop> <20170712020053.GB20323@X58A-UD3R> <20170712075617.o2jds2giuoqxjqic@hirez.programming.kicks-ass.net> <20170713020745.GG20323@X58A-UD3R> <20170713081442.GA439@worktop> <20170713085746.GH20323@X58A-UD3R> <20170713095052.dssev34f7c43vlok@hirez.programming.kicks-ass.net> <20170713100953.GI20323@X58A-UD3R> <20170713102905.ysrvn7td6ryt4jaj@hirez.programming.kicks-ass.net> <20170713111209.ji6w3trt45icpuf6@hirez.programming.kicks-ass.net> From: Byungchul Park Date: Thu, 13 Jul 2017 20:23:33 +0900 Message-ID: Subject: Re: [PATCH v7 06/16] lockdep: Detect and handle hist_lock ring buffer overwrite To: Peter Zijlstra Cc: Byungchul Park , Ingo Molnar , tglx@linutronix.de, Michel Lespinasse , boqun.feng@gmail.com, kirill@shutemov.name, "linux-kernel@vger.kernel.org" , linux-mm@kvack.org, akpm@linux-foundation.org, willy@infradead.org, npiggin@gmail.com, kernel-team@lge.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1491 Lines: 44 On Thu, Jul 13, 2017 at 8:12 PM, Peter Zijlstra wrote: > On Thu, Jul 13, 2017 at 12:29:05PM +0200, Peter Zijlstra wrote: >> On Thu, Jul 13, 2017 at 07:09:53PM +0900, Byungchul Park wrote: >> > On Thu, Jul 13, 2017 at 11:50:52AM +0200, Peter Zijlstra wrote: >> > > wait_for_completion(&C); >> > > atomic_inc_return(); >> > > >> > > mutex_lock(A1); >> > > mutex_unlock(A1); >> > > >> > > >> > > >> > > spin_lock(B1); >> > > spin_unlock(B1); >> > > >> > > ... >> > > >> > > spin_lock(B64); >> > > spin_unlock(B64); >> > > >> > > >> > > > > Also consider the alternative: > > > spin_lock(D); > spin_unlock(D); > > complete(&C); > > > in which case the context test will also not work. Context tests are done on xhlock with the release context, _not_ acquisition context. For example, spin_lock(D) and complete(&C) are in the same context, so the test would pass in this example. So it works. -- Thanks, Byungchul