On Wed, 2022-06-29 at 16:19 -0700, Kalesh Singh wrote: > On Wed, Jun 29, 2022 at 4:02 PM Jason A. Donenfeld <ja...@zx2c4.com> wrote: > > On Wed, Jun 29, 2022 at 03:26:33PM -0700, Kalesh Singh wrote: > > > Thanks for taking a look. I'm concerned holding the sys/power/state > > > open would have unintentional side effects. Adding the > > > /sys/power/userspace_autosuspender seems more appropriate. We don't > > > have a use case for the refcounting, so would prefer the simpler > > > writing '0' / '1' to toggle semantics. > > > > Alright. So I've cooked you up some code that you can submit, since I > > assume based on Christoph's bristliness that he won't do so. The below > > adds /sys/power/pm_userspace_autosleeper, which you can write a 0 or a 1 > > into, and fixes up wireguard and random.c to use it. The code is > > untested, but should generally be the correct thing, I think. > > > > So in order of operations: > > > > 1. You write a patch for SystemSuspend.cpp and post it on Gerrit. > > > > 2. You take the diff below, clean it up or bikeshed the naming a bit or > > do whatever there, and submit it to Rafael's PM tree, including as a > > `Link: ...` this thread and the Gerrit link. > > > > 3. When/if Rafael accepts the patch, you submit the Gerrit CL. > > > > 4. When both have landed, Christoph moves forward with his > > CONFIG_ANDROID removal. > > > > Does that seem like a reasonable way forward? > > Sounds like a plan. I'll clean up and repost your patch once the > Gerrit change is ready.
trivial note: > > diff --git a/kernel/power/main.c b/kernel/power/main.c [] > > @@ -120,6 +120,23 @@ static ssize_t pm_async_store(struct kobject *kobj, > > struct kobj_attribute *attr, > > > > power_attr(pm_async); > > > > +bool pm_userspace_autosleeper_enabled; > > + > > +static ssize_t pm_userspace_autosleeper_show(struct kobject *kobj, > > + struct kobj_attribute *attr, char *buf) > > +{ > > + return sprintf(buf, "%d\n", pm_userspace_autosleeper_enabled); This should use sysfs_emit no?