lttng-modules.git
3 years agoRefactoring: remove unused argument from lttng_syscall_event_enabler_create_matching_...
Mathieu Desnoyers [Fri, 5 Nov 2021 18:52:50 +0000 (14:52 -0400)] 
Refactoring: remove unused argument from lttng_syscall_event_enabler_create_matching_events

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

3 years agoRefactoring: add/remove to/from dispatch list on enable/disable event for event recorder
Mathieu Desnoyers [Fri, 5 Nov 2021 18:50:03 +0000 (14:50 -0400)] 
Refactoring: add/remove to/from dispatch list on enable/disable event for event recorder

Use same behavior for event recorder as for event notifier.

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

3 years agoRefactoring: syscall tracing: config compat
Mathieu Desnoyers [Fri, 5 Nov 2021 18:40:18 +0000 (14:40 -0400)] 
Refactoring: syscall tracing: config compat

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

3 years agoFix: event notifier unknown syscall match only wildcard all
Mathieu Desnoyers [Fri, 5 Nov 2021 18:32:54 +0000 (14:32 -0400)] 
Fix: event notifier unknown syscall match only wildcard all

The unknown system call event should only be generated when matching a
wildcard *all*, otherwise when matching a system call by name we don't
expect to emit a notification for an unknown system call.

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

3 years agoRefactoring: introduce create_unknown_syscall_event
Mathieu Desnoyers [Fri, 5 Nov 2021 16:41:38 +0000 (12:41 -0400)] 
Refactoring: introduce create_unknown_syscall_event

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

3 years agoRefactoring: introduce lttng_syscall_event_enabler_create_matching_events
Mathieu Desnoyers [Fri, 5 Nov 2021 16:35:21 +0000 (12:35 -0400)] 
Refactoring: introduce lttng_syscall_event_enabler_create_matching_events

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

3 years agoFix: add unknown event to dispatch list
Mathieu Desnoyers [Fri, 5 Nov 2021 16:33:37 +0000 (12:33 -0400)] 
Fix: add unknown event to dispatch list

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

3 years agoFix: RCU-aware add event recorder to RCU dispatch list
Mathieu Desnoyers [Fri, 5 Nov 2021 16:31:34 +0000 (12:31 -0400)] 
Fix: RCU-aware add event recorder to RCU dispatch list

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

3 years agoRefactoring: introduce lttng_syscall_event_enabler_create_event
Mathieu Desnoyers [Fri, 5 Nov 2021 16:20:56 +0000 (12:20 -0400)] 
Refactoring: introduce lttng_syscall_event_enabler_create_event

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

3 years agoRefactoring: syscall: move matching event creation before tracepoint registration
Mathieu Desnoyers [Fri, 5 Nov 2021 14:56:30 +0000 (10:56 -0400)] 
Refactoring: syscall: move matching event creation before tracepoint registration

There is no point in doing the event notifier creation after tracepoint
registration for syscall tracing. Move it prior to tracepoint
registration, similarly to event recorder.

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

3 years agosyscalls: remove vmalloc sync mappings
Mathieu Desnoyers [Fri, 5 Nov 2021 14:55:26 +0000 (10:55 -0400)] 
syscalls: remove vmalloc sync mappings

The system call tables don't use vmalloc, so there is no point in
synchronizing the mappings.

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

3 years agoRefactoring: introduce lttng_event_enabler_create_{syscall,tracepoint}_events_if_missing
Mathieu Desnoyers [Fri, 5 Nov 2021 14:16:10 +0000 (10:16 -0400)] 
Refactoring: introduce lttng_event_enabler_create_{syscall,tracepoint}_events_if_missing

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

3 years agoRefactoring: combine common code into _lttng_kernel_event_create
Mathieu Desnoyers [Thu, 4 Nov 2021 21:10:21 +0000 (17:10 -0400)] 
Refactoring: combine common code into _lttng_kernel_event_create

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

3 years agoFix: clear error counter before adding to lists
Mathieu Desnoyers [Thu, 4 Nov 2021 21:05:10 +0000 (17:05 -0400)] 
Fix: clear error counter before adding to lists

Adding to lists should be the last thing in the create function,
otherwise errors on error counter clear may lead to use-after-free
due to presence of freed objects in linked lists.

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

3 years agoRefactoring: introduce lttng_kernel_event_id_available
Mathieu Desnoyers [Thu, 4 Nov 2021 21:02:55 +0000 (17:02 -0400)] 
Refactoring: introduce lttng_kernel_event_id_available

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

3 years agoRefactoring: remove unused event_recorder_return
Mathieu Desnoyers [Thu, 4 Nov 2021 20:53:32 +0000 (16:53 -0400)] 
Refactoring: remove unused event_recorder_return

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

3 years agoRefactoring: event create: introduce _lttng_event_recorder_metadata_statedump
Mathieu Desnoyers [Thu, 4 Nov 2021 20:51:34 +0000 (16:51 -0400)] 
Refactoring: event create: introduce _lttng_event_recorder_metadata_statedump

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

3 years agoRefactoring: event create: use lttng_get_event_list_head_from_enabler
Mathieu Desnoyers [Thu, 4 Nov 2021 20:45:36 +0000 (16:45 -0400)] 
Refactoring: event create: use lttng_get_event_list_head_from_enabler

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

3 years agoRefactoring: introduce lttng_kernel_event_notifier_clear_error_counter
Mathieu Desnoyers [Thu, 4 Nov 2021 20:42:44 +0000 (16:42 -0400)] 
Refactoring: introduce lttng_kernel_event_notifier_clear_error_counter

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

3 years agoRefactoring: introduce lttng_event_enabler_event_name_match_event
Mathieu Desnoyers [Thu, 4 Nov 2021 20:33:39 +0000 (16:33 -0400)] 
Refactoring: introduce lttng_event_enabler_event_name_match_event

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

3 years agoRefactoring: event create: use parent structure
Mathieu Desnoyers [Thu, 4 Nov 2021 19:51:24 +0000 (15:51 -0400)] 
Refactoring: event create: use parent structure

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

3 years agoRefactoring: introduce lttng_kernel_event_alloc and lttng_kernel_event_free
Mathieu Desnoyers [Thu, 4 Nov 2021 19:44:48 +0000 (15:44 -0400)] 
Refactoring: introduce lttng_kernel_event_alloc and lttng_kernel_event_free

Eliminate duplicated code.

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

3 years agoRefactoring: merge lttng_sync_event_list common code
Mathieu Desnoyers [Wed, 3 Nov 2021 20:21:43 +0000 (16:21 -0400)] 
Refactoring: merge lttng_sync_event_list common code

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

3 years agoRefactoring: move enablers list into common structure
Mathieu Desnoyers [Wed, 3 Nov 2021 20:01:14 +0000 (16:01 -0400)] 
Refactoring: move enablers list into common structure

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

3 years agoRefactoring: introduce lttng_event_sync_filter_state and lttng_event_sync_capture_state
Mathieu Desnoyers [Wed, 3 Nov 2021 19:42:01 +0000 (15:42 -0400)] 
Refactoring: introduce lttng_event_sync_filter_state and lttng_event_sync_capture_state

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

3 years agoRefactoring: combine common code into lttng_event_enabler_ref_events
Mathieu Desnoyers [Wed, 3 Nov 2021 19:27:37 +0000 (15:27 -0400)] 
Refactoring: combine common code into lttng_event_enabler_ref_events

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

3 years agoRefactoring: introduce lttng_event_enabler_init_event_filter
Mathieu Desnoyers [Wed, 3 Nov 2021 19:22:28 +0000 (15:22 -0400)] 
Refactoring: introduce lttng_event_enabler_init_event_filter

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

3 years agoRefactoring: introduce lttng_event_enabler_init_event_capture
Mathieu Desnoyers [Wed, 3 Nov 2021 19:19:26 +0000 (15:19 -0400)] 
Refactoring: introduce lttng_event_enabler_init_event_capture

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

3 years agoRefactoring: combine common code into lttng_syscall_table_set_wildcard_all
Mathieu Desnoyers [Wed, 3 Nov 2021 19:09:53 +0000 (15:09 -0400)] 
Refactoring: combine common code into lttng_syscall_table_set_wildcard_all

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

3 years agoRefactoring: introduce list head from enabler getter
Mathieu Desnoyers [Wed, 3 Nov 2021 18:59:51 +0000 (14:59 -0400)] 
Refactoring: introduce list head from enabler getter

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

3 years agoRefactoring: move event list node field to common structure
Mathieu Desnoyers [Wed, 3 Nov 2021 18:55:36 +0000 (14:55 -0400)] 
Refactoring: move event list node field to common structure

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

3 years agoRefactoring: combine common code into lttng_create_event_if_missing
Mathieu Desnoyers [Wed, 3 Nov 2021 16:20:32 +0000 (12:20 -0400)] 
Refactoring: combine common code into lttng_create_event_if_missing

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

3 years agoRefactoring: combine identical functions into lttng_create_tracepoint_event_if_missing
Mathieu Desnoyers [Wed, 3 Nov 2021 16:17:10 +0000 (12:17 -0400)] 
Refactoring: combine identical functions into lttng_create_tracepoint_event_if_missing

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

3 years agoRefactoring/fix: desc match enabler: handle error internally
Mathieu Desnoyers [Wed, 3 Nov 2021 16:14:09 +0000 (12:14 -0400)] 
Refactoring/fix: desc match enabler: handle error internally

This actually ensures that callers don't mistakenly consider a negative
return value (error) as a match success.

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

3 years agoRefactoring: syscalls: use common match functions
Mathieu Desnoyers [Wed, 3 Nov 2021 16:08:22 +0000 (12:08 -0400)] 
Refactoring: syscalls: use common match functions

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

3 years agoRefactoring: combine create event common code
Mathieu Desnoyers [Wed, 3 Nov 2021 16:00:02 +0000 (12:00 -0400)] 
Refactoring: combine create event common code

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

3 years agoRefactoring: combine match functions for notifier and recorder
Mathieu Desnoyers [Wed, 3 Nov 2021 15:25:59 +0000 (11:25 -0400)] 
Refactoring: combine match functions for notifier and recorder

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

3 years agoRefactoring: introduce lttng_get_event_ht_from_enabler
Mathieu Desnoyers [Tue, 2 Nov 2021 20:58:34 +0000 (16:58 -0400)] 
Refactoring: introduce lttng_get_event_ht_from_enabler

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

3 years agoRefactoring: combine hlist_node into common event structure
Mathieu Desnoyers [Tue, 2 Nov 2021 20:42:52 +0000 (16:42 -0400)] 
Refactoring: combine hlist_node into common event structure

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

3 years agoRefactoring: event notifier create: use enablers
Mathieu Desnoyers [Tue, 2 Nov 2021 19:04:08 +0000 (15:04 -0400)] 
Refactoring: event notifier create: use enablers

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

3 years agoRefactoring: combine event hash tables common code
Mathieu Desnoyers [Tue, 2 Nov 2021 18:16:38 +0000 (14:16 -0400)] 
Refactoring: combine event hash tables common code

Combine common code across notifier and recorder.

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

3 years agoRefactoring: combine _lttng_event_unregister common code
Mathieu Desnoyers [Tue, 2 Nov 2021 18:11:40 +0000 (14:11 -0400)] 
Refactoring: combine _lttng_event_unregister common code

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

3 years agoRefactoring: combine register_event common code
Mathieu Desnoyers [Tue, 2 Nov 2021 18:02:37 +0000 (14:02 -0400)] 
Refactoring: combine register_event common code

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

3 years agoRefactoring: combine lttng_create_syscall_event_if_missing common code
Mathieu Desnoyers [Tue, 2 Nov 2021 17:52:42 +0000 (13:52 -0400)] 
Refactoring: combine lttng_create_syscall_event_if_missing common code

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

3 years agoRefactoring: syscalls: move lttng_syscalls_create_matching_event_notifiers into regis...
Mathieu Desnoyers [Tue, 2 Nov 2021 17:50:40 +0000 (13:50 -0400)] 
Refactoring: syscalls: move lttng_syscalls_create_matching_event_notifiers into registration

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

3 years agoRefactoring: Rename lttng_channel_syscall_mask to lttng_syscall_table_get_active_mask
Mathieu Desnoyers [Tue, 2 Nov 2021 17:34:00 +0000 (13:34 -0400)] 
Refactoring: Rename lttng_channel_syscall_mask to lttng_syscall_table_get_active_mask

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

3 years agoRefactoring: kretprobes: use event common argument types
Mathieu Desnoyers [Tue, 2 Nov 2021 17:30:32 +0000 (13:30 -0400)] 
Refactoring: kretprobes: use event common argument types

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

3 years agoRefactoring: kprobes: combine common code between recorder and notifier
Mathieu Desnoyers [Tue, 2 Nov 2021 16:46:48 +0000 (12:46 -0400)] 
Refactoring: kprobes: combine common code between recorder and notifier

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

3 years agoRefactoring: uprobes: combine common code between recorder and notifier
Mathieu Desnoyers [Tue, 2 Nov 2021 16:38:41 +0000 (12:38 -0400)] 
Refactoring: uprobes: combine common code between recorder and notifier

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

3 years agoRefactoring: syscalls: combine syscalls register event for notifier/recorder
Mathieu Desnoyers [Tue, 2 Nov 2021 16:31:08 +0000 (12:31 -0400)] 
Refactoring: syscalls: combine syscalls register event for notifier/recorder

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

3 years agoRefactoring: syscall: combine syscall filter enable/disable recorder/notifier
Mathieu Desnoyers [Tue, 2 Nov 2021 15:21:47 +0000 (11:21 -0400)] 
Refactoring: syscall: combine syscall filter enable/disable recorder/notifier

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

3 years agoRefactoring: rename lttng_syscalls_register_event to lttng_syscalls_register_event_re...
Mathieu Desnoyers [Mon, 1 Nov 2021 20:47:39 +0000 (16:47 -0400)] 
Refactoring: rename lttng_syscalls_register_event to lttng_syscalls_register_event_recorder

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

3 years agoCleanup: tracepoint probe register/unregister: use parent field
Mathieu Desnoyers [Mon, 1 Nov 2021 20:39:22 +0000 (16:39 -0400)] 
Cleanup: tracepoint probe register/unregister: use parent field

Use the parent field to match the type expected in the probe callback.

This works so far only because parent is the first field of the children
structures.

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

3 years agoRefactoring/fix: syscall table unregister/destroy
Mathieu Desnoyers [Mon, 1 Nov 2021 19:59:10 +0000 (15:59 -0400)] 
Refactoring/fix: syscall table unregister/destroy

Combine syscall table unregister/destroy for both channel buffers and
notifier groups.

This fixes an issue within notifier groups where the syscall dispatch
tables are freed before waiting for an RCU grace period.

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

3 years agoRefactoring: rename lttng_channel_create to lttng_channel_buffer_create
Mathieu Desnoyers [Mon, 1 Nov 2021 19:33:28 +0000 (15:33 -0400)] 
Refactoring: rename lttng_channel_create to lttng_channel_buffer_create

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

3 years agoRefactoring: channel enable/disable using common type
Mathieu Desnoyers [Mon, 1 Nov 2021 19:31:04 +0000 (15:31 -0400)] 
Refactoring: channel enable/disable using common type

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

3 years agoCleanup: rename event register/unregister for event recorder
Mathieu Desnoyers [Mon, 1 Nov 2021 19:23:20 +0000 (15:23 -0400)] 
Cleanup: rename event register/unregister for event recorder

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

3 years agoCleanup: rename lttng_syscalls_destroy_event to lttng_syscalls_destroy_channel
Mathieu Desnoyers [Mon, 1 Nov 2021 19:20:22 +0000 (15:20 -0400)] 
Cleanup: rename lttng_syscalls_destroy_event to lttng_syscalls_destroy_channel

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

3 years agoCleanup: syscall filter enable/disable event
Mathieu Desnoyers [Mon, 1 Nov 2021 19:14:44 +0000 (15:14 -0400)] 
Cleanup: syscall filter enable/disable event

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

3 years agoCleanup: notifier syscalls: Remove useless zero-init of zeroed memory
Mathieu Desnoyers [Mon, 1 Nov 2021 18:59:41 +0000 (14:59 -0400)] 
Cleanup: notifier syscalls: Remove useless zero-init of zeroed memory

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

3 years agoRefactoring: combine event enabler destroy for notifier and recorder
Mathieu Desnoyers [Mon, 1 Nov 2021 18:47:24 +0000 (14:47 -0400)] 
Refactoring: combine event enabler destroy for notifier and recorder

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

3 years agoRefactoring: combine event notifier notifier and recorder enable/disable
Mathieu Desnoyers [Mon, 1 Nov 2021 18:31:51 +0000 (14:31 -0400)] 
Refactoring: combine event notifier notifier and recorder enable/disable

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

3 years agoRefactoring: combine filter bytecode attach functions
Mathieu Desnoyers [Mon, 1 Nov 2021 18:16:07 +0000 (14:16 -0400)] 
Refactoring: combine filter bytecode attach functions

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

3 years agoRefactoring: rename lttng_event_enabler to lttng_event_recorder_enabler
Mathieu Desnoyers [Mon, 1 Nov 2021 17:59:48 +0000 (13:59 -0400)] 
Refactoring: rename lttng_event_enabler to lttng_event_recorder_enabler

To clarify that event recorder is distinct from event notifier, rename
"event enabler" to "event recorder enabler".

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

3 years agoRefactoring: syscall tracing: combine common fields into struct lttng_kernel_syscall_...
Mathieu Desnoyers [Mon, 1 Nov 2021 17:43:58 +0000 (13:43 -0400)] 
Refactoring: syscall tracing: combine common fields into struct lttng_kernel_syscall_table

There was a lot of code duplication between syscall tables associated
with ring buffers and those associated with event notifiers.

Move common fields into a struct lttng_kernel_syscall_table, and add a
syscall_table field in both struct lttng_event_notifier_group and
struct lttng_kernel_channel_common_private.

This allows removing both syscall_entry_event_notifier_probe and
syscall_exit_event_notifier_probe by using the syscall_entry_event_probe
and syscall_exit_event_probe instead for event notifiers as well.

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

3 years agoRename event/notifier enabler base field to parent
Mathieu Desnoyers [Fri, 22 Oct 2021 20:16:26 +0000 (16:16 -0400)] 
Rename event/notifier enabler base field to parent

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

3 years agoRename struct lttng_enabler to struct lttng_event_enabler_common
Mathieu Desnoyers [Fri, 22 Oct 2021 19:56:00 +0000 (15:56 -0400)] 
Rename struct lttng_enabler to struct lttng_event_enabler_common

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

3 years agoUse event enabler for event recorder creation for all instrumentation types
Mathieu Desnoyers [Fri, 22 Oct 2021 19:17:25 +0000 (15:17 -0400)] 
Use event enabler for event recorder creation for all instrumentation types

Remove special-cases for uprobes, kprobes, kretprobes and use a
temporary event enabler to hold relevant information for event recorder
creation.

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

3 years agofix: implicit-int error in EXPORT_SYMBOL_GPL
Daniel Gomez [Fri, 8 Oct 2021 17:38:02 +0000 (19:38 +0200)] 
fix: implicit-int error in EXPORT_SYMBOL_GPL

Add module header to fix error:
error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL'
[-Werror=implicit-int]

Log:
/workdir/build/workspace/sources/lttng-modules/src/wrapper/random.c:54:1:
warning: data definition has no type or storage class
   54 EXPORT_SYMBOL_GPL(wrapper_get_bootid);
      ^~~~~~~~~~~~~~~~~
/workdir/build/workspace/sources/lttng-modules/src/wrapper/random.c:54:1:
error: type defaults to 'int' in declaration of 'EXPORT_SYMBOL_GPL'
[-Werror=implicit-int]
/workdir/build/workspace/sources/lttng-modules/src/wrapper/random.c:54:1:
warning: parameter names (without types) in function declaration
cc1: some warnings being treated as errors
make[3]: ***
[/workdir/build/tmp/work-shared/qt5222/kernel-source/scripts/Makefile.build:271:
/workdir/build/workspace/sources/lttng-modules/src/wrapper/random.o]

Signed-off-by: Daniel Gomez <daniel@qtec.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: If1b96f6fcc19988b94dc09b12d071f2c61491b83

3 years agofix: Revert "Makefile: Enable -Wimplicit-fallthrough for Clang" (v5.15)
Michael Jeanson [Mon, 13 Sep 2021 18:16:22 +0000 (14:16 -0400)] 
fix: Revert "Makefile: Enable -Wimplicit-fallthrough for Clang" (v5.15)

Starting with v5.15, "-Wimplicit-fallthrough=5" was added to the build
flags which requires the use of "__attribute__((__fallthrough__))" to
annotate fallthrough case statements.

See upstream commit by the man himself:

  commit d936eb23874433caa3e3d841cfa16f5434b85dcf
  Author: Linus Torvalds <torvalds@linux-foundation.org>
  Date:   Thu Jul 15 18:05:31 2021 -0700

    Revert "Makefile: Enable -Wimplicit-fallthrough for Clang"

    This reverts commit b7eb335e26a9c7f258c96b3962c283c379d3ede0.

    It turns out that the problem with the clang -Wimplicit-fallthrough
    warning is not about the kernel source code, but about clang itself, and
    that the warning is unusable until clang fixes its broken ways.

    In particular, when you enable this warning for clang, you not only get
    warnings about implicit fallthroughs.  You also get this:

       warning: fallthrough annotation in unreachable code [-Wimplicit-fallthrough]

    which is completely broken becasue it

     (a) doesn't even tell you where the problem is (seriously: no line
         numbers, no filename, no nothing).

     (b) is fundamentally broken anyway, because there are perfectly valid
         reasons to have a fallthrough statement even if it turns out that
         it can perhaps not be reached.

    In the kernel, an example of that second case is code in the scheduler:

                    switch (state) {
                    case cpuset:
                            if (IS_ENABLED(CONFIG_CPUSETS)) {
                                    cpuset_cpus_allowed_fallback(p);
                                    state = possible;
                                    break;
                            }
                            fallthrough;
                    case possible:

    where if CONFIG_CPUSETS is enabled you actually never hit the
    fallthrough case at all.  But that in no way makes the fallthrough
    wrong.

    So the warning is completely broken, and enabling it for clang is a very
    bad idea.

    In the meantime, we can keep the gcc option enabled, and make the gcc
    build use

        -Wimplicit-fallthrough=5

    which means that we will at least continue to require a proper
    fallthrough statement, and that gcc won't silently accept the magic
    comment versions. Because gcc does this all correctly, and while the odd
    "=5" part is kind of obscure, it's documented in [1]:

      "-Wimplicit-fallthrough=5 doesn’t recognize any comments as
       fallthrough comments, only attributes disable the warning"

    so if clang ever fixes its bad behavior we can try enabling it there again.

Change-Id: Iea69849592fb69ac04fb9bb28efcd6b8dce8ba88
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: cpu/hotplug: Remove deprecated CPU-hotplug functions. (v5.15)
Michael Jeanson [Mon, 13 Sep 2021 16:00:38 +0000 (12:00 -0400)] 
fix: cpu/hotplug: Remove deprecated CPU-hotplug functions. (v5.15)

The CPU-hotplug functions get|put_online_cpus() were deprecated in v4.13
and removed in v5.15.

See upstream commits :

commit 8c854303ce0e38e5bbedd725ff39da7e235865d8
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date:   Tue Aug 3 16:16:21 2021 +0200

    cpu/hotplug: Remove deprecated CPU-hotplug functions.

    No users in tree use the deprecated CPU-hotplug functions anymore.

    Remove them.

Introduced in v4.13 :

  commit 8f553c498e1772cccb39a114da4a498d22992758
  Author: Thomas Gleixner <tglx@linutronix.de>
  Date:   Wed May 24 10:15:12 2017 +0200

    cpu/hotplug: Provide cpus_read|write_[un]lock()

    The counting 'rwsem' hackery of get|put_online_cpus() is going to be
    replaced by percpu rwsem.

    Rename the functions to make it clear that it's locking and not some
    refcount style interface. These new functions will be used for the
    preparatory patches which make the code ready for the percpu rwsem
    conversion.

    Rename all instances in the cpu hotplug code while at it.

Change-Id: I5a37cf5afc075a402b7347989fac637dfa60a1ed
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: sched: Change task_struct::state (v5.14)
Michael Jeanson [Mon, 12 Jul 2021 18:51:20 +0000 (14:51 -0400)] 
fix: sched: Change task_struct::state (v5.14)

See upstream commit:

  commit 2f064a59a11ff9bc22e52e9678bc601404c7cb34
  Author: Peter Zijlstra <peterz@infradead.org>
  Date:   Fri Jun 11 10:28:17 2021 +0200

    sched: Change task_struct::state

    Change the type and name of task_struct::state. Drop the volatile and
    shrink it to an 'unsigned int'. Rename it in order to find all uses
    such that we can use READ_ONCE/WRITE_ONCE as appropriate.

Change-Id: I3a379192d6b977753fe58d4f67833a78dd7a0a47
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: btrfs: pass btrfs_inode to btrfs_writepage_endio_finish_ordered() (v5.14)
Michael Jeanson [Mon, 12 Jul 2021 19:00:26 +0000 (15:00 -0400)] 
fix: btrfs: pass btrfs_inode to btrfs_writepage_endio_finish_ordered() (v5.14)

See upstream commit:

  commit 38a39ac77e089515acbe85c6c70c3df1e728357d
  Author: Qu Wenruo <wqu@suse.com>
  Date:   Thu Apr 8 20:32:27 2021 +0800

    btrfs: pass btrfs_inode to btrfs_writepage_endio_finish_ordered()

    There is a pretty bad abuse of btrfs_writepage_endio_finish_ordered() in
    end_compressed_bio_write().

    It passes compressed pages to btrfs_writepage_endio_finish_ordered(),
    which is only supposed to accept inode pages.

    Thankfully the important info here is the inode, so let's pass
    btrfs_inode directly into btrfs_writepage_endio_finish_ordered(), and
    make @page parameter optional.

    By this, end_compressed_bio_write() can happily pass page=NULL while
    still getting everything done properly.

    Also, to cooperate with such modification, replace @page parameter for
    trace_btrfs_writepage_end_io_hook() with btrfs_inode.
    Although this removes page_index info, the existing start/len should be
    enough for most usage.

Change-Id: If96e99c2d9533d96d9d1aa6460bb7fd3ac9ed7ab
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: adjust ranges for RHEL 8.4
Michael Jeanson [Tue, 18 May 2021 15:16:34 +0000 (11:16 -0400)] 
fix: adjust ranges for RHEL 8.4

Change-Id: I9ac44467cca4850fb4051252937542d5a054ccc4
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agofix: adjust ranges for RHEL 8.2 and 8.3
Michael Jeanson [Tue, 11 May 2021 19:29:23 +0000 (15:29 -0400)] 
fix: adjust ranges for RHEL 8.2 and 8.3

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0863ac030f9fdfeb0173b843e75396acda21f3b6

3 years agoDisable x86 error code bitwise enum in default build
Michael Jeanson [Thu, 13 May 2021 14:30:24 +0000 (10:30 -0400)] 
Disable x86 error code bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

commit 8c7f2a9f2732b11f5cc9798cecb621420cc0e972
Author: Francis Deslauriers <francis.deslauriers@efficios.com>
Date:   Fri Jun 5 18:42:54 2020 -0400

    x86: add error code enum to pagefault tracepoints

Change-Id: I7901fad216b4774a9bbf3665568f357321805871
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoDisable mmap bitwise enum in default build
Michael Jeanson [Wed, 12 May 2021 18:20:44 +0000 (14:20 -0400)] 
Disable mmap bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit 3cf55950d0f6aa43eb5ad119bad1dbda69f75a54
  Author: Francis Deslauriers <francis.deslauriers@efficios.com>
  Date:   Fri Jun 5 11:38:14 2020 -0400

    syscalls: Make mmap()'s fields `prot` and `flags` enums

Change-Id: I033f42855c2967356b1e90cd89450eb5100a0f0b
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoDisable block rwbs bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 21:22:12 +0000 (17:22 -0400)] 
Disable block rwbs bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit 23634515e7271c8c8594ad87a6685232d4eff297
  Author: Geneviève Bastien <gbastien@versatic.net>
  Date:   Tue Feb 11 11:20:27 2020 -0500

    block: Make the rwbs field as a bit field enum

