lttng-modules.git
2 months agokretprobes: implement counter support
Mathieu Desnoyers [Thu, 10 Feb 2022 20:40:25 +0000 (15:40 -0500)] 
kretprobes: implement counter support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8e64712455b2812305250a45311b5b023281a1fe

2 months agokprobe: implement counter support
Mathieu Desnoyers [Thu, 10 Feb 2022 20:36:48 +0000 (15:36 -0500)] 
kprobe: implement counter support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8741ab89b03089ec34f17965749f84ddc23a2601

2 months agoAdd missing counter handling
Mathieu Desnoyers [Thu, 10 Feb 2022 20:30:31 +0000 (15:30 -0500)] 
Add missing counter handling

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I5ba6bc03b7c090e6c9b6431d81da4a739c764610

2 months agoabi: introduce session common
Mathieu Desnoyers [Thu, 10 Feb 2022 20:23:57 +0000 (15:23 -0500)] 
abi: introduce session common

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Id6512b87661d7e29666f41002370d065d540a27a

2 months agoImplement event counter probe
Mathieu Desnoyers [Thu, 10 Feb 2022 19:45:27 +0000 (14:45 -0500)] 
Implement event counter probe

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I6cdeef84a3b2f5675029a7509ce353a17bbeb0b4

2 months agoRemove unused lttng_event_enabler_event_name_match_event
Mathieu Desnoyers [Thu, 10 Feb 2022 19:39:15 +0000 (14:39 -0500)] 
Remove unused lttng_event_enabler_event_name_match_event

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icd02b897aa6aaa870e503db873f86f80a04ff02c

2 months agoMatch event keys for syscall events
Mathieu Desnoyers [Thu, 10 Feb 2022 19:35:09 +0000 (14:35 -0500)] 
Match event keys for syscall events

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia0b3df16abeda9e0a404eeed156e33c17f4f47e3

2 months agoSkip sync of disabled enablers
Mathieu Desnoyers [Thu, 10 Feb 2022 19:25:35 +0000 (14:25 -0500)] 
Skip sync of disabled enablers

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icf20e16baee3c63b84f1be9f730100229108bcc6

2 months agoRemove duplicate lookup in lttng_event_enabler_create_tracepoint_events_if_missing
Mathieu Desnoyers [Thu, 10 Feb 2022 19:20:48 +0000 (14:20 -0500)] 
Remove duplicate lookup in lttng_event_enabler_create_tracepoint_events_if_missing

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic597f34dfc3823ba83728bde3fcd41bb3eed9c91

2 months agoImplement _lttng_kernel_event_create counter event support
Mathieu Desnoyers [Thu, 10 Feb 2022 19:17:11 +0000 (14:17 -0500)] 
Implement _lttng_kernel_event_create counter event support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If1a2e1d64d8663f592e81611914402d30f111e17

2 months agolttng_kernel_event_alloc: handler counters
Mathieu Desnoyers [Thu, 10 Feb 2022 18:53:07 +0000 (13:53 -0500)] 
lttng_kernel_event_alloc: handler counters

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ic50018274bd5048181f9da278027e1c175b6bd80

2 months agoRefactor notification error counters
Mathieu Desnoyers [Thu, 10 Feb 2022 17:52:54 +0000 (12:52 -0500)] 
Refactor notification error counters

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I106b6fe85f899297582e131252c591ac5ba7d538

2 months agoAdd counter case in lttng_kernel_event_id_available
Mathieu Desnoyers [Wed, 2 Feb 2022 20:37:03 +0000 (15:37 -0500)] 
Add counter case in lttng_kernel_event_id_available

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1967ddd37d677806558a41138f32566ce19bae21

2 months agoImplement event counters
Mathieu Desnoyers [Thu, 27 Jan 2022 21:09:14 +0000 (16:09 -0500)] 
Implement event counters

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9eadee226c78c6b48158a0670b9b50a8b6aab06e

2 months agoAdd channel counter structures to internal header
Mathieu Desnoyers [Wed, 2 Feb 2022 20:23:02 +0000 (15:23 -0500)] 
Add channel counter structures to internal header

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I00b2a4df48d66977deafedeb3e9f5021754bf42a

2 months agoWire up LTTNG_KERNEL_EVENT_TYPE_COUNTER
Mathieu Desnoyers [Thu, 27 Jan 2022 20:58:08 +0000 (15:58 -0500)] 
Wire up LTTNG_KERNEL_EVENT_TYPE_COUNTER

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iddfaa8de487a376d35d404415bfec0676d7cb304

2 months agoRefactor _lttng_event_destroy duplicated code
Mathieu Desnoyers [Thu, 27 Jan 2022 20:53:01 +0000 (15:53 -0500)] 
Refactor _lttng_event_destroy duplicated code

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I42a607101c084ade8ebed673b3a666987cfad98f

2 months agostruct lttng_kernel_event_session_common_private: remove unused ctx field
Mathieu Desnoyers [Thu, 27 Jan 2022 19:44:26 +0000 (14:44 -0500)] 
struct lttng_kernel_event_session_common_private: remove unused ctx field

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I99a8eb21db55ec8d9df2300853b3d08abec095e5

2 months agoRename struct lttng_kernel_session_private events_ht field to events_name_ht
Mathieu Desnoyers [Thu, 27 Jan 2022 19:27:47 +0000 (14:27 -0500)] 
Rename struct lttng_kernel_session_private events_ht field to events_name_ht

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2452d6154064fd91e801d0b8487168c7cdfb0a3e

2 months agoRename struct lttng_metadata_stream list field to node
Mathieu Desnoyers [Thu, 27 Jan 2022 19:24:10 +0000 (14:24 -0500)] 
Rename struct lttng_metadata_stream list field to node

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iaefccfd27d18cbb90726f6b77400409eeea493d0

2 months agoRename struct lttng_kernel_session_private list field to node
Mathieu Desnoyers [Thu, 27 Jan 2022 19:21:52 +0000 (14:21 -0500)] 
Rename struct lttng_kernel_session_private list field to node

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I971bb068e51567ef79a30608984137827f1d45c8

2 months agoReorder struct lttng_kernel_session_private fields
Mathieu Desnoyers [Thu, 27 Jan 2022 19:19:09 +0000 (14:19 -0500)] 
Reorder struct lttng_kernel_session_private fields

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9a7c8f415c1b0b128662081f580df14bd5368893

2 months agoRename session events field to events_head
Mathieu Desnoyers [Thu, 27 Jan 2022 19:17:28 +0000 (14:17 -0500)] 
Rename session events field to events_head

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8181d86dc2dede4ba15178722e1eb884feb556eb

2 months agoRename session chan field to chan_head
Mathieu Desnoyers [Thu, 27 Jan 2022 19:14:54 +0000 (14:14 -0500)] 
Rename session chan field to chan_head

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4447978d05d2979e8c7e8c6d66126da66142e32c

2 months agoIntroduce struct lttng_event_counter_enabler
Mathieu Desnoyers [Thu, 27 Jan 2022 19:09:51 +0000 (14:09 -0500)] 
Introduce struct lttng_event_counter_enabler

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9683c18b4d661d65b128a1edda5adb1154d8d543

2 months agoIntroduce struct lttng_kernel_event_counter_private
Mathieu Desnoyers [Thu, 27 Jan 2022 19:05:35 +0000 (14:05 -0500)] 
Introduce struct lttng_kernel_event_counter_private

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2cc9d82a18f8222682e413e41a27acb8f8a74754

2 months agoMove counter key structures to beginning of events-internal.h
Mathieu Desnoyers [Thu, 27 Jan 2022 19:08:23 +0000 (14:08 -0500)] 
Move counter key structures to beginning of events-internal.h

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4b76cac6837a5098720da9ae321169b46d78866b

2 months agoIntroduce struct lttng_kernel_channel_counter and struct lttng_kernel_channel_counter_ops
Mathieu Desnoyers [Thu, 27 Jan 2022 19:03:49 +0000 (14:03 -0500)] 
Introduce struct lttng_kernel_channel_counter and struct lttng_kernel_channel_counter_ops

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icdc8c1fb6444eca2051b60fa4a7dd564e943da68

2 months agoIntroduce struct lttng_kernel_event_counter
Mathieu Desnoyers [Thu, 27 Jan 2022 19:03:14 +0000 (14:03 -0500)] 
Introduce struct lttng_kernel_event_counter

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie0e9ab234bce48c3ce23cf0d4c664ce4bb3bdaee

2 months agoIntroduce struct lttng_kernel_event_session_common_private
Mathieu Desnoyers [Mon, 10 Jan 2022 21:31:34 +0000 (16:31 -0500)] 
Introduce struct lttng_kernel_event_session_common_private

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ibaab6a0a8ce60bbc5ac212106c5c75a8a16d7e2c

2 months agoIntroduce struct lttng_event_enabler_session_common
Mathieu Desnoyers [Mon, 10 Jan 2022 21:19:27 +0000 (16:19 -0500)] 
Introduce struct lttng_event_enabler_session_common

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia160e559525f9276512506271742703804be6c9b

2 months agoTrace hit counters: introduce counter private data structures
Mathieu Desnoyers [Mon, 10 Jan 2022 19:48:59 +0000 (14:48 -0500)] 
Trace hit counters: introduce counter private data structures

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie6adadcbab8c41237b2bfb03b1c341b4183715cc

2 months agoTrace hit counters: ABI
Mathieu Desnoyers [Mon, 10 Jan 2022 19:34:13 +0000 (14:34 -0500)] 
Trace hit counters: ABI

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I886975f27af90e42cbab274f70820a06090c48bc

2 months agoFix: libcounter: __lttng_counter_add global sum step alloc vs sync mixup
Mathieu Desnoyers [Fri, 2 Sep 2022 20:13:46 +0000 (16:13 -0400)] 
Fix: libcounter: __lttng_counter_add global sum step alloc vs sync mixup

The global sum step needs to be handled on per-cpu allocated counters,
not per-cpu sync.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I9b6ef221fb099c9fc602dfdb9a93d70ae2192500

2 months agoFix: lttng_abi_validate_event_param: use kretprobe enum
Mathieu Desnoyers [Mon, 28 Feb 2022 15:40:03 +0000 (10:40 -0500)] 
Fix: lttng_abi_validate_event_param: use kretprobe enum

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I8c444e16781fb8d8df9f05f0c70775f324ae030f

2 months agokvm instrumentation: Fix kvm_mmio event NULL pointer dereference
Mathieu Desnoyers [Thu, 4 Jul 2024 15:22:23 +0000 (11:22 -0400)] 
kvm instrumentation: Fix kvm_mmio event NULL pointer dereference

Upstream Linux commit e39d200fa5bf ("KVM: Fix stack-out-of-bounds read
in write_mmio") introduce a NULL pointer check within TP_fast_assign().

lttng-modules commit 33630522da97 ("Update kvm instrumentation for 4.15")
introduce use of:

  ctf_sequence_hex(unsigned char, val, val, u32, len)

without the required NULL pointer check, which can trigger NULL pointer
dereference in case of unsatisfied MMIO read.

Add the missing NULL pointer check. Record a sequence of length 0 in the
trace when the val pointer is NULL.

Reported-by: Fahad Arslan <fahad.arslan@siemens.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I51a171a56af96e2cf68dba73f7eb473dd6c0ba0e

2 months agokvm instrumentation: Cleanup: Eliminate code duplication
Mathieu Desnoyers [Thu, 4 Jul 2024 15:15:24 +0000 (11:15 -0400)] 
kvm instrumentation: Cleanup: Eliminate code duplication

Commit 0badc02f82b38 ("Fix: adjust SLE version ranges to build with SP2
and SP3") introduced code duplication. Modify the version match logic to
remove duplicated code.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I918c87d2e6d68e6c71df18fbf66d88445ce68d23

2 months agoFix: Build on CentOS 9 Stream 2024-06
Kienan Stewart [Thu, 20 Jun 2024 15:15:59 +0000 (11:15 -0400)] 
Fix: Build on CentOS 9 Stream 2024-06

Change-Id: I445d2df9d49930e28e57b6a7d075a9f68e914bad
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 months agofix: file: Rename fcheck lookup_fd_rcu (v5.10.220)
Michael Jeanson [Tue, 25 Jun 2024 18:15:39 +0000 (14:15 -0400)] 
fix: file: Rename fcheck lookup_fd_rcu (v5.10.220)

See upstream backported commit:

  commit c4716bb296504cbc64aeefb370df44e821214c44
  Author: Eric W. Biederman <ebiederm@xmission.com>
  Date:   Fri Nov 20 17:14:27 2020 -0600

    file: Rename fcheck lookup_fd_rcu

    [ Upstream commit 460b4f812a9d473d4b39d87d37844f9fc30a9eb3 ]

    Also remove the confusing comment about checking if a fd exists.  I
    could not find one instance in the entire kernel that still matches
    the description or the reason for the name fcheck.

    The need for better names became apparent in the last round of
    discussion of this set of changes[1].

    [1] https://lkml.kernel.org/r/CAHk-=wj8BQbgJFLa+J0e=iT-1qpmCRTbPAJ8gd6MJQ=kbRPqyQ@mail.gmail.com
Link: https://lkml.kernel.org/r/20201120231441.29911-10-ebiederm@xmission.com
Change-Id: Ib880bd8feef1c5d75d2a018cd93a1d464485ab7b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 months agoCleanup: update stale file paths in LICENSE
Michael Jeanson [Mon, 21 Nov 2022 22:26:59 +0000 (17:26 -0500)] 
Cleanup: update stale file paths in LICENSE

Change-Id: I4849b19daa235b93a6435e57bd764128e43d691e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2 months agoCleanup: use SPDX v3.0 identifiers
Michael Jeanson [Mon, 21 Nov 2022 22:10:48 +0000 (17:10 -0500)] 
Cleanup: use SPDX v3.0 identifiers

The short form of GPL-2.0 and LGPL-2.1 were deprecated in favour of the
clearer GPL-2.0-only and GPL-2.0-or-later in the SPDX license list v3.0.

Change-Id: I8b59b3689aa38fb5f5a114f9d02f22274a5bff57
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agoWarn and return on fd overflow fdt
Michael Jeanson [Wed, 29 May 2024 19:02:15 +0000 (15:02 -0400)] 
Warn and return on fd overflow fdt

The fdt should only grow and iterate_fd() holds file_lock, which should
ensure the fdt does not change while the lock is taken but be cautious
and check anyway.

Change-Id: Icd6a3263026734cbe3f296f6087f79add4148a8f
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agocleanup: add correct error messages to lttng-get-syscall-inout.sh
Michael Jeanson [Wed, 8 May 2024 19:46:23 +0000 (15:46 -0400)] 
cleanup: add correct error messages to lttng-get-syscall-inout.sh

The script argument parsing was modified in
commit 6ae73da43362 ("Fix syscall generator scripts") without adjusting
the error messages and comments.

Report the proper errors for the current arguments.

Change-Id: I86f4d16ffede1a6a48bc6ab5fe1e678ef340585b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agocleanup: document 'pipe' syscall override
Michael Jeanson [Wed, 8 May 2024 18:47:09 +0000 (14:47 -0400)] 
cleanup: document 'pipe' syscall override

Change-Id: Iec84c10b774c1001ff2035024a1d05fdd31c8d9d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agofix: net: udp: add IP/port data to the tracepoint udp/udp_fail_queue_rcv_skb (v6.10)
Michael Jeanson [Mon, 27 May 2024 15:11:21 +0000 (11:11 -0400)] 
fix: net: udp: add IP/port data to the tracepoint udp/udp_fail_queue_rcv_skb (v6.10)

See upstream commit:

  commit e9669a00bba79442dd4862c57761333d6a020c24
  Author: Balazs Scheidler <bazsi77@gmail.com>
  Date:   Tue Mar 26 19:05:47 2024 +0100

    net: udp: add IP/port data to the tracepoint udp/udp_fail_queue_rcv_skb

    The udp_fail_queue_rcv_skb() tracepoint lacks any details on the source
    and destination IP/port whereas this information can be critical in case
    of UDP/syslog.

Change-Id: I0c337c5817b0a120298cbf5088d60671d9625b0d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agofix: close_on_exec(): pass files_struct instead of fdtable (v6.10)
Michael Jeanson [Mon, 27 May 2024 14:49:45 +0000 (10:49 -0400)] 
fix: close_on_exec(): pass files_struct instead of fdtable (v6.10)

See upstream commit:

  commit f60d374d2cc88034385265d193a38e3f4a4b430c
  Author: Al Viro <viro@zeniv.linux.org.uk>
  Date:   Thu Jan 4 21:35:38 2024 -0500

    close_on_exec(): pass files_struct instead of fdtable

    both callers are happier that way...

Change-Id: I8cdabb073c2090842b27b74954d86cb486c43b3e
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agofix: btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node (v6.10)
Michael Jeanson [Mon, 27 May 2024 17:13:15 +0000 (13:13 -0400)] 
fix: btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node (v6.10)

See upstream commit:

  commit cf4f04325b2b27efa5697ba0ea4c1abdee0035b4
  Author: Josef Bacik <josef@toxicpanda.com>
  Date:   Fri Apr 12 22:57:13 2024 -0400

    btrfs: move ->parent and ->ref_root into btrfs_delayed_ref_node

    These two members are shared by both the tree refs and data refs, so
    move them into btrfs_delayed_ref_node proper.  This allows us to greatly
    simplify the comparison code, as the shared refs always only sort on
    parent, and the non shared refs always sort first on ref_root, and then
    only data refs sort on their specific fields.

Change-Id: Ib7c92cc4bb8d674ac66ccfa25c03476f7adaaf90
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agofix: btrfs: simplify delayed ref tracepoints (v6.10)
Michael Jeanson [Mon, 27 May 2024 17:04:42 +0000 (13:04 -0400)] 
fix: btrfs: simplify delayed ref tracepoints (v6.10)

See upstream commit:

  commit 1bff6d4f873790cfc675afce9860208576508c5a
  Author: Josef Bacik <josef@toxicpanda.com>
  Date:   Fri Apr 12 20:27:00 2024 -0400

    btrfs: simplify delayed ref tracepoints

    Now that all of the delayed ref information is in the delayed ref node,
    drastically simplify the delayed ref tracepoints by simply passing in
    the btrfs_delayed_ref_node and populating the tracepoints with the
    values from the structure itself.

Change-Id: Ic90bc23d6aa558baec33adc33b4d21e052e83375
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 months agoFix mm_vmscan_lru_isolate tracepoint for RHEL 9.4 kernel
Martin Hicks [Fri, 17 May 2024 15:07:26 +0000 (11:07 -0400)] 
Fix mm_vmscan_lru_isolate tracepoint for RHEL 9.4 kernel

Redhat has moved to using the format first found in the 6.7 kernel
for the mm_vmscan_lru_isolate tracepoint.

Change-Id: I2aa84769c0070458d902e9a0305488d6d8a380e1
Signed-off-by: Martin Hicks <martin@sr-research.com>
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 months agofix: Add missing 'pselect6_time32' and 'ppoll_time32' syscall overrides
Michael Jeanson [Wed, 8 May 2024 18:20:30 +0000 (14:20 -0400)] 
fix: Add missing 'pselect6_time32' and 'ppoll_time32' syscall overrides

The instrumentation currently has overrides to the generated syscall
tracepoints of 'ppoll' and 'pselect6' to extract additional information
from the parameters.

On arm-32 and x86-32 these 2 syscalls were renamed to 'ppoll_time32' and
'pselect6_time32' and new syscalls using 64-bit time_t were introduced
with the old names. This results in missing overrides on these
architectures for the 32-bit variants that were renamed.

Add the '_time32' overrides to restore the previous behavior.

Change-Id: I81e3a3ddc3f3cea58d86edcdf4a1fc9b600637c2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 months agopage alloc wrapper: Fix get_pfnblock_flags_mask prototype
Mathieu Desnoyers [Thu, 9 May 2024 18:43:05 +0000 (14:43 -0400)] 
page alloc wrapper: Fix get_pfnblock_flags_mask prototype

The canary __canary__get_pfnblock_flags_mask has never done its job of
detecting changes to the prototype of get_pfnblock_flags_mask because
it was actually calling the wrapper, because the wrapper/page_alloc.h
header maps get_pfnblock_flags_mask to wrapper_get_pfnblock_flags_mask.

Unfortunately, this wrapper is included by page_alloc.c only _after_ the
linux/pageblock-flags.h header is included, which means the
get_pfnblock_flags_mask prototype does _not_ have the wrapper prefix,
which prevents it from being useful for any kind of type validation.

This has been detected by a compiler warning stating that
wrapper_get_pfnblock_flags_mask() does not have a prior declaration.

Move the wrapper/page_alloc.h include _before_ including
pageblock-flags.h. This ensures the declaration has the wrapper_ prefix,
and therefore the compiler compares the declaration with the definition
of wrapper_get_pfnblock_flags_mask within page_alloc.c. The canary
function can be removed because it is redundant with this type check.

With this proper type check in place, we notice the following two
changes upstream:

commit 535b81e209219 ("mm/page_alloc.c: remove unnecessary end_bitidx for [set|get]_pfnblock_flags_mask()")
introduced in v5.9 removes the end_bitidx argument.

commit ca891f41c4c79 ("mm: constify get_pfnblock_flags_mask and get_pfnblock_migratetype")
introduced in v5.14 adds a const qualifier to the struct page pointer.

Adapt the code to match the evolution of this prototype.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I51b7871edfbff0f74ba1cf4d0ad988eb8d642b4e

4 months agolttng probe: include events-internal.h
Mathieu Desnoyers [Thu, 9 May 2024 17:55:44 +0000 (13:55 -0400)] 
lttng probe: include events-internal.h

Include events-internal.h for the declarations of lttng_logger_init and
lttng_logger_exit.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I14968060c309083f90a282f186f3c635f1ebfd8d

4 months agouprobes: Remove dead code
Mathieu Desnoyers [Thu, 9 May 2024 17:55:16 +0000 (13:55 -0400)] 
uprobes: Remove dead code

lttng_uprobes_destroy_event_notifier_private is now unused. Remove it.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia995c60691f68090b6853b2deb0d265b1d4a047e

4 months agosyscalls: Remove unused duplicated code
Mathieu Desnoyers [Thu, 9 May 2024 17:54:20 +0000 (13:54 -0400)] 
syscalls: Remove unused duplicated code

lttng_abi_syscall_list() was moved to src/lttng-abi.c within the 2.13
refactoring. Remove this unused copy.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iabbab3b576e3d85bc5ac9831729a5786b5c5f224

4 months agostatedump: Add missing events-internal.h include
Mathieu Desnoyers [Thu, 9 May 2024 17:52:54 +0000 (13:52 -0400)] 
statedump: Add missing events-internal.h include

Include events-internal.h for the declaration of
lttng_statedump_start().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ieda391aa0d780113efe1d517d8bc5aedb2095a2c

4 months agolttng-events: Remove dead code
Mathieu Desnoyers [Thu, 9 May 2024 17:51:39 +0000 (13:51 -0400)] 
lttng-events: Remove dead code

Functions lttng_event_notifier_enabler_enable and
lttng_event_notifier_enabler_disable are unused since the 2.13
refactoring, remove them.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I18d0d483bf54cbc7d158413f27111271c68ac37d

4 months agolttng-events: Add missing static
Mathieu Desnoyers [Thu, 9 May 2024 17:50:19 +0000 (13:50 -0400)] 
lttng-events: Add missing static

get_tracker() and lttng_metadata_printf() are only used within the
compile unit, mark them as static.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie454c85cc29a30d964922fcfe1f88f3fb91bbc8f

4 months agoevent notifier: Add missing static
Mathieu Desnoyers [Thu, 9 May 2024 17:49:37 +0000 (13:49 -0400)] 
event notifier: Add missing static

Mark capture_sequence() static because it is only used within the
compile unit.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I003e5cf016fbf2f2df24f4550a6c285e020956d0

4 months agocontext callstack: Add missing static
Mathieu Desnoyers [Thu, 9 May 2024 17:49:08 +0000 (13:49 -0400)] 
context callstack: Add missing static

lttng_cs_event_fields() is only used within the compile unit, mark it
static.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3435c6de411a0671de86ecdbcb3e1ea019d908e6

4 months agolttng-clock: Add missing lttng/events-internal.h include
Mathieu Desnoyers [Thu, 9 May 2024 17:48:05 +0000 (13:48 -0400)] 
lttng-clock: Add missing lttng/events-internal.h include

Needed for lttng_clock_ref and lttng_clock_unref declarations.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Idb21d942b9e2151f1d5a78b31b28ca1ac455719b

4 months agolttng-calibrate: Add missing static and include
Mathieu Desnoyers [Thu, 9 May 2024 17:46:52 +0000 (13:46 -0400)] 
lttng-calibrate: Add missing static and include

Include lttng/events-internal.h for the lttng_calibrate
declaration. Make lttng_calibrate_kretprobe static.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ia18aa60e69cae7a16ed7d17c8297d7ad3bb3aca2

4 months agolttng-bytecode: Remove dead code
Mathieu Desnoyers [Thu, 9 May 2024 17:46:07 +0000 (13:46 -0400)] 
lttng-bytecode: Remove dead code

Functions lttng_filter_enabler_attach_bytecode and
lttng_free_enabler_filter_bytecode are unused since the
refactoring of lttng 2.13. Remove them.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2abbb3906cdb5c1b7fa9c27c7871a51af7697832

4 months agolttng-abi: Add missing static to function definitions
Mathieu Desnoyers [Thu, 9 May 2024 17:45:45 +0000 (13:45 -0400)] 
lttng-abi: Add missing static to function definitions

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icc6928df5a47c96a560e18b2c854780afbcf6307

4 months agoring buffer: Add missing static to function definitions
Mathieu Desnoyers [Thu, 9 May 2024 17:45:24 +0000 (13:45 -0400)] 
ring buffer: Add missing static to function definitions

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I80c03d8c8879777e37d24c3574ba7bdea512446a

4 months agoblkdev wrapper: Fix constness warning
Mathieu Desnoyers [Thu, 9 May 2024 17:44:05 +0000 (13:44 -0400)] 
blkdev wrapper: Fix constness warning

Upstream commit f8c7511db009d ("block: make block_class constant")
makes the block_class const. Reflect this change in the lttng-modules
canary function.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib3aadd3dedc413f8370b9739f200ce9663c38d99

4 months agoRename "tsc" to "timestamp"
Mathieu Desnoyers [Thu, 2 May 2024 21:06:29 +0000 (17:06 -0400)] 
Rename "tsc" to "timestamp"

Naming timestamps "TSC" or "tsc" is an historical artefact dating from
the implementation of libringbuffer, where the initial intent was to use
the x86 "rdtsc" instruction directly, which ended up not being what was
done in reality.

Rename uses of "TSC" and "tsc" to "timestamp" to clarify things and
don't require reviewers to be fluent in x86 instruction set.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I09437b0cf6db79600ed1a423d1f6df0344f5c9f7

5 months agoFix: timer_expire_entry changed in 4.19.312
Kienan Stewart [Mon, 15 Apr 2024 13:25:26 +0000 (09:25 -0400)] 
Fix: timer_expire_entry changed in 4.19.312

See upstream commit:

    commit bbb5b1c060d73ca96ccc8cceaa81f5e1a96e8fa4
    Author: Anna-Maria Gleixner <anna-maria@linutronix.de>
    Date:   Thu Mar 21 13:09:21 2019 +0100

        timer/trace: Improve timer tracing

        [ Upstream commit f28d3d5346e97e60c81f933ac89ccf015430e5cf ]

        Timers are added to the timer wheel off by one. This is required in
        case a timer is queued directly before incrementing jiffies to prevent
        early timer expiry.

        When reading a timer trace and relying only on the expiry time of the timer
        in the timer_start trace point and on the now in the timer_expiry_entry
        trace point, it seems that the timer fires late. With the current
        timer_expiry_entry trace point information only now=jiffies is printed but
        not the value of base->clk. This makes it impossible to draw a conclusion
        to the index of base->clk and makes it impossible to examine timer problems
        without additional trace points.

        Therefore add the base->clk value to the timer_expire_entry trace
        point, to be able to calculate the index the timer base is located at
        during collecting expired timers.

Change-Id: I2ebdbb637db0966ff51f45bf66916a59a496b50c
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoring buffer: Use cpu_dcache_is_aliasing()
Mathieu Desnoyers [Thu, 11 Apr 2024 20:09:26 +0000 (16:09 -0400)] 
ring buffer: Use cpu_dcache_is_aliasing()

Upstream Linux commit 8690bbcf3b7 ("Introduce cpu_dcache_is_aliasing()
across all architectures") allows checking whether the architecture has
aliasing data caches more accurately. This will be present in upstream
Linux v6.9 (currently in v6.9-rc3).

I expect this to improve the ring buffer performance on ARM64 and
32-bit ARM with non-aliasing data caches.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I3e29966b8c8cab098d57437a11f1f94c53a9e186

5 months agoFix: dev_base_lock removed in linux 6.9-rc1
Kienan Stewart [Mon, 25 Mar 2024 14:53:46 +0000 (10:53 -0400)] 
Fix: dev_base_lock removed in linux 6.9-rc1

See upstream commit:

    commit 1b3ef46cb7f2618cc0b507393220a69810f6da12
    Author: Eric Dumazet <edumazet@google.com>
    Date:   Tue Feb 13 06:32:45 2024 +0000

        net: remove dev_base_lock

        dev_base_lock is not needed anymore, all remaining users also hold RTNL.

Change-Id: I6b07e6eed07fd398302ca14d23162ed24d74df15
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoFix: mm_compaction_migratepages changed in linux 6.9-rc1
Kienan Stewart [Mon, 25 Mar 2024 14:30:32 +0000 (10:30 -0400)] 
Fix: mm_compaction_migratepages changed in linux 6.9-rc1

See upstream commit:

    commit ab755bf4249b992fc2140d615ab0a686d50765b4
    Author: Baolin Wang <baolin.wang@linux.alibaba.com>
    Date:   Tue Feb 20 14:16:31 2024 +0800

        mm: compaction: update the cc->nr_migratepages when allocating or freeing the freepages

        Currently we will use 'cc->nr_freepages >= cc->nr_migratepages' comparison
        to ensure that enough freepages are isolated in isolate_freepages(),
        however it just decreases the cc->nr_freepages without updating
        cc->nr_migratepages in compaction_alloc(), which will waste more CPU
        cycles and cause too many freepages to be isolated.

        So we should also update the cc->nr_migratepages when allocating or
        freeing the freepages to avoid isolating excess freepages.  And I can see
        fewer free pages are scanned and isolated when running thpcompact on my
        Arm64 server:

                                               k6.7         k6.7_patched
        Ops Compaction pages isolated      120692036.00   118160797.00
        Ops Compaction migrate scanned     131210329.00   154093268.00
        Ops Compaction free scanned       1090587971.00  1080632536.00
        Ops Compact scan efficiency               12.03          14.26

        Moreover, I did not see an obvious latency improvements, this is likely
        because isolating freepages is not the bottleneck in the thpcompact test
        case.

                                      k6.7                  k6.7_patched
        Amean     fault-both-1      1089.76 (   0.00%)     1080.16 *   0.88%*
        Amean     fault-both-3      1616.48 (   0.00%)     1636.65 *  -1.25%*
        Amean     fault-both-5      2266.66 (   0.00%)     2219.20 *   2.09%*
        Amean     fault-both-7      2909.84 (   0.00%)     2801.90 *   3.71%*
        Amean     fault-both-12     4861.26 (   0.00%)     4733.25 *   2.63%*
        Amean     fault-both-18     7351.11 (   0.00%)     6950.51 *   5.45%*
        Amean     fault-both-24     9059.30 (   0.00%)     9159.99 *  -1.11%*
        Amean     fault-both-30    10685.68 (   0.00%)    11399.02 *  -6.68%*

Change-Id: I103a43fd1b549360b3fc978fd409b7c17ef3e192
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoFix: ASoC add component to set_bias_level events in linux 6.9-rc1
Kienan Stewart [Mon, 25 Mar 2024 13:40:29 +0000 (09:40 -0400)] 
Fix: ASoC add component to set_bias_level events in linux 6.9-rc1

See upstream commit:

    commit 6ef46a69ec32fe1cf56de67742fcd01af4bf48af
    Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Date:   Wed Mar 6 10:30:00 2024 +0100

        ASoC: trace: add component to set_bias_level trace events

        The snd_soc_bias_level_start and snd_soc_bias_level_done trace events
        currently look like:

                   aplay-229   [000]  1250.140778: snd_soc_bias_level_start: card=vscn-2046 val=1
                   aplay-229   [000]  1250.140784: snd_soc_bias_level_done: card=vscn-2046 val=1
                   aplay-229   [000]  1250.140786: snd_soc_bias_level_start: card=vscn-2046 val=2
                   aplay-229   [000]  1250.140788: snd_soc_bias_level_done: card=vscn-2046 val=2
            kworker/u8:1-21    [000]  1250.140871: snd_soc_bias_level_start: card=vscn-2046 val=1
            kworker/u8:0-11    [000]  1250.140951: snd_soc_bias_level_start: card=vscn-2046 val=1
            kworker/u8:0-11    [000]  1250.140956: snd_soc_bias_level_done: card=vscn-2046 val=1
            kworker/u8:0-11    [000]  1250.140959: snd_soc_bias_level_start: card=vscn-2046 val=2
            kworker/u8:0-11    [000]  1250.140961: snd_soc_bias_level_done: card=vscn-2046 val=2
            kworker/u8:1-21    [000]  1250.167219: snd_soc_bias_level_done: card=vscn-2046 val=1
            kworker/u8:1-21    [000]  1250.167222: snd_soc_bias_level_start: card=vscn-2046 val=2
            kworker/u8:1-21    [000]  1250.167232: snd_soc_bias_level_done: card=vscn-2046 val=2
            kworker/u8:0-11    [000]  1250.167440: snd_soc_bias_level_start: card=vscn-2046 val=3
            kworker/u8:0-11    [000]  1250.167444: snd_soc_bias_level_done: card=vscn-2046 val=3
            kworker/u8:1-21    [000]  1250.167497: snd_soc_bias_level_start: card=vscn-2046 val=3
            kworker/u8:1-21    [000]  1250.167506: snd_soc_bias_level_done: card=vscn-2046 val=3

        There are clearly multiple calls, one per component, but they cannot be
        discriminated from each other.

        Change the ftrace events to also print the component name, to make it clear
        which part of the code is involved. This requires changing the passed value
        from a struct snd_soc_card, where the DAPM context is not kwown, to a
        struct snd_soc_dapm_context where it is obviously known but the a card
        pointer is also available.

        With this change, the resulting trace becomes:

                   aplay-247   [000]  1436.357332: snd_soc_bias_level_start: card=vscn-2046 component=(none) val=1
                   aplay-247   [000]  1436.357338: snd_soc_bias_level_done: card=vscn-2046 component=(none) val=1
                   aplay-247   [000]  1436.357340: snd_soc_bias_level_start: card=vscn-2046 component=(none) val=2
                   aplay-247   [000]  1436.357343: snd_soc_bias_level_done: card=vscn-2046 component=(none) val=2
            kworker/u8:4-215   [000]  1436.357437: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=1
            kworker/u8:5-231   [000]  1436.357518: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=1
            kworker/u8:5-231   [000]  1436.357523: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=1
            kworker/u8:5-231   [000]  1436.357526: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=2
            kworker/u8:5-231   [000]  1436.357528: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=2
            kworker/u8:4-215   [000]  1436.383217: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=1
            kworker/u8:4-215   [000]  1436.383221: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=2
            kworker/u8:4-215   [000]  1436.383231: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=2
            kworker/u8:5-231   [000]  1436.383468: snd_soc_bias_level_start: card=vscn-2046 component=ff320000.i2s val=3
            kworker/u8:5-231   [000]  1436.383472: snd_soc_bias_level_done: card=vscn-2046 component=ff320000.i2s val=3
            kworker/u8:4-215   [000]  1436.383503: snd_soc_bias_level_start: card=vscn-2046 component=ff560000.codec val=3
            kworker/u8:4-215   [000]  1436.383513: snd_soc_bias_level_done: card=vscn-2046 component=ff560000.codec val=3

Change-Id: I959f1680c002acdf29828b968d3975247f5433d8
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoFix: ASoC snd_doc_dapm on linux 6.9-rc1
Kienan Stewart [Mon, 25 Mar 2024 12:54:42 +0000 (08:54 -0400)] 
Fix: ASoC snd_doc_dapm on linux 6.9-rc1

See upstream commit:

    commit 7df3eb4cdb6bbfa482f51548b9fd47c2723c68ba
    Author: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Date:   Wed Mar 6 10:30:01 2024 +0100

        ASoC: trace: add event to snd_soc_dapm trace events

        Add the event value to the snd_soc_dapm_start and snd_soc_dapm_done trace
        events to make them more informative.

        Trace before:

                   aplay-229   [000]   250.140309: snd_soc_dapm_start:   card=vscn-2046
                   aplay-229   [000]   250.167531: snd_soc_dapm_done:    card=vscn-2046
                   aplay-229   [000]   251.169588: snd_soc_dapm_start:   card=vscn-2046
                   aplay-229   [000]   251.195245: snd_soc_dapm_done:    card=vscn-2046

        Trace after:

                   aplay-214   [000]   693.290612: snd_soc_dapm_start:   card=vscn-2046 event=1
                   aplay-214   [000]   693.315508: snd_soc_dapm_done:    card=vscn-2046 event=1
                   aplay-214   [000]   694.537349: snd_soc_dapm_start:   card=vscn-2046 event=2
                   aplay-214   [000]   694.563241: snd_soc_dapm_done:    card=vscn-2046 event=2

Change-Id: If0d33544b8dd1dfb3d12ca9390892190fc0444b0
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoFix: support ext4_journal_start on EL 8.4+
Kienan Stewart [Fri, 22 Mar 2024 13:55:55 +0000 (09:55 -0400)] 
Fix: support ext4_journal_start on EL 8.4+

The lower value of the EL range, 240.15.1, corresponds to the first
import of EL r8 kernels into Rocky Linux's kernel staging repo.
The change may have been introduced in an earlier RHEL 8 kernel,
prior to the history of imports into Rocky.

Change-Id: Ibec02b382478bee33947d079f33835823827f4c5
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoFix: build kvm probe on EL 8.4+
Kienan Stewart [Fri, 22 Mar 2024 13:28:08 +0000 (09:28 -0400)] 
Fix: build kvm probe on EL 8.4+

The lower value of the EL range, 240.15.1, corresponds to the first
import of EL r8 kernels into Rocky Linux's kernel staging repo.
The change may have been introduced in an earlier RHEL 8 kernel,
prior to the history of imports into Rocky.

Change-Id: Icefe472d43e28cc09746e9e046b12299609ebab1
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 months agoFix: correct RHEL range for kmem_cache_free define
Kienan Stewart [Thu, 21 Mar 2024 19:16:29 +0000 (15:16 -0400)] 
Fix: correct RHEL range for kmem_cache_free define

When compiling against RHEL 8.5 kernels, lttng-modules builds fail
with the following error:

```
lttng-modules/src/probes/../../include/lttng/tracepoint-event-impl.h:133:6: error: conflicting types for ‘trace_kmem_
cache_free’; have ‘void(long unsigned int,  const void *)’
```

The original range was introduced in commit
89d917153fc52c1e5b0ddabf8ee078897656b263 which tested against RHEL 8.6
and not RHEL 8.5.

Change-Id: Icff98c15415ce8e1e95a10974cd65ed6e84cd00a
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agodocs: Add supported versions and fix-backport policy
Kienan Stewart [Thu, 14 Mar 2024 15:37:05 +0000 (11:37 -0400)] 
docs: Add supported versions and fix-backport policy

Change-Id: I5d6da21b9541f838cb326263eff8c1448e37fc55
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoFix: Correct minimum version in jbd2 SLE kernel range
Kienan Stewart [Fri, 8 Mar 2024 17:47:06 +0000 (12:47 -0500)] 
Fix: Correct minimum version in jbd2 SLE kernel range

This range was introduced in commit b49650509ff072d37ec112cf45a5f14f382c9a31;
however, the range is wrong and worked because the kernel versions
(eg. `5.14.21-150400.24.100-default`) were evaluated to values
greater than `LTTNG_SLE_KERNEL_RANGE(5,14,21,24,46,1)`.

As a result builds of lttng-modules against older versions of SLE
kernels failed.

Change-Id: I23d97d84a23c7b24e957fe943932d6aefbe1b409
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoFix: Handle recent SLE major version codes
Kienan Stewart [Fri, 8 Mar 2024 16:26:02 +0000 (11:26 -0500)] 
Fix: Handle recent SLE major version codes

Starting in early 2022, the SLE linux version codes changed from the
previous style `5.3.18-59.40.1` to a new convention in which the major
version is a compound number consisting of the major release version,
the service pack version, and the auxillary version (currently unused
from my understanding) similar to the following `5.3.18-150300.59.43.1`[1].

The newer values used in the SLE major version causes the integer
value to "overflow" the expected number of digits and the comparisons
may fail. The `LTTNG_SLE_KERNEL_VERSION` macro also multiplies the
`LTTNG_KERNEL_VERSION` by `100000000ULL` which doesn't work in all
situations, as the resulting value is too large to be stored fully in
an `unsigned long long`.

Example of previous results:

```
// Example range comparison. True or false depending on the value of
// `LTTNG_SLE_VERSION_CODE` and `LTTNG_LINUX_VERSION_CODE`.
LTTNG_SLE_KERNEL_RANGE(5,15,21,150400,24,46, 5,15,0,0,0,0);

// Note: values printed with `%ull`
LTTNG_SLE_KERNEL_VERSION(5,15,21,24,26,1); // 6106486698364570153
LTTNG_SLE_KERNEL_VERSION(5,15,0,0,0,0);    // 0
LTTNG_KERNEL_VERSION(5,15,0);              // 84869120

// Corrected SLE version codes
LTTNG_SLE_KERNEL_VERSION(5,14,21,150400,24,26); // 14918348902249793914
LTTNG_SLE_KERNEL_VERSION(5,14,21,150400,24,46); // 14918348902249793934
LTTNG_SLE_KERNEL_VERSION(5,15,0,150400,0,0));   // 6971507145825058816
```

`LTTNG_KERNEL_VERSION` packs the kernel version into a 32-bit integer;
however, using that type of packing on the SLE kernel version will not
work well:

* Major: `150400` needs 18 bits
* Minor: may exceed 127, requires 8 bits (eg. `4.12.14-150100.197.148.1`)
* Patch: may exceed 127, requires 8 bits (eg. `5.3.18-150300.59.124.1`)

In this patch, the SLE version is packed into a 64-bit integer
with 48 bits for the major version, 8 bits for each of the minor and
patch versions.

As a result of packing the SLE version into a 64-bit integer,
it is not possible to coherently combine an `LTTNG_KERNEL_VERSION` and
an `LTTNG_SLE_KERNEL_VERSION`. Doing so would require an integer
larger than 64-bits. Therefore, the `LTTNG_SLE_KERNEL_RANGE` macro has
been adjusted to perform the range comparisons using the two values
separately. The usage of the `LTTNG_SLE_KERNEL_RANGE` remains
unchanged, as `LTTNG_SLE_VERSION` is only used inside that macro.

Using the adjusted macros:

```
// Example range comparison. True or false depending on the value of
// `LTTNG_SLE_VERSION_CODE` and `LTTNG_LINUX_VERSION_CODE`.
LTTNG_SLE_KERNEL_RANGE(5,15,21,150400,24,46, 5,15,0,0,0,0);

// Note: values printed with `%ull`
LTTNG_SLE_VERSION(24,26,1); // 1579521
LTTNG_SLE_VERSION(0,0,0);   // 0
LTTNG_KERNEL_VERSION(5,15,0);      // 84869120

// Corrected SLE version codes
LTTNG_SLE_VERSION(150400,24,26); // 9856620570
LTTNG_SLE_VERSION(150400,24,46); // 9856620590
LTTNG_SLE_VERSION(150400,0,0));  // 9863168000
```

Known drawbacks
===============

It's possible that future releases of SLE kernels have minor or patch
values that exceed 255 (SLE15SP1 has a release using `197`, for example),
requiring an adjustment to using more bits for those fields when
packing into a 64-bit integer.

The schema of multiplying an `LTTNG_KERNEL_VERSION` by a large value
is used for other distributions. RHEL in particular uses
`100000000ULL`, which could lead to overflow issues with certain
comparisons similar to the previous behaviour of
`LTTNG_SLE_KERNEL_VERSION(5,15,0,0,0,0);`.

[1]: https://www.suse.com/support/kb/doc/?id=000019587#SLE15SP4

Change-Id: Iaa90bfa422e47213a13829cdf008ab20d7484cab
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 months agoFix: build on sles15sp4
Kienan Stewart [Tue, 27 Feb 2024 16:47:58 +0000 (11:47 -0500)] 
Fix: build on sles15sp4

Introduced in 5.14.21-150400.46.1.

See SLE commit:

    commit 96a814b6c528f45fc92bf8e6de90ad8923511091
    Author: Petr Pavlu <petr.pavlu@suse.com>
    Date:   Tue Jan 24 14:52:24 2023 +0100

        jbd2: use the correct print format (git-fixes).

        suse-commit: 34db311bec3ca4388b82b2355eed7c08b25f5a2e

Change-Id: Ic267b9498b7f9a4a814514ff82f9226f844c133f
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 months agoCompile fixes for RHEL 9.3 kernels
Martin Hicks [Fri, 26 Jan 2024 17:18:33 +0000 (12:18 -0500)] 
Compile fixes for RHEL 9.3 kernels

The ranges were build tested on RHEL9.2 (5.14.0-284.11.1), RHEL9.3
(5.14.0-362.8.1) and RHEL8.9 (4.18.0-513.11.1).

This disables the kmem and compaction modules.  I don't believe getting
these to compile will be easy, as the required struct declarations are
in vmlinux.h, and haven't been moved into mm/internal.h and mm/slab.h in
the RHEL sources.

Change-Id: I999c593d6850e2327f6e9df8432a4ea2325a7cea
Signed-off-by: Martin Hicks <martin@sr-research.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 months agoFix: ext4_discard_preallocations changed in linux 6.8.0-rc3
Kienan Stewart [Mon, 5 Feb 2024 13:52:29 +0000 (08:52 -0500)] 
Fix: ext4_discard_preallocations changed in linux 6.8.0-rc3

See upstream commit:

    commit f0e54b6087de9571ec61c189d6c378b81edbe3b2
    Author: Kemeng Shi <shikemeng@huaweicloud.com>
    Date:   Fri Jan 5 17:21:02 2024 +0800

        ext4: remove 'needed' in trace_ext4_discard_preallocations

        As 'needed' to trace_ext4_discard_preallocations is always 0 which
        is meaningless. Just remove it.

Change-Id: Ib6b698ca553c4beebd4ca791c83bbbb927901758
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 months agoClean-up: rb: backend.h: remove extra newline
Jérémie Galarneau [Wed, 31 Jan 2024 01:42:01 +0000 (20:42 -0500)] 
Clean-up: rb: backend.h: remove extra newline

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iaf749728feb1b3e790091af84fa09739bf1b50f8

7 months agoRemove strlcpy usage
Kienan Stewart [Thu, 1 Feb 2024 19:02:19 +0000 (14:02 -0500)] 
Remove strlcpy usage

The replacement for `strlcpy`, `strscpy`, was introduced in Linux
4.3. As lttng-modules master aims to support Linux 4.4+ at this time,
the version check can safely be removed.

See upstream commit:

    commit 30035e45753b708e7d47a98398500ca005e02b86
    Author: Chris Metcalf <cmetcalf@ezchip.com>
    Date:   Wed Apr 29 12:52:04 2015 -0400

        string: provide strscpy()

        The strscpy() API is intended to be used instead of strlcpy(),
        and instead of most uses of strncpy().

        - Unlike strlcpy(), it doesn't read from memory beyond (src + size).

        - Unlike strlcpy() or strncpy(), the API provides an easy way to check
          for destination buffer overflow: an -E2BIG error return value.

        - The provided implementation is robust in the face of the source
          buffer being asynchronously changed during the copy, unlike the
          current implementation of strlcpy().

        - Unlike strncpy(), the destination buffer will be NUL-terminated
          if the string in the source buffer is too long.

        - Also unlike strncpy(), the destination buffer will not be updated
          beyond the NUL termination, avoiding strncpy's behavior of zeroing
          the entire tail end of the destination buffer.  (A memset() after
          the strscpy() can be used if this behavior is desired.)

        - The implementation should be reasonably performant on all
          platforms since it uses the asm/word-at-a-time.h API rather than
          simple byte copy.  Kernel-to-kernel string copy is not considered
          to be performance critical in any case.

Change-Id: I31fefde148d5b63a30532fbcb4b59bb951bba902
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 months agoFix: btrfs_get_extent flags and compress_type changed in linux 6.8.0-rc1
Kienan Stewart [Mon, 22 Jan 2024 18:13:36 +0000 (13:13 -0500)] 
Fix: btrfs_get_extent flags and compress_type changed in linux 6.8.0-rc1

See upstream commit:

    commit f86f7a75e2fb5fd7d31d00eab8a392f97ba42ce9
    Author: Filipe Manana <fdmanana@suse.com>
    Date:   Mon Dec 4 16:20:33 2023 +0000

        btrfs: use the flags of an extent map to identify the compression type

        Currently, in struct extent_map, we use an unsigned int (32 bits) to
        identify the compression type of an extent and an unsigned long (64 bits
        on a 64 bits platform, 32 bits otherwise) for flags. We are only using
        6 different flags, so an unsigned long is excessive and we can use flags
        to identify the compression type instead of using a dedicated 32 bits
        field.

        We can easily have tens or hundreds of thousands (or more) of extent maps
        on busy and large filesystems, specially with compression enabled or many
        or large files with tons of small extents. So it's convenient to have the
        extent_map structure as small as possible in order to use less memory.

        So remove the compression type field from struct extent_map, use flags
        to identify the compression type and shorten the flags field from an
        unsigned long to a u32. This saves 8 bytes (on 64 bits platforms) and
        reduces the size of the structure from 136 bytes down to 128 bytes, using
        now only two cache lines, and increases the number of extent maps we can
        have per 4K page from 30 to 32. By using a u32 for the flags instead of
        an unsigned long, we no longer use test_bit(), set_bit() and clear_bit(),
        but that level of atomicity is not needed as most flags are never cleared
        once set (before adding an extent map to the tree), and the ones that can
        be cleared or set after an extent map is added to the tree, are always
        performed while holding the write lock on the extent map tree, while the
        reader holds a lock on the tree or tests for a flag that never changes
        once the extent map is in the tree (such as compression flags).

Change-Id: I95402d43f064c016b423b48652e4968d3db9b8a9
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 months agoFix: btrfs_chunk tracepoints changed in linux 6.8.0-rc1
Kienan Stewart [Mon, 22 Jan 2024 17:17:33 +0000 (12:17 -0500)] 
Fix: btrfs_chunk tracepoints changed in linux 6.8.0-rc1

See upstream commit:

    commit 7dc66abb5a47778d7db327783a0ba172b8cff0b5
    Author: Filipe Manana <fdmanana@suse.com>
    Date:   Tue Nov 21 13:38:38 2023 +0000

        btrfs: use a dedicated data structure for chunk maps

        Currently we abuse the extent_map structure for two purposes:

        1) To actually represent extents for inodes;
        2) To represent chunk mappings.

        This is odd and has several disadvantages:

        1) To create a chunk map, we need to do two memory allocations: one for
           an extent_map structure and another one for a map_lookup structure, so
           more potential for an allocation failure and more complicated code to
           manage and link two structures;

        2) For a chunk map we actually only use 3 fields (24 bytes) of the
           respective extent map structure: the 'start' field to have the logical
           start address of the chunk, the 'len' field to have the chunk's size,
           and the 'orig_block_len' field to contain the chunk's stripe size.

           Besides wasting a memory, it's also odd and not intuitive at all to
           have the stripe size in a field named 'orig_block_len'.

           We are also using 'block_len' of the extent_map structure to contain
           the chunk size, so we have 2 fields for the same value, 'len' and
           'block_len', which is pointless;

        3) When an extent map is associated to a chunk mapping, we set the bit
           EXTENT_FLAG_FS_MAPPING on its flags and then make its member named
           'map_lookup' point to the associated map_lookup structure. This means
           that for an extent map associated to an inode extent, we are not using
           this 'map_lookup' pointer, so wasting 8 bytes (on a 64 bits platform);

        4) Extent maps associated to a chunk mapping are never merged or split so
           it's pointless to use the existing extent map infrastructure.

        So add a dedicated data structure named 'btrfs_chunk_map' to represent
        chunk mappings, this is basically the existing map_lookup structure with
        some extra fields:

        1) 'start' to contain the chunk logical address;
        2) 'chunk_len' to contain the chunk's length;
        3) 'stripe_size' for the stripe size;
        4) 'rb_node' for insertion into a rb tree;
        5) 'refs' for reference counting.

        This way we do a single memory allocation for chunk mappings and we don't
        waste memory for them with unused/unnecessary fields from an extent_map.

        We also save 8 bytes from the extent_map structure by removing the
        'map_lookup' pointer, so the size of struct extent_map is reduced from
        144 bytes down to 136 bytes, and we can now have 30 extents map per 4K
        page instead of 28.

