From owner-freebsd-acpi@FreeBSD.ORG Sat Jun 2 21:39:19 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 CB366106566B for ; Sat, 2 Jun 2012 21:39:19 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4B8CD8FC12 for ; Sat, 2 Jun 2012 21:39:19 +0000 (UTC) Received: by lbon10 with SMTP id n10so3056711lbo.13 for ; Sat, 02 Jun 2012 14:39:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=O0Ran4sjHzTmQznzGHpZkgWdTRkqJqKTG+I0EJPNzPc=; b=qcNMvj9x4k8qtbBV+gio/jIJ3Dpp5AmlXsSqkATGbGnj7MAoEoOIbxyFu/g5OW2Evt hfHTjBZ+g+XFYwxki6wiYY3SxGqKJbKo95sysvRHb0dnT6oiaN3NAmWidWPlL/bn3Zwi ytDiEdFJvVyADu+xurkj8rUvucj7g9a0VYNYkbUkEe5iObo2QOF1NZpMvp8l87EcNRFs npe9VwvKN1wS4J8rvxStvT6rlpV1SIrL1cbRV1mZXRNO3L54p7ALzL4NnU+GLJku+cb7 pYj/4YLWMRbkzS90m7MxiCVoX7FSSt+56nofgmzAWmQKUM6Pf2TiJ1zXjJRhsBhAicy9 uiBg== MIME-Version: 1.0 Received: by 10.152.104.171 with SMTP id gf11mr7618942lab.5.1338673158018; Sat, 02 Jun 2012 14:39:18 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.27.65 with HTTP; Sat, 2 Jun 2012 14:39:17 -0700 (PDT) In-Reply-To: <20120603.002554.119853142.iwasaki@jp.FreeBSD.org> References: <20120603.002554.119853142.iwasaki@jp.FreeBSD.org> Date: Sat, 2 Jun 2012 22:39:17 +0100 X-Google-Sender-Auth: QwEwbOF4BScMtq3EEwA-bienoyA Message-ID: From: Attilio Rao To: Mitsuru IWASAKI Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-acpi@freebsd.org Subject: Re: preparation for x86/acpica/acpi_wakeup.c 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: Sat, 02 Jun 2012 21:39:19 -0000 2012/6/2 Mitsuru IWASAKI : > Hi, > > Well I think we are ready to have x86/acpica/acpi_wakeup.c to share > acpi_sleep_machdep() and acpi_wakeup_machdep() between amd64 and i386. > > http://people.freebsd.org/~iwasaki/acpi/x86-acpi_wakeup-20120602.diff > > There are no functional changes. =C2=A0The following is major changes. > amd64: > - Add suspend/resume related members in PCB. > - Add suspendctx() in cpu_switch.S. > - acpi_switch.S moved into cpu_switch.S as resumectx(). > > amd64, i386: > - Add pcb_flags bit PCB_SUSPENDING to indicate AP is wakeup or not. I still didn't review your patch in detail, but I think PCB_SUSPENDING is not really the way it should be done. PCB datas are about the thread state on a particular CPU and the suspension of the CPU has not much to do with the thread state. It should be more a CPU state itself. This area is very weak in FreeBSD right now, however, but I will try to dump my thinking on it right now. The first thing to consider is that right now we only have 2 states for CPUs: started and stopped. These states are controlled by started_cpus and stopped_cpus masks respectively. It seems you really want to add an intermediate level among the 2 where you have: started -> suspended -> started -> suspended ... -> stopped and you need to expand the mechanism for dealing with started and stopped cpus to do that. I'm pretty sure this will be very helpful also for other architectures that want to do the same. This is however a larger patch and you want probabilly implement it in a second round of changes. For the moment dropping the paranoid check on PCB_SUPENDING is good enough in order to evaluate the merge of the amd64/i386. Attilio --=20 Peace can only be achieved by understanding - A. Einstein