Change-Id: I6c285d1cbfbd88e151d4b0abb52ad9a650764ea2
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoDisable sched_switch bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 21:15:15 +0000 (17:15 -0400)] 
Disable sched_switch bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit 721caea47b6506f7ad9086c3e9801dc9dfe06b6a
  Author: Geneviève Bastien <gbastien@versatic.net>
  Date:   Wed Feb 12 16:58:25 2020 -0500

    sched: Make the sched_switch task state an enum

Change-Id: Ib19d06365fbed7daa9440d5dfff283c4f89db6ee
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoDisable open[at] bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 21:09:07 +0000 (17:09 -0400)] 
Disable open[at] bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit c8dfb72431505d5f01a6f090f3f7427d9ca6fe94
  Author: Geneviève Bastien <gbastien@versatic.net>
  Date:   Wed Mar 11 12:33:04 2020 -0400

    syscalls: Make the flags and mode fields of open[at] enumerations

Use the non-override system call tracing implementation when the enum is
not used.

Change-Id: I2dbebe56eaba6186843dab20264d3378962c7d30
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoDisable fcntl bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 21:05:37 +0000 (17:05 -0400)] 
Disable fcntl bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit c1c07d681a68ba37da066d6f0456129957073169
  Author: Geneviève Bastien <gbastien+lttng@versatic.net>
  Date:   Wed Mar 11 12:38:51 2020 -0400

    syscalls: Make the cmd field of fcntl an enum

Use the non-override system call tracing implementation when the enum is
not used.

Change-Id: I4c650d40a14b1c56ada0ed9aae1877364d0c4580
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoDisable clone bitwise enum in default build
Michael Jeanson [Tue, 11 May 2021 20:16:18 +0000 (16:16 -0400)] 
Disable clone bitwise enum in default build

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Original commit:

  commit d775625e2ba4825b73b5897e7701ad6e2bdba115
  Author: Geneviève Bastien <gbastien@versatic.net>
  Date:   Wed Apr 1 14:31:49 2020 -0400

    syscalls: Make clone()'s `flags` field a 2 enum struct.

Change-Id: Ia67b5fc93b932b8b76330b4965753a43401c1514
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd experimental bitwise enum config option
Michael Jeanson [Wed, 12 May 2021 20:21:50 +0000 (16:21 -0400)] 
Add experimental bitwise enum config option

Only generate the bitwise enumerations when
CONFIG_LTTNG_EXPERIMENTAL_BITWISE_ENUM is enabled, so the default build
does not generate traces which lead to warnings when viewed with
babeltrace 1.x and babeltrace 2 with default options.

Change-Id: Id45c7a78b280a7f35bbeafb80f2f6f5aa1ebbdc9
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoAdd defaults to Kconfig options
Michael Jeanson [Wed, 12 May 2021 20:13:01 +0000 (16:13 -0400)] 
Add defaults to Kconfig options

Add defaults to the Kconfig options used when building in-tree that
match the default configuration when built out-of-tree.

Change-Id: I436251f1fb4c3e238a013d18d67932565b92ef45
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoCleanup: remove unused EXTCFLAGS from Makefile
Michael Jeanson [Thu, 13 May 2021 14:42:38 +0000 (10:42 -0400)] 
Cleanup: remove unused EXTCFLAGS from Makefile

Change-Id: I36c4f6f403b03a1aa158863f393049efdc70af04
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSync `show_inode_state()` macro with upstream stable kernels
Michael Jeanson [Wed, 12 May 2021 17:35:24 +0000 (13:35 -0400)] 
Sync `show_inode_state()` macro with upstream stable kernels

The following commit was backported to multiple stable branches:

  commit 5fcd57505c002efc5823a7355e21f48dd02d5a51
  Author: Jan Kara <jack@suse.cz>
  Date:   Fri May 29 16:24:43 2020 +0200

    writeback: Drop I_DIRTY_TIME_EXPIRE

    The only use of I_DIRTY_TIME_EXPIRE is to detect in
    __writeback_single_inode() that inode got there because flush worker
    decided it's time to writeback the dirty inode time stamps (either
    because we are syncing or because of age). However we can detect this
    directly in __writeback_single_inode() and there's no need for the
    strange propagation with I_DIRTY_TIME_EXPIRE flag.

Change-Id: I6e7c0ced13acd4fcd88bcd572d0ba1f9b254c58c
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoSync `show_inode_state()` macro with Ubuntu 4.15 kernel
Francis Deslauriers [Mon, 10 May 2021 17:41:48 +0000 (13:41 -0400)] 
Sync `show_inode_state()` macro with Ubuntu 4.15 kernel

The following commit changed the `show_inode_state()` macro which
triggered a warning on our CI build:
  commit 63388062bea96e5cd8b8d7abf7b7142f8666ca1f
  Author: Jan Kara <jack@suse.cz>
  Date:   Mon Jan 25 12:37:43 2021 -0800

      writeback: Drop I_DIRTY_TIME_EXPIRE

Also, this commit adds a comment to clarify why we keep these
`#if/#elif` even though we don't use it the macro.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I2dd53a1a286ab8a431977bda6cde01f700f0c7d9

3 years agofix: block: remove disk_part_iter (v5.12)
Michael Jeanson [Mon, 10 May 2021 15:39:24 +0000 (11:39 -0400)] 
fix: block: remove disk_part_iter (v5.12)

In v5.12 a refactoring of the genhd code was started and the symbols
related to 'disk_part_iter' were unexported. In v5.13 they were
completely removed.

This patch replaces the short lived compat code that is specific to
v5.12 and replaces it with a generic internal implementation that
iterates directly on the 'disk->part_tbl' xarray which will be used
on v5.12 and up.

This seems like a better option than keeping the compat code that will
only work on v5.12 and make maintenance more complicated. The compat was
backported to the stable branches but isn't yet part of a point release
so can be safely replaced.

See the upstream commits:

  commit 3212135a718b06be38811f2d9a320ae842e76409
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Tue Apr 6 08:23:02 2021 +0200

    block: remove disk_part_iter

    Just open code the xa_for_each in the remaining user.

  commit a33df75c6328bf40078b35f2040d8e54d574c357
  Author: Christoph Hellwig <hch@lst.de>
  Date:   Sun Jan 24 11:02:41 2021 +0100

    block: use an xarray for disk->part_tbl

    Now that no fast path lookups in the partition table are left, there is
    no point in micro-optimizing the data structure for it.  Just use a bog
    standard xarray.

Change-Id: If3497e087fadaa285e135f57aab7e6df157b06c6
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoCleanup: lib ring buffer: rename pagecpy local variable
Mathieu Desnoyers [Tue, 11 May 2021 17:29:43 +0000 (13:29 -0400)] 
Cleanup: lib ring buffer: rename pagecpy local variable

Rename pagecpy local variable to bytes_left_in_page, which has a clearer
semantic. Also remove the unused pagecpy parameter from slow paths which
was always 0.

Also add a missing __user annotation on @src of
the _lib_ring_buffer_copy_from_user_inatomic prototype.

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

3 years agoCleanup: clarify strcpy/strcpy_from_user local variables
Mathieu Desnoyers [Tue, 11 May 2021 17:19:33 +0000 (13:19 -0400)] 
Cleanup: clarify strcpy/strcpy_from_user local variables

The variable name "bytes_left_in_page" is clearer than "pagecpy". Also
the only caller of slow paths always has a 0 pagecpy parameter, so
remove that parameter. Also use a "bool" for src_terminated (no
functional change).

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

3 years agoImplement ring buffer Pascal string copy
Mathieu Desnoyers [Fri, 7 May 2021 18:05:00 +0000 (14:05 -0400)] 
Implement ring buffer Pascal string copy

Introduce a new lib_ring_buffer_pstrcpy() to handle copying into a ring
buffer Pascal String, use them for array and sequence of text.

Cover strings copied from both kernel and user-space.

This ensures that when copying from a string input to a ring buffer
utf8/ascii-encoded array or sequence, the source is not read beyond its
null terminating character.

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

3 years agoMove alignment into event write callback
Mathieu Desnoyers [Fri, 7 May 2021 18:33:58 +0000 (14:33 -0400)] 
Move alignment into event write callback

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

3 years agoCleanup: disable page fault after access_ok
Mathieu Desnoyers [Mon, 10 May 2021 12:34:16 +0000 (08:34 -0400)] 
Cleanup: disable page fault after access_ok

The page faults don't need to be disabled for access_ok. Simplify the
fill buffer error paths.

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

3 years agoFix: increment buffer offset when failing to copy from user-space
Mathieu Desnoyers [Fri, 7 May 2021 19:03:04 +0000 (15:03 -0400)] 
Fix: increment buffer offset when failing to copy from user-space

Upon failure to copy from user-space due to failing access ok check, the
ring buffer offset is not incremented, which could generate unreadable
traces because we don't account for the padding we write into the ring
buffer.

Note that this typically won't affect a common use-case of copying
strings from user-space, because unless mprotect is invoked within a
narrow race window (between user strlen and user strcpy), the strlen
will fail on access ok when calculating the space to reserve, which will
match what happens on strcpy.

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

3 years agoFix: incorrect in/out direction for syscall exit
Mathieu Desnoyers [Mon, 10 May 2021 15:01:02 +0000 (11:01 -0400)] 
Fix: incorrect in/out direction for syscall exit

Syscall exit should fetch the "sc_out" parameters. This issue was
introduced by commit e42c4f49c15b ("Split syscall tracepoint generation in their own files").

Fixes: e42c4f49c15b ("Split syscall tracepoint generation in their own files")
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ib34912005323ea34b6d11ca9acc5edf491649cdd

3 years agoFix: add missing #include for 3.8 kernel
Francis Deslauriers [Fri, 7 May 2021 14:48:28 +0000 (10:48 -0400)] 
Fix: add missing #include for 3.8 kernel

Add the `linux/compat.h` include to fix the following error while
building the modules against a 3.8 kernel for x86-64 kernel:
  error: ‘F_GETLK64’ undeclared here (not in a function)
     ctf_enum_value("F_GETLK64", F_GETLK64)

Also, move the #include directives from the instrumentation headers to
the `lttng-syscalls.h` file.

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I334a14d0b40ec77e0ca0aa3b762197de2050a1ae

3 years agoFix: builtin script referring to old directories
Francis Deslauriers [Thu, 6 May 2021 21:50:03 +0000 (17:50 -0400)] 
Fix: builtin script referring to old directories

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I30fb8abb1a69d6695552947e30cf2b43d3db36b3

3 years agoevents.h API const-ness
Mathieu Desnoyers [Thu, 6 May 2021 20:42:52 +0000 (16:42 -0400)] 
events.h API const-ness

Ensure events.h definitions, fields, and arguments referring to const
arrays of pointers are const.

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

3 years agoRename struct lib_ring_buffer* to struct lttng_kernel_ring_buffer*
Mathieu Desnoyers [Thu, 6 May 2021 20:32:32 +0000 (16:32 -0400)] 
Rename struct lib_ring_buffer* to struct lttng_kernel_ring_buffer*

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

3 years agoRename struct channel to struct lttng_kernel_ring_buffer_channel
Mathieu Desnoyers [Thu, 6 May 2021 20:08:37 +0000 (16:08 -0400)] 
Rename struct channel to struct lttng_kernel_ring_buffer_channel

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

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