From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753621AbcBORSX (ORCPT ); Mon, 15 Feb 2016 12:18:23 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:34622 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751571AbcBORST (ORCPT ); Mon, 15 Feb 2016 12:18:19 -0500 Date: Mon, 15 Feb 2016 18:18:45 +0100 From: Daniel Vetter To: Peter Zijlstra Cc: Joonas Lahtinen , "Gautham R. Shenoy" , Intel graphics driver community testing & development , Linux kernel development , David Hildenbrand , "Paul E. McKenney" , Ingo Molnar Subject: Re: [Intel-gfx] [PATCH] [RFC] kernel/cpu: Use lockref for online CPU reference counting Message-ID: <20160215171845.GZ11240@phenom.ffwll.local> Mail-Followup-To: Peter Zijlstra , Joonas Lahtinen , "Gautham R. Shenoy" , Intel graphics driver community testing & development , Linux kernel development , David Hildenbrand , "Paul E. McKenney" , Ingo Molnar References: <1455539803-13913-1-git-send-email-joonas.lahtinen@linux.intel.com> <20160215141755.GG6357@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160215141755.GG6357@twins.programming.kicks-ass.net> X-Operating-System: Linux phenom 4.3.0-1-amd64 User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 15, 2016 at 03:17:55PM +0100, Peter Zijlstra wrote: > On Mon, Feb 15, 2016 at 02:36:43PM +0200, Joonas Lahtinen wrote: > > Instead of implementing a custom locked reference counting, use lockref. > > > > Current implementation leads to a deadlock splat on Intel SKL platforms > > when lockdep debugging is enabled. > > > > This is due to few of CPUfreq drivers (including Intel P-state) having this; > > policy->rwsem is locked during driver initialization and the functions called > > during init that actually apply CPU limits use get_online_cpus (because they > > have other calling paths too), which will briefly lock cpu_hotplug.lock to > > increase cpu_hotplug.refcount. > > > > On later calling path, when doing a suspend, when cpu_hotplug_begin() is called > > in disable_nonboot_cpus(), callbacks to CPUfreq functions get called after, > > which will lock policy->rwsem and cpu_hotplug.lock is already held by > > cpu_hotplug_begin() and we do have a potential deadlock scenario reported by > > our CI system (though it is a very unlikely one). See the Bugzilla link for more > > details. > > I've been meaning to change the thing into a percpu-rwsem, I just > haven't had time to look into the lockdep splat that generated. I've thrown Joonas patch into a local topic branch to shut up the noise in our CI, and it seems to be effective at that (2 runs thus far). I'll drop this again once we have a proper solution (whatever it'll be) upstream. Cheers, Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch