From: Nigel Cunningham <ncunningham-jjFNsPSvq+iXDw4h08c5KA@public.gmane.org>
To: Li Shaohua <shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: ACPI-DEV
<acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Pavel Machek <pavel-AlSwsSmVLrQ@public.gmane.org>
Subject: Re: RFC 0/4: make ACPI interpret safe for suspend/resume
Date: Wed, 19 Jan 2005 18:21:30 +1100 [thread overview]
Message-ID: <1106119290.3168.7.camel@nigelcunningham> (raw)
In-Reply-To: <1106104620.12957.270.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
Hi.
On Wed, 2005-01-19 at 14:17, Li Shaohua wrote:
> Hi,
> I'm sending the patches not for merging but for comments. We currently
> encounter a big issue for suspend/resume. I take S3 for an example, but
> S4 (or S4BIOS) is the same. The detail is:
> 1. PCI link device acts as a sysdev, that means its .resume method will
> be executed with IRQ disabled. The .resume method will invoke ACPI _SRS
> method, and possibly execute any AML code. The log (at the bottom of the
> email) is a failure case caused by this issue.
> 2. Current suspend/resume code will freeze all processes first and then
> start doing suspend/resume. SO 'acpi_pm_prepare', 'acpi_pm_enter' and
> acpi_pm_finish' will be invoked with other processes are frozen. The 3
> (at least the first and the last ones) will enter ACPI interpret. ACPI
> interpret actually will do memory allocating, semaphore handling,
> sleeping and memory mapping, the actual actions depend on BIOS. Consider
> one case: if a user process acquire an ACPI semaphore but sleep after
> suspend, and 'acpi_pm_finish' requires the semaphore, we will have
> terrible deadlock.
I'm not sure that there should be any problem here: processes should
drop semaphores before entering the signal handler on the way to the
freezer, shouldn't they? Have any freezes been observed relating to
these calls?
> Case 1 actually isn't severe, I basically think we should remove the PCI
> link device suspend/resume code if all PCI driver suspend/resume code
> call 'pci_enable_device', which will call acpi_pci_irq_enable' and do
> the same thing like the link device resume code. So case 1 actually is
> similar with case 2.
>
> Changing ACPI interpret is impossible, since it includes too many code.
> Fortunately, all OS dependent code of ACPI interpret is in osl.c, below
> patches try to change osl.c and make ACPI interpret safe.
> patch 1: introduce a new system state to shadow 'might_sleep' complain.
Pavel knows far better than me here, so I will leave it to him to
comment.
> patch 2: solve the memory allocating issue. we suspend only if there is
> enough free memory.
This one shouldn't be a problem either. Pavel, do you still have the
half-of-memory limit? It is certainly redundant in my case - I already
make sure the number of available pages is much higher than 100.
> patch 3: solve the acpi_os_sleep issue.
Does this interact with the recent patches for the pic suspend/resume
code? If so, how?
> patch 4: solve the semaphore issue. We track the semaphore usage of
> ACPICA, and suspend wait till all semaphroes are free.
> Unresolved issue is 'acpi_os_memory_mapping' and 'acpi_os_read_memory'.
> We possibly must introduce new memory APIs, which will be something like
> 'atomic_vmap'.
(See above)
> The principle here is we can tolerate suspend failure but we can't
> tolerate resume failure. I did test the patches but they are not
> matured. Comments and suggestions will be welcome!
Hope mine are helpful.
> Thanks,
> Shaohua
>
> P.S. Did anybody know why we should freeze all processes for S3 and
> S4BIOS? I checked FreeBSD code, it doesn't. I know it's safer, but if
> all device drivers can freeze request to them, it's possibly not
> required to me.
I'll leave this one for Pavel too.
Nigel
--
Nigel Cunningham
Software Engineer
Cyclades Corporation
http://cyclades.com
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
next prev parent reply other threads:[~2005-01-19 7:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-19 3:17 RFC 0/4: make ACPI interpret safe for suspend/resume Li Shaohua
[not found] ` <1106104620.12957.270.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2005-01-19 7:21 ` Nigel Cunningham [this message]
2005-01-19 7:55 ` Li Shaohua
2005-01-19 10:18 ` Pavel Machek
[not found] ` <20050119101858.GE25623-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2005-01-20 1:28 ` Li Shaohua
[not found] ` <1106184495.13181.68.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2005-01-20 9:12 ` Pavel Machek
[not found] ` <20050120091242.GB1452-I/5MKhXcvmPrBKCeMvbIDA@public.gmane.org>
2005-01-20 9:26 ` Li Shaohua
[not found] ` <1106213207.16186.10.camel-U5EdaLXB8smDugQYiPIPGdh3ngVCH38I@public.gmane.org>
2005-01-20 9:40 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1106119290.3168.7.camel@nigelcunningham \
--to=ncunningham-jjfnspsvq+ixdw4h08c5ka@public.gmane.org \
--cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
--cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=pavel-AlSwsSmVLrQ@public.gmane.org \
--cc=shaohua.li-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox