Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Jun 2012 22:39:17 +0100
From:      Attilio Rao <attilio@freebsd.org>
To:        Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
Cc:        freebsd-acpi@freebsd.org
Subject:   Re: preparation for x86/acpica/acpi_wakeup.c
Message-ID:  <CAJ-FndAfm4_XqFSwBqXK=cgWkE6YVrtkS5BbcH7zcRd-100xTw@mail.gmail.com>
In-Reply-To: <20120603.002554.119853142.iwasaki@jp.FreeBSD.org>
References:  <20120603.002554.119853142.iwasaki@jp.FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2012/6/2 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>:
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-FndAfm4_XqFSwBqXK=cgWkE6YVrtkS5BbcH7zcRd-100xTw>