From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Johannes Berg <johannes@sipsolutions.net>,
Marcel Holtmann <marcel@holtmann.org>,
"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
Ian Molton <ian.molton@collabora.co.uk>,
linux-acpi@vger.kernel.org,
Corentin Chary <corentincj@iksaif.net>
Subject: Re: rfkill: persistent device suspend/resume
Date: Sat, 28 Nov 2009 15:32:24 +0000 [thread overview]
Message-ID: <4B114288.2000409@tuffmail.co.uk> (raw)
In-Reply-To: <20091128124158.GB17373@khazad-dum.debian.net>
Henrique de Moraes Holschuh wrote:
> On Thu, 18 Jun 2009, Henrique de Moraes Holschuh wrote:
>
>>> The setting of the "persistent" flag is also made more explicit using
>>> a new rfkill_init_sw_state() function, instead of special-casing
>>> rfkill_set_sw_state() when it is called before registration.
>>>
>>> Suspend is a bit of a corner case so we try to get away without adding
>>> another hack to rfkill-input - it's going to be removed soon.
>>> If the state does change over suspend, users will simply have to prod
>>> rfkill-input twice in order to toggle the state.
>>>
>
> Well, I acked it, but I didn't do my job properly and didn't notice the
> above.
>
> Suspend/resume is not much of a corner case at all: unless overriden by
> some weird policy that doesn't even exist right now (the only one that comes
> to mind is to have it always off upon resume in highly-critical
> environments), we really want to restore the hardware to the previous soft
> state, subject to any changes on any hard state that happened while the
> machine was sleeping.
>
> And any "weird policy" we might implement would have to come through the
> core anyway. So, we really should be taking advantage of the fact that the
> rfkill class will resume *after* the device, and let the core call the
> backend (unconditionally, so it is also a way to make sure the
> firmware/hardware is in sync with the core) to set the proper state after a
> resume.
>
> The backend will be able to update any hard states before the rfkill class
> resume code runs, so this will always work fine. It also allows the
> backend driver to ask the platform to resume with radios disabled, so that
> if we _ever_ decide to change the core to have a different policy to what
> should be done to radios on resume (e.g. leave them off and wait for
> userspace to tell us what to do :) ), that will need no change to drivers
> (and radios won't get turned on just to be turned off, etc).
>
> It will also let us remove a few LOC from eeepc-laptop and avoid adding a
> few LOC to thinkpad-acpi (which has a regression since 2.6.30 because failed
> to notice I would have to handle resume).
>
> What do you guys think? I will cook up a patch to implement the above, but
> if there are any objections to the idea, I'd like to hear it ASAP, as I do
> have a regression to fix :)
>
> Note: eeepc-laptop and thinkpad-acpi are the only rfkill persistent devices
> in-tree
"Suspend/resume is not much of a corner case at all"
Sorry for my naff patch description. The actual corner case is when the
soft rfkill state changes between when we suspend and resume.
"we really want to restore the hardware to the previous soft state"
Context warning: this only affects "persistent" rfkill devices. We
currently do this for everything except thinkpad-acpi and eeepc-laptop.
Blame Marcel, the current choice was his suggestion :). I think his
argument was that restoring the state could impose policy, and that this
would be bad. I didn't resist too hard because his principle provides a
marginal feature in eeepc-laptop.
[That said, I later noticed that it speeds up resume from s2ram.
eeepc-laptop is 'special'; its WLDS method takes a whole second to run.]
To elaborate:
The state in NV-ram may be changed deliberately. On eeepc-laptop, you
can change it in the BIOS setup screen - and then resume from
hibernation. Marcel suggests that overriding this change would be a
policy decision, which userspace should be able to control. The simplest
way to do so is to simply preserve the state (and emit an event to
notify userspace of the change).
I thought thinkpad-acpi might also allow such changes. At least for some
controls, the BIOS defaults to implementing them itself, right? Even if
this isn't true for rfkill on the thinkpad, it's a possibility we may
encounter in future. Imagine a system where this happens:
- hibernate
- boot resume kernel
- user presses rfkill key -> BIOS toggles the rfkill state
- load kernel from hibernation image
- rfkill resume now unconditionally overrides the rfkill state
So your suggestion forces users to accept corner case behaviour like
this. Marcel's position appears to come from writing a userspace daemon
which provides persistent state for all rfkill devices. That is, if we
want to keep in-kernel handling of persistent state in the long run, we
have to justify it by addressing the corner cases which only the kernel
can solve.
rfkill-input is scheduled for removal in anticipation of rfkilld. If you
want to schedule removal of persistent rfkill devices in anticipation of
"rfkilld with persistence", that would seem just as reasonable :-p. I'm
sure Johannes would then accept the small change to the rfkill core to
fix this regression.
Alan
next prev parent reply other threads:[~2009-11-28 15:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-16 13:53 [PATCH 2/4] rfkill: don't restore software blocked state on persistent devices Alan Jenkins
2009-06-16 14:14 ` Johannes Berg
2009-06-16 14:39 ` [PATCHv2 " Alan Jenkins
2009-06-16 15:37 ` Marcel Holtmann
2009-06-18 3:08 ` Henrique de Moraes Holschuh
2009-11-28 12:41 ` rfkill: persistent device suspend/resume Henrique de Moraes Holschuh
2009-11-28 13:12 ` Johannes Berg
2009-11-28 13:27 ` Henrique de Moraes Holschuh
2009-11-28 13:39 ` Johannes Berg
2009-11-28 17:17 ` Henrique de Moraes Holschuh
2009-11-28 15:32 ` Alan Jenkins [this message]
2009-11-28 16:42 ` Henrique de Moraes Holschuh
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=4B114288.2000409@tuffmail.co.uk \
--to=alan-jenkins@tuffmail.co.uk \
--cc=corentincj@iksaif.net \
--cc=hmh@hmh.eng.br \
--cc=ian.molton@collabora.co.uk \
--cc=johannes@sipsolutions.net \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=marcel@holtmann.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;
as well as URLs for NNTP newsgroup(s).