Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424452AbWKPU1Z (ORCPT ); Thu, 16 Nov 2006 15:27:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1423801AbWKPU1Z (ORCPT ); Thu, 16 Nov 2006 15:27:25 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:40645 "HELO iolanthe.rowland.org") by vger.kernel.org with SMTP id S1424452AbWKPU1Z (ORCPT ); Thu, 16 Nov 2006 15:27:25 -0500 Date: Thu, 16 Nov 2006 15:27:23 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Thomas Gleixner cc: LKML , Linus Torvalds , john stultz , Ingo Molnar , David Miller , Arjan van de Ven , Andrew Morton , Andi Kleen Subject: Re: BUG: cpufreq notification broken In-Reply-To: <1163707250.10333.24.camel@localhost.localdomain> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2020 Lines: 47 On Thu, 16 Nov 2006, Thomas Gleixner wrote: > [PATCH] cpufreq: make the transition_notifier chain use SRCU > (b4dfdbb3c707474a2254c5b4d7e62be31a4b7da9) > > breaks cpu frequency notification users, which register the callback on > core_init level. Interestingly enough the registration survives the > uninitialized head, but the registered user is lost by: > > static int __init init_cpufreq_transition_notifier_list(void) > { > srcu_init_notifier_head(&cpufreq_transition_notifier_list); > return 0; > } > core_initcall(init_cpufreq_transition_notifier_list); > > This affects i386, x86_64 and sparc64 AFAICT, which call > register_notifier early in the arch code. > > > The head of the notifier chain needs to be initialized before use; > > this is done by an __init routine at core_initcall time. If this turns > > out not to be a good choice, it can easily be changed. > > Hmm, there are no static initializers for srcu and the only way to fix > this up is to move the arch calls to postcore_init. If you can find a way to invoke init_cpufreq_transition_notifier_list earlier than core_initcall time, that would be okay. I did it this way because it was easiest, but earlier should be just as good. The only requirement is that alloc_percpu() has to be working, so that the SRCU per-cpu data values can be set up. I don't know how early in the boot process you can do per-cpu memory allocation. As an alternative approach, initialization of srcu_notifiers could be broken up into two pieces, one of which could be done statically. The part that has to be done dynamically (the SRCU initialization) wouldn't mess up the notifier chain. Provided the dynamic part is carried out while the system is still single-threaded, it would be safe. Alan Stern - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/