Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

porting to Marlin / sailfish #1

Open
nine7nine opened this issue Oct 31, 2017 · 11 comments
Open

porting to Marlin / sailfish #1

nine7nine opened this issue Oct 31, 2017 · 11 comments

Comments

@nine7nine
Copy link

hi,

sorry for the noise, but; I'm interested in getting your dynamic stune boost && vox populi code running on Sailfish (google pixel 1St gen)....

I've been able to get everything in the kernel running, including cpu-boost + dynamic stune boost, but currently /dev/stune/top-app/stune.boost is defaulting to 50 (?)... /sys/module/cpu_boost/parameters/dynamic_stune_boost = 10. .. but that value seems to be ignored...

I'm at a bit of a loss as to why that is?. ... or where it is getting the value of 50 from?

i'm wondering if there would be a way to hardcode the value to 10?

also, i am curious if any progress has been made on creating a flashable zip for vox populi?

OR is it safe to use your prebuilts for vox populi on my stock pixel rom?

any advice you may have would be incredibly useful and appreciated. thx

@joshchoo
Copy link
Member

joshchoo commented Oct 31, 2017

Hi @nine7nine!

Dynamic stune boost and Vox Populi works differently and cannot co-exist atm.
The Pixel achieves its touch boost via a Power HAL (in /system/lib64/hw/power.*.so if I recall correctly). Vox Populi is an alternative customizable Power HAL that is meant to be used as a replacement. We have not yet created a flashable zip for it, but will do so when we are less busy.

While a Power HAL is a userspace solution (ie. Android OS/frameworks controls it), Dynamic Stune Boost/Cpu-boost is a kernel solution (ie controlled by the Android kernel alone). They cannot co-exist because they can't coordinate between each other. The likely reason why Dynamic Stune Boost doesn't seem to be working is because the Pixel hardcoded the stune boost of 50 in its Power HAL. The only way to use Dynamic Stune Boost is to disable the Power HAL by removing the relevant *.so blob or disabling the perfd service (type "stop perfd" in terminal), which acts on behalf of the Power HAL to toggle the stune boost value.

For now you can try disabling perfd in terminal or Ex-Kernel Manager (or other apps), then see if dynamic stune boost does anything and let me know. The downside of disabling perfd (halting Power HAL boosting) is that it handles other kinds of boost besides touch boost. It's important for boosting freqs to max on app launches, providing sustained boosts for certain apps such as VR apps and some camera apps, and other things. But you do sacrifice the convenience of customisability if you go with perfd. Give dynamic stune boost a try and see if it works out for you.

I do not recommend using prebuilts of Vox Populi on Pixel because it has not yet been updated for Oreo (not binderized yet). If you track this repo, you'll get an alert when I've updated it hopefully in November.

@nine7nine
Copy link
Author

Hey! thanks for the in-depth reply. You've been very helpful 😁

I can verify that disabling perfd fixes the issue, it now is setting the proper value. I couldn't figure out where the value of 50 came from, so your explanation has helped me better understand the relationship between the power Hal, vox populi and dynamic stune boost. awesome... I'll just add disabling perfd to my custom init for my kernel / in anykernel2... I'm still learning about AES and Schedutil, although I do have years of experience maintainingkernel packages (for archlinux), patching and porting... but mostly with linux-rt... android is more linux-like than linux. lol

anyhoo, I'll need to test this for 24hrs or so, to see how things stack up. but I'm hopeful... and clearly my porting effort to sailfish has been successful. your branch for the OP5 has been incredibly helpful, I was able to pull a ton of code, on top of most of the EAS stuff that was kicking around for Sailfish already, in my branch, gathered from elsewhere.

I'll let you know how things turn out. thanks again!

@nine7nine
Copy link
Author

Update:

So for the most part, everything seems good on my kernel, but I did notice one use case where the input boost did seem to cause issue. Not sure If you can reproduce it or not.... I have this pro-audio music making app called "Beatonal" (Available in Play Store)... It's generally one of the more demanding apps (in terms of performance, low latency, processing) and I found with input boost enabled periodically:

The sound would cut out when using touch / manipulating some of the FX settings. In particular; I tend to set really long reverbs and delays/echoes (as it's cpu intensive) I found in this scenario - I would get the dropouts / freeze ups... I'm not sure if that is because of cpu frequency scaling/changes or something else - I may double check my configs against yours - maybe something pops out. idk. That said, with input boost disabled, but dynamic_stune_boost at 10 or 20 (and sched_cfs_boost at 10-20) - the app is smooth as can be, no clicks, pops or underruns (which is an improvement over the stock kernel with Sched)...

I'm still experimenting with scheduler tuneables, trying to figure out the best balanced settings (in general), I don't know if you have any insights on this (?) - any recommendations would be great! ... there doesn't seem to be a ton of documentation for Schedutil, although I've been able to get the basics. ... That said; overall, battery life has been great...

Also, on Oreo; The Power Hal seems to live in the system//vendor/lib64(and lib)/hw ... power.marlin.so ... there is also a power.default.so, as well. I haven't tried removing either. But out of curiousity, I may just to see if my device still boots - obviously there is still power hall spam in logcat. So I'm curious.

@nine7nine
Copy link
Author

removing power.marlin.so works / boots fine - no spam in logcat

@joshchoo
Copy link
Member

joshchoo commented Nov 1, 2017 via email

@nine7nine
Copy link
Author

I wonder though; leaving the power Hal. so in; does that cause any issue, aaside from a ton of log spam?

Ya, I maintained PREEMP_RT linux packages for several years, same goes with the nvidia binary drivers (which I use to hack on a bit too). I maintained and contributed some other packages to Archlinux, as well.... handed them to a friend to maintain now. some other FOSS contributions, as well. I'm not a great programmer, but I can fix bugs, compiler issues, etc and occasionally, I come up with good ideas. lol

I will for sure let you know how things progress for sure. So far, it's just been the input boost that caused an issue, but I did change some configs, so I'll give it another go... see what happens.

I'm following your github now too. ttyl

@joshchoo
Copy link
Member

joshchoo commented Nov 2, 2017

Nothing critical will happen. It's just that log spam would cause some overhead.
I think it's more important to be able to spot the issues like you do :)
Thanks for the follow man

@nine7nine
Copy link
Author

Hey Josh! (I'm Jordan, btw)

Ya, I figured it was just spam overhead - I'm been using it without power.marlin.so for a bit now and I do like the lack of spam - as I am in logcat a lot. (as an aside, I also pulled a bunch of fixes from Code Aurora for msm-3.18, which is cleaning up logs, as well. No idea why Google is so lazy about kernel updates)...

I can't be positive, but I think the input boost issue might be to do with a config that is (and must be set differently) than your kernel. my 3.18 kernel has RCU backported from 4.9... It was reccomended to use RCU Boost and RT prio 1 for rcu kthread (to avoid priority inversion), I did set it like you did (taken from the Pixel 2 confgi, IIRC?), but my kernel did NOT like that and Logcat showed some complaints.... Not sure if the two correlate or not - but i haven't noticed any problems with my RCU setup, nor keeping input boost disabled (for now).

Now, probz on thefollow, like I said; you've been very helpful and I've been using code pulled from your OP5 kernel. So it's been a win win, I think ;)

@nine7nine
Copy link
Author

This is a curiosity, but;

Have you considered also making /proc/sys/kernel/sched_cfs_boost, be dynamically set too?

The documentation suggests that this (*system wide) tunable is used to bias energy efficiency VS. performance (for all tasks, then?)... I wonder if it could be adapted to just bias the top-app?

I may be a bit ignorant on how this tunable works / cgroups / boosting... I assume you have a better understanding than I, So i thought that I'd ask. (?)

have a good one!

PS: I have a few people testing my kernel, So I should have some progress to report later on / in the week. ttyl

@RenderBroken
Copy link
Member

RenderBroken commented Nov 2, 2017 via email

@nine7nine
Copy link
Author

Hey Zacharia,

Your simplified explanation makes perfect sense to me, Thanks for jumping in and explaining it!

IIRC, like the Pixel 1 has cpusets something like this;

bg 0
sys-bg 0-2
fg 0-2
ta 0-3

...mind you, we have a few less cores to work with...
and I have to double check.

anyhoo, I appreciate your insights. thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants