From owner-freebsd-arch@FreeBSD.ORG Wed Jun 6 19:03:44 2012 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3B7FA106564A; Wed, 6 Jun 2012 19:03:44 +0000 (UTC) (envelope-from iwasaki@jp.FreeBSD.org) Received: from locore.org (ns01.locore.org [218.45.21.227]) by mx1.freebsd.org (Postfix) with ESMTP id DCF5F8FC0A; Wed, 6 Jun 2012 19:03:43 +0000 (UTC) Received: from localhost (celeron.v4.locore.org [192.168.0.10]) by locore.org (8.14.5/8.14.5/iwasaki) with ESMTP/inet id q56J3gH9050606; Thu, 7 Jun 2012 04:03:42 +0900 (JST) (envelope-from iwasaki@jp.FreeBSD.org) Date: Thu, 07 Jun 2012 04:03:42 +0900 (JST) Message-Id: <20120607.040342.73368798.iwasaki@jp.FreeBSD.org> To: avg@FreeBSD.org From: Mitsuru IWASAKI In-Reply-To: <4FCBBEDD.5000604@FreeBSD.org> References: <4FCB0FE5.4050607@FreeBSD.org> <20120603.234243.28389486.iwasaki@jp.FreeBSD.org> <4FCBBEDD.5000604@FreeBSD.org> X-Mailer: Mew version 3.3 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: attilio@FreeBSD.org, freebsd-acpi@FreeBSD.org, freebsd-arch@FreeBSD.org Subject: Re: cpu stopping X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 19:03:44 -0000 Hi, I've created the patches of experimental implementation based on discussion so far. http://people.freebsd.org/~iwasaki/acpi/cpustop_hook-20120606.diff In acpi_wakeup.c, cpususpend_handler() and susppcbs are replaced with cpustop_handler() and stoppcbs. This is for RELENG_9 and only for i386 but I think it's enough for the start. From: Andriy Gapon Subject: Re: cpu stopping Date: Sun, 03 Jun 2012 22:45:33 +0300 Message-ID: <4FCBBEDD.5000604@FreeBSD.org> > > Never mind :) What I'm trying to do in the patches is just to unify > > amd64/i386 independent part (acpi_wakeup.c) for the code maintenance, > > so please let's commit it first, then start re-design the > > cpususpend_handler(). > > In no way I am trying to delay your work :) > Just shared my view on the design of cpu stopping code. I got it :) > >> My view of how this should work is: > >> - there can be only one master CPU that controls all other (slave) CPUs > >> - the master sets entry and exit hooks > > > > Entry hook for suspending might be > > ---- > > ctx_fpusave(suspfpusave[cpu]); > > wbinvd(); > > CPU_SET_ATOMIC(cpu, &stopped_cpus); > > ---- > > > > and for stopping is > > ---- > > /* Indicate that we are stopped */ > > CPU_SET_ATOMIC(cpu, &stopped_cpus); > > ---- > > > > Correct? > > Yes. The only nit is that CPU_SET_ATOMIC(cpu, &stopped_cpus) could be part of > the wait loop prologue. No need to duplicate it in each hook. OK, I did so. I hope the patch is not far from your idea. Thanks!