Change-Id: Ie52b5ac83df4bc6abeb84d958c4f5d24ae0d8c75
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 months agoFix: strlcpy removed in linux 6.8.0-rc1
Kienan Stewart [Mon, 22 Jan 2024 16:47:40 +0000 (11:47 -0500)] 
Fix: strlcpy removed in linux 6.8.0-rc1

See upstream commit:

    commit d26270061ae66b915138af7cd73ca6f8b85e6b44
    Author: Kees Cook <keescook@chromium.org>
    Date:   Thu Jan 18 12:31:55 2024 -0800

        string: Remove strlcpy()

        With all the users of strlcpy() removed[1] from the kernel, remove the
        API, self-tests, and other references. Leave mentions in Documentation
        (about its deprecation), and in checkpatch.pl (to help migrate host-only
        tools/ usage). Long live strscpy().

The replacement interface, `strscpy`, has been available since linux
4.3, introduced in the upstream commit
30c44659f4a3e7e1f9f47e895591b4b40bf62671.

As lttng-modules master branch targets linux 4.4+ at this time,
`strlcpy` can be replaced with `strscpy`.

Change-Id: I27cdff70a504b25340cc59150ed8e959d9629e43
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 months agoFix: timer_start changed in linux 6.8.0-rc1
Kienan Stewart [Mon, 22 Jan 2024 16:33:39 +0000 (11:33 -0500)] 
Fix: timer_start changed in linux 6.8.0-rc1

