Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Case Study: Linux kernel contribution and LTS f...

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for K. Hayashi K. Hayashi
September 12, 2025
15

Case Study: Linux kernel contribution and LTS following ~1つの修正パッチが24 個のstable パッチになった話~

Japan Technical Jamboree Episode II ep.7 LTS 勉強会

Avatar for K. Hayashi

K. Hayashi

September 12, 2025

Transcript

  1. 1 Case Study: Linux kernel contribution and LTS following Embedded

    SW Engineer/OpenSource Contributer K.Hayashi ( khayash1) 2025/09/12 ~1つの修正パッチが 24 個の stable パッチになった話~ Japan Technical Jamboree Episode II ep.7 LTS 勉強会
  2. 2 About me 2025/09/12 Name: K.Hayashi ( khayash1) Job: Embedded

    SW Engineer OpenSource Contributer  Linux kernel (For soc, dts, pci, net, usb, sdhci, ata, spi, …)  U-Boot  Buildroot  OP-TEE  Zephyr RTOS
  3. 3 Story 2025/09/12 PCI のテストドライバ (pci_endpoint_test) の表示に不備があり,単一修正パッチを投稿 レビューが進むにつれて問題点が増加 さらにレビューアから改善して欲しい要望も増加,パッチ数も増加 何回か投稿し直してなんとか

    apply されました 既存のツリーも修正を適用した方がいいので stable フラグを付けた結果, LTS への適用が進むと(Greg とSasha からの) 大量の自動メールが送付され…
  4. 4 Patch について 2025/09/12 SoC SoC PCI kernel PCI endpoint-

    test pcitest kernel PCI epf-test # modprobe pci_endpoint_test # ./pcitest -r READ ( 102400 bytes): OKAY # ./pcitest -w WRITE ( 102400 bytes): OKAY # ./pcitest -c COPY ( 102400 bytes): OKAY https://www.kernel.org/doc/html/latest/PCI/endpoint/pci-test-howto.html pci_epf_test pci_epf_test.0: WRITE => Size: 102400 B pci_epf_test pci_epf_test.0: READ => Size: 102400 B pci_epf_test pci_epf_test.0: COPY => Size: 102400 B PCI の RootComplex と Endpoint を接続してテストを行う “pci_endpoint_test” ドライバ に対する修正 patch RootComplex(host) Endpoint(device) SoC SSD PCI kernel PCI nvme app RootComplex(host) Endpoint(device) blk 一般的なPCI 接続例(SSD) fs
  5. 5 v1 2025/09/12 [Link] • ioctl(GET_IRQTYPE) を呼び出して得られる「種別」が反映 できていない ( 切り替えても必ず

    “MSI” が返ってくる) ioctl() ⇒ が参照する global 変数 に反映できていないため global ⇒ 変数に反映する修正 • 割込みが確保できなかった時のエラーメッセージもおかしい ( ⇒ 反映できていない) global 変数 を参照しているため global ⇒ 反映前のため、参照を内部 local 変数に変更 • 2 つの修正があるので分割すること • テスト時のエラーメッセージを commit に書くこと • ( レビュー中に) エラー時に割込みが解放されないバグを発見 # pcitest -i 0 SET IRQ TYPE TO LEGACY: OKAY # pcitest -I GET IRQ TYPE: MSI [RESEND PATCH v1] misc: pci_endpoint_test: Fix irq_type to convey the correct type
  6. 6 v2 2025/09/12 [Link] • 2 つの修正を 2 つの commit

    に分割 (+1) • エラーメッセージを commit log に追加 • 割込み解放バグを修正する patch を追加 (+1) • v6.14-rc ( 最新) に rebase してね • そもそも global 変数 使ってるのがおかしいのでは? • ドライバが終わってないのに “devm” ( 終了時にリソース自 動解放) を使うのはおかしくない? という追加注文が次々と… [PATCH v2 0/3] Fix some issues related to an interrupt type in pci_endpoint_test [PATCH v2 1/3] misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error [PATCH v2 2/3] misc: pci_endpoint_test: Fix disyplaying irq_type after request_irq error [PATCH v2 3/3] misc: pci_endpoint_test: Fix irq_type to convey the correct type
  7. 7 v3 2025/09/12 [Link] • v6.14-rc に rebase • 新たに

    global 変数を削除する patch を追加 (+1) • 新たに devm を使わない patch を追加 (+1) • v6.14-rc は PCI のテストケースを kselftests に移動したから それでテストしてね • GET_IRQTYPE のテストがないので追加して、 patch が修正できていることを確認してね • global 変数が要らなくなった理由を commit log に書いてね [PATCH v3 0/5] Fix some issues related to an interrupt type in pci_endpoint_test [PATCH v3 1/5] misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error [PATCH v3 2/5] misc: pci_endpoint_test: Fix disyplaying irq_type after request_irq error [PATCH v3 3/5] misc: pci_endpoint_test: Fix irq_type to convey the correct type [PATCH v3 4/5] misc: pci_endpoint_test: Remove global irq_type [PATCH v3 5/5] misc: pci_endpoint_test: Do not use managed irq functions
  8. 8 v4 2025/09/12 [Link] • kselftest に GET_IRQTYPE テストを追加 (+1)

    • commit log に説明追加 Applied! [Link] [PATCH v4 0/6] Fix some issues related to an interrupt type in pci_endpoint_test [PATCH v4 1/6] selftests: pci_endpoint: Add GET_IRQTYPE checks to each interrupt test [PATCH v4 2/6] misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error [PATCH v4 3/6] misc: pci_endpoint_test: Fix displaying irq_type after request_irq error [PATCH v4 4/6] misc: pci_endpoint_test: Fix irq_type to convey the correct type [PATCH v4 5/6] misc: pci_endpoint_test: Remove global 'irq_type' and 'no_msi’ [PATCH v4 6/6] misc: pci_endpoint_test: Do not use managed irq functions
  9. 9 Stable flag 2025/09/12 selftest: pci_endpoint: Add GET_IRQTYPE checks to

    each interrupt test misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error misc: pci_endpoint_test: Fix displaying irq_type after request_irq error misc: pci_endpoint_test: Fix irq_type to convey the correct type misc: pci_endpoint_test: Remove global ‘irq_type’ and ‘no_msi’ misc: pci_endpoint_test: Do not use managed irq functions 太字の patch は 過去の stable tree にも反映すべき「不具合修正」 “Cc: ⇒ [email protected]” 行を付けて投稿 ⇒ 自動的に apply されて stable tree に反映されることを期待
  10. 10 About stable/LTS kernel 2025/09/12 https://kernel.org/ (captured on 2025/5/19) LTS

    バージョンは stable よりも 長い期間 (EOL) 修正パッチを適用され メンテナンス対象となっている この時点で • Mainline 1 バージョン • Stable 2 バージョン • LTS 6 バージョン がメンテナンス対象 LTS (Long Term Support) stable kernel リリース後、一定期間メンテナンス対象 とし、Bug Fix と Security Fix を行う
  11. 11 Applied to stable/LTS kernel 2025/09/12 • [email protected] に投稿された patch

    は順次 “適用可能な” stable/LTS tree へ自動的に apply される • この時点の最新 stable は v6.14 他の patch はどこへ? 他の LTS への適用は?? v6.12(LTS) への apply が1 つ v6.13(stable) への apply が1 つ v6.14(stable) への apply が3 つ https://lore.kernel.org/stable/?q=pci_endpoint_test
  12. 13 Conflicts… 2025/09/12 https://lore.kernel.org/stable/?q=pci_endpoint_test v6.13 v6.12 v6.6 v6.1 v5.15 v5.10

    v5.4 v6.13 v6.12 v6.6 v6.1 v5.15 v5.10 v5.4 v6.13 v6.12 v6.6 v6.1 v5.15 v5.10 v5.4 v6.14 v6.14 v6.14 どのバージョンで修正が必要か? LTS Stable 7 versions 7 versions 5 versions
  13. 14 Conflict at stable/LTS kernel 2025/09/12 [Link] Stable/LTS kernel で

    conflict ( 衝突) したことを知らせるメールを受信 ⇒ 自動メールだが,どうやって再投稿したらよいかをガイドしてくれている
  14. 15 Fixed 2025/09/12 https://lore.kernel.org/stable/?q=pci_endpoint_test for ver in 5.4.y 5.10.y 5.15.y

    6.1.y 6.6.y 6.12.y 6.13.y; do git checkout –-track origin/linux-${ver} make O=build-${ver} || break git cherry-pick <commit1-sha-id> || break make O=build-${ver} drivers/misc/pci_endpoint_test.o || break git cherry-pick <commit2-sha-id> || break make O=build-${ver} drivers/misc/pci_endpoint_test.o || break git cherry-pick <commit3-sha-id> || break make O=build-${ver} drivers/misc/pci_endpoint_test.o || break end 各バージョンごとに修正パッチを投稿 各バージョンごとに修正パッチを適用してビルド確認 動作確認 ( 自明なら省略)
  15. 17 Result 2025/09/12 v5.15 LTS に反映 v5.10 LTS に反映 v5.4

    LTS に反映 v6.6 LTS に反映 v6.1 LTS に反映 v6.12 LTS に反映 残りのバックポート完了通知 が届いてようやく完了! + v6.13 stable に反映 (2 通)
  16. 18 Summary 2025/09/12 • 1 つの修正パッチ投稿がきっかけで,多数のパッチに発展することもある 時間と忍耐が必要だが,本体への改善にも自分の実績にもなる • 何気なくメンテナンスされている LTS

    ツリー 管理バージョン数が多いほどメンテナンスは大変なのがよく分かる 結構自動化されているので,指示に従えば OK • 修正はバージョンが遅れるほど差分が増し,適用処理が大変になる 修正パッチはローカルで抱え込まずにできるだけ早く投稿を!