Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

python-crash changes to work with OpenEmbedded#46

Open
AlexanderKamensky wants to merge 3 commits intocrash-python:mastercrash-python/crash-python:masterfrom
AlexanderKamensky:for_jeffAlexanderKamensky/crash-python:for_jeffCopy head branch name to clipboard
Open

python-crash changes to work with OpenEmbedded#46
AlexanderKamensky wants to merge 3 commits intocrash-python:mastercrash-python/crash-python:masterfrom
AlexanderKamensky:for_jeffAlexanderKamensky/crash-python:for_jeffCopy head branch name to clipboard

Conversation

@AlexanderKamensky
Copy link

Hi Jeff,

I have been working on integrating python-crash tool with OpenEmbedded
distro. I have created meta-krash [1] OpenEmbedded layer that primarily
includes crash-python tool. During my integration I ran into several
issues. For example, OpenEmbedded kernel does not enable CONFIG_NUMA, or
CONFIG_SCHED_INFO and uses CONFIG_SLUB (vs CONFIG_SLAB). To deal with the
differences I have added a few patches.

Although OpenEmbedded layer allows local changes for upstream projects
it would be great if you could look at my changes and possibly merge
them. If you have any comments or remarks it would be greatly appreciated.

Thanks,
Alexander

[1] https://github.com/AlexanderKamensky/meta-kcrash

Alexander Kamensky added 3 commits November 12, 2020 17:18
On system without CONFIG_NODES_SHIFT in config referncing config["NODE_SHIFT"]
returns a NoneType instead of a KeyError, this results in a TypeError execption
when NoneType is converted to integer.

Catch TypeError exception to fall back to hard coded value

Signed-off-by: Alexander Kamensky <alexander.kamensky42@gmail.com>
In Yocto Project 5.8 kernel pycrash produces the following exception:

Loading tasks...crash-python: Failed to open /home/skamensk/oe/20201017/build/vmcore.  No method to retrieve last run from task found.
Traceback (most recent call last):
  File "<string>", line 38, in <module>
  File "./build/lib/crash/session.py", line 33, in __init__
    self.kernel.setup_tasks()
  File "./build/lib/crash/kernel.py", line 691, in setup_tasks
    ltask = LinuxTask(task)
  File "./build/lib/crash/types/task.py", line 229, in __init__
    self._init_task_types(task_struct)
  File "./build/lib/crash/types/task.py", line 269, in _init_task_types
    cls._pick_last_run()
  File "./build/lib/crash/types/task.py", line 604, in _pick_last_run
    raise RuntimeError("No method to retrieve last run from task found.")
RuntimeError: No method to retrieve last run from task found.

It turns out that Yocto Project 5.8 kernel does not enable CONFIG_TASKSTATS
and CONFIG_TASK_DELAY_ACCT as result CONFIG_SCHED_INFO is not selected,
as a result this raises the aformentioned exception because struct sched_info
does not have any fields in this case. To work around this
the raising of the RuntimeError was replaced with a print out that states
which CONFIGS must be enabled and cls._get_last was set to a function that
will always return 0.

'pyps -l' functionality is important but there are plenty of other useful
funcationality even if we cannot figure out last run time of task.

Signed-off-by: Alexander Kamensky <alexander.kamensky42@gmail.com>
In Yocto 5.8 kernel it was observed that pycrash produces the following
exception:

...
  File "/home/skamensk/crash-python/20201101/crash-python/build/lib/crash/commands/kmem.py", line 28, in <module>
    from crash.types.slab import kmem_cache_get_all, kmem_cache_from_name
...
  File "/home/skamensk/crash-python/20201101/crash-python/build/lib/crash/types/slab.py", line 328, in check_kmem_cache_type
    cls.percpu_name = find_member_variant(gdbtype, ['cpu_cache', 'array'])
  File "/home/skamensk/crash-python/20201101/crash-python/build/lib/crash/util/__init__.py", line 304, in find_member_variant
    raise TypeError("Unrecognized '{}': could not find member '{}'"
TypeError: Unrecognized 'struct kmem_cache': could not find member 'cpu_cache'

Yocto Project 5.8 Kernel configured with CONFIG_SLUB. In this case struct
kem_cache does not have field cpu_cache, so lookup of this field fails in
such configuration.

Workaround is to check kernel config if CONFIG_SLUB is enabled and skip slab
specif functionality if that is the case.

TODO: Implement slub analogs for slab operations.

Signed-off-by: Alexander Kamensky <alexander.kamensky42@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.