Skip to main content

Command Palette

Search for a command to run...

My Linux Kernel Bug Fixing Mentorship experience

Published
3 min read

Back in September I had gotten the opportunity to be a part of the fall cohort of the Linux kernel bug fixing program. And this is my experience detailing my learnings from the mentorship.

During my LKMP bug fixing fall cohort, I submitted 13 patches to the IIO subsystem for the following drivers :

  • vl6180 (distance and light sensor)

  • ltr390 (ambient light sensor)

  • vl53l0x (proximity sensor)

  • max1363 (ADC)

This is the link for all the patches that have been upstreamed in the kernel during the mentorship period.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=author&q=Abhash+Jha

The patches aim at finishing the TODOs that were present in the files for many IIO drivers. They enable new features for the sensors.

All of the patches for the above drivers were accepted in the IIO tree and are now upstreamed in the 6.12 kernel. These patches include the following:

LTR390 IIO driver

  • Added support for configuring the sampling rate for the sensor (link)

  • Added interrupt persistence support (link)

  • Added Suspend and Resume support for the sensor (link)

  • Added Interrupt based Threshold events to detect spikes or falls in UVI and ALS levels (link)

VL6180 IIO driver

  • Support for Continuous mode, where the sensor sends data continuously depending on the sampling rate selected and in the driver we collect it in a buffer (link)

  • Added interrupt support for single shot access. Everytime the data is ready the sensors sends an interrupt to our driver and we have to read the data. (link)

  • Added configurable inter-measurement period support (link)

VL53L0X IIO driver

  • Added Continuous Mode support by using IIO triggered buffers and Interrupts (link)

  • Added sensor ID check (link)

MAX1363 IIO driver

  • Refactored code to use get_unaligned_be16 (link)

My learnings during the mentorship

At the beginning of the mentorship we all were encouraged to explore different subsystems and see for ourselves where we can contribute. I started with many different subsystems like eBPF, ALSA, IIO etc.

Other than that during the weekly office hours I got a lot of exposure to different bug finding and fixing tools like syzkaller, syzbot, gdb, strace etc. I tried my hands on them as well before stumbling on to the IIO subsystem where I discovered that many of the drivers had pending TODOs waiting to be done.

I bought a bunch of hardware for the drivers and started hacking away at them. At first I was just trying to probe them, once I got the basic functionality like reading and writing to work then I moved on to solve the TODOs.

During the 12 weeks of this mentorship, I read a lot of driver code in the IIO subsystem in order to understand the best practices to accomplish the required tasks. The maintainer (Jonathan Cameron) and the reviewers of IIO were very helpful in pointing out the mistakes that I had made in the earlier versions of my patches. I got to learn a lot from their advice whether it be something very technical like how to use the triggered buffer approach or something related to style, i.e. which attributes to expose to sysfs.

Most of the above patches required 3-6 revisions upon the comments of the maintainer and the reviewers.

I also learnt a lot of stuff along the way like device tree, building the kernel based on the required configuration, power management and device driver programming.

The last 12 weeks were very enriching for me from a learning perspective, I also got to be part of the kernel community for which I am really grateful. I learned a lot from everyone involved and got a peek at how the community works and interacts with one another.

In the end I would like to thank Shuah khan (my mentor), Ricardo Marliere, Javier Carrasco and Anup Sharma for being so helpful and approachable during the mentorship. It was a really good experience for me working under their mentorship.