From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759880AbYG1V6Y (ORCPT ); Mon, 28 Jul 2008 17:58:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752188AbYG1V6Q (ORCPT ); Mon, 28 Jul 2008 17:58:16 -0400 Received: from www.tglx.de ([62.245.132.106]:60006 "EHLO www.tglx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbYG1V6P (ORCPT ); Mon, 28 Jul 2008 17:58:15 -0400 Date: Mon, 28 Jul 2008 23:51:45 +0200 (CEST) From: Thomas Gleixner To: Andi Kleen cc: Linus Torvalds , Andrew Morton , LKML , Ingo Molnar , Dhaval Giani , Venkatesch Pallipadi , Len Brown Subject: Re: [PATCH] ACPI/CPUIDLE: prevent setting pm_idle to NULL In-Reply-To: <20080728195324.GE30344@one.firstfloor.org> Message-ID: References: <20080728174644.GC30344@one.firstfloor.org> <20080728195324.GE30344@one.firstfloor.org> User-Agent: Alpine 1.10 (LFD 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 28 Jul 2008, Andi Kleen wrote: > > The problem here is that the acpi/cpuidle code can be in a state where > > the _save/old variables _ARE_ NULL because they had not been > > initialized with the original pm_idle before the module is removed or > > the cst state changes. So all we have to do is to prevent pm_idle to > > be set to NULL. > > It still seems wrong to me to fall back to the cpuidle idle function > instead of the earlier idle function just because cpuidle was loaded > in a weird way. WTF are you talking about ? pm_idle_save is initialized with pm_idle (the original idle function selected by the arch code). When CST changes or the acpi/cpuidle modules are removed we need to restore the original pm_idle function from pm_idle_save. When pm_idle_save was not initialized, which can happen, then we wrote NULL to pm_idle, which is obviously wrong. We simply want to avoid that we write NULL into pm_idle. That's all what the patch does. Nothing else. This problem was hidden by the magic if (!pm_idle) pm_idle = default_idle; in the arch/x86 code which was removed when I refactored the pm_idle initialization code. Just get it. That "if (!pm_idle)" check in the arch code was just papering over the fact that the acpi code set pm_idle to NULL under certain conditions. Thanks, tglx