See upstream commit

    commit dbcdcb62b59db2cf6a24113873b90da15c6f0b19
    Author: Anna-Maria Behnsen <anna-maria@linutronix.de>
    Date:   Fri Dec 1 10:26:26 2023 +0100

        tracing/timers: Enhance timer_start tracepoint

        For starting a timer, the timer is enqueued into a bucket of the timer
        wheel. The bucket expiry is the defacto expiry of the timer but it is not
        equal the timer expiry because of increasing granularity when bucket is in
        a higher level of the wheel. To be able to figure out in a trace whether a
        timer expired in time or not, the bucket expiry time is required as well.

        Add bucket expiry time to the timer_start tracepoint and thereby simplify
        the arguments.

Change-Id: I4868092765745b1efd0c48f13c0b837f2007dcb6
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 months agoFix: sched_stat_runtime changed in linux 6.8.0-rc1
Kienan Stewart [Mon, 22 Jan 2024 16:10:37 +0000 (11:10 -0500)] 
Fix: sched_stat_runtime changed in linux 6.8.0-rc1

See upstream commit:

    commit 5fe6ec8f6ab549b6422e41551abb51802bd48bc7
    Author: Peter Zijlstra <peterz@infradead.org>
    Date:   Mon Nov 6 13:41:43 2023 +0100

        sched: Remove vruntime from trace_sched_stat_runtime()

        Tracing the runtime delta makes sense, observer can sum over time.
        Tracing the absolute vruntime makes less sense, inconsistent:
        absolute-vs-delta, but also vruntime delta can be computed from
        runtime delta.

        Removing the vruntime thing also makes the two tracepoint sites
        identical, allowing to unify the code in a later patch.

