From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752192AbcA2IOK (ORCPT ); Fri, 29 Jan 2016 03:14:10 -0500 Received: from LGEAMRELO13.lge.com ([156.147.23.53]:45468 "EHLO lgeamrelo13.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751287AbcA2IOJ (ORCPT ); Fri, 29 Jan 2016 03:14:09 -0500 X-Original-SENDERIP: 156.147.1.151 X-Original-MAILFROM: byungchul.park@lge.com X-Original-SENDERIP: 10.177.222.33 X-Original-MAILFROM: byungchul.park@lge.com Date: Fri, 29 Jan 2016 17:13:45 +0900 From: Byungchul Park To: Sergey Senozhatsky Cc: Peter Hurley , Sergey Senozhatsky , akpm@linux-foundation.org, mingo@kernel.org, linux-kernel@vger.kernel.org, akinobu.mita@gmail.com, jack@suse.cz, torvalds@linux-foundation.org Subject: Re: [PATCH v4] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Message-ID: <20160129081345.GF31266@X58A-UD3R> References: <000301d15985$7f416690$7dc433b0$@lge.com> <20160128060530.GC1834@swordfish> <20160128081313.GB31266@X58A-UD3R> <20160128104137.GA610@swordfish> <20160128105342.GB610@swordfish> <20160128154257.GA564@swordfish> <56AA9F63.9070600@hurleysoftware.com> <20160129002703.GA4820@swordfish> <20160129065407.GE31266@X58A-UD3R> <20160129071330.GH4820@swordfish> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160129071330.GH4820@swordfish> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 29, 2016 at 04:13:30PM +0900, Sergey Senozhatsky wrote: > On (01/29/16 15:54), Byungchul Park wrote: > > On Fri, Jan 29, 2016 at 09:27:03AM +0900, Sergey Senozhatsky wrote: > > > > > > well, the stack is surely limited, but on every > > > spin_dump()->spin_lock() recursive call it does another > > > round of > > > > > > u64 loops = loops_per_jiffy * HZ; > > > > > > for (i = 0; i < loops; i++) { > > > if (arch_spin_trylock(&lock->raw_lock)) ^^^ this is a trylock. > > > return; > > > __delay(1); > > > } > > > > > > so if you have 1000 spin_dump()->spin_lock() then, well, > > > something has been holding the lock for '1000 * loops_per_jiffy * HZ'. > > > > Or the printk() is heavily called and the lock is congested. > > well, isn't it the case that ticket-based locking assumes at least > some sort of fairness? how many cpus do you have there? you can It's true for a congestion between arch_spin_lock()s, not trylock(). And I cannot remember how many online cpus there are, since I frequently change the number. Sorry. But the range is from 2 to 4. > have `num_online_cpus() - 1' tasks spinning on the spin lock and > 1 owning the spin lock... if your lock is in correct state (no > before/after spinlock debug errors) even most unlucky task should > get the lock eventually... > > -ss