From owner-freebsd-acpi@FreeBSD.ORG Mon Jul 9 15:06:17 2012 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD0F8106564A; Mon, 9 Jul 2012 15:06:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 838FB8FC16; Mon, 9 Jul 2012 15:06:17 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id E6508B98B; Mon, 9 Jul 2012 11:06:16 -0400 (EDT) From: John Baldwin To: freebsd-acpi@freebsd.org Date: Mon, 9 Jul 2012 08:38:05 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <4FF96357.1030601@FreeBSD.org> In-Reply-To: <4FF96357.1030601@FreeBSD.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201207090838.05245.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 09 Jul 2012 11:06:17 -0400 (EDT) Cc: Andriy Gapon Subject: Re: safe acpi_cpu_idle disabling X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Jul 2012 15:06:17 -0000 On Sunday, July 08, 2012 6:39:19 am Andriy Gapon wrote: > > I would like to propose the following patch for your review: > http://people.freebsd.org/~avg/acpi_cpu_disable_idle.diff > > The main purpose of this change is to provide safe interaction between > acpi_cpu_idle and dynamic C-state changes by disabling acpi_cpu_idle while > C-state data is updated. > > If my understanding is correct, currently there is no mutual protection between > acpi_cpu_idle code and acpi_cpu_cx_cst. The code more or less works by never > cleaning up old C-state data, so it is still accessible while the two functions > have incoherent views. There still could be problems when acpi_cpu_idle expects > C-state data at certain index to belong to one type while acpi_cpu_cx_cst > changes it to a different type. > > P.S. I think that cpu_disable_idle should be made per-CPU (go to acpi_cpu softc). I don't think you need the locking, I think all you need to add is the smp_rendezvous() call. The IPI mechanism has sufficient membar's already, and the smp_rendezvous() function itself will not return to the caller until all the CPUs can see the write to disable idling. -- John Baldwin