Change-Id: I24ebb4e06dbb646a1af75ac62b74f3821ff197de
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 months agodocs: Add links to project resources
Kienan Stewart [Fri, 24 Nov 2023 15:09:46 +0000 (10:09 -0500)] 
docs: Add links to project resources

Indicate that Gerrit (https://review.lttng.org) is the principal place
where patches are submitted and reviewed, rather than the mailing list.

Based on feedback received on the mailing list:
https://lists.lttng.org/pipermail/lttng-dev/2023-November/030670.html

Change-Id: I611deeec26393fc25c9a103c022687198100df0c
Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 months agoFix: Disable IBT around indirect function calls
Mathieu Desnoyers [Mon, 8 Jan 2024 18:31:04 +0000 (13:31 -0500)] 
Fix: Disable IBT around indirect function calls

When the Intel IBT feature is enabled, a CPU supporting this feature
validates that all indirect jumps/calls land on an ENDBR64 instruction.

The kernel seals functions which are not meant to be called indirectly,
which means that calling functions indirectly from their address fetched
using kallsyms or kprobes trigger a crash.

Use the MSR_IA32_S_CET CET_ENDBR_EN MSR bit to temporarily disable ENDBR
validation around indirect calls to kernel functions. Considering that
the main purpose of this feature is to prevent ROP-style attacks,
disabling the ENDBR validation temporarily around the call from a kernel
module does not affect the ROP protection.

Fixes #1408
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I97f5d8efce093c1e956cede1f44de2fcebf30227

8 months agoRemove splice_to_pipe kallsyms wrapper
Michael Jeanson [Mon, 8 Jan 2024 21:05:22 +0000 (16:05 -0500)] 
Remove splice_to_pipe kallsyms wrapper

Starting from kernel v4.2, the splice_to_pipe symbol is exported for GPL
modules. Use it rather than the kallsyms wrapper.

This fixes commit 0e5e973df5 which should have removed the wrapper
rather than using it all the time.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I52ce8cc99c3174fea30479af8fcf72879ef8aa47

8 months agoInline implementation of task_prio()
Mathieu Desnoyers [Tue, 9 Jan 2024 15:36:31 +0000 (10:36 -0500)] 
Inline implementation of task_prio()

The task_prio() function has been implemented as "return p->prio -
MAX_RT_PRIO;" since at least kernel v3.0, so inline it into
lttng-modules rather than using kallsyms to call the kernel
implementation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I7dd482a2da72a005c16b3e5864767b47d7bc3fd3

8 months agoFix: prio context NULL pointer exception
Mathieu Desnoyers [Tue, 9 Jan 2024 15:33:13 +0000 (10:33 -0500)] 
Fix: prio context NULL pointer exception

A missing call to wrapper_task_prio_init() causes the function pointer
for task_prio to stay NULL, which triggers a OOPS when trying to use the
prio context.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I417e84cb8a07db624e682c7ec2c033fbc2a7b8e7

8 months agoSet version to 2.14-pre
Michael Jeanson [Mon, 8 Jan 2024 19:36:51 +0000 (14:36 -0500)] 
Set version to 2.14-pre

Change-Id: If3952a982001ca334d1cc7069d8a63c478dfde8d
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 months agoCleanup: combine ifdefs for arm thumb2
Mathieu Desnoyers [Fri, 22 Dec 2023 02:01:51 +0000 (21:01 -0500)] 
Cleanup: combine ifdefs for arm thumb2

Those two ifdefs can be combined into a single preprocessor conditional
with a &&.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Icc2c11f1fd033af475cf69f14140dd710417cf10

8 months agoCleanup: kallsyms wrapper refactoring
Mathieu Desnoyers [Thu, 21 Dec 2023 20:10:22 +0000 (15:10 -0500)] 
Cleanup: kallsyms wrapper refactoring

Move the Christmas tree of #ifdef which was implemented in
do_get_kallsyms() into separate functions:

- kallsyms_pre_arch_adjust(),
- kallsyms_get_arch_call_addr().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I1bfdb43682e466f446d376ba7a122e295a2f0ea1

8 months agoFix: MODULE_IMPORT_NS is introduced in kernel 5.4
Mathieu Desnoyers [Mon, 18 Dec 2023 18:17:07 +0000 (13:17 -0500)] 
Fix: MODULE_IMPORT_NS is introduced in kernel 5.4

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I4c5faafb3a3ff8178b45c0e411113b17643bbc78

8 months agoAndroid: Import VFS namespace for android common kernel
Lei wang [Mon, 18 Dec 2023 10:16:33 +0000 (05:16 -0500)] 
Android: Import VFS namespace for android common kernel

Android GKI kernel add limitation on fs interface usage.
Need to import VFS namespace explicitly to make it workable
for lttng-modules.

Signed-off-by: Lei wang <quic_leiwan@quicinc.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 months agofix: lookup_fd_rcu replaced by lookup_fdget_rcu in linux 6.7.0-rc1
Kienan Stewart [Mon, 20 Nov 2023 16:34:40 +0000 (11:34 -0500)] 
fix: lookup_fd_rcu replaced by lookup_fdget_rcu in linux 6.7.0-rc1

See upstream commit:

    commit 0ede61d8589cc2d93aa78230d74ac58b5b8d0244
    Author: Christian Brauner <brauner@kernel.org>
    Date:   Fri Sep 29 08:45:59 2023 +0200

        file: convert to SLAB_TYPESAFE_BY_RCU

        In recent discussions around some performance improvements in the file
        handling area we discussed switching the file cache to rely on
        SLAB_TYPESAFE_BY_RCU which allows us to get rid of call_rcu() based
        freeing for files completely. This is a pretty sensitive change overall
        but it might actually be worth doing.

        The main downside is the subtlety. The other one is that we should
        really wait for Jann's patch to land that enables KASAN to handle
        SLAB_TYPESAFE_BY_RCU UAFs. Currently it doesn't but a patch for this
        exists.

        With SLAB_TYPESAFE_BY_RCU objects may be freed and reused multiple times
        which requires a few changes. So it isn't sufficient anymore to just
        acquire a reference to the file in question under rcu using
        atomic_long_inc_not_zero() since the file might have already been
        recycled and someone else might have bumped the reference.

        In other words, callers might see reference count bumps from newer
        users. For this reason it is necessary to verify that the pointer is the
        same before and after the reference count increment. This pattern can be
        seen in get_file_rcu() and __files_get_rcu().

        In addition, it isn't possible to access or check fields in struct file
        without first aqcuiring a reference on it. Not doing that was always
        very dodgy and it was only usable for non-pointer data in struct file.
        With SLAB_TYPESAFE_BY_RCU it is necessary that callers first acquire a
        reference under rcu or they must hold the files_lock of the fdtable.
        Failing to do either one of this is a bug.

        Thanks to Jann for pointing out that we need to ensure memory ordering
        between reallocations and pointer check by ensuring that all subsequent
        loads have a dependency on the second load in get_file_rcu() and
        providing a fixup that was folded into this patch.

Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Change-Id: Iba3663f19a54820afd31a8eeec24b3b5d4b06589
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 months agofix: mm, vmscan signatures changed in linux 6.7.0-rc1
Kienan Stewart [Mon, 20 Nov 2023 16:33:14 +0000 (11:33 -0500)] 
fix: mm, vmscan signatures changed in linux 6.7.0-rc1

See upstream commit:

    commit 3dfbb555c98ac55b9d911f9af0e35014b445fb41
    Author: Vlastimil Babka <vbabka@suse.cz>
    Date:   Thu Sep 14 15:16:39 2023 +0200

        mm, vmscan: remove ISOLATE_UNMAPPED

        This isolate_mode_t flag is effectively unused since 89f6c88a6ab4 ("mm:
        __isolate_lru_page_prepare() in isolate_migratepages_block()") as
        sc->may_unmap is now checked directly (and only node_reclaim has a mode
        that sets it to 0).  The last remaining place is mm_vmscan_lru_isolate
        tracepoint for the isolate_mode parameter.  That one was mainly used to
        indicate the active/inactive mode, which the trace-vmscan-postprocess.pl
        script consumed, but that got silently broken.  After fixing the script by
        the previous patch, it does not need the isolate_mode anymore.  So just
        remove the parameter and with that the whole ISOLATE_UNMAPPED flag.

Signed-off-by: Kienan Stewart <kstewart@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie7346886d926a1a9d20bcb1570c587c5e943a1c3

This page took 0.05044 seconds and 4 git commands to generate.