162306a36Sopenharmony_ciBisecting a bug 262306a36Sopenharmony_ci+++++++++++++++ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ciLast updated: 28 October 2016 562306a36Sopenharmony_ci 662306a36Sopenharmony_ciIntroduction 762306a36Sopenharmony_ci============ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ciAlways try the latest kernel from kernel.org and build from source. If you are 1062306a36Sopenharmony_cinot confident in doing that please report the bug to your distribution vendor 1162306a36Sopenharmony_ciinstead of to a kernel developer. 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ciFinding bugs is not always easy. Have a go though. If you can't find it don't 1462306a36Sopenharmony_cigive up. Report as much as you have found to the relevant maintainer. See 1562306a36Sopenharmony_ciMAINTAINERS for who that is for the subsystem you have worked on. 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_ciBefore you submit a bug report read 1862306a36Sopenharmony_ci'Documentation/admin-guide/reporting-issues.rst'. 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ciDevices not appearing 2162306a36Sopenharmony_ci===================== 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ciOften this is caused by udev/systemd. Check that first before blaming it 2462306a36Sopenharmony_cion the kernel. 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ciFinding patch that caused a bug 2762306a36Sopenharmony_ci=============================== 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ciUsing the provided tools with ``git`` makes finding bugs easy provided the bug 3062306a36Sopenharmony_ciis reproducible. 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ciSteps to do it: 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci- build the Kernel from its git source 3562306a36Sopenharmony_ci- start bisect with [#f1]_:: 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci $ git bisect start 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci- mark the broken changeset with:: 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci $ git bisect bad [commit] 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_ci- mark a changeset where the code is known to work with:: 4462306a36Sopenharmony_ci 4562306a36Sopenharmony_ci $ git bisect good [commit] 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci- rebuild the Kernel and test 4862306a36Sopenharmony_ci- interact with git bisect by using either:: 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci $ git bisect good 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ci or:: 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_ci $ git bisect bad 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci depending if the bug happened on the changeset you're testing 5762306a36Sopenharmony_ci- After some interactions, git bisect will give you the changeset that 5862306a36Sopenharmony_ci likely caused the bug. 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_ci- For example, if you know that the current version is bad, and version 6162306a36Sopenharmony_ci 4.8 is good, you could do:: 6262306a36Sopenharmony_ci 6362306a36Sopenharmony_ci $ git bisect start 6462306a36Sopenharmony_ci $ git bisect bad # Current version is bad 6562306a36Sopenharmony_ci $ git bisect good v4.8 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci.. [#f1] You can, optionally, provide both good and bad arguments at git 6962306a36Sopenharmony_ci start with ``git bisect start [BAD] [GOOD]`` 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ciFor further references, please read: 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci- The man page for ``git-bisect`` 7462306a36Sopenharmony_ci- `Fighting regressions with git bisect <https://www.kernel.org/pub/software/scm/git/docs/git-bisect-lk2009.html>`_ 7562306a36Sopenharmony_ci- `Fully automated bisecting with "git bisect run" <https://lwn.net/Articles/317154>`_ 7662306a36Sopenharmony_ci- `Using Git bisect to figure out when brokenness was introduced <http://webchick.net/node/99>`_ 77