Linux Kernel changes in 5.x for i.MX users and developers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Linux Kernel changes in 5.x for i.MX users and developers

Linux Kernel changes in 5.x for i.MX users and developers

Overview

In this doc, I will try to give you a brief of the Linux kernel changes between 4.x and 5.4 (5.0/5.1/5.2/5.3/5.4), which related to i.MX users/developers:

  • Important bug fix and improvements according to my experiences
  • New features you should keep an eye on
  • Interfaces changes may impact applications
  • i.MX up-streaming

I cannot make sure every single change's description is 100% correct. Either, I cannot list all of the impacts to the i.MX platform due to my limited knowledge and experiences. I hope this doc can help you on developing kernel drivers, user applications or debugging issues of 5.x i.MX kernel release.

Changes

Subsystem/ModulesDetail changesCommentsReferences
Kernel Coresbinder: new binderfs, a pseudo-filesystem for the Android Binder IPC driver which can be mounted per-ipc namespace allowing to run multiple instances of AndroidHmm... that may imply we can run multi-instance Android without Hypervisor?
sysctl: add panic_print sysctl to configure which information to print at panic time, w/ replay option

So we can define the panic information for better debugging the crash issue. Also option for users to configure the "panic_print" to replay all dmesg in buffer, some of which they may have never seen due to the loglevel setting, which will help panic debugging

How to use
boot: Add boot option ( driver_async_probe=... ) to specify drivers to be async probedAsynchronous driver probing can help much on kernel fastboot, and this option can provide a flexible way to optimize and quickly verify async driver probe.

Asynchronous device/driver probing support [LWN.net] 

swiotlb: add debugfs to track swiotlb buffer usageThe device driver will not be able to do dma operations once swiotlb buffer is full, either because the driver is using so many IO TLB blocks inflight, or because there is memory leak issue in device driver. Export buffer usage in debugfs can help. Please note, almost all of the dma buffers on i.MX8 platform comes from swiotlb.

aarch64 Linux Kernel Memory Management 

New mount syscall APIThe kernel supports a wide variety of filesystem types, and each has its own, often extensive set of options. As a result, the mount() system call is complex. This makes application code who need mount FS more clear.

Six (or seven) new system calls for filesystem mounting [LWN.net] 

New APIs to support pidfsclone return pidfs, new syscall pidfd_send_signal(2), which uses file descriptors from /proc/<pid> as stable handles on struct pid. 

Toward race-free process signaling [LWN.net] 

locking: rwsem improvementunification and simpler micro-optimizations, performance improvement of this locking primitive.

Preparations for PREEMPT_RTIt's excited that community decided to merge the PREEMPT_RT kernel changes into mainline. It's well known as rt-patch for hard real-time use cases like industry.Index of /pub/linux/kernel/projects/rt/ 
Memory managementKASAN: Improved the KASAN performance for arm64KernelAddressSANitizer (KASAN) is a dynamic memory error detector. It provides a fast and comprehensive solution for finding use-after-free and out-of-bounds bugs. It's useful when debugging kernel drivers and modules memory issue.The Kernel Address Sanitizer (KASAN) — The Linux Kernel documentation 
Fragmentation avoidance improvements, reducing fragmentation events by over 90%. With this change, the page allocator would spread allocations across zones before introducing fragmentation. We can always found customer's product memory fragment in some use cases in old kernel. Which would cause kmalloc or cma alloc failure and system stop. Balance between zones (i.MX8 we have DMA/NORMAL zones) to avoid fragment is very helpful.

patch intro

One of customer case(fixed by not using kmalloc): https://jira.sw.nxp.com/browse/MLK-23220 

Increase success rates and reduce latency of compaction (physical memory defragmentation)Memory compaction is the way to avoid memory fragment.

Memory compaction [LWN.net] 

Improve Out Of Memory (OOM) reports, include victim's memcgMore clear kernel OOM report may help lot

Remove the ancient OOM killer heuristic that preferred to kill children of the "worst" process rather than the process itselfImprove the OOM efficiency
zram improvements, which can help estimate wasted memory, and perform writeback that will free itzram is actually used very widely in the Android system as backup swap for physical memory. Swap performance is very important.

Low RAM Configuration  |  Android Open Source Project 

Simplify some of the early memory allocations by replacing usage of older memblock APIs with newer and shinier onesmemblock API changes. If you used memblock in your drivers, then need to check.

Boot time memory management — The Linux Kernel documentation 

psi: Improves the Pressure Stall Information resource monitoringWith this mechanism, Android can monitor for, and ward off, mounting memory shortages before they cause problems for the user. For example, using memory stall,
monitors in userspace like the low memory killer daemon (lmkd) can detect mounting pressure and kill less important processes. Supported in Android10, replace the vmpressure.

Low Memory Killer Daemon (lmkd)  |  Android Open Source Project 

Pressure stall monitors [LWN.net] 

Improve vmap allocationSpeed up the vmalloc

https://lkml.org/lkml/2018/10/19/786 

Introduce madvise() flags MADV_COLD, MADV_FREE, MADV_PAGEOUTMADV_COLD marks pages as inactive (thus more easily reclaimed under memory pressure), but doesn't discard the contents like MADV_FREE does, and MADV_PAGEOUT , which reclaims pages immediately. Android would use this flags for better memory management

kernel/git/torvalds/linux.git - Linux kernel source tree 

memcg: from v1->v2
  • shrink all memcg caches for the slab cache
  • Throttle allocators when reclaim cannot keep up with v2 memory.high limit
  • Introduce gradual reclaim pressure.....

Control Group v2 — The Linux Kernel documentation 

Block layerBoot to a device-mapper device without initramfsDM is widely used, you can not bootup to DM rootfs directly. Android 10 would use dynamic partition by creating super partition for /system, /vendor of dm-linearImplementing Dynamic Partitions  |  Android Open Source Project 
Tracing and PerfPerf: lots of improvementTBD
Securitysecurity: Create "kernel hardening" config areaHelp mitigate kernel vulnerabilities and find bugs in kernel drivers, like Stack buffer overflow mitigation, Hardened usercopyKernel Hardening  |  Android Open Source Project 
LSM: Add kernel lockdown functionalityWhen enabled, the new "lockdown" feature will restrict some kernel functionality, even for the root user, making it harder for compromised root accounts to compromise the rest of the OSKernel lockdown in 4.17? [LWN.net] 
NetworkingEnable MSG_ZEROCOPY for udp sockets

Improve the UDP sending performance.

Pay attention that the zero copy UDP sockets only limit to the send operations, not receive. Also require application code change, not efficient at small MTU.

Zero-copy networking [LWN.net] 
ARM/ARM64

New SoCs:

  • i.MX7ULP with EVK
  • i.MX8MQ with EVK
  • i.MX8MM 
  • i.MX8QXP

perf vendor events: Add Cortex-A57 and Cortex-A72 events

 support all ARMv8 recommended events

Make CONFIG_ZONE_DMA32 configurable commit

Which means you can remove the DMA zone, and use only one single normal zone in kernel.
Driversdrm: Initial merge of timeline sync objectsTimeline syncobj gives user more flexibility and convenience to do sychronization. Android does not used.

Staging driver: i.MX7 MIPI CSI subdev

NXP QuadSPI driver

Introduce Sound Open Firmware (SOF) for audio DSP devices

Big changes to the current HiFi4 DSP (in i.MX8QM/QXP) infrastructure. The SOF is an open source audio DSP firmware and SDK that provides audio firmware infrastructure and development tools. Also integrated with current kernel alsa subsystem. 

Add NXP SJA1105 DSA network driver with ptp support

Used for networking switch

Add TJA11xx PHY driver

Add lpspi driver support

fsl_lpuart: add imx8qxp support

Add SCU watchdog/RTC support

regmap: add i3c bus support commit

Means we can have i3c bus support in regmap now.

References

Labels (1)
No ratings
Version history
Last update:
‎04-09-2020 06:52 PM
Updated by: