17 Aug, 2022

2 commits

  • [ Upstream commit e3c8d33e0d62175c31ca7ab7ab01b18f0b6318d3 ]

    The type atomic_long_t can have size 4 or 8 bytes, depending on
    CONFIG_64BIT; it's only content, the field 'counter', is either an
    int or a s64 value.

    Current code incorrectly uses the fixed size utils.read_u64() to
    read the field 'counter' inside atomic_long_t.

    On 32 bits architectures reading the last element 'tail_id' of the
    struct prb_desc_ring:
    struct prb_desc_ring {
    ...
    atomic_long_t tail_id;
    };
    causes the utils.read_u64() to access outside the boundary of the
    struct and the gdb command 'lx-dmesg' exits with error:
    Python Exception : index out of range
    Error occurred in Python: index out of range

    Query the really used atomic_long_t counter type size.

    Link: https://lore.kernel.org/r/20220617143758.137307-1-antonio.borneo@foss.st.com
    Fixes: e60768311af8 ("scripts/gdb: update for lockless printk ringbuffer")
    Signed-off-by: Antonio Borneo
    [pmladek@suse.com: Query the really used atomic_long_t counter type size]
    Tested-by: Antonio Borneo
    Reviewed-by: John Ogness
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/20220719122831.19890-1-pmladek@suse.com
    Signed-off-by: Sasha Levin

    Antonio Borneo
     
  • [ Upstream commit deaee2704a157dfcca77301ddaa10c62a9840952 ]

    For the gdb command lx-dmesg, the entire descriptor, info, and text
    data regions are read into memory before printing any records. For
    large kernel log buffers, this not only causes a huge delay before
    seeing any records, but it may also lead to python errors of too
    much memory allocation.

    Rather than reading in all these regions in advance, read them as
    needed and only read the regions for the particular record that is
    being printed.

    The gdb macro "dmesg" in Documentation/admin-guide/kdump/gdbmacros.txt
    already prints out the kernel log buffer like this.

    Signed-off-by: John Ogness
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/874k79c3a9.fsf@jogness.linutronix.de
    Signed-off-by: Sasha Levin

    John Ogness
     

15 Jun, 2022

1 commit

  • [ Upstream commit 1f7a6cf6b07c74a17343c2559cd5f5018a245961 ]

    MAGIC_START("IKCFG_ST") and MAGIC_END("IKCFG_ED") are moved out
    from the kernel_config_data variable.

    Thus, we parse kernel_config_data directly instead of considering
    offset of MAGIC_START and MAGIC_END.

    Fixes: 13610aa908dc ("kernel/configs: use .incbin directive to embed config_data.gz")
    Signed-off-by: Kuan-Ying Lee
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Sasha Levin

    Kuan-Ying Lee
     

07 May, 2021

3 commits

  • arm64 uses SP_EL0 to save the current task_struct address. While running
    in EL0, SP_EL0 is clobbered by userspace. So if the upper bit is not 1
    (not TTBR1), the current address is invalid. This patch checks the upper
    bit of SP_EL0, if the upper bit is 1, lx_current() of arm64 will return
    the derefrence of current task. Otherwise, lx_current() will tell users
    they are running in userspace(EL0).

    While arm64 is running in EL0, it is actually pointless to print current
    task as the memory of kernel space is not accessible in EL0.

    Link: https://lkml.kernel.org/r/20210314203444.15188-3-song.bao.hua@hisilicon.com
    Signed-off-by: Barry Song
    Cc: Jan Kiszka
    Cc: Jonathan Corbet
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Barry Song
     
  • Patch series "scripts/gdb: clarify the platforms supporting lx_current and add arm64 support", v2.

    lx_current depends on per_cpu current_task variable which exists on x86
    only. so it actually works on x86 only. the 1st patch documents this
    clearly; the 2nd patch adds support for arm64.

    This patch (of 2):

    x86 is the only architecture which has per_cpu current_task:

    arch$ git grep current_task | grep -i per_cpu
    x86/include/asm/current.h:DECLARE_PER_CPU(struct task_struct *, current_task);
    x86/kernel/cpu/common.c:DEFINE_PER_CPU(struct task_struct *, current_task) ____cacheline_aligned =
    x86/kernel/cpu/common.c:EXPORT_PER_CPU_SYMBOL(current_task);
    x86/kernel/cpu/common.c:DEFINE_PER_CPU(struct task_struct *, current_task) = &init_task;
    x86/kernel/cpu/common.c:EXPORT_PER_CPU_SYMBOL(current_task);
    x86/kernel/smpboot.c: per_cpu(current_task, cpu) = idle;

    On other architectures, lx_current() will lead to a python exception:

    (gdb) p $lx_current().pid
    Python Exception No symbol "current_task" in current context.:
    Error occurred in Python: No symbol "current_task" in current context.

    To avoid more people struggling and wasting time in other architectures,
    document it.

    Link: https://lkml.kernel.org/r/20210314203444.15188-1-song.bao.hua@hisilicon.com
    Link: https://lkml.kernel.org/r/20210314203444.15188-2-song.bao.hua@hisilicon.com
    Signed-off-by: Barry Song
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Jonathan Corbet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Barry Song
     
  • If we store the relative path, the user might later cd to a different
    directory, and that would break the automatic symbol resolving that
    happens when a module is loaded into the target kernel. Fix this by
    storing the abspath() of each path given, just like we already do for the
    cwd (os.getcwd() is absolute.)

    Link: https://lkml.kernel.org/r/20201217091747.bf4332cf2b35.I10ebbdb7e9b80ab1a5cddebf53d073be8232d656@changeid
    Signed-off-by: Johannes Berg
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Johannes Berg
     

27 Feb, 2021

1 commit

  • If the list is uninitialized (next pointer is NULL), list_for_each gets
    stuck in an infinite loop. Print a message and treat list as empty.

    Link: https://lkml.kernel.org/r/4ae23bb1-c333-f669-da2d-fa35c4f49018@amazon.com
    Signed-off-by: George Prekas
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    George Prekas
     

16 Feb, 2021

1 commit

  • As commit d0e628cd817f ("kbuild: doc: clarify the difference between
    extra-y and always-y") explained, extra-y should be used for listing
    the prerequisites of vmlinux.

    These targets are not related to vmlinux. always-y is a better fix.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Rob Herring

    Masahiro Yamada
     

17 Oct, 2020

2 commits

  • With the patch.

    TASK PID COMM
    0xffffffff82c2b8c0 0 swapper/0
    0xffff888a0ba20040 1 systemd
    0xffff888a0ba24040 2 kthreadd
    0xffff888a0ba28040 3 rcu_gp

    w/o
    0xffffffff82c2b8c0 0 swapper/0
    0xffff888a0ba20040 1 systemd
    0xffff888a0ba24040 2 kthreadd
    0xffff888a0ba28040 3 rcu_gp

    Signed-off-by: Ritesh Harjani
    Signed-off-by: Andrew Morton
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Link: http://lkml.kernel.org/r/54c868c79b5fc364a8be7799891934a6fe6d1464.1597742951.git.riteshh@linux.ibm.com
    Signed-off-by: Linus Torvalds

    Ritesh Harjani
     
  • This is many times found useful while debugging some FS related
    issue.

    mount super_block devname pathname fstype options
    0xffff888a0bfa4b40 0xffff888a0bfc1000 none / rootfs rw 0 0
    0xffff888a033f75c0 0xffff8889fcf65000 /dev/root / ext4 rw,relatime 0 0
    0xffff8889fc8ce040 0xffff888a0bb51000 devtmpfs /dev devtmpfs rw,relatime 0 0

    Signed-off-by: Ritesh Harjani
    Signed-off-by: Andrew Morton
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Link: http://lkml.kernel.org/r/a3c4177e1597b3e06d66d55e07d72c0c46a03571.1597742951.git.riteshh@linux.ibm.com
    Signed-off-by: Linus Torvalds

    Ritesh Harjani
     

14 Oct, 2020

1 commit

  • Pull printk updates from Petr Mladek:
    "The big new thing is the fully lockless ringbuffer implementation,
    including the support for continuous lines. It will allow to store and
    read messages in any situation wihtout the risk of deadlocks and
    without the need of temporary per-CPU buffers.

    The access is still serialized by logbuf_lock. It synchronizes few
    more operations, for example, temporary buffer for formatting the
    message, syslog and kmsg_dump operations. The lock removal is being
    discussed and should be ready for the next release.

    The continuous lines are handled exactly the same way as before to
    avoid regressions in user space. It means that they are appended to
    the last message when the caller is the same. Only the last message
    can be extended.

    The data ring includes plain text of the messages. Except for an
    integer at the beginning of each message that points back to the
    descriptor ring with other metadata.

    The dictionary has to stay. journalctl uses it to filter the log. It
    allows to show messages related to a given device. The dictionary
    values are stored in the descriptor ring with the other metadata.

    This is the first part of the printk rework as discussed at Plumbers
    2019, see https://lore.kernel.org/r/87k1acz5rx.fsf@linutronix.de. The
    next big step will be handling consoles by kthreads during the normal
    system operation. It will require special handling of situations when
    the kthreads could not get scheduled, for example, early boot,
    suspend, panic.

    Other changes:

    - Add John Ogness as a reviewer for printk subsystem. He is author of
    the rework and is familiar with the code and history.

    - Fix locking in serial8250_do_startup() to prevent lockdep report.

    - Few code cleanups"

    * tag 'printk-for-5.10' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux: (27 commits)
    printk: Use fallthrough pseudo-keyword
    printk: reduce setup_text_buf size to LOG_LINE_MAX
    printk: avoid and/or handle record truncation
    printk: remove dict ring
    printk: move dictionary keys to dev_printk_info
    printk: move printk_info into separate array
    printk: reimplement log_cont using record extension
    printk: ringbuffer: add finalization/extension support
    printk: ringbuffer: change representation of states
    printk: ringbuffer: clear initial reserved fields
    printk: ringbuffer: add BLK_DATALESS() macro
    printk: ringbuffer: relocate get_data()
    printk: ringbuffer: avoid memcpy() on state_var
    printk: ringbuffer: fix setting state in desc_read()
    kernel.h: Move oops_in_progress to printk.h
    scripts/gdb: update for lockless printk ringbuffer
    scripts/gdb: add utils.read_ulong()
    docs: vmcoreinfo: add lockless printk ringbuffer vmcoreinfo
    printk: reduce LOG_BUF_SHIFT range for H8300
    printk: ringbuffer: support dataless records
    ...

    Linus Torvalds
     

12 Oct, 2020

1 commit


22 Sep, 2020

1 commit

  • Dictionaries are only used for SUBSYSTEM and DEVICE properties. The
    current implementation stores the property names each time they are
    used. This requires more space than otherwise necessary. Also,
    because the dictionary entries are currently considered optional,
    it cannot be relied upon that they are always available, even if the
    writer wanted to store them. These issues will increase should new
    dictionary properties be introduced.

    Rather than storing the subsystem and device properties in the
    dict ring, introduce a struct dev_printk_info with separate fields
    to store only the property values. Embed this struct within the
    struct printk_info to provide guaranteed availability.

    Signed-off-by: John Ogness
    Reviewed-by: Petr Mladek
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/87mu1jl6ne.fsf@jogness.linutronix.de

    John Ogness
     

15 Sep, 2020

2 commits

  • Add support for extending the newest data block. For this, introduce
    a new finalization state (desc_finalized) denoting a committed
    descriptor that cannot be extended.

    Until a record is finalized, a writer can reopen that record to
    append new data. Reopening a record means transitioning from the
    desc_committed state back to the desc_reserved state.

    A writer can explicitly finalize a record if there is no intention
    of extending it. Also, records are automatically finalized when a
    new record is reserved. This relieves writers of needing to
    explicitly finalize while also making such records available to
    readers sooner. (Readers can only traverse finalized records.)

    Four new memory barrier pairs are introduced. Two of them are
    insignificant additions (data_realloc:A/desc_read:D and
    data_realloc:A/data_push_tail:B) because they are alternate path
    memory barriers that exactly match the purpose, pairing, and
    context of the two existing memory barrier pairs they provide an
    alternate path for. The other two new memory barrier pairs are
    significant additions:

    desc_reopen_last:A / _prb_commit:B - When reopening a descriptor,
    ensure the state transitions back to desc_reserved before
    fully trusting the descriptor data.

    _prb_commit:B / desc_reserve:D - When committing a descriptor,
    ensure the state transitions to desc_committed before checking
    the head ID to see if the descriptor needs to be finalized.

    Signed-off-by: John Ogness
    Reviewed-by: Petr Mladek
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/20200914123354.832-6-john.ogness@linutronix.de

    John Ogness
     
  • Rather than deriving the state by evaluating bits within the flags
    area of the state variable, assign the states explicit values and
    set those values in the flags area. Introduce macros to make it
    simple to read and write state values for the state variable.

    Although the functionality is preserved, the binary representation
    for the states is changed.

    Signed-off-by: John Ogness
    Reviewed-by: Petr Mladek
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/20200914123354.832-5-john.ogness@linutronix.de

    John Ogness
     

08 Sep, 2020

2 commits

  • With the introduction of the lockless printk ringbuffer, the data
    structure for the kernel log buffer was changed. Update the gdb
    scripts to be able to parse/print the new log buffer structure.

    Fixes: 896fbe20b4e2333fb55 ("printk: use the lockless ringbuffer")
    Signed-off-by: John Ogness
    Reported-by: Nick Desaulniers
    Tested-by: Nick Desaulniers
    Tested-by: Petr Mladek
    [akpm@linux-foundation.org: A typo fix.]
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/20200814212525.6118-3-john.ogness@linutronix.de

    John Ogness
     
  • Add a function for reading unsigned long values, which vary in size
    depending on the architecture.

    Signed-off-by: John Ogness
    Reviewed-by: Nick Desaulniers
    Tested-by: Nick Desaulniers
    Tested-by: Petr Mladek
    Signed-off-by: Petr Mladek
    Link: https://lore.kernel.org/r/20200814212525.6118-2-john.ogness@linutronix.de

    John Ogness
     

13 Aug, 2020

1 commit

  • Fixes the observed warnings:
    scripts/gdb/linux/rbtree.py:20: SyntaxWarning: "is" with a literal. Did
    you mean "=="?
    if node is 0:
    scripts/gdb/linux/rbtree.py:36: SyntaxWarning: "is" with a literal. Did
    you mean "=="?
    if node is 0:

    It looks like this is a new warning added in Python 3.8. I've only seen
    this once after adding the add-auto-load-safe-path rule to my ~/.gdbinit
    for a new tree.

    Fixes: commit 449ca0c95ea2 ("scripts/gdb: add rb tree iterating utilities")
    Signed-off-by: Nick Desaulniers
    Signed-off-by: Andrew Morton
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Aymeric Agon-Rambosson
    Link: http://lkml.kernel.org/r/20200805225015.2847624-1-ndesaulniers@google.com
    Link: https://adamj.eu/tech/2020/01/21/why-does-python-3-8-syntaxwarning-for-is-literal/
    Signed-off-by: Linus Torvalds

    Nick Desaulniers
     

03 Aug, 2020

1 commit

  • * pm-sleep:
    PM: sleep: spread "const char *" correctness
    PM: hibernate: fix white space in a few places
    freezer: Add unsafe version of freezable_schedule_timeout_interruptible() for NFS
    PM: sleep: core: Emit changed uevent on wakeup_sysfs_add/remove

    * pm-domains:
    PM: domains: Restore comment indentation for generic_pm_domain.child_links
    PM: domains: Fix up terminology with parent/child

    * powercap:
    powercap: Add Power Limit4 support
    powercap: idle_inject: Replace play_idle() with play_idle_precise() in comments
    powercap: intel_rapl: add support for Sapphire Rapids

    * pm-tools:
    pm-graph v5.7 - important s2idle fixes
    cpupower: Replace HTTP links with HTTPS ones
    cpupower: Fix NULL but dereferenced coccicheck errors
    cpupower: Fix comparing pointer to 0 coccicheck warns

    Rafael J. Wysocki
     

25 Jul, 2020

1 commit

  • Commit ed66f991bb19 ("module: Refactor section attr into bin attribute")
    removed the 'name' field from 'struct module_sect_attr' triggering the
    following error when invoking lx-symbols:

    (gdb) lx-symbols
    loading vmlinux
    scanning for modules in linux/build
    loading @0xffffffffc014f000: linux/build/drivers/net/tun.ko
    Python Exception There is no member named name.:
    Error occurred in Python: There is no member named name.

    This patch fixes the issue taking the module name from the 'struct
    attribute'.

    Fixes: ed66f991bb19 ("module: Refactor section attr into bin attribute")
    Signed-off-by: Stefano Garzarella
    Signed-off-by: Andrew Morton
    Reviewed-by: Jan Kiszka
    Reviewed-by: Kieran Bingham
    Link: http://lkml.kernel.org/r/20200722102239.313231-1-sgarzare@redhat.com
    Signed-off-by: Linus Torvalds

    Stefano Garzarella
     

09 Jul, 2020

1 commit

  • The genpd infrastructure uses the terms master/slave, but such uses have
    no external exposures (not even in Documentation/driver-api/pm/*) and are
    not mandated by nor associated with any external specifications. Change
    the language used through-out to parent/child.

    There was one possible exception in the debugfs node
    "pm_genpd/pm_genpd_summary" but its path has no hits outside of the
    kernel itself when performing a code search[1], and it seems even this
    single usage has been non-functional since it was introduced due to a
    typo in the Python ("apend" instead of correct "append"). Fix the typo
    while we're at it.

    Link: https://codesearch.debian.net/ # [1]
    Signed-off-by: Kees Cook
    Reviewed-by: Greg Kroah-Hartman
    Reviewed-by: Kieran Bingham
    Signed-off-by: Rafael J. Wysocki

    Kees Cook
     

08 May, 2020

1 commit

  • The current implementations of the rb_first() and rb_last() gdb
    functions have a variable that references itself in its instanciation,
    which causes the function to throw an error if a specific condition on
    the argument is met. The original author rather intended to reference
    the argument and made a typo. Referring the argument instead makes the
    function work as intended.

    Signed-off-by: Aymeric Agon-Rambosson
    Signed-off-by: Andrew Morton
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Jackie Liu
    Cc: Jason Wessel
    Link: http://lkml.kernel.org/r/20200427051029.354840-1-aymeric.agon@yandex.com
    Signed-off-by: Linus Torvalds

    Aymeric Agon-Rambosson
     

25 Mar, 2020

1 commit


07 Nov, 2019

1 commit

  • gcc's -freorder-blocks-and-partition option makes it group frequently
    and infrequently used code in .text.hot and .text.unlikely sections
    respectively. At least when building modules on s390, this option is
    used by default.

    gdb assumes that all code is located in .text section, and that .text
    section is located at module load address. With such modules this is no
    longer the case: there is code in .text.hot and .text.unlikely, and
    either of them might precede .text.

    Fix by explicitly telling gdb the addresses of code sections.

    It might be tempting to do this for all sections, not only the ones in
    the white list. Unfortunately, gdb appears to have an issue, when
    telling it about e.g. loadable .note.gnu.build-id section causes it to
    think that non-loadable .note.Linux section is loaded at address 0,
    which in turn causes NULL pointers to be resolved to bogus symbols. So
    keep using the white list approach for the time being.

    Link: http://lkml.kernel.org/r/20191028152734.13065-1-iii@linux.ibm.com
    Signed-off-by: Ilya Leoshkevich
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Heiko Carstens
    Cc: Vasily Gorbik
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ilya Leoshkevich
     

19 Oct, 2019

2 commits

  • Currently lx-symbols assumes that module text is always located at
    module->core_layout->base, but s390 uses the following layout:

    +------+ core_layout->base
    | GOT |
    +------+ core_layout->base + module->arch->plt_offset
    | PLT |
    +------+ core_layout->base + module->arch->plt_offset +
    | TEXT | module->arch->plt_size
    +------+

    Therefore, when trying to debug modules on s390, all the symbol
    addresses are skewed by plt_offset + plt_size.

    Fix by adding plt_offset + plt_size to module_addr in
    load_module_symbols().

    Link: http://lkml.kernel.org/r/20191017085917.81791-1-iii@linux.ibm.com
    Signed-off-by: Ilya Leoshkevich
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Heiko Carstens
    Cc: Vasily Gorbik
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ilya Leoshkevich
     
  • When CONFIG_PRINTK_CALLER is set, struct printk_log contains an
    additional member caller_id. This affects the offset of the log text.
    Account for this by using the type information from gdb to determine all
    the offsets instead of using hardcoded values.

    This fixes following error:

    (gdb) lx-dmesg
    Python Exception embedded null character:
    Error occurred in Python command: embedded null character

    The read_u* utility functions now take an offset argument to make them
    easier to use.

    Link: http://lkml.kernel.org/r/20191011142500.2339-1-joel.colledge@linbit.com
    Signed-off-by: Joel Colledge
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Leonard Crestez
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joel Colledge
     

26 Sep, 2019

1 commit

  • Some systems (like Chrome OS) may use "split debug" for kernel modules.
    That means that the debug symbols are in a different file than the main
    elf file. Let's handle that by also searching for debug symbols that end
    in ".ko.debug".

    This is a packaging topic. You can take a normal elf file and split the
    debug out of it using objcopy. Try "man objcopy" and then take a look at
    the "--only-keep-debug" option. It'll give you a whole recipe for doing
    splitdebug. The suffix used for the debug symbols is arbitrary. If
    people have other another suffix besides ".ko.debug" then we could
    presumably support that too...

    For portage (which is the packaging system used by Chrome OS) split debug
    is supported by default (and the suffix is .ko.debug). ...and so in
    Chrome OS we always get the installed elf files stripped and then the
    symbols stashed away.

    At the moment we don't actually use the normal portage magic to do this
    for the kernel though since it affects our ability to get good stack dumps
    in the kernel. We instead pass a script as "strip" [1].

    [1] https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/refs/heads/master/eclass/cros-kernel/strip_splitdebug

    Link: http://lkml.kernel.org/r/20190730234052.148744-1-dianders@chromium.org
    Signed-off-by: Douglas Anderson
    Reviewed-by: Stephen Boyd
    Reviewed-by: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Jason Wessel
    Cc: Daniel Thompson
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Douglas Anderson
     

17 Jul, 2019

2 commits

  • Add helper commands and functions for finding pointers to struct device
    by enumerating linux device bus/class infrastructure. This can be used
    to fetch subsystem and driver-specific structs:

    (gdb) p *$container_of($lx_device_find_by_class_name("net", "eth0"), "struct net_device", "dev")
    (gdb) p *$container_of($lx_device_find_by_bus_name("i2c", "0-004b"), "struct i2c_client", "dev")
    (gdb) p *(struct imx_port*)$lx_device_find_by_class_name("tty", "ttymxc1")->parent->driver_data

    Several generic "lx-device-list" functions are included to enumerate
    devices by bus and class:

    (gdb) lx-device-list-bus usb
    (gdb) lx-device-list-class
    (gdb) lx-device-list-tree &platform_bus

    Similar information is available in /sys but pointer values are
    deliberately hidden.

    Link: http://lkml.kernel.org/r/c948628041311cbf1b9b4cff3dda7d2073cb3eaa.1561492937.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Reviewed-by: Stephen Boyd
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: "Rafael J. Wysocki"
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • This is like /sys/kernel/debug/pm/pm_genpd_summary except it's
    accessible through a debugger.

    This can be useful if the target crashes or hangs because power domains
    were not properly enabled.

    Link: http://lkml.kernel.org/r/f9ee627a0d4f94b894aa202fee8a98444049bed8.1561492937.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Reviewed-by: Stephen Boyd
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: "Rafael J. Wysocki"
    Cc: Greg Kroah-Hartman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     

10 Jul, 2019

1 commit

  • Commit 25b146c5b8ce ("kbuild: allow Kbuild to start from any directory")
    deprecated KBUILD_SRCTREE.

    It is only used in tools/testing/selftest/ to distinguish out-of-tree
    build. Replace it with a new boolean flag, building_out_of_srctree.

    I also replaced the conditional ($(srctree),.) because the next commit
    will allow an absolute path to be used for $(srctree) even when building
    in the source tree.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

02 Jun, 2019

1 commit

  • CLK_GET_RATE_NOCACHE depends on CONFIG_COMMON_CLK. Importing constants.py
    when CONFIG_COMMON_CLK is not defined causes:

    (gdb) lx-symbols
    (...)
    File "scripts/gdb/linux/proc.py", line 15, in
    from linux import constants
    File "scripts/gdb/linux/constants.py", line 2, in
    LX_CLK_GET_RATE_NOCACHE = gdb.parse_and_eval("CLK_GET_RATE_NOCACHE")
    gdb.error: No symbol "CLK_GET_RATE_NOCACHE" in current context.

    Link: http://lkml.kernel.org/r/20190523195313.24701-1-farosas@linux.ibm.com
    Fixes: e7e6f462c1be ("scripts/gdb: print cached rate in lx-clk-summary")
    Signed-off-by: Fabiano Rosas
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Cc: Leonard Crestez
    Cc: Jackie Liu
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Fabiano Rosas
     

21 May, 2019

1 commit


15 May, 2019

8 commits

  • The clk rate is always stored in clk_core but might be out of date and
    require calls to update from hardware.

    Deal with that case by printing a (c) suffix.

    Link: http://lkml.kernel.org/r/1a474318982a5f0125f2360c4161029b17f56bd1.1556881728.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Cc: Stephen Boyd
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • An incorrect argument to list_for_each is an internal error in gdb
    scripts so a TypeError should be raised. The gdb.GdbError exception
    type is intended for user errors such as incorrect invocation.

    Drop the type assertion in list_for_each_entry because list_for_each
    isn't going to suddenly yield something else.

    Applies to both list and hlist

    Link: http://lkml.kernel.org/r/c1d3fd4db13d999a3ba57f5bbc1924862d824f61.1556881728.git.leonard.crestez@nxp.com
    Signed-off-by: Leonard Crestez
    Reviewed-by: Stephen Boyd
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • Finding an individual clk_core requires walking the tree which can be
    quite complicated so add a helper for easy access.

    (gdb) print *(struct clk_scu*)$lx_clk_core_lookup("uart0_clk")->hw

    Link: http://lkml.kernel.org/r/Message-ID:
    Signed-off-by: Leonard Crestez
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Cc: Stephen Boyd
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • Add an lx-clk-summary command which prints a subset of
    /sys/kernel/debug/clk/clk_summary.

    This can be used to examine hangs caused by clk not being enabled.

    Link: http://lkml.kernel.org/r/Message-ID:
    Signed-off-by: Leonard Crestez
    Cc: Jan Kiszka
    Cc: Jason Wessel
    Cc: Kieran Bingham
    Cc: Stephen Boyd
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • This allows easily examining kernel hlists in python.

    Link: http://lkml.kernel.org/r/Message-ID:
    Signed-off-by: Leonard Crestez
    Reviewed-by: Stephen Boyd
    Cc: Jason Wessel
    Cc: Jan Kiszka
    Cc: Kieran Bingham
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Leonard Crestez
     
  • These scripts have some pep8 style warnings. Fix them up so that this
    directory is all pep8 clean.

    Link: http://lkml.kernel.org/r/20190329220844.38234-6-swboyd@chromium.org
    Signed-off-by: Stephen Boyd
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: Jackie Liu
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • Implement a command to print the timer list, much like how
    /proc/timer_list is implemented. This can be used to look at the
    pending timers on a crashed system.

    [swboyd@chromium.org: v2]
    Link: http://lkml.kernel.org/r/20190329220844.38234-5-swboyd@chromium.org
    Link: http://lkml.kernel.org/r/20190325184522.260535-5-swboyd@chromium.org
    Signed-off-by: Stephen Boyd
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: Jackie Liu
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd
     
  • Implement gdb functions for rb_first(), rb_last(), rb_next(), and
    rb_prev(). These can be useful to iterate through the kernel's
    red-black trees.

    [swboyd@chromium.org: v2]
    Link: http://lkml.kernel.org/r/20190329220844.38234-4-swboyd@chromium.org
    Link: http://lkml.kernel.org/r/20190325184522.260535-4-swboyd@chromium.org
    Signed-off-by: Stephen Boyd
    Cc: Douglas Anderson
    Cc: Nikolay Borisov
    Cc: Kieran Bingham
    Cc: Jan Kiszka
    Cc: Jackie Liu
    Cc: Jason Wessel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Boyd