[Google Pixel 3 XL ROMs, Kernels, Recoveries, & Oth] Freak07:
Information about the Q merge and what it brings to the table

Hello guys and girls,

This time I decided to make this a separate post and see how it goes.

Google introduced quite a few changes with Q. I´ll try to break them a bit down so everyone hopefully has a better understanding. Since there are quite a few changes.

Not all of this changes result in changes that one does feel, but they increase stability, security and the up to "dateness" of the kernel!

Linux-Stable

Google updated the kernel to 4.9.153, which was released on January 26th!

This is a big leap forward.

For comparison: The February security update bumped linux-stable on the P kernel to 4.9.124, which was released in August 2018!

With the release of 2.1.0 my kernel will be on 4.9.163. But for a big OEM this jump is pretty good!

Removal of Safestack, but replacement with Shadow Call Stack

Safestack got entirely removed from the source (it was never enabled) as it was causing issues before the Pixel 3/XL was released.

With Q Google replaced this now with a method called Shadow Call Stack. This complements LTO and CFI, which is already built in to the kernel!

Here are a few interesting source to better understand CFI and LTO:

Readup 1 on CFI as well as readup 2 on CFI

Readup on LTO

Shadow Call Stack protects now additionally against return-oriented programming.

I like this development for more security!

Memory Management related changes

PSI

Google introduced a very interesting mechanism called PSI (=pressure stall information). They also introduced the PSI Monitor. The information collected there can be passed to the userspace low memory killer daemon.

This allows to detect memory contention/stalls more effectively than by vmpressure!

Unfortunately this needs rom side changes, so it will not work on PIE stock roms.

I managed to build a custom rom with support for PSI monitors and got it to work successfully. I think I will provide a patchset for ROM´s so we all might benefit from this change for the next months on PIE. No promises though. We´ll see how that goes too!

I can see a improvement as far as I can tell, but Google is still actively working on tuning psi pressure utilization correctly. I did my own bit of testing and can say it looks good!

Please don´t ask me for the ROM I won´t share it publicly.

Other memory related changes:

This patch allows pages to be freed without actually killing processes.

https://android.googlesource.com/kernel/msm/+/e48b0dd9cc1fa572455434357f5678018b3458b9

Take also a look at this:

https://lore.kernel.org/lkml/1465804259-29345-1-git-send-email-minchan@kernel.org/#r

This is only kernel dependant so everyone can benefit from it!

F2FS

Google gave f2fs a huge bump! My kernel had all this patches for a few months already :)

ZRAM-Writeback

The Q kernel supports ZRAM writeback now. It allows unused idle/huge ZRAM pages to be moved from ZRAM to the writeback device.

Quite from https://android.googlesource.com/kernel/msm/+/e8f29f0e2c1346bbf575f8210ebce73e6fd30a5a:

On zram-swap usecase, zram has usually many idle/huge swap pages.
It's pointless to keep in memory(ie, zram).

To solve the problem, this feature introduces idle/huge page
writeback to backing device so the goal is to save more memory
space on embedded system.

Sadly this needs rom side implementation and I haven´t got it to work yet. My priority was PSI until now. So this might change!

Removal of Speck encryption and addition of Adamantium encryption

This doesn´t affect us as adamantium encryption is meant for low end devices. Interesting nonetheless:

https://www.blog.google/technology/safety-security/adiantum-encryption-safer-devices/

Changes to display and touchscreen drivers

The most noticeable change is a smoother transition from very high brightness (googles own "not so very high" high brightness mode/compared to our built in high brightness modes) to high brightness (after disabling googles own high brightness mode).

UFS driver

Ability to monitor hardware health and improvements!

Fix a few more memory leaks