From owner-freebsd-stable@FreeBSD.ORG Fri Jun 11 12:25:10 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 10158106567D; Fri, 11 Jun 2010 12:25:10 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CF27C8FC0C; Fri, 11 Jun 2010 12:25:09 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 7EA1D46C2F; Fri, 11 Jun 2010 08:25:09 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 998938A04F; Fri, 11 Jun 2010 08:25:08 -0400 (EDT) From: John Baldwin To: Giovanni Trematerra Date: Fri, 11 Jun 2010 08:18:27 -0400 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201006110818.27366.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Fri, 11 Jun 2010 08:25:08 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.8 required=4.2 tests=AWL,BAYES_00,URIBL_SBL autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: freebsd-stable , David DEMELIER , avg@freebsd.org, Attilio Rao , Brandon Gooch , kib@freebsd.org, Rui Paulo , jkim@freebsd.org Subject: Re: Kernel panic when unpluggin AC adaptor X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Jun 2010 12:25:10 -0000 On Friday 11 June 2010 6:27:48 am Giovanni Trematerra wrote: > On Thu, Jun 10, 2010 at 10:58 PM, Giovanni Trematerra > wrote: > > On Tue, May 4, 2010 at 6:35 PM, David DEMELIER wrote: > >> Good news ! It worked, check the picture here : > >> > >> http://img63.imageshack.us/img63/4244/dsc00361g.jpg > >> > > > > Into the file sys/dev/acpica/acpi_cpu.c at the end of acpi_cpu_notify > > (a per cpu notification handler), called when _CST objects changing, > > global cpu_cx_count is set to the greatest value of all sc->cpu_cx_count > > per-cpu variables. That could result in a panic as David reported, > > because that lets to invoke acpi_cpu_global_cx_lowest_sysctl from > > /etc/rc.d/power_profile, when AC adapter is unplugged, with a value > > that not all the CPUs could handle in the acpi_cpu_idle. > > The patch also change global cpu_cx_lowest according to new value of > > global cpu_cx_count if needed. > > > > David Demelier made a great work to test every patch I sent him > > to identify the source of the problem. > > > > Please, let me know your comments and possibly commit the patch > > if you think is good enough. > > As jhb@ pointed me out in private with the previous patch a CPU could > never enter in the > lowest Cx-state even if it gained. > So I'd like to propose this new solution. > When hw.acpi.cpu.cx_lowest sysctl is set, the global handler in > sys/dev/acpi_cpu.c > will set the greatest sc->cpu_cx_lowest value supported by the CPU and > not the same > value for all CPUs. > Later, when CPU, possibly gain new Cx-states, the acpi_cpu_notify > handler will set > sc->cpu_cx_lowest accordingly with global cx_lowest and the Cx-states > supported by > the CPU. > > Now I think that /etc/rc.d/power_profile script has a problem but that > is a different story. > The script select the lowest_value only querying cx-states of the dev.cpu.0. > If different CPUs may have different Cx-states, the script should use > as lowest_value the > lowest value between all the CPUs. Yes. > Please, let me know your comments and possibly commit the patch > if you think is good enough. I think this is a good compromise for now. -- John Baldwin