0xff07
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # My Experience to the Linux Kernel Mentorship Program [TOC] ## Why Linux Kernel? > This blog can be found on https://hackmd.io/@0xff07/lkmp-sharing I’ve always been curious about how Linux achieves its world dominance. Look into the surroundings: the routers, refrigerators, laptops, cloud services that make it possible for this page to exist. Linux is what makes our daily life possible. Yet one way or another, they all derive from that one and only mainline Linux kernel. It’s a huge world to explore, and it’s been my dream to have that ability to explore it, and to be part of that community. I’ve done some hobbyist kernel development in the past, but still, there's a difference. I thought that only very niche developers get the chance to be a part of that community. This was my belief for years. Until one day, this mentorship appeared at the sight. And I thought to myself this might be the opportunity. So after working on a few prerequisite tasks, I joined the mentorship! ## First challenge: bootstrapping the knowledge The first challenge is to know at least how some parts of the kernel works. The kernel is already open source so just read it, right? Well, it's a bit more complicated. Although source code of the kernel is publicly available, it's more than 30 million lines of code. Skimming each line for 10 seconds for 12 hours a day will take more than 19 years to finish, and that's under the assumption that the kernel doesn't grow over the years you're reading it. Also, reading code without understanding proper context often leads to misinterpretation. And when it happens, it happens silently, and often takes great effort to correct afterwards. Fortunately, the source code is not the only source of knowledge. Here are some tips I learned during the mentorship that work for me. ### Learn it from conference/webinar videos This is particularly useful to catch up on some latest topics. It also works very effectively when the documentation in the kernel doesn't mention that specific topic very much. Videos of the past event held by Linux Foundation can be found on their YouTube channel. From the core kernel functions like [IRQ](https://youtu.be/-pehAzaP1eg?si=HlxYsqjADFFxr9Hw), [bottom-half handling](https://youtu.be/kC-SB8k02aE?si=8Q8VDHNKRIfVJmEq) like tasklet, workqueue, and threaded IRQs, to [memory management](https://youtu.be/ql1axx--8sI?si=txZOnbyboyduwWwc) and the [internals of the SLUB](https://youtu.be/2hYzxsWeNcE?si=RmrHHZQLdSYNBmsg) (kernel's slab allocator), to [storage stack](https://youtu.be/hCKruOlLPIQ) and [network stack](https://www.youtube.com/live/T5TvPRQFNoM). This truly is what makes the Linux kernel community wonderful. There are also [*LF Live: Mentorship Series*](https://www.youtube.com/watch?v=y458QwEfSsU&list=PLbzoR-pLrL6o8cdq_JLTwsLfe2_DhNsDf) that could be very great tutorials. I made a [list](https://hackmd.io/@0xff07/kernel-pocket-index) that categorized videos into different topics: ![Screenshot from 2024-11-30 11-23-05](https://hackmd.io/_uploads/B1ZVrW_Xkx.png) (It can be found on hackmd.io/@0xff07/kernel-pocket-index) Those videos greatly enhance the understanding of the kernel, not only for this mentorship, but also for my job. Exploring topics, listening to stories told by people in the community, sharing them with people, they all bring tremendous joy to me! ### Hardware is the Rosetta Stone For example, a sensor supported by Linux kernel may also be supported by a simpler environment, say, Arduino. If you've already familiar with some of those MCU platforms, it is possible to learn how that hardware works on those platforms, and with that knowledge learn how the kernel handles the same piece of hardware. This will greatly speed up the learning process. Other examples are the commonly used protocols like USB, PCIe, and I2C. They have stand alone specifications that are independent of the Linux kernel, which means that they can be learned without any prior knowledge of the kernel. ### Learn from the mailing list The mailing archive has a really powerful query function. The hints can be found in the tiny little "help" beside the search box in every mailing list: ![Screenshot from 2024-11-30 09-53-05](https://hackmd.io/_uploads/S1m4ll_mJl.png) Clicking into it shows some mysterious symbols: ``` s: match within Subject e.g. s:"a quick brown fox" d: match date-time range, git "approxidate" formats supported Open-ended ranges such as `d:last.week..' and `d:..2.days.ago' are supported b: match within message body, including text attachments nq: match non-quoted text within message body q: match quoted text within message body n: match filename of attachment(s) t: match within the To header c: match within the Cc header f: match within the From header a: match within the To, Cc, and From headers tc: match within the To and Cc headers l: match contents of the List-Id header bs: match within the Subject and body dfn: match filename from diff dfa: match diff removed (-) lines dfb: match diff added (+) lines dfhh: match diff hunk header context (usually a function name) dfctx: match diff context lines dfpre: match pre-image git blob ID dfpost: match post-image git blob ID dfblob: match either pre or post-image git blob ID patchid: match `git patch-id --stable' output rt: match received time, like `d:' if sender's clock was correct forpatchid: the `X-For-Patch-ID' mail header e.g. forpatchid:stable changeid: the `X-Change-ID' mail header e.g. changeid:stable ``` This is the [Xapian Query Syntax](https://getting-started-with-xapian.readthedocs.io/en/latest/concepts/search/queryparser.html) that I learned from [*Doing more with lore and b4*](https://youtu.be/wTpQYM08_Yg). This allows one to filter out mails in a mailing list archive. For example, to find mails containing diff of `drivers/gpu/drm/i915/display/intel_dp_mst.c`, simply copy and paste the following to the search box: ```lisp (dfn:"drivers/gpu/drm/i915/display/intel_dp_mst.c") ``` And you'll be able to see mails regarding this file! Other than learning, this is particularly useful for seeing if anyone has had similar idea before, and more importantly, why that idea didn't work in the first place. ## Where the first few patches might be ### Documentation typo This is rather straightforward: see the typo and send a patch to fix it. Other things similar to this is fixing the inconsistent style and fixing it. Note that some documentation is extracted from the comments in the source code, so some of them may also be worth fixing. ### .gitignore Simply do a `make` and run `git status` to see if there's any untracked file after `make`. Trying to understand why it's there. Sometimes it's because of missing `.gitignore`. The `tools/`, or the kselftests might be an easier starting point for this. ### Kconfig descriptions This is somewhat similar to documentation (e.g. typos). There are other scenario where you might be able to propose change. For example, sometimes the vendor added support for new devices to a driver, but forgot to mention that in the Kconfig description. This might also be something that could be fixed. Do check the mailing list (the Xapian query syntax would be very helpful in this case), `git log`, and the driver match tables to confirm this. ### Static check: Coverity, smatch, sparse. The static check tools try to catch issues by analyzing the source code. They are "static" in the sense that it happens before or during the compilation, not when the kernel is actually running. 1. Coverity: [*ONE simple and rewarding way to contribute to the Linux Kernel: Fix Coverity issues*](https://embeddedor.com/blog/2024/09/28/one-simple-and-rewarding-way-to-contribute-to-the-linux-kernel-fix-coverity-issues/) by Gustavo A. R. Silva 2. smatch: [*Mentorship Session: New Ideas for Smatch (Static Analysis)*](https://youtu.be/zZGvKcPYhe0) by Dan Carpenter 3. sparse: see [*Sparse*](https://docs.kernel.org/dev-tools/sparse.html) on the Linux kernel documentation. ### Syzbot bugs The Syabot board shows results of fuzzing tests on the kernel regularly. The report contains kernel image, `vmlinux`, kernel configuration and sometimes C program to reproduce that bug. See [*Fixing bugs in the Linux kernel with Syzbot, Qemu and GDB*](https://javiercarrascocruz.github.io/syzbot) detailed instructions. This is also a place where I find exercises for myself to read output from various sanitizers. ## More than just "my code works" After making a change, tests ensue. Although the kernel community surely has its own culture in terms of development, common dev practices apply. Doing verification of the change is crucial, even if it's not actual C code. For example, after fixing a typo in the documentation, make sure that it compiles and renders as expected. Maybe a .gitignore is fixed, then it’s a good idea to think if the regex is both sufficient and necessary? Will it ignore files that it’s not supposed to exclude? As unique as the kernel is, common sense for software development may still apply. Do try the best to verify things. Also, justifying that a change is necessary is also important. For example, ## Conclusion This is a really eye-opening experience, and also a dream come true! The most important thing I learned is what interacting with the kernel community feels like, and starting to believe that upstreaming some simple patches is doable by mere mortals like me. I used to be very afraid of sending any mail to the mailing list, thinking that any mistake I made would doom myself. The mailing list never falls short of heated debates after all. It turned out that it also has some very inclusive aspects. The community often provides very helpful suggestions. Listening to community's feedback is a really nice way to grow. Special thanks to Shuah Khan and Ricardo B. Marliere for teaching everything. Not just for answering questions, but also for teaching mentalities, for joining an open source community, and for building a welcoming culture for us mentees. You truly are the role models that I’m aiming to become. Although this is the end of this mentorship, I’m sure that we'll meet again in the community again in the future. Let's further the world dominance of Linux together!

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully