All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] linux-yocto: consolidated pull request
@ 2020-09-14 22:34 Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 1/6] linux-yocto/5.8: update to v5.8.8 Bruce Ashfield
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-14 22:34 UTC (permalink / raw)
  To: richard.purdie; +Cc: openembedded-core

From: Bruce Ashfield <bruce.ashfield@gmail.com>

Richard,

Here's the latest round of -stable updates for the active kernels in
master.

My first runs ran into the lttng-modules issues, and I've included a
10 patch backport of changes from lttng 2.12.x to address the various
build issues I found against 5.4 and 5.8.

There's a different lttng patch on the list, but it didn't address all
of my build failures, so I generated this full backport change.

Cheers,

Bruce

The following changes since commit 070d9b8f5e753e8928d2d7048e0c7bd9adbb3c29:

  linux-yocto/config: netfilter: Enable nat for ipv4 and ipv6 (2020-09-14 12:13:47 -0400)

are available in the Git repository at:

  git://git.yoctoproject.org/poky-contrib zedd/kernel
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=zedd/kernel

Bruce Ashfield (5):
  linux-yocto/5.8: update to v5.8.8
  linux-yocto/5.4: update to v5.4.64
  linux-yocto/config: configuration warning cleanup
  linux-yocto/5.8: update to v5.8.9
  linux-yocto/5.4: update to v5.4.65

Jens Rehsack (1):
  lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+
    builds

 .../linux/linux-yocto-rt_5.4.bb               |   6 +-
 .../linux/linux-yocto-rt_5.8.bb               |   6 +-
 .../linux/linux-yocto-tiny_5.4.bb             |   8 +-
 .../linux/linux-yocto-tiny_5.8.bb             |   8 +-
 meta/recipes-kernel/linux/linux-yocto_5.4.bb  |  22 +-
 meta/recipes-kernel/linux/linux-yocto_5.8.bb  |  22 +-
 ...ndency-issue-when-building-in-tree-w.patch |  54 ++
 ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
 ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
 ...he-length-of-per-inode-prealloc-list.patch |  84 ++
 ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
 ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
 ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
 ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
 ...es-for-ext4_discard_preallocations-a.patch |  52 +
 .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
 .../lttng/lttng-modules_2.12.2.bb             |  12 +-
 17 files changed, 1865 insertions(+), 37 deletions(-)
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch

-- 
2.19.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH 1/6] linux-yocto/5.8: update to v5.8.8
  2020-09-14 22:34 [PATCH 0/6] linux-yocto: consolidated pull request Bruce Ashfield
@ 2020-09-14 22:34 ` Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 2/6] linux-yocto/5.4: update to v5.4.64 Bruce Ashfield
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-14 22:34 UTC (permalink / raw)
  To: richard.purdie; +Cc: openembedded-core

From: Bruce Ashfield <bruce.ashfield@gmail.com>

Updating linux-yocto/5.8 to the latest korg -stable release that comprises
the following commits:

    4f447bf95fdc Linux 5.8.8
    830b08e696f7 net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
    548c1175051d cfg80211: regulatory: reject invalid hints
    9206b03e7fc9 mm/khugepaged.c: fix khugepaged's request size in collapse_file
    951e290ad85b mm/hugetlb: fix a race between hugetlb sysctl handlers
    e2d4e423205e mm/hugetlb: try preferred node first when alloc gigantic page from cma
    3fd08f78f47a mm/migrate: fixup setting UFFD_WP flag
    658e93f1c318 checkpatch: fix the usage of capture group ( ... )
    d3498d5e8775 sdhci: tegra: Add missing TMCLK for data timeout
    55eb0f42f465 kconfig: streamline_config.pl: check defined(ENV variable) before using it
    8c4c56846892 perf record: Correct the help info of option "--no-bpf-event"
    bf8fe7b755c2 io_uring: no read/write-retry on -EAGAIN error and O_NONBLOCK marked file
    a8bf40a7538f mm/rmap: fixup copying of soft dirty and uffd ptes
    9b4a9e89f6e8 mm: madvise: fix vma user-after-free
    98650804fa53 mm: track page table modifications in __apply_to_page_range()
    3eba981cffc9 mm: slub: fix conversion of freelist_corrupted()
    4469ea5972ab dm thin metadata: Fix use-after-free in dm_bm_set_read_only
    b3c76fdbb119 dm thin metadata: Avoid returning cmd->bm wild pointer on error
    d02a33a24825 dm cache metadata: Avoid returning cmd->bm wild pointer on error
    0a495d145f59 dm crypt: Initialize crypto wait structures
    372236a01bc5 dm integrity: fix error reporting in bitmap mode after creation
    2c8ee4951f11 dm mpath: fix racey management of PG initialization
    cc06bdfc211b dm writecache: handle DAX to partitions on persistent memory correctly
    67ba86179fc6 drm/amdgpu: Specify get_argument function for ci_smu_funcs
    dd8a223d0f58 drm/amd/pm: avoid false alarm due to confusing softwareshutdowntemp setting
    696f8cfee025 drm/i915: Fix sha_text population code
    1693c125c0a9 dmaengine: dw-edma: Fix scatter-gather address calculation
    3c761332597d blk-stat: make q->stats->lock irqsafe
    70d22582c3eb blk-iocost: ioc_pd_free() shouldn't assume irq disabled
    57fd9f8eb603 mips/oprofile: Fix fallthrough placement
    dea6f05d372a libata: implement ATA_HORKAGE_MAX_TRIM_128M and apply to Sandisks
    3264d781e1ad s390: fix GENERIC_LOCKBREAK dependency typo in Kconfig
    e37bc36aaff3 io_uring: fix removing the wrong file in __io_sqe_files_update()
    329c9ffc81cf io_uring: set table->files[i] to NULL when io_sqe_file_register failed
    a7a42c1e5023 block: ensure bdi->io_pages is always initialized
    b7df98a8b7b8 block: allow for_each_bvec to support zero len bvec
    2221f41d3fb3 affs: fix basic permission bits to actually work
    9af0c46a7612 media: rc: uevent sysfs file races with rc_unregister_device()
    bff924ee40ae media: rc: do not access device via sysfs after rc_unregister_device()
    91994b8489a3 mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers
    88df22892d14 mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings
    01263d02f5da mmc: mediatek: add optional module reset property
    f8916b54514e arm64: dts: mt7622: add reset node for mmc device
    ab90e0d7a985 ALSA: hda/realtek - Improved routing for Thinkpad X1 7th/8th Gen
    3695decb7771 ALSA: hda/realtek: Add quirk for Samsung Galaxy Book Ion NT950XCJ-X716A
    c1e0aff25b1b ALSA; firewire-tascam: exclude Tascam FE-8 from detection
    8e83bd51016a ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO
    48510be50e87 ALSA: firewire-digi00x: exclude Avid Adrenaline from detection
    7554ad2ffdad ALSA: hda/hdmi: always check pin power status in i915 pin fixup
    db5d1d51bef1 ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check
    dfcfc358e366 ALSA: usb-audio: Add implicit feedback quirk for UR22C
    3284ababd0c4 ALSA: usb-audio: Add basic capture support for Pioneer DJ DJM-250MK2
    2c9ba98fec4d ALSA: ca0106: fix error code handling
    9aa4e2c3da17 Revert "ALSA: hda: Add support for Loongson 7A1000 controller"
    df7a51020021 x86/mm/32: Bring back vmalloc faulting on x86_32
    98f0b4072c94 Bluetooth: Return NOTIFY_DONE for hci_suspend_notifier
    434ed4233877 btrfs: tree-checker: fix the error message for transid error
    6b09009a2eae btrfs: block-group: fix free-space bitmap threshold
    6d12fbd0c4b7 btrfs: set the lockdep class for log tree extent buffers
    7ad3d8ad569c btrfs: set the correct lockdep class for new nodes
    42a2fbd05773 btrfs: allocate scrub workqueues outside of locks
    26cf893236fd btrfs: fix potential deadlock in the search ioctl
    5e85cae6cd52 btrfs: drop path before adding new uuid tree entry
    be69bb028264 arc: fix memory initialization for systems with two memory banks
    ec96b4b7514c ARC: perf: don't bail setup if pct irq missing in device-tree
    7d5026dcd362 xfs: don't update mtime on COW faults
    9c12f371a2ce ext2: don't update mtime on COW faults
    4e99722219f4 x86/debug: Allow a single level of #DB recursion
    231508fa9a6d x86/entry: Fix AC assertion
    f76c4eab5ce9 tracing/kprobes, x86/ptrace: Fix regs argument order for i386
    98176c9f3a77 iommu/vt-d: Handle 36bit addressing for x86-32
    c93d26ef17b4 include/linux/log2.h: add missing () around n in roundup_pow_of_two()
    03ca1f09ab1f net/packet: fix overflow in tpacket_rcv
    4437dfb7777d iommu/amd: Use cmpxchg_double() when updating 128-bit IRTE
    6b0caba52055 iommu/amd: Restore IRTE.RemapEn bit after programming IRTE
    2551a138792a thermal: qcom-spmi-temp-alarm: Don't suppress negative temp
    7da369acd79f thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430
    7583c56d9092 iommu/vt-d: Serialize IOMMU GCMD register modifications
    a9c41d6214a8 x86, fakenuma: Fix invalid starting node ID
    abbb183229ac tg3: Fix soft lockup when tg3_reset_task() fails.
    594adc1bda7a perf bench: The do_run_multi_threaded() function must use IS_ERR(perf_session__new())
    f42f9c0d115e perf stat: Turn off summary for interval mode by default
    c58ff4b470e8 perf jevents: Fix suspicious code in fixregex()
    62a5784285bf xfs: fix xfs_bmap_validate_extent_raw when checking attr fork of rt files
    c10fa9458aa6 MIPS: SNI: Fix SCSI interrupt
    b5c901d96a59 MIPS: add missing MSACSR and upper MSA initialization
    6aef73907338 net: dp83867: Fix WoL SecureOn password
    d7983d7b64c4 nfp: flower: fix ABI mismatch between driver and firmware
    5c9f765dcd4e net: gemini: Fix another missing clk_disable_unprepare() in probe
    f555d57c8f1b net: bcmgenet: fix mask check in bcmgenet_validate_flow()
    41e233bd6412 fix regression in "epoll: Keep a reference on files added to the check list"
    3cdbbaca1681 net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
    5a48e463f50a perf tools: Correct SNOOPX field offset
    f4b9594e02d5 perf intel-pt: Fix corrupt data after perf inject from
    7ea241e7a0a2 perf cs-etm: Fix corrupt data after perf inject from
    8a435d33c261 perf top/report: Fix infinite loop in the TUI for grouped events
    692d06265574 block: fix locking in bdev_del_partition
    bbb1dc4431b0 MIPS: perf: Fix wrong check condition of Loongson event IDs
    89639c177d04 net: ethernet: ti: am65-cpsw: fix rmii 100Mbit link mode
    eec98f743e40 cxgb4: fix thermal zone device registration
    e5d5c3b4e4a2 opp: Don't drop reference for an OPP table that was never parsed
    3484b664521d netfilter: conntrack: do not auto-delete clash entries on reply
    4aa6128188fb nvme: fix controller instance leak
    db8c729bca37 nvmet-fc: Fix a missed _irqsave version of spin_lock in 'nvmet_fc_fod_op_done()'
    4b5158a2f6b7 netfilter: nfnetlink: nfnetlink_unicast() reports EAGAIN instead of ENOBUFS
    e8df547c81d0 net: dsa: mt7530: fix advertising unsupported 1000baseT_Half
    cbd84d8ef3e9 selftests/bpf: Fix massive output from test_maps
    991ca0615902 media: i2c: imx214: select V4L2_FWNODE
    404f3f27b087 net: ethernet: ti: cpsw_new: fix error handling in cpsw_ndo_vlan_rx_kill_vid()
    b3b321d44175 media: cedrus: Add missing v4l2_ctrl_request_hdl_put()
    60e9f3f036f3 media: vicodec: add missing v4l2_ctrl_request_hdl_put()
    72c7309533b4 bnxt: don't enable NAPI until rings are ready
    531c6cb9ad1e xfs: fix boundary test in xfs_attr_shortform_verify
    91565765b6de xfs: finish dfops on every insert range shift iteration
    81fbc28873ef bnxt_en: fix HWRM error when querying VF temperature
    e4d07b93a26b bnxt_en: Fix possible crash in bnxt_fw_reset_task().
    e0543e56fa62 bnxt_en: Fix PCI AER error recovery flow
    214c19832333 bnxt_en: Fix ethtool -S statitics with XDP or TCs enabled.
    376326004a42 bnxt_en: Check for zero dir entries in NVRAM.
    8fd4262bc8e4 bnxt_en: Don't query FW when netif_running() is false.
    b12fefddb43f net: ethernet: ti: cpsw_new: fix clean up of vlan mc entries for host port
    634b47d46f93 net: ethernet: ti: cpsw: fix clean up of vlan mc entries for host port
    e4fe6bfddafe gtp: add GTPA_LINK info to msg sent to userspace
    f276f4e1b743 dmaengine: ti: k3-udma: Fix the TR initialization for prep_slave_sg
    1185d129364a dmaengine: pl330: Fix burst length if burst size is smaller than bus width
    ad32766990e2 bpf: Fix a buffer out-of-bound access when filling raw_tp link_info
    bb3eebda4e22 net: arc_emac: Fix memleak in arc_mdio_probe
    9ea477348bd2 ravb: Fixed to be able to unload modules
    ab1423e5b4d1 net: systemport: Fix memleak in bcm_sysport_probe
    0c14725cb063 net: hns: Fix memleak in hns_nic_dev_probe
    a949770022f4 netfilter: nf_tables: fix destination register zeroing
    b7d77de2fe79 netfilter: nf_tables: incorrect enum nft_list_attributes definition
    e8261af70717 netfilter: nf_tables: add NFTA_SET_USERDATA if not null
    20a7ee03beba perf top: Skip side-band event setup if HAVE_LIBBPF_SUPPORT is not set
    06a1d6e334b0 perf sched timehist: Fix use of CPU list with summary option
    b1c9e29c933e mmc: sdhci-acpi: Fix HS400 tuning for AMDI0040
    17c1b210b6ea MIPS: BMIPS: Also call bmips_cpu_setup() for secondary cores
    f39c875a8eeb MIPS: mm: BMIPS5000 has inclusive physical caches
    feb72ac627bc rxrpc: Make rxrpc_kernel_get_srtt() indicate validity
    26457829b759 rxrpc: Fix loss of RTT samples due to interposed ACK
    e2674459be67 rxrpc: Keep the ACK serial in a var in rxrpc_input_ack()
    eff6dcb0c388 dmaengine: at_hdmac: add missing kfree() call in at_dma_xlate()
    159db733b2ac dmaengine: at_hdmac: add missing put_device() call in at_dma_xlate()
    e3149ca07e92 dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
    c6156f0064b1 batman-adv: bla: use netif_rx_ni when not in interrupt context
    cb6560a41c45 batman-adv: Fix own OGM check in aggregated OGMs
    27cc30cdc8f4 batman-adv: Avoid uninitialized chaddr when handling DHCP
    4b805451419c dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling
    6f88924528c8 fsldma: fix very broken 32-bit ppc ioread64 functionality
    adaa55616567 xen/xenbus: Fix granting of vmalloc'd memory
    2c97832bae08 drm/amd/display: Fix memleak in amdgpu_dm_mode_config_init
    fe4e01212478 drm/amd/display: Retry AUX write when fail occurs
    a3a943b6f211 drm/amd/display: Keep current gain when ABM disable immediately
    e7ea08312558 drm/amd/display: Fix passive dongle mistaken as active dongle in EDID emulation
    151ed59e03a9 drm/amd/display: Revert HDCP disable sequence change
    af7dceeda116 drivers: gpu: amd: Initialize amdgpu_dm_backlight_caps object to 0 in amdgpu_dm_update_backlight_caps
    47fd4ba5cc95 drm/amd/display: Reject overlay plane configurations in multi-display scenarios
    35950cec8547 drm/amd/display: should check error using DC_OK
    bd5f4d49094c s390: don't trace preemption in percpu macros
    c3bf0387a0a9 nbd: restore default timeout when setting it to zero
    0f6c545bddd3 cpuidle: Fixup IRQ state
    a3c2bcb3e9e3 irqchip/ingenic: Leave parent IRQ unmasked on suspend
    2659c526f928 drm/omap: fix incorrect lock state
    01a28ac6e917 i2c: iproc: Fix shifting 31 bits
    46653857d015 ceph: don't allow setlease on cephfs
    94fd015fe91f hv_utils: drain the timesync packets on onchannelcallback
    6a725c83a08d hv_utils: return error if host timesysnc update is stale
    4f3ffd5fcbf7 gfs2: add some much needed cleanup for log flushes that fail
    2ed484c404e0 drm/msm/a6xx: fix gmu start on newer firmware
    2ad613d97f96 habanalabs: check correct vmalloc return code
    72038388869b habanalabs: validate FW file size
    9a3acad9ae0e habanalabs: set max power according to card type
    3a24b9420ee0 habanalabs: proper handling of alloc size in coresight
    a8d7e5599614 habanalabs: set clock gating according to mask
    fb8b4592f958 habanalabs: validate packet id during CB parse
    b18c6071868c habanalabs: unmap PCI bars upon iATU failure
    4e2beff0b638 drm/msm: enable vblank during atomic commits
    3fe50ada2a56 nvmet: Disable keep-alive timer when kato is cleared to 0h
    64c064ba11c6 hwmon: (applesmc) check status earlier.
    56ed34ea6cd7 drm/msm: add shutdown support for display platform_driver
    87371d858101 tty: serial: qcom_geni_serial: Drop __init from qcom_geni_console_setup
    c92e690c5e23 drm/msm/dpu: fix unitialized variable error
    d33d9115be04 drm/msm/dpu: Fix scale params in plane validation
    6ea918a6197d drm/msm/dpu: Fix reservation failures in modeset
    8ca621939d76 HID: quirks: Always poll three more Lenovo PixArt mice
    7cd0d11c6408 hwmon: (pmbus/isl68137) remove READ_TEMPERATURE_1 telemetry for RAA228228
    b72c392fa3e5 Linux 5.8.7
    839ab6a84a9b scsi: target: tcmu: Optimize use of flush_dcache_page
    ba1bc48691d4 nl80211: fix NL80211_ATTR_HE_6GHZ_CAPABILITY usage
    3def2670934b sdhci: tegra: Remove SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK for Tegra186
    4710fc20adac sdhci: tegra: Remove SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK for Tegra210
    bb8d1ed450ea arm64: tegra: Add missing timeout clock to Tegra210 SDMMC
    eac502d07d49 arm64: tegra: Add missing timeout clock to Tegra186 SDMMC nodes
    da2d25c35435 arm64: tegra: Add missing timeout clock to Tegra194 SDMMC nodes
    991b02edd133 dt-bindings: mmc: tegra: Add tmclk for Tegra210 and later
    495b506743a1 KVM: arm64: Survive synchronous exceptions caused by AT instructions
    71e9e3ce6a2c KVM: arm64: Add kvm_extable for vaxorcism code
    5b1c0ed9ff3c media: media/v4l2-core: Fix kernel-infoleak in video_put_user()
    ff95152b14f2 perf record/stat: Explicitly call out event modifiers in the documentation
    20257b70d5f1 selftests/x86/test_vsyscall: Improve the process_vm_readv() test
    e80a7602b405 mm: fix pin vs. gup mismatch with gate pages
    331524770431 netfilter: nft_set_rbtree: Handle outcomes of tree rotations in overlap detection
    e771e63c0cdc HID: core: Sanitize event code and type when mapping input
    b070b1e20768 HID: core: Correctly handle ReportSize being zero
    66534fe2b940 Linux 5.8.6
    e54835be930d ALSA: usb-audio: Update documentation comment for MS2109 quirk
    a34b7526320e dma-pool: Fix an uninitialized variable bug in atomic_pool_expand()
    f880d69b2810 drm/vmwgfx/ldu: Use drm_mode_config_reset
    01736d379ece drm/vmwgfx/sou: Use drm_mode_config_reset
    4ba591d72a70 drm/vmwgfx/stdu: Use drm_mode_config_reset
    7947e0ba4cca HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage()
    9d960a74b43a mm/page_counter: fix various data races at memsw
    b65258eb82cc fbmem: pull fbcon_update_vcs() out of fb_set_var()
    d88c0bef7070 drm/atomic-helper: reset vblank on crtc reset
    e93fd7a49023 io_uring: make offset == -1 consistent with preadv2/pwritev2
    9ab83e1c4a31 io_uring: don't use poll handler if file can't be nonblocking read/written
    b7e397bcba0a io_uring: don't recurse on tsk->sighand->siglock with signalfd
    b727b92fd33b usb: typec: tcpm: Fix Fix source hard reset response for TDA 2.3.1.1 and TDA 2.3.1.2 failures
    d597f82cc262 usb: typec: ucsi: Hold con->lock for the entire duration of ucsi_register_port()
    3c4cd68799f8 usb: typec: ucsi: Rework ppm_lock handling
    84e29c7cf591 usb: typec: ucsi: Fix 2 unlocked ucsi_run_command calls
    4b59dabd3170 usb: typec: ucsi: Fix AB BA lock inversion
    53965c79c2db USB: Fix device driver race
    a18d5d456c00 USB: Also match device drivers using the ->match vfunc
    0ca26ffe3c1f usb: storage: Add unusual_uas entry for Sony PSZ drives
    fad19f628f53 USB: cdc-acm: rework notification_buffer resizing
    afb420486016 usb: dwc3: gadget: Handle ZLP for sg requests
    8301e3aa1c8d usb: dwc3: gadget: Fix handling ZLP
    d884a90cec5a usb: dwc3: gadget: Don't setup more than requested
    3b9953fe5723 USB: gadget: u_f: Unbreak offset calculation in VLAs
    ae6a5394d9fb USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()
    480e17846d32 USB: gadget: u_f: add overflow checks to VLA macros
    ec5c2663d533 usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe()
    27cf2e50545a USB: Ignore UAS for JMicron JMS567 ATA/ATAPI Bridge
    7eb94ea0e8e9 USB: quirks: Ignore duplicate endpoint on Sound Devices MixPre-D
    155288e45c8d USB: quirks: Add no-lpm quirk for another Raydium touchscreen
    2b9be3af1037 usb: uas: Add quirk for PNY Pro Elite
    495f2f1b53d7 USB: yurex: Fix bad gfp argument
    ccc9838fed80 drm/amd/pm: correct the thermal alert temperature limit settings
    56ab34c44e85 drm/amd/pm: correct Vega20 swctf limit setting
    520e40dcea83 drm/amd/pm: correct Vega12 swctf limit setting
    b46df9eab0cd drm/amd/pm: correct Vega10 swctf limit setting
    686a7f065cd8 drm/amd/powerplay: Fix hardmins not being sent to SMU for RV
    cd9c79f79dd4 drm/amdgpu/gfx10: refine mgcg setting
    54dc92e19008 drm/amd/display: use correct scale for actual_brightness
    83ac52039493 drm/amdgpu: Fix buffer overflow in INFO ioctl
    5f5bd9002bb1 drm/modeset-lock: Take the modeset BKL for legacy drivers
    057423349c34 drm/dp_mst: Don't return error code when crtc is null
    dd36e041bd51 drm/etnaviv: fix external abort seen on GC600 rev 0x19
    74e1bbfb842a drm/i915: Fix cmd parser desc matching with masks
    f07523a5b09a x86/hotplug: Silence APIC only after all interrupts are migrated
    bbf423c28efc x86/irq: Unbreak interrupt affinity setting
    66e1e9bda022 irqchip/stm32-exti: Avoid losing interrupts due to clearing pending bits by mistake
    a1b116511aa8 genirq/matrix: Deal with the sillyness of for_each_cpu() on UP
    8cb3561d084e usbip: Implement a match function to fix usbip
    3c491c441942 crypto: af_alg - Work around empty control messages without MSG_MORE
    1d35dfde2a7d device property: Fix the secondary firmware node handling in set_primary_fwnode()
    9a9cc8c9b1c7 powerpc/perf: Fix crashes with generic_compat_pmu & BHRB
    bdae01670694 powerpc/32s: Disable VMAP stack which CONFIG_ADB_PMU
    3b555853d736 PM: sleep: core: Fix the handling of pending runtime resume requests
    17d66e628058 arm64: vdso32: make vdso32 install conditional
    d36a6712d9f1 KVM: arm64: Set HCR_EL2.PTW to prevent AT taking synchronous exception
    13f35a2c0fd5 io-wq: fix hang after cancelling pending hashed work
    96d020ddff6a xhci: Always restore EP_SOFT_CLEAR_TOGGLE even if ep reset failed
    7d31eaa7e295 xhci: Do warm-reset when both CAS and XDEV_RESUME are set
    50a7c735bc0a usb: host: xhci: fix ep context print mismatch in debugfs
    55c0eeabceb7 usb: host: xhci-tegra: fix tegra_xusb_get_phy()
    c08e590b07e4 usb: host: xhci-tegra: otg usb2/usb3 port init
    68adec4646bf usb: renesas-xhci: remove version check
    2b32323f966d XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.
    05ae7cf354b7 writeback: Fix sync livelock due to b_dirty_time processing
    d74c235bd59f writeback: Avoid skipping inode writeback
    dd71dd1dc12f writeback: Protect inode->i_io_list with inode->i_lock
    1506fdcde864 io_uring: clear req->result on IOPOLL re-issue
    116790cfa0b8 serial: 8250: change lock order in serial8250_do_startup()
    89171ef86bdc serial: 8250_exar: Fix number of ports for Commtech PCIe cards
    0a60539b4cd9 serial: stm32: avoid kernel warning on absence of optional IRQ
    df26430356bf serial: pl011: Don't leak amba_ports entry on driver register error
    6648c599db7f serial: pl011: Fix oops on -EPROBE_DEFER
    e3f8041d2434 serial: samsung: Removes the IRQ not found warning
    edc8a4eb10cf vt_ioctl: change VT_RESIZEX ioctl to check for error return from vc_resize()
    2392eea66e66 vt: defer kfree() of vc_screenbuf in vc_do_resize()
    e863ac5f53dc USB: lvtest: return proper error code in probe
    34cf1aff169d fbcon: prevent user font height or width change from causing potential out-of-bounds access
    bb77dd02ba16 btrfs: detect nocow for swap after snapshot delete
    b40d12b7da66 btrfs: fix space cache memory leak after transaction abort
    c7e8c6f46869 btrfs: check the right error variable in btrfs_del_dir_entries_in_log
    204ed5f3f628 btrfs: reset compression level for lzo on remount
    b4cbbc1305f0 blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART
    649b6c86ccf7 HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands
    7aaaf975dd4c block: loop: set discard granularity and alignment for block device backed loop
    7b85140f7060 block: fix get_max_io_size()
    8245d79338b7 hwmon: (gsc-hwmon) Scale temperature to millidegrees
    faf428a8d81c arm64: Allow booting of late CPUs affected by erratum 1418040
    e028fa961a3a arm64: Move handling of erratum 1418040 into C code
    736d8a6a73be bpf: selftests: global_funcs: Check err_str before strstr
    d5a4d2f25d77 libbpf: Fix map index used in error message
    1c20c32e8a2a powerpc/perf: Fix soft lockups due to missed interrupt accounting
    d3499d206c5d ext4: limit the length of per-inode prealloc list
    61aacc3594c9 bpf: Avoid visit same object multiple times
    2d9018e5e6e2 bpf: Fix a rcu_sched stall issue with bpf task/task_file iterator
    3636ca3d046f drm/amdkfd: fix the wrong sdma instance query for renoir
    eb9f5a5bf402 drm/amdgpu: fix NULL pointer access issue when unloading driver
    833e41f79c77 net: gianfar: Add of_node_put() before goto statement
    a8f90da8480c macvlan: validate setting of multiple remote source MAC addresses
    cd8e4a8c7416 Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"
    a36de930485f scsi: qla2xxx: Fix null pointer access during disconnect from subsystem
    aa6373e5f9d6 scsi: qla2xxx: Check if FW supports MQ before enabling
    3d2419958fc5 scsi: qla2xxx: Fix login timeout
    eb34d23c9473 scsi: qla2xxx: Indicate correct supported speeds for Mezz card
    580ffb7fd621 scsi: qla2xxx: Flush I/O on zone disable
    2626e3b023ff scsi: qla2xxx: Flush all sessions on zone disable
    018360efe867 scsi: scsi_debug: Fix scp is NULL errors
    56f13789a05a scsi: ufs: Clean up completed request without interrupt notification
    91be3977cc34 scsi: ufs: Improve interrupt handling for shared interrupts
    33cf91947c84 scsi: ufs: Fix possible infinite loop in ufshcd_hold
    4ef551cd2f8b scsi: fcoe: Fix I/O path allocation
    5dd18770d919 selftests: disable rp_filter for icmp_redirect.sh
    8e6025686c8a ALSA: usb-audio: ignore broken processing/extension unit
    ee4dd74d0872 ASoC: wm8994: Avoid attempts to read unreadable registers
    42f9f777f953 s390/cio: add cond_resched() in the slow_eval_known_fn() loop
    f3637a82e1f8 ALSA: hda/realtek: Add model alc298-samsung-headphone
    effc2c1250cf drivers/net/wan/hdlc_x25: Added needed_headroom and a skb->len check
    1ca28e0d9e49 dma-pool: Only allocate from CMA when in same memory zone
    47184b9ddf18 dma-pool: fix coherent pool allocations for IOMMU mappings
    b960e50d6172 can: j1939: transport: j1939_xtp_rx_dat_one(): compare own packets to detect corruptions
    da9c02c50991 selftests/bpf: Correct various core_reloc 64-bit assumptions
    751799b3b2ef selftests/bpf: Fix btf_dump test cases on 32-bit arches
    daca0c13cb12 selftest/bpf: Fix compilation warnings in 32-bit mode
    50bc5a55666e tools/bpftool: Fix compilation warnings in 32-bit mode
    b97071cc83f8 libbpf: Prevent overriding errno when logging errors
    e3a5fa63a2e5 netfilter: avoid ipv6 -> nf_defrag_ipv6 module dependency
    810b3c8b656a selftests/bpf: Fix segmentation fault in test_progs
    4a5e1c465e84 drm/amd/display: Switch to immediate mode for updating infopackets
    04e7daa61fd7 drm/amd/display: Fix LFC multiplier changing erratically
    757460fe2351 drm/amd/powerplay: correct UVD/VCE PG state on custom pptable uploading
    eb7eaabb7fb9 drm/amd/powerplay: correct Vega20 cached smu feature state
    5a2bc176c13d spi: stm32: always perform registers configuration prior to transfer
    accab0677047 spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate
    0e92f6b422db spi: stm32: fix fifo threshold level in case of short transfer
    87fb6c0331bc spi: stm32h7: fix race condition at end of transfer
    c13fd34bc607 fs: prevent BUG_ON in submit_bh_wbc()
    e3e46eaa2f33 ext4: correctly restore system zone info when remount fails
    6c30edde8a3a ext4: handle error of ext4_setup_system_zone() on remount
    c27ed2e8d7f8 ext4: handle option set by mount flags correctly
    5482fa036756 jbd2: abort journal if free a async write error metadata buffer
    1ca3e7d0cc00 ext4: abort the filesystem if failed to async write metadata buffer
    c8bf676fff3e drm/virtio: fix memory leak in virtio_gpu_cleanup_object()
    f2fb15e7e037 ext4: skip non-loaded groups at cr=0/1 when scanning for good groups
    a245fa7062a6 ext4: handle read only external journal device
    d558851e5ff4 ext4: don't BUG on inconsistent journal feature
    55be43c8b123 jbd2: make sure jh have b_transaction set in refile/unfile_buffer
    9b04463ab475 spi: stm32: clear only asserted irq flags on interrupt
    a5d6a17faf19 video: fbdev: controlfb: Fix build for COMPILE_TEST=y && PPC_PMAC=n
    7fee32de555b usb: gadget: f_tcm: Fix some resource leaks in some error paths
    2813786a5b89 vdpa: ifcvf: free config irq in ifcvf_free_irq()
    5bd342db2db7 vdpa: ifcvf: return err when fail to request config irq
    b9080a8d8237 i2c: rcar: in slave mode, clear NACK earlier
    f24ffc31709b i2c: core: Don't fail PRP0001 enumeration when no ID table exist
    a416b1e870b1 drm/etnaviv: always start/stop scheduler in timeout processing
    87789f561e39 habanalabs: Fix memory corruption in debugfs
    6f43d2f469bf null_blk: fix passing of REQ_FUA flag in null_handle_rq
    e05f3c879aa8 nvme: multipath: round-robin: fix single non-optimized path case
    afb511ebb78a nvme-fc: Fix wrong return value in __nvme_fc_init_request()
    227064b2ca9e nvmet: fix a memory leak
    614b266f69fe blkcg: fix memleak for iolatency
    b5ce818355a8 blk-mq: insert request not through ->queue_rq into sw/scheduler queue
    3cea38246ad4 hwmon: (nct7904) Correct divide by 0
    4346396a717d bfq: fix blkio cgroup leakage v4
    700d01d85ebb block: Fix page_is_mergeable() for compound pages
    103942e19ae4 drm/msm/adreno: fix updating ring fence
    58794696d3d8 block: virtio_blk: fix handling single range discard request
    b31d83181f99 block: respect queue limit of max discard segment
    e2655c17ee2e nfsd: fix oops on mixed NFSv4/NFSv3 client access
    ccba36760ca3 ALSA: usb-audio: Add capture support for Saffire 6 (USB 1.1)
    be85585a0617 cpufreq: intel_pstate: Fix EPP setting via sysfs in active mode
    ce9d78bce0ef PM / devfreq: Fix the wrong end with semicolon
    6eacb4639e22 PCI: qcom: Add missing reset for ipq806x
    e78ff09ed4c3 PCI: qcom: Change duplicate PCI reset to phy reset
    ff381a46439a PCI: qcom: Add missing ipq806x clocks in PCIe driver
    0b91c538cedb net: openvswitch: introduce common code for flushing flows
    2a80aa3a41d4 arm64: Fix __cpu_logical_map undefined issue
    d91fe6fa0d84 efi: provide empty efi_enter_virtual_mode implementation
    14e6b3725ff0 pinctrl: mediatek: fix build for tristate changes
    08074471105f pinctrl: mediatek: avoid virtual gpio trying to set reg
    f02889decdc2 brcmfmac: Set timeout value when configuring power save
    1bbd2c5daed7 mmc: sdhci-of-arasan: fix timings allocation code
    b082d42f1c17 USB: sisusbvga: Fix a potential UB casued by left shifting a negative value
    7278a1b0a17f dmaengine: idxd: fix PCI_MSI build errors
    2757d46ff9cd powerpc/spufs: add CONFIG_COREDUMP dependency
    34f379956e9d KVM: arm64: Fix symbol dependency in __hyp_call_panic_nvhe
    22c3762014e2 drm/amd/display: fix compilation error on allmodconfig
    ad18857f5958 drm/amd/display: change global buffer to local buffer
    a539e86e8396 media: i2c: imx290: fix reset GPIO pin handling
    22dcf9b459e4 media: davinci: vpif_capture: fix potential double free
    f2231eeadd1b hugetlbfs: prevent filesystem stacking of hugetlbfs
    a11488640c6f EDAC/ie31200: Fallback if host bridge device is already initialized
    3e93d48ee60e i2c: i801: Add support for Intel Tiger Lake PCH-H
    e805b1ffc9be scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()
    3bd5dad493e5 ceph: do not access the kiocb after aio requests
    e9c34e71a043 ceph: fix potential mdsc use-after-free crash
    8ceddd70a682 netfilter: nf_tables: report EEXIST on overlaps
    71e86271b49b scsi: iscsi: Do not put host in iscsi_set_flashnode_param()
    b83f035a0fcc btrfs: make btrfs_qgroup_check_reserved_leak take btrfs_inode
    3b616321576e btrfs: file: reserve qgroup space after the hole punch range is locked
    4754db363cfd locking/lockdep: Fix overflow in presentation of average lock-time
    e95673aa1263 drm/nouveau: Fix reference count leak in nouveau_connector_detect
    62f9a8747340 drm/nouveau: fix reference count leak in nv50_disp_atomic_commit
    84708092d685 drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open
    02465b9d38c9 f2fs: fix use-after-free issue
    f9bd216ca5bb HID: quirks: add NOGET quirk for Logitech GROUP
    acae5555c9c1 ASoC: Intel: sof_sdw_rt711: remove properties in card remove
    72db989557d9 cec-api: prevent leaking memory through hole in structure
    41399a7d4f50 gpu: host1x: Put gather's BO on pinning error
    4afc97f8ad5f ALSA: hda: Add support for Loongson 7A1000 controller
    674772bf76c9 mips/vdso: Fix resource leaks in genvdso.c
    90019585a606 rtlwifi: rtl8192cu: Prevent leaking urb
    d5d5a10574f8 ARM: dts: ls1021a: output PPS signal on FIPER2
    24a3bc57b937 PCI: Fix pci_create_slot() reference count leak
    19aa529aabea omapfb: fix multiple reference count leaks due to pm_runtime_get_sync
    fcd0ea8ff7f8 MIPS: KVM: Limit Trap-and-Emulate to MIPS32R2 only
    7fafbbefb758 f2fs: fix error path in do_recover_data()
    26bf496cd1b6 f2fs: remove write attribute of main_blkaddr sysfs node
    c06a07ab8a3d selftests/powerpc: Purge extra count_pmc() calls of ebb selftests
    cca4669a9768 scsi: target: Fix xcopy sess release leak
    bce0f660a06a xfs: Don't allow logging of XFS_ISTALE inodes
    2b5055b3aa5b scsi: lpfc: Fix shost refcount mismatch when deleting vport
    04cde704f329 drm/amdgpu/pm: fix ref count leak when pm_runtime_get_sync fails
    4e302836dc79 drm/amdkfd: fix ref count leak when pm_runtime_get_sync fails
    2e91283fdb45 drm/amdgpu/fence: fix ref count leak when pm_runtime_get_sync fails
    e4fdcdb7837c drm/amdgpu/display: fix ref count leak when pm_runtime_get_sync fails
    b86657e328b6 drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config
    c04caca229c4 drm/amd/display: fix ref count leak in amdgpu_drm_ioctl
    8b73bed1e964 drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms
    bedae9feaca9 drm/radeon: fix multiple reference count leak
    d312f436dd10 drm/amdkfd: Fix reference count leaks.
    b7850ba6edf0 platform/chrome: cros_ec_sensorhub: Fix EC timestamp overflow
    c71c249310b5 iommu/iova: Don't BUG on invalid PFNs
    8bcd6545f0b4 mfd: intel-lpss: Add Intel Tiger Lake PCH-H PCI IDs
    d7570375e9f2 scsi: target: tcmu: Fix crash on ARM during cmd completion
    4b0badbe3c91 staging: rts5208: fix memleaks on error handling paths in probe
    46381f4d0c1a blktrace: ensure our debugfs dir exists
    2145297ac316 gcc-plugins/stackleak: Don't instrument itself
    27a22e3c1645 media: pci: ttpci: av7110: fix possible buffer overflow caused by bad DMA value in debiirq()
    d75f8e2c9d6a powerpc/xive: Ignore kmemleak false positives
    970f32a28429 arm64: dts: qcom: msm8916: Pull down PDM GPIOs during sleep
    6a5bd8b333b8 mfd: intel-lpss: Add Intel Emmitsburg PCH PCI IDs
    dd80a7201ed7 ASoC: tegra: Fix reference count leaks.
    d5581a8e323c ASoC: img-parallel-out: Fix a reference count leak
    c340a3b9da14 ASoC: img: Fix a reference count leak in img_i2s_in_set_fmt
    7d60c7760631 EDAC/mc: Call edac_inc_ue_error() before panic
    ec24c53a4d0c drm/amdgpu: fix RAS memory leak in error case
    9cc4449aae8c ALSA: hda/hdmi: Use force connectivity quirk on another HP desktop
    3d41fe81e646 ALSA: hda/realtek: Fix pin default on Intel NUC 8 Rugged
    9a87d126b662 ALSA: pci: delete repeated words in comments
    ed2cdce09912 ALSA: hda/hdmi: Add quirk to force connectivity
    d4dadf0c5a07 ASoC: intel/skl/hda - fix probe regression on systems without i915
    bd331906c61b khugepaged: khugepaged_test_exit() check mmget_still_valid()

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 .../linux/linux-yocto-rt_5.8.bb               |  6 ++---
 .../linux/linux-yocto-tiny_5.8.bb             |  8 +++----
 meta/recipes-kernel/linux/linux-yocto_5.8.bb  | 22 +++++++++----------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
index 8b9dc70aba..e3a483fbe4 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
@@ -11,13 +11,13 @@ python () {
         raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
 }
 
-SRCREV_machine ?= "ded3e9afb3262feb367227c63da1f762f893b192"
-SRCREV_meta ?= "80452c7c245ed02e8dda4b1c519aa270b5e73256"
+SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
+SRCREV_meta ?= "f79c81e7a7d995f0ddb3114000555b25f4649373"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.8;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "5.8.5"
+LINUX_VERSION ?= "5.8.8"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
index d0da4edb61..26f34289fe 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
 
 require recipes-kernel/linux/linux-yocto.inc
 
-LINUX_VERSION ?= "5.8.5"
+LINUX_VERSION ?= "5.8.8"
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
 
 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
 KMETA = "kernel-meta"
 KCONF_BSP_AUDIT_LEVEL = "2"
 
-SRCREV_machine_qemuarm ?= "5bc60299c57b6dd6d88cd3196e1a3949a4365214"
-SRCREV_machine ?= "ded3e9afb3262feb367227c63da1f762f893b192"
-SRCREV_meta ?= "80452c7c245ed02e8dda4b1c519aa270b5e73256"
+SRCREV_machine_qemuarm ?= "14a8e34bdcc80797e7b3355241625f13d3396ed8"
+SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
+SRCREV_meta ?= "f79c81e7a7d995f0ddb3114000555b25f4649373"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.8.bb b/meta/recipes-kernel/linux/linux-yocto_5.8.bb
index cd34504946..c232614c21 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.8.bb
@@ -12,16 +12,16 @@ KBRANCH_qemux86  ?= "v5.8/standard/base"
 KBRANCH_qemux86-64 ?= "v5.8/standard/base"
 KBRANCH_qemumips64 ?= "v5.8/standard/mti-malta64"
 
-SRCREV_machine_qemuarm ?= "683da0bfdf000de0d65dc4a3c66bdc9906735144"
-SRCREV_machine_qemuarm64 ?= "ded3e9afb3262feb367227c63da1f762f893b192"
-SRCREV_machine_qemumips ?= "a86380b2bc78d8a40af8608569fe8d7f88f1bfd7"
-SRCREV_machine_qemuppc ?= "ded3e9afb3262feb367227c63da1f762f893b192"
-SRCREV_machine_qemuriscv64 ?= "ded3e9afb3262feb367227c63da1f762f893b192"
-SRCREV_machine_qemux86 ?= "ded3e9afb3262feb367227c63da1f762f893b192"
-SRCREV_machine_qemux86-64 ?= "ded3e9afb3262feb367227c63da1f762f893b192"
-SRCREV_machine_qemumips64 ?= "c0568a8edccef3a9bb29c2c4911b8200892c23f2"
-SRCREV_machine ?= "ded3e9afb3262feb367227c63da1f762f893b192"
-SRCREV_meta ?= "80452c7c245ed02e8dda4b1c519aa270b5e73256"
+SRCREV_machine_qemuarm ?= "0e9ceeb178a44d70be22088205d9e6b52f9feb3f"
+SRCREV_machine_qemuarm64 ?= "542471b271e827808692640e58f8771ff6bc67dc"
+SRCREV_machine_qemumips ?= "68ccca78b4c670e7db82ee7d5aa289abb4910ebe"
+SRCREV_machine_qemuppc ?= "542471b271e827808692640e58f8771ff6bc67dc"
+SRCREV_machine_qemuriscv64 ?= "542471b271e827808692640e58f8771ff6bc67dc"
+SRCREV_machine_qemux86 ?= "542471b271e827808692640e58f8771ff6bc67dc"
+SRCREV_machine_qemux86-64 ?= "542471b271e827808692640e58f8771ff6bc67dc"
+SRCREV_machine_qemumips64 ?= "18d9d696a89282b3c7b9d3a0b4bbe9d5500e9eb3"
+SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
+SRCREV_meta ?= "f79c81e7a7d995f0ddb3114000555b25f4649373"
 
 # remap qemuarm to qemuarma15 for the 5.8 kernel
 # KMACHINE_qemuarm ?= "qemuarma15"
@@ -30,7 +30,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.8;destsuffix=${KMETA}"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
-LINUX_VERSION ?= "5.8.5"
+LINUX_VERSION ?= "5.8.8"
 
 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
 DEPENDS += "openssl-native util-linux-native"
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 2/6] linux-yocto/5.4: update to v5.4.64
  2020-09-14 22:34 [PATCH 0/6] linux-yocto: consolidated pull request Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 1/6] linux-yocto/5.8: update to v5.8.8 Bruce Ashfield
@ 2020-09-14 22:34 ` Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 3/6] linux-yocto/config: configuration warning cleanup Bruce Ashfield
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-14 22:34 UTC (permalink / raw)
  To: richard.purdie; +Cc: openembedded-core

From: Bruce Ashfield <bruce.ashfield@gmail.com>

Updating linux-yocto/5.4 to the latest korg -stable release that comprises
the following commits:

    6ffabce36fc8 Linux 5.4.64
    beaf13ed8e97 net: usb: Fix uninit-was-stored issue in asix_read_phy_addr()
    58c3e86d42d2 cfg80211: regulatory: reject invalid hints
    08eeec445297 mm/khugepaged.c: fix khugepaged's request size in collapse_file
    af7786b20c71 mm/hugetlb: fix a race between hugetlb sysctl handlers
    f2cd86225c89 checkpatch: fix the usage of capture group ( ... )
    59ac5bfa82bc sdhci: tegra: Add missing TMCLK for data timeout
    e915b3b63dfd perf record: Correct the help info of option "--no-bpf-event"
    894a6f0be372 vfio/pci: Fix SR-IOV VF handling with MMIO blocking
    f4fa8d937edf mm: madvise: fix vma user-after-free
    87fb7b0c5266 mm: slub: fix conversion of freelist_corrupted()
    291144f1114d dm thin metadata: Fix use-after-free in dm_bm_set_read_only
    cfe85a4a8552 dm thin metadata: Avoid returning cmd->bm wild pointer on error
    392a6afcbf19 dm cache metadata: Avoid returning cmd->bm wild pointer on error
    9dd74db0bfd1 dm crypt: Initialize crypto wait structures
    e6ddb1d45c51 dm integrity: fix error reporting in bitmap mode after creation
    b30f628beec9 dm mpath: fix racey management of PG initialization
    226fb99eb59d dm writecache: handle DAX to partitions on persistent memory correctly
    6fb192c06a14 drm/amd/pm: avoid false alarm due to confusing softwareshutdowntemp setting
    f84804af09c7 dmaengine: dw-edma: Fix scatter-gather address calculation
    9f4ab0172e6c blk-iocost: ioc_pd_free() shouldn't assume irq disabled
    f7880745e91b libata: implement ATA_HORKAGE_MAX_TRIM_128M and apply to Sandisks
    5f5f27228195 block: ensure bdi->io_pages is always initialized
    84c041c12442 block: allow for_each_bvec to support zero len bvec
    b6e4827c04b0 affs: fix basic permission bits to actually work
    2d89e44dc932 media: rc: uevent sysfs file races with rc_unregister_device()
    5925179bbc64 media: rc: do not access device via sysfs after rc_unregister_device()
    3d77c12f3040 mmc: sdhci-pci: Fix SDHCI_RESET_ALL for CQHCI for Intel GLK-based controllers
    ed48704c36a8 mmc: cqhci: Add cqhci_deactivate()
    a69047c01eb4 mmc: dt-bindings: Add resets/reset-names for Mediatek MMC bindings
    5876ee035ba6 mmc: mediatek: add optional module reset property
    2816ccd07145 arm64: dts: mt7622: add reset node for mmc device
    d074d9d52fe0 ALSA: hda/realtek - Improved routing for Thinkpad X1 7th/8th Gen
    7de2f56ef51a ALSA: hda/realtek: Add quirk for Samsung Galaxy Book Ion NT950XCJ-X716A
    a253fe35666d ALSA; firewire-tascam: exclude Tascam FE-8 from detection
    982505615063 ALSA: hda - Fix silent audio output and corrupted input on MSI X570-A PRO
    cebaed033037 ALSA: firewire-digi00x: exclude Avid Adrenaline from detection
    4fa06a43bf9f ALSA: hda/hdmi: always check pin power status in i915 pin fixup
    2ebb83a259a8 ALSA: pcm: oss: Remove superfluous WARN_ON() for mulaw sanity check
    79124b1b912c ALSA: usb-audio: Add implicit feedback quirk for UR22C
    a3b94af5117b ALSA: ca0106: fix error code handling
    156dd7c73a9b Revert "ALSA: hda: Add support for Loongson 7A1000 controller"
    62db427bf8ca Revert "net: dsa: microchip: set the correct number of ports"
    4254a4f7988c btrfs: fix potential deadlock in the search ioctl
    de53545e8d4c net: core: use listified Rx for GRO_NORMAL in napi_gro_receive()
    df0c47585cea btrfs: tree-checker: fix the error message for transid error
    650275310f3b btrfs: set the lockdep class for log tree extent buffers
    7e0ffb0d9d9f btrfs: set the correct lockdep class for new nodes
    c37cc199da2b btrfs: allocate scrub workqueues outside of locks
    eb29635ba68a btrfs: drop path before adding new uuid tree entry
    20b591fd00c0 ARC: perf: don't bail setup if pct irq missing in device-tree
    ce690fa1d5d0 xfs: don't update mtime on COW faults
    12cd8fccc9ed ext2: don't update mtime on COW faults
    cc6c4d81d6ad tracing/kprobes, x86/ptrace: Fix regs argument order for i386
    036a857bb57d iommu/vt-d: Handle 36bit addressing for x86-32
    8f747b0149c5 vfio-pci: Invalidate mmaps and block MMIO access on disabled memory
    b0f5096b281a vfio-pci: Fault mmaps to enable vma tracking
    270c35d0723a vfio/type1: Support faulting PFNMAP vmas
    5629bb21ce20 include/linux/log2.h: add missing () around n in roundup_pow_of_two()
    bc846b58fe5c net/packet: fix overflow in tpacket_rcv
    e3d109c3484e iommu/amd: Restore IRTE.RemapEn bit after programming IRTE
    7ce6bc1b549e thermal: qcom-spmi-temp-alarm: Don't suppress negative temp
    f5b3bd38ae91 thermal: ti-soc-thermal: Fix bogus thermal shutdowns for omap4430
    0c21f1bcafc1 iommu/vt-d: Serialize IOMMU GCMD register modifications
    920d9ffcd481 x86, fakenuma: Fix invalid starting node ID
    1a7e03867a37 tg3: Fix soft lockup when tg3_reset_task() fails.
    b0c40f8a7a0e perf jevents: Fix suspicious code in fixregex()
    6c4ad5444a26 xfs: fix xfs_bmap_validate_extent_raw when checking attr fork of rt files
    58591dd6afda MIPS: add missing MSACSR and upper MSA initialization
    612e2b7ec962 net: gemini: Fix another missing clk_disable_unprepare() in probe
    88405cf0f2bd fix regression in "epoll: Keep a reference on files added to the check list"
    901d22c6b6dc net: ethernet: mlx4: Fix memory allocation in mlx4_buddy_init()
    8e2660c834e3 perf tools: Correct SNOOPX field offset
    37f0a08a3a83 cxgb4: fix thermal zone device registration
    50d284778427 nvme: fix controller instance leak
    f4b830c61b5b nvmet-fc: Fix a missed _irqsave version of spin_lock in 'nvmet_fc_fod_op_done()'
    9ff9f74ed462 netfilter: nfnetlink: nfnetlink_unicast() reports EAGAIN instead of ENOBUFS
    498575898ec4 net: dsa: mt7530: fix advertising unsupported 1000baseT_Half
    c4a427b71cd7 selftests/bpf: Fix massive output from test_maps
    e0a1bebc332d media: cedrus: Add missing v4l2_ctrl_request_hdl_put()
    3fe12f4be001 media: vicodec: add missing v4l2_ctrl_request_hdl_put()
    f28f3cffff27 bnxt: don't enable NAPI until rings are ready
    da7a1676d6c1 xfs: fix boundary test in xfs_attr_shortform_verify
    8227199ceafd bnxt_en: fix HWRM error when querying VF temperature
    927a7629bedd bnxt_en: Fix possible crash in bnxt_fw_reset_task().
    70699d3cc77c bnxt_en: Fix PCI AER error recovery flow
    87547923b6c6 bnxt_en: Check for zero dir entries in NVRAM.
    e7cbba4db7da bnxt_en: Don't query FW when netif_running() is false.
    c11510bb8898 net: ethernet: ti: cpsw: fix clean up of vlan mc entries for host port
    0bd92cdc04e6 gtp: add GTPA_LINK info to msg sent to userspace
    24249fab08c6 dmaengine: pl330: Fix burst length if burst size is smaller than bus width
    719f92de3fff net: arc_emac: Fix memleak in arc_mdio_probe
    268fe5a4c040 ravb: Fixed to be able to unload modules
    8123fa897e65 net: systemport: Fix memleak in bcm_sysport_probe
    a49c0aebf9c4 net: hns: Fix memleak in hns_nic_dev_probe
    210b889fd8ef netfilter: nf_tables: fix destination register zeroing
    576fbd4902fb netfilter: nf_tables: incorrect enum nft_list_attributes definition
    929d07feb94f netfilter: nf_tables: add NFTA_SET_USERDATA if not null
    fb1e97674aa8 mmc: sdhci-acpi: Fix HS400 tuning for AMDI0040
    da8e3e507d2f MIPS: BMIPS: Also call bmips_cpu_setup() for secondary cores
    c5e9e36fc2f8 MIPS: mm: BMIPS5000 has inclusive physical caches
    5f7798f05311 rxrpc: Make rxrpc_kernel_get_srtt() indicate validity
    43cf7e7dfa7b rxrpc: Keep the ACK serial in a var in rxrpc_input_ack()
    242a7ab0ac52 dmaengine: at_hdmac: check return value of of_find_device_by_node() in at_dma_xlate()
    2f2786bb9d40 batman-adv: bla: use netif_rx_ni when not in interrupt context
    fd8b3ef644a4 batman-adv: Fix own OGM check in aggregated OGMs
    2344f2f186fd batman-adv: Avoid uninitialized chaddr when handling DHCP
    89cb604c4226 dmaengine: of-dma: Fix of_dma_router_xlate's of_dma_xlate handling
    1a89606baf31 fsldma: fix very broken 32-bit ppc ioread64 functionality
    6eb88c42dcc9 xen/xenbus: Fix granting of vmalloc'd memory
    0878655a9880 drm/amd/display: Fix memleak in amdgpu_dm_mode_config_init
    b014f2846e6f drm/amd/display: Retry AUX write when fail occurs
    9947928e619a drivers: gpu: amd: Initialize amdgpu_dm_backlight_caps object to 0 in amdgpu_dm_update_backlight_caps
    79d31527dfc3 drm/amd/display: Reject overlay plane configurations in multi-display scenarios
    29bade8e2fc9 s390: don't trace preemption in percpu macros
    c756635246e9 nbd: restore default timeout when setting it to zero
    c1e333e7b8da cpuidle: Fixup IRQ state
    ad3a4efc8c56 drm/omap: fix incorrect lock state
    0a8dcad24424 ceph: don't allow setlease on cephfs
    755fd63ae163 drm/msm/a6xx: fix gmu start on newer firmware
    7a55cf8a20c7 habanalabs: check correct vmalloc return code
    c9436de020a4 habanalabs: validate FW file size
    dddd5003c707 drm/msm: enable vblank during atomic commits
    2c9bc7d9600c nvmet: Disable keep-alive timer when kato is cleared to 0h
    e94a3d76305b hwmon: (applesmc) check status earlier.
    19583b280801 drm/msm: add shutdown support for display platform_driver
    8bc25dea70fe tty: serial: qcom_geni_serial: Drop __init from qcom_geni_console_setup
    28ffe70a2e33 drm/msm/dpu: Fix scale params in plane validation
    b2fc347e2126 HID: quirks: Always poll three more Lenovo PixArt mice
    e32f4fa1b24d Linux 5.4.63
    5153710a5ecc scsi: target: tcmu: Optimize use of flush_dcache_page
    bb9949fdfddd scsi: target: tcmu: Fix size in calls to tcmu_flush_dcache_range
    6d2e274f60fc sdhci: tegra: Remove SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK for Tegra186
    0176db2f2ad5 sdhci: tegra: Remove SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK for Tegra210
    eda97e9d90db arm64: tegra: Add missing timeout clock to Tegra210 SDMMC
    5cd8c5979e72 arm64: tegra: Add missing timeout clock to Tegra186 SDMMC nodes
    ef8b5f333780 arm64: tegra: Add missing timeout clock to Tegra194 SDMMC nodes
    9d806d68bf97 dt-bindings: mmc: tegra: Add tmclk for Tegra210 and later
    d2ac42e61ecd KVM: arm64: Set HCR_EL2.PTW to prevent AT taking synchronous exception
    ffad02f9e3ea KVM: arm64: Survive synchronous exceptions caused by AT instructions
    1744237ca047 KVM: arm64: Add kvm_extable for vaxorcism code
    538caddbe635 drm/etnaviv: fix TS cache flushing on GPUs with BLT engine
    80743b4bde09 drm/sched: Fix passing zero to 'PTR_ERR' warning v2
    6cadd1e2d8c5 perf record/stat: Explicitly call out event modifiers in the documentation
    4bae1afed432 HID: core: Sanitize event code and type when mapping input
    667514df10a0 HID: core: Correctly handle ReportSize being zero
    933cf1c2c075 Linux 5.4.62
    54ee77961e79 io_uring: Fix NULL pointer dereference in io_sq_wq_submit_work()
    44cf62d388fb ALSA: usb-audio: Update documentation comment for MS2109 quirk
    851d0813ab80 HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage()
    c98b6ebd9b55 kbuild: fix broken builds because of GZIP,BZIP2,LZOP variables
    37432a83faab kbuild: add variables for compression tools
    47a41f65afb6 kheaders: explain why include/config/autoconf.h is excluded from md5sum
    7caddaa9f88b kheaders: remove the last bashism to allow sh to run it
    18f48708c3f5 kheaders: optimize header copy for in-tree builds
    a1d0c6e2f334 kheaders: optimize md5sum calculation for in-tree builds
    eb914bae6e17 kheaders: remove unneeded 'cat' command piped to 'head' / 'tail'
    376810e5e9e1 fbmem: pull fbcon_update_vcs() out of fb_set_var()
    6a862aa31ec3 usb: dwc3: gadget: Handle ZLP for sg requests
    7c8b5685662b usb: dwc3: gadget: Fix handling ZLP
    4bc5d90a7dce usb: dwc3: gadget: Don't setup more than requested
    f8e4c5297fcd drm/i915: Fix cmd parser desc matching with masks
    73992639ec78 usb: storage: Add unusual_uas entry for Sony PSZ drives
    2add73c8c00d USB: cdc-acm: rework notification_buffer resizing
    e2e02f260496 USB: gadget: u_f: Unbreak offset calculation in VLAs
    4f529c4d1e43 USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()
    f47ab852bea3 USB: gadget: u_f: add overflow checks to VLA macros
    2534d3dec376 usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe()
    de24343880a6 USB: Ignore UAS for JMicron JMS567 ATA/ATAPI Bridge
    ca29a2a53953 USB: quirks: Ignore duplicate endpoint on Sound Devices MixPre-D
    20b3564c6748 USB: quirks: Add no-lpm quirk for another Raydium touchscreen
    b32ec919ee37 usb: uas: Add quirk for PNY Pro Elite
    ad0bc424fc0a USB: yurex: Fix bad gfp argument
    3623dab2959e drm/amd/pm: correct the thermal alert temperature limit settings
    85ca6f199c77 drm/amd/pm: correct Vega20 swctf limit setting
    9afabefd42fc drm/amd/pm: correct Vega12 swctf limit setting
    60cffee2d951 drm/amd/pm: correct Vega10 swctf limit setting
    2809cf7f6eba drm/amd/powerplay: Fix hardmins not being sent to SMU for RV
    20700b352d10 drm/amdgpu/gfx10: refine mgcg setting
    8fc7a66619e1 drm/amdgpu: Fix buffer overflow in INFO ioctl
    1adf8c19f974 x86/hotplug: Silence APIC only after all interrupts are migrated
    47c8387a963e irqchip/stm32-exti: Avoid losing interrupts due to clearing pending bits by mistake
    927aa9a10f12 genirq/matrix: Deal with the sillyness of for_each_cpu() on UP
    70957a10e1db crypto: af_alg - Work around empty control messages without MSG_MORE
    aca10ab0568a device property: Fix the secondary firmware node handling in set_primary_fwnode()
    df2a6a4a9d68 powerpc/perf: Fix crashes with generic_compat_pmu & BHRB
    b260fb2a02b5 PM: sleep: core: Fix the handling of pending runtime resume requests
    7ded78a8c89e arm64: vdso32: make vdso32 install conditional
    3b7087e07730 xhci: Always restore EP_SOFT_CLEAR_TOGGLE even if ep reset failed
    02166fea639f xhci: Do warm-reset when both CAS and XDEV_RESUME are set
    3ac8545b29ae usb: host: xhci: fix ep context print mismatch in debugfs
    4d3e2a3a0c64 XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.
    6623c19042b6 writeback: Fix sync livelock due to b_dirty_time processing
    cb0c74450072 writeback: Avoid skipping inode writeback
    8eab2b531fd3 writeback: Protect inode->i_io_list with inode->i_lock
    2e76a3a1667c serial: 8250: change lock order in serial8250_do_startup()
    f53ebc7c2922 serial: 8250_exar: Fix number of ports for Commtech PCIe cards
    fbb55ec82dd6 serial: stm32: avoid kernel warning on absence of optional IRQ
    64a05aadf936 serial: pl011: Don't leak amba_ports entry on driver register error
    0806b49bba20 serial: pl011: Fix oops on -EPROBE_DEFER
    daae6b962a13 serial: samsung: Removes the IRQ not found warning
    7c57237d74a0 vt_ioctl: change VT_RESIZEX ioctl to check for error return from vc_resize()
    adb76f3f7732 vt: defer kfree() of vc_screenbuf in vc_do_resize()
    db1bb352cc08 USB: lvtest: return proper error code in probe
    96e41fc29e8a fbcon: prevent user font height or width change from causing potential out-of-bounds access
    cd1d270e3e4f btrfs: detect nocow for swap after snapshot delete
    eb576fc43a43 btrfs: fix space cache memory leak after transaction abort
    1d08edc70154 btrfs: check the right error variable in btrfs_del_dir_entries_in_log
    8a3509486f08 btrfs: reset compression level for lzo on remount
    b1a83ee0cbbf blk-mq: order adding requests to hctx->dispatch and checking SCHED_RESTART
    c2035d1e55aa HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands
    db4542b6617b block: loop: set discard granularity and alignment for block device backed loop
    f09dbec9c0c6 block: fix get_max_io_size()
    2f4b202eb1b1 arm64: Allow booting of late CPUs affected by erratum 1418040
    82b05f0838aa arm64: Move handling of erratum 1418040 into C code
    7d44b707aaff powerpc/perf: Fix soft lockups due to missed interrupt accounting
    9c0305c0cfa2 net: gianfar: Add of_node_put() before goto statement
    c656534e5c45 macvlan: validate setting of multiple remote source MAC addresses
    19f669a3609c Revert "scsi: qla2xxx: Fix crash on qla2x00_mailbox_command"
    48765b780ace scsi: qla2xxx: Fix null pointer access during disconnect from subsystem
    36a139cf4146 scsi: qla2xxx: Check if FW supports MQ before enabling
    88274626d110 scsi: qla2xxx: Fix login timeout
    37528b3ee9e1 scsi: ufs: Clean up completed request without interrupt notification
    a39ba0fdcdfd scsi: ufs: Improve interrupt handling for shared interrupts
    d895b0be701c scsi: ufs: Fix possible infinite loop in ufshcd_hold
    1778bebd06b4 scsi: fcoe: Fix I/O path allocation
    a8d26145e112 selftests: disable rp_filter for icmp_redirect.sh
    957066143e6c ASoC: wm8994: Avoid attempts to read unreadable registers
    1d63737b0777 s390/cio: add cond_resched() in the slow_eval_known_fn() loop
    2a8c6149a49a ALSA: hda/realtek: Add model alc298-samsung-headphone
    021a98a87864 can: j1939: transport: j1939_xtp_rx_dat_one(): compare own packets to detect corruptions
    3803312a3c55 netfilter: avoid ipv6 -> nf_defrag_ipv6 module dependency
    35238963c972 drm/amd/display: Switch to immediate mode for updating infopackets
    b92b415fa7b7 drm/amd/powerplay: correct UVD/VCE PG state on custom pptable uploading
    73a0e6280a32 drm/amd/powerplay: correct Vega20 cached smu feature state
    d2da80e0a3e7 spi: stm32: always perform registers configuration prior to transfer
    2844685c661a spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate
    a6daa863d15e spi: stm32: fix fifo threshold level in case of short transfer
    3c15a3c4b155 spi: stm32h7: fix race condition at end of transfer
    a08e95e83e6f fs: prevent BUG_ON in submit_bh_wbc()
    28a56c26a00d ext4: correctly restore system zone info when remount fails
    8e63c86f6580 ext4: handle error of ext4_setup_system_zone() on remount
    e579635669da ext4: handle option set by mount flags correctly
    3a53d012bd26 jbd2: abort journal if free a async write error metadata buffer
    1b36d4fa4b66 ext4: handle read only external journal device
    2e7312ddaf62 ext4: don't BUG on inconsistent journal feature
    40827caf954c jbd2: make sure jh have b_transaction set in refile/unfile_buffer
    e4351ad44d7e spi: stm32: clear only asserted irq flags on interrupt
    d63728afe947 usb: gadget: f_tcm: Fix some resource leaks in some error paths
    262f5fbad941 i2c: rcar: in slave mode, clear NACK earlier
    883ed72723ef i2c: core: Don't fail PRP0001 enumeration when no ID table exist
    2fc8fa50ebee null_blk: fix passing of REQ_FUA flag in null_handle_rq
    88994acafd96 nvme: multipath: round-robin: fix single non-optimized path case
    97f30414a2e0 nvme-fc: Fix wrong return value in __nvme_fc_init_request()
    05c608f630b9 blkcg: fix memleak for iolatency
    872a2b3182ee blk-mq: insert request not through ->queue_rq into sw/scheduler queue
    9054d5844092 hwmon: (nct7904) Correct divide by 0
    1475314530bb bfq: fix blkio cgroup leakage v4
    2295664518c3 block: Fix page_is_mergeable() for compound pages
    3e9eb1e893ba drm/msm/adreno: fix updating ring fence
    effd3b89f7e5 block: virtio_blk: fix handling single range discard request
    cc3a73f245cb block: respect queue limit of max discard segment
    8f409e764c4b media: gpio-ir-tx: improve precision of transmitted signal due to scheduling
    6ba04701b801 ALSA: usb-audio: Add capture support for Saffire 6 (USB 1.1)
    5861e84d7145 cpufreq: intel_pstate: Fix EPP setting via sysfs in active mode
    1b7b2d45b31e PCI: qcom: Add missing reset for ipq806x
    ea552383a9d5 PCI: qcom: Change duplicate PCI reset to phy reset
    29ecf28be997 PCI: qcom: Add missing ipq806x clocks in PCIe driver
    6d11320bed41 EDAC/{i7core,sb,pnd2,skx}: Fix error event severity
    87cc96bb11b9 EDAC: skx_common: get rid of unused type var
    3bf42b2e8d67 EDAC: sb_edac: get rid of unused vars
    75aaa8fa7672 mm/vunmap: add cond_resched() in vunmap_pmd_range
    a2038eb833a5 drm/amd/display: Fix dmesg warning from setting abm level
    8522b1bec88e drm/amd/display: Add additional config guards for DCN
    992e51ff0e4b drm/amd/display: Trigger modesets on MST DSC connectors
    b730fb14434f drm/ingenic: Fix incorrect assumption about plane->index
    8dc47d858fea gpu/drm: ingenic: Use the plane's src_[x,y] to configure DMA length
    302b9e189962 cma: don't quit at first error when activating reserved areas
    aed14b1b5c0e mm/cma.c: switch to bitmap_zalloc() for cma bitmap allocation
    965d3d5ce355 mm: fix kthread_use_mm() vs TLB invalidate
    72574434da87 mm/shuffle: don't move pages between zones and don't read garbage memmaps
    483b956a16a0 btrfs: only commit delayed items at fsync if we are logging a directory
    3eddcc71fe8a btrfs: only commit the delayed inode when doing a full fsync
    d5f5b15d3ea4 btrfs: factor out inode items copy loop from btrfs_log_inode()
    a0cfda9cb3a1 s390/numa: set node distance to LOCAL_DISTANCE
    67f8b390b15e drm/xen-front: Fix misused IS_ERR_OR_NULL checks
    02611bcaafe5 drm/xen: fix passing zero to 'PTR_ERR' warning
    fe376f1b12d2 PM / devfreq: rk3399_dmc: Fix kernel oops when rockchip,pmu is absent
    b7cca731b486 PM / devfreq: rk3399_dmc: Disable devfreq-event device when fails
    a0f69c6f5e0b PM / devfreq: rk3399_dmc: Add missing of_node_put()
    961bfe1277ae usb: cdns3: gadget: always zeroed TRB buffer when enable endpoint
    2c0000f409ec sched/uclamp: Fix a deadlock when enabling uclamp static key
    88435320ebc1 sched/uclamp: Protect uclamp fast path code with static key
    93709d8ade00 Revert "ath10k: fix DMA related firmware crashes on multiple devices"
    da56eb03ea94 arm64: Fix __cpu_logical_map undefined issue
    12a9bec2bd4e efi: provide empty efi_enter_virtual_mode implementation
    b2defeb19bff brcmfmac: Set timeout value when configuring power save
    7aac56d8b0ee USB: sisusbvga: Fix a potential UB casued by left shifting a negative value
    e77f71c6341a powerpc/spufs: add CONFIG_COREDUMP dependency
    653ae33b030b KVM: arm64: Fix symbol dependency in __hyp_call_panic_nvhe
    a84a6eb935ba media: davinci: vpif_capture: fix potential double free
    6b0010ed7140 hugetlbfs: prevent filesystem stacking of hugetlbfs
    c67c6e1f54aa EDAC/ie31200: Fallback if host bridge device is already initialized
    41191f8c57a1 scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()
    a002274db527 ceph: do not access the kiocb after aio requests
    01540d5e7c1b ceph: fix potential mdsc use-after-free crash
    9da791b5410e scsi: iscsi: Do not put host in iscsi_set_flashnode_param()
    050292f138a3 btrfs: make btrfs_qgroup_check_reserved_leak take btrfs_inode
    1f52b85f6c79 btrfs: file: reserve qgroup space after the hole punch range is locked
    7d6689df48de locking/lockdep: Fix overflow in presentation of average lock-time
    2adf6ec63db2 drm/nouveau: Fix reference count leak in nouveau_connector_detect
    19e81f6325a9 drm/nouveau: fix reference count leak in nv50_disp_atomic_commit
    d23d52e38cc9 drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open
    45e30390f50f f2fs: fix use-after-free issue
    4cba87943046 HID: quirks: add NOGET quirk for Logitech GROUP
    6734eeb6c2f0 cec-api: prevent leaking memory through hole in structure
    bd4593030332 ALSA: hda: Add support for Loongson 7A1000 controller
    f4107f633a29 mips/vdso: Fix resource leaks in genvdso.c
    71e7e02c0590 rtlwifi: rtl8192cu: Prevent leaking urb
    3a84491364e1 ARM: dts: ls1021a: output PPS signal on FIPER2
    4410fd0c378e PCI: Fix pci_create_slot() reference count leak
    201838142c52 omapfb: fix multiple reference count leaks due to pm_runtime_get_sync
    22d859fe1bdc f2fs: fix error path in do_recover_data()
    110c5a5a6854 selftests/powerpc: Purge extra count_pmc() calls of ebb selftests
    0450a50c914e scsi: target: Fix xcopy sess release leak
    774cc7c882f8 xfs: Don't allow logging of XFS_ISTALE inodes
    40b450375c80 scsi: lpfc: Fix shost refcount mismatch when deleting vport
    815060a8ec2a drm/amdgpu/display: fix ref count leak when pm_runtime_get_sync fails
    8290f9d4695f drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config
    3753eff4c69a drm/amd/display: fix ref count leak in amdgpu_drm_ioctl
    c911da7b6673 drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms
    40d0bf2b6e99 drm/radeon: fix multiple reference count leak
    9c88b27ac444 drm/amdkfd: Fix reference count leaks.
    1174ed705dda iommu/iova: Don't BUG on invalid PFNs
    f0a066af0f37 mfd: intel-lpss: Add Intel Tiger Lake PCH-H PCI IDs
    d98ea48810e6 scsi: target: tcmu: Fix crash on ARM during cmd completion
    ab2d90e58ae1 blktrace: ensure our debugfs dir exists
    fc93c091de22 media: pci: ttpci: av7110: fix possible buffer overflow caused by bad DMA value in debiirq()
    1dc0ed18219a powerpc/xive: Ignore kmemleak false positives
    88eb00cb39ce arm64: dts: qcom: msm8916: Pull down PDM GPIOs during sleep
    d8cc881483d8 mfd: intel-lpss: Add Intel Emmitsburg PCH PCI IDs
    fd5908860a17 ASoC: tegra: Fix reference count leaks.
    7d60cd2a6e08 ASoC: img-parallel-out: Fix a reference count leak
    8150a0e3d796 ASoC: img: Fix a reference count leak in img_i2s_in_set_fmt
    a53f67368c98 ALSA: hda/hdmi: Use force connectivity quirk on another HP desktop
    348da2f8566b ALSA: hda/realtek: Fix pin default on Intel NUC 8 Rugged
    bcf40820b4fd ALSA: pci: delete repeated words in comments
    b45944e2b39e ALSA: hda/hdmi: Add quirk to force connectivity
    266d21a57093 ipvlan: fix device features
    e1334c4f4aec net/sched: act_ct: Fix skb double-free in tcf_ct_handle_fragments() error flow
    97a74349cf82 net: ena: Make missed_tx stat incremental
    6c2e795f95cd tipc: fix uninit skb->data in tipc_nl_compat_dumpit()
    d429362b3de4 net/smc: Prevent kernel-infoleak in __smc_diag_dump()
    4d2fe0addc38 net: sctp: Fix negotiation of the number of data streams.
    4ef63e365466 net: qrtr: fix usage of idr in port assignment to socket
    4ae9ebf9e8ea net: nexthop: don't allow empty NHA_GROUP
    6ed89176755c net: Fix potential wrong skb->protocol in skb_vlan_untag()
    b5e34120b06a gre6: Fix reception with IP6_TNL_F_RCV_DSCP_COPY
    730443f4c48a binfmt_flat: revert "binfmt_flat: don't offset the data start"
    669fc3b38ce2 powerpc/64s: Don't init FSCR_DSCR in __init_FSCR()

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 .../linux/linux-yocto-rt_5.4.bb               |  6 ++---
 .../linux/linux-yocto-tiny_5.4.bb             |  8 +++----
 meta/recipes-kernel/linux/linux-yocto_5.4.bb  | 22 +++++++++----------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb
index 12c3daab0f..97cb7d934f 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb
@@ -11,13 +11,13 @@ python () {
         raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
 }
 
-SRCREV_machine ?= "e65e9ff22c5c42c9ae57a4cce45fbf91a7e7ae3b"
-SRCREV_meta ?= "647f4fd91cc47567a7d88f21a6ad7d230d354469"
+SRCREV_machine ?= "b170a5953260ea7d7bdfcf223fb92d138eb7db67"
+SRCREV_meta ?= "34b6e8caf82c411655d33e0eeff6700a8de1f6fc"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "5.4.61"
+LINUX_VERSION ?= "5.4.64"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb
index bc3a1e50e0..7d836593c9 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb
@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
 
 require recipes-kernel/linux/linux-yocto.inc
 
-LINUX_VERSION ?= "5.4.61"
+LINUX_VERSION ?= "5.4.64"
 LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
 
 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
 KMETA = "kernel-meta"
 KCONF_BSP_AUDIT_LEVEL = "2"
 
-SRCREV_machine_qemuarm ?= "f30ce7653a038eb05ef0503d0d15c7c6ec33cdc5"
-SRCREV_machine ?= "00809fdaf65b24fcd0347f3d3e489e2890f7ed44"
-SRCREV_meta ?= "647f4fd91cc47567a7d88f21a6ad7d230d354469"
+SRCREV_machine_qemuarm ?= "3bd01ef1ebb9b2a9bbae3c35eb9d640cd1ab9da7"
+SRCREV_machine ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
+SRCREV_meta ?= "34b6e8caf82c411655d33e0eeff6700a8de1f6fc"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.4.bb b/meta/recipes-kernel/linux/linux-yocto_5.4.bb
index def26f6a92..26778a67a3 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.4.bb
@@ -12,16 +12,16 @@ KBRANCH_qemux86  ?= "v5.4/standard/base"
 KBRANCH_qemux86-64 ?= "v5.4/standard/base"
 KBRANCH_qemumips64 ?= "v5.4/standard/mti-malta64"
 
-SRCREV_machine_qemuarm ?= "487ecd38aaa59c22302930e8a9697c62c9d85fe5"
-SRCREV_machine_qemuarm64 ?= "00809fdaf65b24fcd0347f3d3e489e2890f7ed44"
-SRCREV_machine_qemumips ?= "ad1d747e7343bc9851bff62c4279060094c6eb59"
-SRCREV_machine_qemuppc ?= "00809fdaf65b24fcd0347f3d3e489e2890f7ed44"
-SRCREV_machine_qemuriscv64 ?= "00809fdaf65b24fcd0347f3d3e489e2890f7ed44"
-SRCREV_machine_qemux86 ?= "00809fdaf65b24fcd0347f3d3e489e2890f7ed44"
-SRCREV_machine_qemux86-64 ?= "00809fdaf65b24fcd0347f3d3e489e2890f7ed44"
-SRCREV_machine_qemumips64 ?= "4fe8438e9dea8d0a00f82003277f36785aac9e3d"
-SRCREV_machine ?= "00809fdaf65b24fcd0347f3d3e489e2890f7ed44"
-SRCREV_meta ?= "647f4fd91cc47567a7d88f21a6ad7d230d354469"
+SRCREV_machine_qemuarm ?= "33ab5549b39d7bbfc067f13527bfa817250c69a3"
+SRCREV_machine_qemuarm64 ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
+SRCREV_machine_qemumips ?= "7954ad760bd317039a9ad44300a8bf1a34107fc8"
+SRCREV_machine_qemuppc ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
+SRCREV_machine_qemuriscv64 ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
+SRCREV_machine_qemux86 ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
+SRCREV_machine_qemux86-64 ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
+SRCREV_machine_qemumips64 ?= "91fb319534f5206619aa04556dbf32d49afa1080"
+SRCREV_machine ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
+SRCREV_meta ?= "34b6e8caf82c411655d33e0eeff6700a8de1f6fc"
 
 # remap qemuarm to qemuarma15 for the 5.4 kernel
 # KMACHINE_qemuarm ?= "qemuarma15"
@@ -30,7 +30,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
-LINUX_VERSION ?= "5.4.61"
+LINUX_VERSION ?= "5.4.64"
 
 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
 DEPENDS += "openssl-native util-linux-native"
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 3/6] linux-yocto/config: configuration warning cleanup
  2020-09-14 22:34 [PATCH 0/6] linux-yocto: consolidated pull request Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 1/6] linux-yocto/5.8: update to v5.8.8 Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 2/6] linux-yocto/5.4: update to v5.4.64 Bruce Ashfield
@ 2020-09-14 22:34 ` Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 4/6] linux-yocto/5.8: update to v5.8.9 Bruce Ashfield
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-14 22:34 UTC (permalink / raw)
  To: richard.purdie; +Cc: openembedded-core

From: Bruce Ashfield <bruce.ashfield@gmail.com>

Integrating the following commit(s) to linux-yocto/.:

    7d52eb95f6d ti-am335x: Clean up useless and badly formatted fragments
    5fd04e4da78 features/nf_tables: remove duplicate entry

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb   | 2 +-
 meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb | 2 +-
 meta/recipes-kernel/linux/linux-yocto_5.8.bb      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
index e3a483fbe4..ec8060c945 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
@@ -12,7 +12,7 @@ python () {
 }
 
 SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_meta ?= "f79c81e7a7d995f0ddb3114000555b25f4649373"
+SRCREV_meta ?= "7d52eb95f6d0899e764f58fec27acf1b477e31c7"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.8;destsuffix=${KMETA}"
diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
index 26f34289fe..2461254fb4 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
@@ -17,7 +17,7 @@ KCONF_BSP_AUDIT_LEVEL = "2"
 
 SRCREV_machine_qemuarm ?= "14a8e34bdcc80797e7b3355241625f13d3396ed8"
 SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_meta ?= "f79c81e7a7d995f0ddb3114000555b25f4649373"
+SRCREV_meta ?= "7d52eb95f6d0899e764f58fec27acf1b477e31c7"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.8.bb b/meta/recipes-kernel/linux/linux-yocto_5.8.bb
index c232614c21..a0a55ac569 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.8.bb
@@ -21,7 +21,7 @@ SRCREV_machine_qemux86 ?= "542471b271e827808692640e58f8771ff6bc67dc"
 SRCREV_machine_qemux86-64 ?= "542471b271e827808692640e58f8771ff6bc67dc"
 SRCREV_machine_qemumips64 ?= "18d9d696a89282b3c7b9d3a0b4bbe9d5500e9eb3"
 SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_meta ?= "f79c81e7a7d995f0ddb3114000555b25f4649373"
+SRCREV_meta ?= "7d52eb95f6d0899e764f58fec27acf1b477e31c7"
 
 # remap qemuarm to qemuarma15 for the 5.8 kernel
 # KMACHINE_qemuarm ?= "qemuarma15"
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 4/6] linux-yocto/5.8: update to v5.8.9
  2020-09-14 22:34 [PATCH 0/6] linux-yocto: consolidated pull request Bruce Ashfield
                   ` (2 preceding siblings ...)
  2020-09-14 22:34 ` [PATCH 3/6] linux-yocto/config: configuration warning cleanup Bruce Ashfield
@ 2020-09-14 22:34 ` Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 5/6] linux-yocto/5.4: update to v5.4.65 Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds Bruce Ashfield
  5 siblings, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-14 22:34 UTC (permalink / raw)
  To: richard.purdie; +Cc: openembedded-core

From: Bruce Ashfield <bruce.ashfield@gmail.com>

Updating linux-yocto/5.8 to the latest korg -stable release that comprises
the following commits:

    f82f36b2fb1d Linux 5.8.9
    cdba995d2f19 mptcp: free acked data before waiting for more memory
    655e1af6aecd net: disable netpoll on fresh napis
    6f0e276cda3e tipc: fix using smp_processor_id() in preemptible
    aae250a26893 tipc: fix shutdown() of connectionless socket
    44c3fca3de64 taprio: Fix using wrong queues in gate mask
    db16256c95ac sctp: not disable bh in the whole sctp_get_port_local()
    05a8237c08f0 net: usb: dm9601: Add USB ID of Keenetic Plus DSL
    6540bd18bf2f netlabel: fix problems with mapping removal
    089097476c4c ipv6: Fix sysctl max for fib_multipath_hash_policy
    d68c3397de48 ipv4: Silence suspicious RCU usage warning
    bd15d2192261 RDMA/cma: Execute rdma_cm destruction from a handler properly
    d4794085738d RDMA/cma: Remove unneeded locking for req paths
    c2064ac30331 RDMA/cma: Using the standard locking pattern when delivering the removal event
    5a0c4cbd099b RDMA/cma: Simplify DEVICE_REMOVAL for internal_id
    87d8175e9c3d io_uring: fix linked deferred ->files cancellation
    f5fea75f4ea4 io_uring: fix cancel of deferred reqs with ->files

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 .../linux/linux-yocto-rt_5.8.bb               |  6 ++---
 .../linux/linux-yocto-tiny_5.8.bb             |  8 +++----
 meta/recipes-kernel/linux/linux-yocto_5.8.bb  | 22 +++++++++----------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
index ec8060c945..d29c5985cd 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.8.bb
@@ -11,13 +11,13 @@ python () {
         raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
 }
 
-SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_meta ?= "7d52eb95f6d0899e764f58fec27acf1b477e31c7"
+SRCREV_machine ?= "31fafe701e2adec65d2b2a74a3e592a358915c67"
+SRCREV_meta ?= "a933cb2f91915dceb138775c3878212e228d3eff"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.8;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "5.8.8"
+LINUX_VERSION ?= "5.8.9"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
index 2461254fb4..d32e5d372b 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.8.bb
@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
 
 require recipes-kernel/linux/linux-yocto.inc
 
-LINUX_VERSION ?= "5.8.8"
+LINUX_VERSION ?= "5.8.9"
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
 
 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
 KMETA = "kernel-meta"
 KCONF_BSP_AUDIT_LEVEL = "2"
 
-SRCREV_machine_qemuarm ?= "14a8e34bdcc80797e7b3355241625f13d3396ed8"
-SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_meta ?= "7d52eb95f6d0899e764f58fec27acf1b477e31c7"
+SRCREV_machine_qemuarm ?= "830cb9af40e856615b7a435a4fac57b748ba56d6"
+SRCREV_machine ?= "31fafe701e2adec65d2b2a74a3e592a358915c67"
+SRCREV_meta ?= "a933cb2f91915dceb138775c3878212e228d3eff"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.8.bb b/meta/recipes-kernel/linux/linux-yocto_5.8.bb
index a0a55ac569..9ff1d5da80 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.8.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.8.bb
@@ -12,16 +12,16 @@ KBRANCH_qemux86  ?= "v5.8/standard/base"
 KBRANCH_qemux86-64 ?= "v5.8/standard/base"
 KBRANCH_qemumips64 ?= "v5.8/standard/mti-malta64"
 
-SRCREV_machine_qemuarm ?= "0e9ceeb178a44d70be22088205d9e6b52f9feb3f"
-SRCREV_machine_qemuarm64 ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_machine_qemumips ?= "68ccca78b4c670e7db82ee7d5aa289abb4910ebe"
-SRCREV_machine_qemuppc ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_machine_qemuriscv64 ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_machine_qemux86 ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_machine_qemux86-64 ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_machine_qemumips64 ?= "18d9d696a89282b3c7b9d3a0b4bbe9d5500e9eb3"
-SRCREV_machine ?= "542471b271e827808692640e58f8771ff6bc67dc"
-SRCREV_meta ?= "7d52eb95f6d0899e764f58fec27acf1b477e31c7"
+SRCREV_machine_qemuarm ?= "d351bf87c9c0e96a1f27f87f16d298bc4470e0b5"
+SRCREV_machine_qemuarm64 ?= "31fafe701e2adec65d2b2a74a3e592a358915c67"
+SRCREV_machine_qemumips ?= "93d29a70890b19fb5482ebcab5f3a49301851daf"
+SRCREV_machine_qemuppc ?= "31fafe701e2adec65d2b2a74a3e592a358915c67"
+SRCREV_machine_qemuriscv64 ?= "31fafe701e2adec65d2b2a74a3e592a358915c67"
+SRCREV_machine_qemux86 ?= "31fafe701e2adec65d2b2a74a3e592a358915c67"
+SRCREV_machine_qemux86-64 ?= "31fafe701e2adec65d2b2a74a3e592a358915c67"
+SRCREV_machine_qemumips64 ?= "4faa049b6b7b51c5d12d20c5e9fcf8e0a3ba8d42"
+SRCREV_machine ?= "31fafe701e2adec65d2b2a74a3e592a358915c67"
+SRCREV_meta ?= "a933cb2f91915dceb138775c3878212e228d3eff"
 
 # remap qemuarm to qemuarma15 for the 5.8 kernel
 # KMACHINE_qemuarm ?= "qemuarma15"
@@ -30,7 +30,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.8;destsuffix=${KMETA}"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
-LINUX_VERSION ?= "5.8.8"
+LINUX_VERSION ?= "5.8.9"
 
 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
 DEPENDS += "openssl-native util-linux-native"
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 5/6] linux-yocto/5.4: update to v5.4.65
  2020-09-14 22:34 [PATCH 0/6] linux-yocto: consolidated pull request Bruce Ashfield
                   ` (3 preceding siblings ...)
  2020-09-14 22:34 ` [PATCH 4/6] linux-yocto/5.8: update to v5.8.9 Bruce Ashfield
@ 2020-09-14 22:34 ` Bruce Ashfield
  2020-09-14 22:34 ` [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds Bruce Ashfield
  5 siblings, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-14 22:34 UTC (permalink / raw)
  To: richard.purdie; +Cc: openembedded-core

From: Bruce Ashfield <bruce.ashfield@gmail.com>

Updating linux-yocto/5.4 to the latest korg -stable release that comprises
the following commits:

    6c3d34dea2fc Linux 5.4.65
    ddb279d64b72 net: disable netpoll on fresh napis
    09c45065257b tipc: fix shutdown() of connectionless socket
    b95eb482c288 taprio: Fix using wrong queues in gate mask
    20f8c874789a sctp: not disable bh in the whole sctp_get_port_local()
    8b61bb0b2d57 net: usb: dm9601: Add USB ID of Keenetic Plus DSL
    346fefa82325 netlabel: fix problems with mapping removal
    3f73dbf94f8f ipv6: Fix sysctl max for fib_multipath_hash_policy
    263e463358d3 ipv4: Silence suspicious RCU usage warning

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 .../linux/linux-yocto-rt_5.4.bb               |  6 ++---
 .../linux/linux-yocto-tiny_5.4.bb             |  8 +++----
 meta/recipes-kernel/linux/linux-yocto_5.4.bb  | 22 +++++++++----------
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb b/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb
index 97cb7d934f..73876bb99e 100644
--- a/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-rt_5.4.bb
@@ -11,13 +11,13 @@ python () {
         raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to linux-yocto-rt to enable it")
 }
 
-SRCREV_machine ?= "b170a5953260ea7d7bdfcf223fb92d138eb7db67"
-SRCREV_meta ?= "34b6e8caf82c411655d33e0eeff6700a8de1f6fc"
+SRCREV_machine ?= "1d9e25c4f35155580cef313ff2a76de545124a1d"
+SRCREV_meta ?= "0d860e075788a92601dff3eb9b615ee41e465040"
 
 SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;branch=${KBRANCH};name=machine \
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
 
-LINUX_VERSION ?= "5.4.64"
+LINUX_VERSION ?= "5.4.65"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb b/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb
index 7d836593c9..853fc93694 100644
--- a/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto-tiny_5.4.bb
@@ -6,7 +6,7 @@ KCONFIG_MODE = "--allnoconfig"
 
 require recipes-kernel/linux/linux-yocto.inc
 
-LINUX_VERSION ?= "5.4.64"
+LINUX_VERSION ?= "5.4.65"
 LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
 
 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
@@ -15,9 +15,9 @@ DEPENDS += "openssl-native util-linux-native"
 KMETA = "kernel-meta"
 KCONF_BSP_AUDIT_LEVEL = "2"
 
-SRCREV_machine_qemuarm ?= "3bd01ef1ebb9b2a9bbae3c35eb9d640cd1ab9da7"
-SRCREV_machine ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
-SRCREV_meta ?= "34b6e8caf82c411655d33e0eeff6700a8de1f6fc"
+SRCREV_machine_qemuarm ?= "bb77791bc00cfa70211dd238d312b4db950c0808"
+SRCREV_machine ?= "406008bf3232dfc9e63b6e7bf745ca883c45041e"
+SRCREV_meta ?= "0d860e075788a92601dff3eb9b615ee41e465040"
 
 PV = "${LINUX_VERSION}+git${SRCPV}"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto_5.4.bb b/meta/recipes-kernel/linux/linux-yocto_5.4.bb
index 26778a67a3..fe93691961 100644
--- a/meta/recipes-kernel/linux/linux-yocto_5.4.bb
+++ b/meta/recipes-kernel/linux/linux-yocto_5.4.bb
@@ -12,16 +12,16 @@ KBRANCH_qemux86  ?= "v5.4/standard/base"
 KBRANCH_qemux86-64 ?= "v5.4/standard/base"
 KBRANCH_qemumips64 ?= "v5.4/standard/mti-malta64"
 
-SRCREV_machine_qemuarm ?= "33ab5549b39d7bbfc067f13527bfa817250c69a3"
-SRCREV_machine_qemuarm64 ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
-SRCREV_machine_qemumips ?= "7954ad760bd317039a9ad44300a8bf1a34107fc8"
-SRCREV_machine_qemuppc ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
-SRCREV_machine_qemuriscv64 ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
-SRCREV_machine_qemux86 ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
-SRCREV_machine_qemux86-64 ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
-SRCREV_machine_qemumips64 ?= "91fb319534f5206619aa04556dbf32d49afa1080"
-SRCREV_machine ?= "86d9bf1c575ada30e515b9337a0ba3fe07986091"
-SRCREV_meta ?= "34b6e8caf82c411655d33e0eeff6700a8de1f6fc"
+SRCREV_machine_qemuarm ?= "894e63d3256613faa39931a6ae505cfd196df067"
+SRCREV_machine_qemuarm64 ?= "406008bf3232dfc9e63b6e7bf745ca883c45041e"
+SRCREV_machine_qemumips ?= "aa13fdb2c5f8c4e4e432bfee6df9c8f76ec8ac70"
+SRCREV_machine_qemuppc ?= "406008bf3232dfc9e63b6e7bf745ca883c45041e"
+SRCREV_machine_qemuriscv64 ?= "406008bf3232dfc9e63b6e7bf745ca883c45041e"
+SRCREV_machine_qemux86 ?= "406008bf3232dfc9e63b6e7bf745ca883c45041e"
+SRCREV_machine_qemux86-64 ?= "406008bf3232dfc9e63b6e7bf745ca883c45041e"
+SRCREV_machine_qemumips64 ?= "4fb21d604fc54db63221ea28ab90622c29d74202"
+SRCREV_machine ?= "406008bf3232dfc9e63b6e7bf745ca883c45041e"
+SRCREV_meta ?= "0d860e075788a92601dff3eb9b615ee41e465040"
 
 # remap qemuarm to qemuarma15 for the 5.4 kernel
 # KMACHINE_qemuarm ?= "qemuarma15"
@@ -30,7 +30,7 @@ SRC_URI = "git://git.yoctoproject.org/linux-yocto.git;name=machine;branch=${KBRA
            git://git.yoctoproject.org/yocto-kernel-cache;type=kmeta;name=meta;branch=yocto-5.4;destsuffix=${KMETA}"
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=bbea815ee2795b2f4230826c0c6b8814"
-LINUX_VERSION ?= "5.4.64"
+LINUX_VERSION ?= "5.4.65"
 
 DEPENDS += "${@bb.utils.contains('ARCH', 'x86', 'elfutils-native', '', d)}"
 DEPENDS += "openssl-native util-linux-native"
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-14 22:34 [PATCH 0/6] linux-yocto: consolidated pull request Bruce Ashfield
                   ` (4 preceding siblings ...)
  2020-09-14 22:34 ` [PATCH 5/6] linux-yocto/5.4: update to v5.4.65 Bruce Ashfield
@ 2020-09-14 22:34 ` Bruce Ashfield
  2020-09-14 22:35   ` Bruce Ashfield
                     ` (2 more replies)
  5 siblings, 3 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-14 22:34 UTC (permalink / raw)
  To: richard.purdie; +Cc: openembedded-core

From: Jens Rehsack <sno@netbsd.org>

Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
them once .3 is released, but for now, we need the fixes to build
against the latest 5.4, 5.8 and 5.9 kernels.

We also bump the devupstream SRCREV to pickup the same changes.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 ...ndency-issue-when-building-in-tree-w.patch |  54 ++
 ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
 ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
 ...he-length-of-per-inode-prealloc-list.patch |  84 ++
 ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
 ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
 ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
 ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
 ...es-for-ext4_discard_preallocations-a.patch |  52 +
 .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
 .../lttng/lttng-modules_2.12.2.bb             |  12 +-
 11 files changed, 1829 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch

diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
new file mode 100644
index 0000000000..ae8bec45de
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
@@ -0,0 +1,54 @@
+From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
+From: Beniamin Sandu <beniaminsandu@gmail.com>
+Date: Thu, 13 Aug 2020 16:24:39 +0300
+Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
+ without CONFIG_FTRACE
+
+When building in-tree, one could disable CONFIG_FTRACE from kernel
+config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
+but generate a lot of linker errors like below because it leaves out
+other stuff, e.g.:
+
+trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
+ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
+ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
+ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
+ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
+
+It appears to be caused by the fact that TRACE_EVENT macros in the Linux
+kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
+enabled.
+
+Steps to reproduce:
+
+- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
+
+- Configure a standard x86-64 build, enable built-in LTTNG but disable
+  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
+
+- Build will fail at linking stage
+
+Upstream-Status: Backport
+
+Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Kconfig b/Kconfig
+index acdab73..10eccff 100644
+--- a/Kconfig
++++ b/Kconfig
+@@ -2,7 +2,7 @@
+ 
+ config LTTNG
+ 	tristate "LTTng support"
+-	select TRACEPOINTS
++	select TRACING
+ 	help
+ 	  LTTng is an open source tracing framework for Linux.
+ 
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
new file mode 100644
index 0000000000..fab673b854
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
@@ -0,0 +1,41 @@
+From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 10 Aug 2020 11:22:05 -0400
+Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
+
+  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
+  Author: Sean Christopherson <sean.j.christopherson@intel.com>
+  Date:   Mon Jun 22 13:20:29 2020 -0700
+
+    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
+
+    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
+
+Upstream-Status: Backport
+
+Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
+index 37384a2..5a7ef1e 100644
+--- a/probes/lttng-probe-kvm-x86-mmu.c
++++ b/probes/lttng-probe-kvm-x86-mmu.c
+@@ -24,7 +24,11 @@
+  */
+ #include <wrapper/tracepoint.h>
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++#include <../../arch/x86/kvm/mmu/mmutrace.h>
++#else
+ #include <../../arch/x86/kvm/mmutrace.h>
++#endif
+ 
+ #undef TRACE_INCLUDE_PATH
+ #undef TRACE_INCLUDE_FILE
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
new file mode 100644
index 0000000000..524631cc72
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
@@ -0,0 +1,39 @@
+From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 10 Aug 2020 11:36:03 -0400
+Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
+ accessor internal-only (v5.9)
+
+  commit 985ab2780164698ec6e7d73fad523d50449261dd
+  Author: Sean Christopherson <sean.j.christopherson@intel.com>
+  Date:   Mon Jun 22 13:20:32 2020 -0700
+
+    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
+
+    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
+    be poking into the gory details of shadow pages.
+
+Upstream-Status: Backport
+
+Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ probes/lttng-probe-kvm-x86-mmu.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
+index 5a7ef1e..8f98186 100644
+--- a/probes/lttng-probe-kvm-x86-mmu.c
++++ b/probes/lttng-probe-kvm-x86-mmu.c
+@@ -25,6 +25,7 @@
+ #include <wrapper/tracepoint.h>
+ 
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
+ #include <../../arch/x86/kvm/mmu/mmutrace.h>
+ #else
+ #include <../../arch/x86/kvm/mmutrace.h>
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
new file mode 100644
index 0000000000..e29c07252c
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
@@ -0,0 +1,84 @@
+From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 24 Aug 2020 15:26:04 -0400
+Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
+ (v5.9)
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+See upstream commit:
+
+  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
+  Author: brookxu <brookxu.cn@gmail.com>
+  Date:   Mon Aug 17 15:36:15 2020 +0800
+
+    ext4: limit the length of per-inode prealloc list
+
+    In the scenario of writing sparse files, the per-inode prealloc list may
+    be very long, resulting in high overhead for ext4_mb_use_preallocated().
+    To circumvent this problem, we limit the maximum length of per-inode
+    prealloc list to 512 and allow users to modify it.
+
+    After patching, we observed that the sys ratio of cpu has dropped, and
+    the system throughput has increased significantly. We created a process
+    to write the sparse file, and the running time of the process on the
+    fixed kernel was significantly reduced, as follows:
+
+    Running time on unfixed kernel:
+    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
+    real    0m2.051s
+    user    0m0.008s
+    sys     0m2.026s
+
+    Running time on fixed kernel:
+    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
+    real    0m0.471s
+    user    0m0.004s
+    sys     0m0.395s
+
+Upstream-Status: Backport
+
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
+---
+ instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
+index 5f7ab28..72ad4c9 100644
+--- a/instrumentation/events/lttng-module/ext4.h
++++ b/instrumentation/events/lttng-module/ext4.h
+@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
+ )
+ #endif
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
++	TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
++
++	TP_ARGS(inode, len, needed),
++
++	TP_FIELDS(
++		ctf_integer(dev_t, dev, inode->i_sb->s_dev)
++		ctf_integer(ino_t, ino, inode->i_ino)
++		ctf_integer(unsigned int, len, len)
++		ctf_integer(unsigned int, needed, needed)
++	)
++)
++#else
+ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
+ 	TP_PROTO(struct inode *inode),
+ 
+@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
+ 		ctf_integer(ino_t, ino, inode->i_ino)
+ 	)
+ )
++#endif
+ 
+ LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
+ 	TP_PROTO(struct super_block *sb, int needed),
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
new file mode 100644
index 0000000000..f76e9698c8
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
@@ -0,0 +1,63 @@
+From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 24 Aug 2020 15:37:50 -0400
+Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
+ =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+See upstream commit:
+
+  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
+  Author: Theodore Ts'o <tytso@mit.edu>
+  Date:   Wed Jul 15 11:48:55 2020 -0400
+
+    ext4: indicate via a block bitmap read is prefetched via a tracepoint
+
+    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
+    whether a block bitmap is being prefetched.
+
+Upstream-Status: Backport
+
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
+---
+ instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
+index 72ad4c9..4476abb 100644
+--- a/instrumentation/events/lttng-module/ext4.h
++++ b/instrumentation/events/lttng-module/ext4.h
+@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
+ 	TP_ARGS(sb, group)
+ )
+ 
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
++	TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
++
++	TP_ARGS(sb, group, prefetch),
++
++	TP_FIELDS(
++		ctf_integer(dev_t, dev, sb->s_dev)
++		ctf_integer(__u32, group, group)
++		ctf_integer(bool, prefetch, prefetch)
++	)
++)
++#else
+ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
+ 
+ 	TP_PROTO(struct super_block *sb, unsigned long group),
+ 
+ 	TP_ARGS(sb, group)
+ )
++#endif
+ 
+ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
+ 
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
new file mode 100644
index 0000000000..0970dd30aa
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
@@ -0,0 +1,391 @@
+From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Tue, 25 Aug 2020 10:56:29 -0400
+Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
+
+See upstream commits:
+
+  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
+  Author: Will Deacon <will@kernel.org>
+  Date:   Tue Oct 24 11:22:47 2017 +0100
+
+    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
+
+    In preparation for the removal of lockless_dereference(), which is the
+    same as READ_ONCE() on all architectures other than Alpha, add an
+    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
+    used to head dependency chains on all architectures.
+
+  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
+  Author: Will Deacon <will.deacon@arm.com>
+  Date:   Tue Oct 24 11:22:47 2017 +0100
+
+    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
+
+    In preparation for the removal of lockless_dereference(), which is the
+    same as READ_ONCE() on all architectures other than Alpha, add an
+    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
+    used to head dependency chains on all architectures.
+
+Upstream-Status: Backport
+
+Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ instrumentation/events/lttng-module/i2c.h |  4 ++--
+ lib/ringbuffer/backend.h                  |  2 +-
+ lib/ringbuffer/backend_internal.h         |  2 +-
+ lib/ringbuffer/frontend.h                 |  4 ++--
+ lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
+ lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
+ lttng-events.c                            |  8 ++++----
+ probes/lttng-kprobes.c                    |  6 +++---
+ probes/lttng-kretprobes.c                 |  6 +++---
+ probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
+ probes/lttng-uprobes.c                    |  6 +++---
+ wrapper/compiler.h                        | 18 ++++++++++++++++++
+ wrapper/trace-clock.h                     | 15 +++++----------
+ 13 files changed, 51 insertions(+), 38 deletions(-)
+
+diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
+index dcbabf6..131d134 100644
+--- a/instrumentation/events/lttng-module/i2c.h
++++ b/instrumentation/events/lttng-module/i2c.h
+@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
+ 
+ 	TP_code_pre(
+ 		tp_locvar->extract_sensitive_payload =
+-			READ_ONCE(extract_sensitive_payload);
++			LTTNG_READ_ONCE(extract_sensitive_payload);
+ 	),
+ 
+ 	TP_FIELDS(
+@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
+ 
+ 	TP_code_pre(
+ 		tp_locvar->extract_sensitive_payload =
+-			READ_ONCE(extract_sensitive_payload);
++			LTTNG_READ_ONCE(extract_sensitive_payload);
+ 	),
+ 
+ 	TP_FIELDS(
+diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
+index da937f2..43e1d47 100644
+--- a/lib/ringbuffer/backend.h
++++ b/lib/ringbuffer/backend.h
+@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
+ 		 * Only read source character once, in case it is
+ 		 * modified concurrently.
+ 		 */
+-		c = READ_ONCE(src[count]);
++		c = LTTNG_READ_ONCE(src[count]);
+ 		if (!c)
+ 			break;
+ 		lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
+diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
+index 2d6a345..1226fd8 100644
+--- a/lib/ringbuffer/backend_internal.h
++++ b/lib/ringbuffer/backend_internal.h
+@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
+ 	 * Performing a volatile access to read the sb_pages, because we want to
+ 	 * read a coherent version of the pointer and the associated noref flag.
+ 	 */
+-	id = READ_ONCE(bufb->buf_wsb[idx].id);
++	id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
+ 	for (;;) {
+ 		/* This check is called on the fast path for each record. */
+ 		if (likely(!subbuffer_id_is_noref(config, id))) {
+diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
+index 6f516d9..41382fe 100644
+--- a/lib/ringbuffer/frontend.h
++++ b/lib/ringbuffer/frontend.h
+@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
+ #define for_each_channel_cpu(cpu, chan)					\
+ 	for ((cpu) = -1;						\
+ 		({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);	\
+-		   smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
++		   smp_rmb(); (cpu) < nr_cpu_ids; });)
+ 
+ extern struct lib_ring_buffer *channel_get_ring_buffer(
+ 				const struct lib_ring_buffer_config *config,
+@@ -155,7 +155,7 @@ static inline
+ int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
+ 				 struct lib_ring_buffer *buf)
+ {
+-	int finalized = READ_ONCE(buf->finalized);
++	int finalized = LTTNG_READ_ONCE(buf->finalized);
+ 	/*
+ 	 * Read finalized before counters.
+ 	 */
+diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
+index 3cab365..4980d20 100644
+--- a/lib/ringbuffer/ring_buffer_frontend.c
++++ b/lib/ringbuffer/ring_buffer_frontend.c
+@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
+ 	int finalized;
+ 
+ retry:
+-	finalized = READ_ONCE(buf->finalized);
++	finalized = LTTNG_READ_ONCE(buf->finalized);
+ 	/*
+ 	 * Read finalized before counters.
+ 	 */
+@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
+ 		return -EBUSY;
+ 	}
+ retry:
+-	finalized = READ_ONCE(buf->finalized);
++	finalized = LTTNG_READ_ONCE(buf->finalized);
+ 	/*
+ 	 * Read finalized before counters.
+ 	 */
+diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
+index d25db72..7b4f20a 100644
+--- a/lib/ringbuffer/ring_buffer_iterator.c
++++ b/lib/ringbuffer/ring_buffer_iterator.c
+@@ -46,7 +46,7 @@ restart:
+ 	switch (iter->state) {
+ 	case ITER_GET_SUBBUF:
+ 		ret = lib_ring_buffer_get_next_subbuf(buf);
+-		if (ret && !READ_ONCE(buf->finalized)
++		if (ret && !LTTNG_READ_ONCE(buf->finalized)
+ 		    && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
+ 			/*
+ 			 * Use "pull" scheme for global buffers. The reader
+diff --git a/lttng-events.c b/lttng-events.c
+index be7e389..d719294 100644
+--- a/lttng-events.c
++++ b/lttng-events.c
+@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
+ 	size_t len;
+ 	va_list ap;
+ 
+-	WARN_ON_ONCE(!READ_ONCE(session->active));
++	WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
+ 
+ 	va_start(ap, fmt);
+ 	str = kvasprintf(GFP_KERNEL, fmt, ap);
+@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
+ {
+ 	int ret = 0;
+ 
+-	if (event->metadata_dumped || !READ_ONCE(session->active))
++	if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
+ 		return 0;
+ 	if (chan->channel_type == METADATA_CHANNEL)
+ 		return 0;
+@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
+ {
+ 	int ret = 0;
+ 
+-	if (chan->metadata_dumped || !READ_ONCE(session->active))
++	if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
+ 		return 0;
+ 
+ 	if (chan->channel_type == METADATA_CHANNEL)
+@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
+ 	struct lttng_event *event;
+ 	int ret = 0;
+ 
+-	if (!READ_ONCE(session->active))
++	if (!LTTNG_READ_ONCE(session->active))
+ 		return 0;
+ 
+ 	lttng_metadata_begin(session);
+diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
+index a44eaa1..38fb72e 100644
+--- a/probes/lttng-kprobes.c
++++ b/probes/lttng-kprobes.c
+@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
+ 	int ret;
+ 	unsigned long data = (unsigned long) p->addr;
+ 
+-	if (unlikely(!READ_ONCE(chan->session->active)))
++	if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
+ 		return 0;
+-	if (unlikely(!READ_ONCE(chan->enabled)))
++	if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
+ 		return 0;
+-	if (unlikely(!READ_ONCE(event->enabled)))
++	if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+ 		return 0;
+ 
+ 	lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
+diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
+index ab98ff2..a6bcd21 100644
+--- a/probes/lttng-kretprobes.c
++++ b/probes/lttng-kretprobes.c
+@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
+ 		unsigned long parent_ip;
+ 	} payload;
+ 
+-	if (unlikely(!READ_ONCE(chan->session->active)))
++	if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
+ 		return 0;
+-	if (unlikely(!READ_ONCE(chan->enabled)))
++	if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
+ 		return 0;
+-	if (unlikely(!READ_ONCE(event->enabled)))
++	if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+ 		return 0;
+ 
+ 	payload.ip = (unsigned long) krpi->rp->kp.addr;
+diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
+index 77b8638..72a669e 100644
+--- a/probes/lttng-tracepoint-event-impl.h
++++ b/probes/lttng-tracepoint-event-impl.h
+@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)		      \
+ 									      \
+ 	if (!_TP_SESSION_CHECK(session, __session))			      \
+ 		return;							      \
+-	if (unlikely(!READ_ONCE(__session->active)))			      \
++	if (unlikely(!LTTNG_READ_ONCE(__session->active)))		      \
+ 		return;							      \
+-	if (unlikely(!READ_ONCE(__chan->enabled)))			      \
++	if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))		      \
+ 		return;							      \
+-	if (unlikely(!READ_ONCE(__event->enabled)))			      \
++	if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))		      \
+ 		return;							      \
+ 	__lf = lttng_rcu_dereference(__session->pid_tracker.p);		      \
+ 	if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
+@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)			      \
+ 									      \
+ 	if (!_TP_SESSION_CHECK(session, __session))			      \
+ 		return;							      \
+-	if (unlikely(!READ_ONCE(__session->active)))			      \
++	if (unlikely(!LTTNG_READ_ONCE(__session->active)))		      \
+ 		return;							      \
+-	if (unlikely(!READ_ONCE(__chan->enabled)))			      \
++	if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))		      \
+ 		return;							      \
+-	if (unlikely(!READ_ONCE(__event->enabled)))			      \
++	if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))		      \
+ 		return;							      \
+ 	__lf = lttng_rcu_dereference(__session->pid_tracker.p);		      \
+ 	if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
+diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
+index bc10128..bda1d9b 100644
+--- a/probes/lttng-uprobes.c
++++ b/probes/lttng-uprobes.c
+@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
+ 		unsigned long ip;
+ 	} payload;
+ 
+-	if (unlikely(!READ_ONCE(chan->session->active)))
++	if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
+ 		return 0;
+-	if (unlikely(!READ_ONCE(chan->enabled)))
++	if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
+ 		return 0;
+-	if (unlikely(!READ_ONCE(event->enabled)))
++	if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
+ 		return 0;
+ 
+ 	lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
+diff --git a/wrapper/compiler.h b/wrapper/compiler.h
+index 1496f33..b9f8c51 100644
+--- a/wrapper/compiler.h
++++ b/wrapper/compiler.h
+@@ -9,6 +9,7 @@
+ #define _LTTNG_WRAPPER_COMPILER_H
+ 
+ #include <linux/compiler.h>
++#include <linux/version.h>
+ 
+ /*
+  * Don't allow compiling with buggy compiler.
+@@ -39,4 +40,21 @@
+ # define WRITE_ONCE(x, val)	({ ACCESS_ONCE(x) = val; })
+ #endif
+ 
++/*
++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
++ * lockless_dereference(), replicate this behavior on prior kernels
++ * and remove calls to smp_read_barrier_depends which was dropped
++ * in v5.9.
++ */
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
++#define LTTNG_READ_ONCE(x)	READ_ONCE(x)
++#else
++#define LTTNG_READ_ONCE(x)			\
++({						\
++	typeof(x) __val = READ_ONCE(x);		\
++	smp_read_barrier_depends();		\
++	__val;					\
++})
++#endif
++
+ #endif /* _LTTNG_WRAPPER_COMPILER_H */
+diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
+index 9f4e366..187fc82 100644
+--- a/wrapper/trace-clock.h
++++ b/wrapper/trace-clock.h
+@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
+ 
+ static inline u64 trace_clock_read64(void)
+ {
+-	struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
++	struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
+ 
+ 	if (likely(!ltc)) {
+ 		return trace_clock_read64_monotonic();
+ 	} else {
+-		read_barrier_depends();	/* load ltc before content */
+ 		return ltc->read64();
+ 	}
+ }
+ 
+ static inline u64 trace_clock_freq(void)
+ {
+-	struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
++	struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
+ 
+ 	if (!ltc) {
+ 		return trace_clock_freq_monotonic();
+ 	} else {
+-		read_barrier_depends();	/* load ltc before content */
+ 		return ltc->freq();
+ 	}
+ }
+ 
+ static inline int trace_clock_uuid(char *uuid)
+ {
+-	struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
++	struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
+ 
+-	read_barrier_depends();	/* load ltc before content */
+ 	/* Use default UUID cb when NULL */
+ 	if (!ltc || !ltc->uuid) {
+ 		return trace_clock_uuid_monotonic(uuid);
+@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
+ 
+ static inline const char *trace_clock_name(void)
+ {
+-	struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
++	struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
+ 
+ 	if (!ltc) {
+ 		return trace_clock_name_monotonic();
+ 	} else {
+-		read_barrier_depends();	/* load ltc before content */
+ 		return ltc->name();
+ 	}
+ }
+ 
+ static inline const char *trace_clock_description(void)
+ {
+-	struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
++	struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
+ 
+ 	if (!ltc) {
+ 		return trace_clock_description_monotonic();
+ 	} else {
+-		read_barrier_depends();	/* load ltc before content */
+ 		return ltc->description();
+ 	}
+ }
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
new file mode 100644
index 0000000000..2843c9cb62
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
@@ -0,0 +1,59 @@
+From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 31 Aug 2020 11:41:38 -0400
+Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
+
+See upstream commit:
+
+  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.
+
+Upstream-Status: Backport
+
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
+---
+ instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
+ 1 file changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
+index affb4eb..ece67ad 100644
+--- a/instrumentation/events/lttng-module/writeback.h
++++ b/instrumentation/events/lttng-module/writeback.h
+@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
+ 
+ #endif
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++#define show_inode_state(state)					\
++	__print_flags(state, "|",				\
++		{I_DIRTY_SYNC,		"I_DIRTY_SYNC"},	\
++		{I_DIRTY_DATASYNC,	"I_DIRTY_DATASYNC"},	\
++		{I_DIRTY_PAGES,		"I_DIRTY_PAGES"},	\
++		{I_NEW,			"I_NEW"},		\
++		{I_WILL_FREE,		"I_WILL_FREE"},		\
++		{I_FREEING,		"I_FREEING"},		\
++		{I_CLEAR,		"I_CLEAR"},		\
++		{I_SYNC,		"I_SYNC"},		\
++		{I_DIRTY_TIME,		"I_DIRTY_TIME"},	\
++		{I_REFERENCED,		"I_REFERENCED"}		\
++	)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
+ #define show_inode_state(state)					\
+ 	__print_flags(state, "|",				\
+ 		{I_DIRTY_SYNC,		"I_DIRTY_SYNC"},	\
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
new file mode 100644
index 0000000000..7a0d9a38b8
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
@@ -0,0 +1,117 @@
+From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Mon, 31 Aug 2020 14:16:01 -0400
+Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
+ processing (v5.9)
+
+See upstream commit:
+
+  commit f9cae926f35e8230330f28c7b743ad088611a8de
+  Author: Jan Kara <jack@suse.cz>
+  Date:   Fri May 29 16:08:58 2020 +0200
+
+    writeback: Fix sync livelock due to b_dirty_time processing
+
+    When we are processing writeback for sync(2), move_expired_inodes()
+    didn't set any inode expiry value (older_than_this). This can result in
+    writeback never completing if there's steady stream of inodes added to
+    b_dirty_time list as writeback rechecks dirty lists after each writeback
+    round whether there's more work to be done. Fix the problem by using
+    sync(2) start time is inode expiry value when processing b_dirty_time
+    list similarly as for ordinarily dirtied inodes. This requires some
+    refactoring of older_than_this handling which simplifies the code
+    noticeably as a bonus.
+
+Upstream-Status: Backport
+
+Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
+ 1 file changed, 26 insertions(+), 13 deletions(-)
+
+diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
+index ece67ad..e9018dd 100644
+--- a/instrumentation/events/lttng-module/writeback.h
++++ b/instrumentation/events/lttng-module/writeback.h
+@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
+ #endif
+ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
++	TP_PROTO(struct bdi_writeback *wb,
++		 struct wb_writeback_work *work,
++		 unsigned long dirtied_before,
++		 int moved),
++	TP_ARGS(wb, work, dirtied_before, moved),
++	TP_FIELDS(
++		ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
++		ctf_integer(unsigned long, older, dirtied_before)
++		ctf_integer(int, moved, moved)
++	)
++)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
+ 	TP_PROTO(struct bdi_writeback *wb,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ 		 struct wb_writeback_work *work,
+-#else
+-		 unsigned long *older_than_this,
+-#endif
+ 		 int moved),
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ 	TP_ARGS(wb, work, moved),
+-#else
++	TP_FIELDS(
++		ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
++		ctf_integer(int, moved, moved)
++	)
++)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
++	TP_PROTO(struct bdi_writeback *wb,
++		 unsigned long *older_than_this,
++		 int moved),
+ 	TP_ARGS(wb, older_than_this, moved),
+-#endif
+ 	TP_FIELDS(
+ 		ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+-#else
+ 		ctf_integer(unsigned long, older,
+ 			older_than_this ? *older_than_this : 0)
+ 		ctf_integer(long, age,
+ 			older_than_this ?
+ 				(jiffies - *older_than_this) * 1000 / HZ
+ 				: -1)
+-#endif
+ 		ctf_integer(int, moved, moved)
+ 	)
+ )
++#endif
+ 
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
+ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+ 		ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
+ 	)
+ )
+-#else
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+ 
+ 	writeback_global_dirty_state,
+@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+ 	)
+ )
+ #endif
+-#endif
+ 
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ 
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
new file mode 100644
index 0000000000..346e1d63ad
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
@@ -0,0 +1,52 @@
+From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
+From: Michael Jeanson <mjeanson@efficios.com>
+Date: Fri, 4 Sep 2020 11:52:51 -0400
+Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
+ writeback_queue_io
+
+Upstream-Status: Backport
+
+Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
+---
+ instrumentation/events/lttng-module/ext4.h      | 3 ++-
+ instrumentation/events/lttng-module/writeback.h | 8 +++++++-
+ 2 files changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
+index 4476abb..b172c8d 100644
+--- a/instrumentation/events/lttng-module/ext4.h
++++ b/instrumentation/events/lttng-module/ext4.h
+@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
+ )
+ #endif
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
++	LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
+ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
+ 	TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
+ 
+diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
+index e9018dd..09637d7 100644
+--- a/instrumentation/events/lttng-module/writeback.h
++++ b/instrumentation/events/lttng-module/writeback.h
+@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
+ #endif
+ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
++	LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
++	LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
++	LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
++	LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
++	LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
++	LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
+ LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
+ 	TP_PROTO(struct bdi_writeback *wb,
+ 		 struct wb_writeback_work *work,
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
new file mode 100644
index 0000000000..a16750ddb3
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
@@ -0,0 +1,918 @@
+From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
+From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Date: Tue, 28 Jan 2020 16:02:44 -0500
+Subject: [PATCH 10/10] Fix: system call filter table
+
+The system call filter table has effectively been unused for a long
+time due to system call name prefix mismatch. This means the overhead of
+selective system call tracing was larger than it should have been because
+the event payload preparation would be done for all system calls as soon
+as a single system call is traced.
+
+However, fixing this underlying issue unearths several issues that crept
+unnoticed when the "enabler" concept was introduced (after the original
+implementation of the system call filter table).
+
+Here is a list of the issues which are resolved here:
+
+- Split lttng_syscalls_unregister into an unregister and destroy
+  function, thus awaiting for a grace period (and therefore quiescence
+  of the users) after unregistering the system call tracepoints before
+  freeing the system call filter data structures. This effectively fixes
+  a use-after-free.
+
+- The state for enabling "all" system calls vs enabling specific system
+  calls (and sequences of enable-disable) was incorrect with respect to
+  the "enablers" semantic. This is solved by always tracking the
+  bitmap of enabled system calls, and keeping this bitmap even when
+  enabling all system calls. The sc_filter is now always allocated
+  before system call tracing is registered to tracepoints, which means
+  it does not need to be RCU dereferenced anymore.
+
+Padding fields in the ABI are reserved to select whether to:
+
+- Trace either native or compat system call (or both, which is the
+  behavior currently implemented),
+- Trace either system call entry or exit (or both, which is the
+  behavior currently implemented),
+- Select the system call to trace by name (behavior currently
+  implemented) or by system call number,
+
+Upstream-Status: Backport
+
+Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+---
+ lttng-abi.c      |  43 ++++++
+ lttng-abi.h      |  26 ++++
+ lttng-events.c   | 112 +++++++++++++--
+ lttng-events.h   |  31 ++++-
+ lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
+ 5 files changed, 380 insertions(+), 180 deletions(-)
+
+diff --git a/lttng-abi.c b/lttng-abi.c
+index 64ea99d..b33879d 100644
+--- a/lttng-abi.c
++++ b/lttng-abi.c
+@@ -1264,6 +1264,46 @@ nomem:
+ 	return ret;
+ }
+ 
++static
++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
++{
++	/* Limit ABI to implemented features. */
++	switch (event_param->instrumentation) {
++	case LTTNG_KERNEL_SYSCALL:
++		switch (event_param->u.syscall.entryexit) {
++		case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
++			break;
++		default:
++			return -EINVAL;
++		}
++		switch (event_param->u.syscall.abi) {
++		case LTTNG_KERNEL_SYSCALL_ABI_ALL:
++			break;
++		default:
++			return -EINVAL;
++		}
++		switch (event_param->u.syscall.match) {
++		case LTTNG_SYSCALL_MATCH_NAME:
++			break;
++		default:
++			return -EINVAL;
++		}
++		break;
++
++	case LTTNG_KERNEL_TRACEPOINT:	/* Fallthrough */
++	case LTTNG_KERNEL_KPROBE:	/* Fallthrough */
++	case LTTNG_KERNEL_KRETPROBE:	/* Fallthrough */
++	case LTTNG_KERNEL_NOOP:		/* Fallthrough */
++	case LTTNG_KERNEL_UPROBE:
++		break;
++
++	case LTTNG_KERNEL_FUNCTION:	/* Fallthrough */
++	default:
++		return -EINVAL;
++	}
++	return 0;
++}
++
+ static
+ int lttng_abi_create_event(struct file *channel_file,
+ 			   struct lttng_kernel_event *event_param)
+@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
+ 		ret = -EOVERFLOW;
+ 		goto refcount_error;
+ 	}
++	ret = lttng_abi_validate_event_param(event_param);
++	if (ret)
++		goto event_error;
+ 	if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
+ 			|| event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
+ 		struct lttng_enabler *enabler;
+diff --git a/lttng-abi.h b/lttng-abi.h
+index 1d356ab..51d60e5 100644
+--- a/lttng-abi.h
++++ b/lttng-abi.h
+@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
+ 	} u;
+ } __attribute__((packed));
+ 
++enum lttng_kernel_syscall_entryexit {
++	LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
++	LTTNG_KERNEL_SYSCALL_ENTRY = 1,		/* Not implemented. */
++	LTTNG_KERNEL_SYSCALL_EXIT = 2,		/* Not implemented. */
++};
++
++enum lttng_kernel_syscall_abi {
++	LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
++	LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,	/* Not implemented. */
++	LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,	/* Not implemented. */
++};
++
++enum lttng_kernel_syscall_match {
++	LTTNG_SYSCALL_MATCH_NAME = 0,
++	LTTNG_SYSCALL_MATCH_NR = 1,		/* Not implemented. */
++};
++
++struct lttng_kernel_syscall {
++	uint8_t entryexit;	/* enum lttng_kernel_syscall_entryexit */
++	uint8_t abi;		/* enum lttng_kernel_syscall_abi */
++	uint8_t match;		/* enum lttng_kernel_syscall_match */
++	uint8_t padding;
++	uint32_t nr;		/* For LTTNG_SYSCALL_MATCH_NR */
++} __attribute__((packed));
++
+ /*
+  * For syscall tracing, name = "*" means "enable all".
+  */
+@@ -106,6 +131,7 @@ struct lttng_kernel_event {
+ 		struct lttng_kernel_kprobe kprobe;
+ 		struct lttng_kernel_function_tracer ftrace;
+ 		struct lttng_kernel_uprobe uprobe;
++		struct lttng_kernel_syscall syscall;
+ 		char padding[LTTNG_KERNEL_EVENT_PADDING2];
+ 	} u;
+ } __attribute__((packed));
+diff --git a/lttng-events.c b/lttng-events.c
+index d719294..4c0b04a 100644
+--- a/lttng-events.c
++++ b/lttng-events.c
+@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
+ 		WARN_ON(ret);
+ 	}
+ 	synchronize_trace();	/* Wait for in-flight events to complete */
++	list_for_each_entry(chan, &session->chan, list) {
++		ret = lttng_syscalls_destroy(chan);
++		WARN_ON(ret);
++	}
+ 	list_for_each_entry_safe(enabler, tmpenabler,
+ 			&session->enablers_head, node)
+ 		lttng_enabler_destroy(enabler);
+@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
+ 		event->enabled = 0;
+ 		event->registered = 0;
+ 		event->desc = event_desc;
++		switch (event_param->u.syscall.entryexit) {
++		case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
++			ret = -EINVAL;
++			goto register_error;
++		case LTTNG_KERNEL_SYSCALL_ENTRY:
++			event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
++			break;
++		case LTTNG_KERNEL_SYSCALL_EXIT:
++			event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
++			break;
++		}
++		switch (event_param->u.syscall.abi) {
++		case LTTNG_KERNEL_SYSCALL_ABI_ALL:
++			ret = -EINVAL;
++			goto register_error;
++		case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
++			event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
++			break;
++		case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
++			event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
++			break;
++		}
+ 		if (!event->desc) {
+ 			ret = -EINVAL;
+ 			goto register_error;
+@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
+ 						  event);
+ 		break;
+ 	case LTTNG_KERNEL_SYSCALL:
+-		ret = lttng_syscall_filter_enable(event->chan,
+-			desc->name);
++		ret = lttng_syscall_filter_enable(event->chan, event);
+ 		break;
+ 	case LTTNG_KERNEL_KPROBE:
+ 	case LTTNG_KERNEL_UPROBE:
+@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
+ 		ret = 0;
+ 		break;
+ 	case LTTNG_KERNEL_SYSCALL:
+-		ret = lttng_syscall_filter_disable(event->chan,
+-			desc->name);
++		ret = lttng_syscall_filter_disable(event->chan, event);
+ 		break;
+ 	case LTTNG_KERNEL_NOOP:
+ 		ret = 0;
+@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
+ 		struct lttng_enabler *enabler)
+ {
+ 	const char *desc_name, *enabler_name;
++	bool compat = false, entry = false;
+ 
+ 	enabler_name = enabler->event_param.name;
+ 	switch (enabler->event_param.instrumentation) {
+ 	case LTTNG_KERNEL_TRACEPOINT:
+ 		desc_name = desc->name;
++		switch (enabler->type) {
++		case LTTNG_ENABLER_STAR_GLOB:
++			return lttng_match_enabler_star_glob(desc_name, enabler_name);
++		case LTTNG_ENABLER_NAME:
++			return lttng_match_enabler_name(desc_name, enabler_name);
++		default:
++			return -EINVAL;
++		}
+ 		break;
+ 	case LTTNG_KERNEL_SYSCALL:
+ 		desc_name = desc->name;
+-		if (!strncmp(desc_name, "compat_", strlen("compat_")))
++		if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
+ 			desc_name += strlen("compat_");
++			compat = true;
++		}
+ 		if (!strncmp(desc_name, "syscall_exit_",
+ 				strlen("syscall_exit_"))) {
+ 			desc_name += strlen("syscall_exit_");
+ 		} else if (!strncmp(desc_name, "syscall_entry_",
+ 				strlen("syscall_entry_"))) {
+ 			desc_name += strlen("syscall_entry_");
++			entry = true;
+ 		} else {
+ 			WARN_ON_ONCE(1);
+ 			return -EINVAL;
+ 		}
++		switch (enabler->event_param.u.syscall.entryexit) {
++		case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
++			break;
++		case LTTNG_KERNEL_SYSCALL_ENTRY:
++			if (!entry)
++				return 0;
++			break;
++		case LTTNG_KERNEL_SYSCALL_EXIT:
++			if (entry)
++				return 0;
++			break;
++		default:
++			return -EINVAL;
++		}
++		switch (enabler->event_param.u.syscall.abi) {
++		case LTTNG_KERNEL_SYSCALL_ABI_ALL:
++			break;
++		case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
++			if (compat)
++				return 0;
++			break;
++		case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
++			if (!compat)
++				return 0;
++			break;
++		default:
++			return -EINVAL;
++		}
++		switch (enabler->event_param.u.syscall.match) {
++		case LTTNG_SYSCALL_MATCH_NAME:
++			switch (enabler->type) {
++			case LTTNG_ENABLER_STAR_GLOB:
++				return lttng_match_enabler_star_glob(desc_name, enabler_name);
++			case LTTNG_ENABLER_NAME:
++				return lttng_match_enabler_name(desc_name, enabler_name);
++			default:
++				return -EINVAL;
++			}
++			break;
++		case LTTNG_SYSCALL_MATCH_NR:
++			return -EINVAL;	/* Not implemented. */
++		default:
++			return -EINVAL;
++		}
+ 		break;
+ 	default:
+ 		WARN_ON_ONCE(1);
+ 		return -EINVAL;
+ 	}
+-	switch (enabler->type) {
+-	case LTTNG_ENABLER_STAR_GLOB:
+-		return lttng_match_enabler_star_glob(desc_name, enabler_name);
+-	case LTTNG_ENABLER_NAME:
+-		return lttng_match_enabler_name(desc_name, enabler_name);
+-	default:
+-		return -EINVAL;
+-	}
+ }
+ 
+ static
+@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
+ static
+ int lttng_enabler_ref_events(struct lttng_enabler *enabler)
+ {
+-	struct lttng_session *session = enabler->chan->session;
++	struct lttng_channel *chan = enabler->chan;
++	struct lttng_session *session = chan->session;
+ 	struct lttng_event *event;
+ 
++	if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
++			enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
++			enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
++			enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
++			!strcmp(enabler->event_param.name, "*")) {
++		if (enabler->enabled)
++			WRITE_ONCE(chan->syscall_all, 1);
++		else
++			WRITE_ONCE(chan->syscall_all, 0);
++	}
++
+ 	/* First ensure that probe events are created for this enabler. */
+ 	lttng_create_event_if_missing(enabler);
+ 
+diff --git a/lttng-events.h b/lttng-events.h
+index a36a312..d4d9976 100644
+--- a/lttng-events.h
++++ b/lttng-events.h
+@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
+ 	struct list_head node;
+ };
+ 
++enum lttng_syscall_entryexit {
++	LTTNG_SYSCALL_ENTRY,
++	LTTNG_SYSCALL_EXIT,
++};
++
++enum lttng_syscall_abi {
++	LTTNG_SYSCALL_ABI_NATIVE,
++	LTTNG_SYSCALL_ABI_COMPAT,
++};
++
+ /*
+  * lttng_event structure is referred to by the tracing fast path. It must be
+  * kept small.
+@@ -318,6 +328,11 @@ struct lttng_event {
+ 			struct inode *inode;
+ 			struct list_head head;
+ 		} uprobe;
++		struct {
++			char *syscall_name;
++			enum lttng_syscall_entryexit entryexit;
++			enum lttng_syscall_abi abi;
++		} syscall;
+ 	} u;
+ 	struct list_head list;		/* Event list in session */
+ 	unsigned int metadata_dumped:1;
+@@ -457,10 +472,10 @@ struct lttng_channel {
+ 	struct lttng_syscall_filter *sc_filter;
+ 	int header_type;		/* 0: unset, 1: compact, 2: large */
+ 	enum channel_type channel_type;
++	int syscall_all;
+ 	unsigned int metadata_dumped:1,
+ 		sys_enter_registered:1,
+ 		sys_exit_registered:1,
+-		syscall_all:1,
+ 		tstate:1;		/* Transient enable state */
+ };
+ 
+@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
+ #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
+ int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
+ int lttng_syscalls_unregister(struct lttng_channel *chan);
++int lttng_syscalls_destroy(struct lttng_channel *chan);
+ int lttng_syscall_filter_enable(struct lttng_channel *chan,
+-		const char *name);
++		struct lttng_event *event);
+ int lttng_syscall_filter_disable(struct lttng_channel *chan,
+-		const char *name);
++		struct lttng_event *event);
+ long lttng_channel_syscall_mask(struct lttng_channel *channel,
+ 		struct lttng_kernel_syscall_mask __user *usyscall_mask);
+ #else
+@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
+ 	return 0;
+ }
+ 
++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
++{
++	return 0;
++}
++
+ static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
+-		const char *name)
++		struct lttng_event *event);
+ {
+ 	return -ENOSYS;
+ }
+ 
+ static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
+-		const char *name)
++		struct lttng_event *event);
+ {
+ 	return -ENOSYS;
+ }
+diff --git a/lttng-syscalls.c b/lttng-syscalls.c
+index 97f1ba9..26cead6 100644
+--- a/lttng-syscalls.c
++++ b/lttng-syscalls.c
+@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
+ #undef CREATE_SYSCALL_TABLE
+ 
+ struct lttng_syscall_filter {
+-	DECLARE_BITMAP(sc, NR_syscalls);
+-	DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
++	DECLARE_BITMAP(sc_entry, NR_syscalls);
++	DECLARE_BITMAP(sc_exit, NR_syscalls);
++	DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
++	DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
+ };
+ 
+ static void syscall_entry_unknown(struct lttng_event *event,
+@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
+ 	size_t table_len;
+ 
+ 	if (unlikely(in_compat_syscall())) {
+-		struct lttng_syscall_filter *filter;
+-
+-		filter = lttng_rcu_dereference(chan->sc_filter);
+-		if (filter) {
+-			if (id < 0 || id >= NR_compat_syscalls
+-				|| !test_bit(id, filter->sc_compat)) {
+-				/* System call filtered out. */
+-				return;
+-			}
++		struct lttng_syscall_filter *filter = chan->sc_filter;
++
++		if (id < 0 || id >= NR_compat_syscalls
++			|| (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
++			/* System call filtered out. */
++			return;
+ 		}
+ 		table = compat_sc_table;
+ 		table_len = ARRAY_SIZE(compat_sc_table);
+ 		unknown_event = chan->sc_compat_unknown;
+ 	} else {
+-		struct lttng_syscall_filter *filter;
+-
+-		filter = lttng_rcu_dereference(chan->sc_filter);
+-		if (filter) {
+-			if (id < 0 || id >= NR_syscalls
+-				|| !test_bit(id, filter->sc)) {
+-				/* System call filtered out. */
+-				return;
+-			}
++		struct lttng_syscall_filter *filter = chan->sc_filter;
++
++		if (id < 0 || id >= NR_syscalls
++			|| (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
++			/* System call filtered out. */
++			return;
+ 		}
+ 		table = sc_table;
+ 		table_len = ARRAY_SIZE(sc_table);
+@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
+ 
+ 	id = syscall_get_nr(current, regs);
+ 	if (unlikely(in_compat_syscall())) {
+-		struct lttng_syscall_filter *filter;
+-
+-		filter = lttng_rcu_dereference(chan->sc_filter);
+-		if (filter) {
+-			if (id < 0 || id >= NR_compat_syscalls
+-				|| !test_bit(id, filter->sc_compat)) {
+-				/* System call filtered out. */
+-				return;
+-			}
++		struct lttng_syscall_filter *filter = chan->sc_filter;
++
++		if (id < 0 || id >= NR_compat_syscalls
++			|| (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
++			/* System call filtered out. */
++			return;
+ 		}
+ 		table = compat_sc_exit_table;
+ 		table_len = ARRAY_SIZE(compat_sc_exit_table);
+ 		unknown_event = chan->compat_sc_exit_unknown;
+ 	} else {
+-		struct lttng_syscall_filter *filter;
+-
+-		filter = lttng_rcu_dereference(chan->sc_filter);
+-		if (filter) {
+-			if (id < 0 || id >= NR_syscalls
+-				|| !test_bit(id, filter->sc)) {
+-				/* System call filtered out. */
+-				return;
+-			}
++		struct lttng_syscall_filter *filter = chan->sc_filter;
++
++		if (id < 0 || id >= NR_syscalls
++			|| (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
++			/* System call filtered out. */
++			return;
+ 		}
+ 		table = sc_exit_table;
+ 		table_len = ARRAY_SIZE(sc_exit_table);
+@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
+ 		memset(&ev, 0, sizeof(ev));
+ 		switch (type) {
+ 		case SC_TYPE_ENTRY:
+-			strncpy(ev.name, SYSCALL_ENTRY_STR,
+-				LTTNG_KERNEL_SYM_NAME_LEN);
++			ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
++			ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
+ 			break;
+ 		case SC_TYPE_EXIT:
+-			strncpy(ev.name, SYSCALL_EXIT_STR,
+-				LTTNG_KERNEL_SYM_NAME_LEN);
++			ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
++			ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
+ 			break;
+ 		case SC_TYPE_COMPAT_ENTRY:
+-			strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
+-				LTTNG_KERNEL_SYM_NAME_LEN);
++			ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
++			ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
+ 			break;
+ 		case SC_TYPE_COMPAT_EXIT:
+-			strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
+-				LTTNG_KERNEL_SYM_NAME_LEN);
+-			break;
+-		default:
+-			BUG_ON(1);
++			ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
++			ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
+ 			break;
+ 		}
+-		strncat(ev.name, desc->name,
+-			LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
++		strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ 		ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
+ 		ev.instrumentation = LTTNG_KERNEL_SYSCALL;
+ 		chan_table[i] = _lttng_event_create(chan, &ev, filter,
+@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
+ 		strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ 		ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
+ 		ev.instrumentation = LTTNG_KERNEL_SYSCALL;
++		ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
++		ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
+ 		chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
+ 						desc,
+ 						ev.instrumentation);
+@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
+ 		strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ 		ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
+ 		ev.instrumentation = LTTNG_KERNEL_SYSCALL;
++		ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
++		ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
+ 		chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
+ 						desc,
+ 						ev.instrumentation);
+@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
+ 		strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ 		ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
+ 		ev.instrumentation = LTTNG_KERNEL_SYSCALL;
++		ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
++		ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
+ 		chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
+ 						filter, desc,
+ 						ev.instrumentation);
+@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
+ 		strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+ 		ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
+ 		ev.instrumentation = LTTNG_KERNEL_SYSCALL;
++		ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
++		ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
+ 		chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
+ 						desc, ev.instrumentation);
+ 		WARN_ON_ONCE(!chan->sc_exit_unknown);
+@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
+ 	if (ret)
+ 		return ret;
+ #endif
++
++	if (!chan->sc_filter) {
++		chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
++				GFP_KERNEL);
++		if (!chan->sc_filter)
++			return -ENOMEM;
++	}
++
+ 	if (!chan->sys_enter_registered) {
+ 		ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
+ 				(void *) syscall_entry_probe, chan);
+@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
+ 			return ret;
+ 		chan->sys_exit_registered = 0;
+ 	}
+-	/* lttng_event destroy will be performed by lttng_session_destroy() */
++	return 0;
++}
++
++int lttng_syscalls_destroy(struct lttng_channel *chan)
++{
+ 	kfree(chan->sc_table);
+ 	kfree(chan->sc_exit_table);
+ #ifdef CONFIG_COMPAT
+@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
+ 	return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
+ }
+ 
+-int lttng_syscall_filter_enable(struct lttng_channel *chan,
+-		const char *name)
++static
++const char *get_syscall_name(struct lttng_event *event)
+ {
+-	int syscall_nr, compat_syscall_nr, ret;
+-	struct lttng_syscall_filter *filter;
++	size_t prefix_len = 0;
+ 
+-	WARN_ON_ONCE(!chan->sc_table);
++	WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
+ 
+-	if (!name) {
+-		/* Enable all system calls by removing filter */
+-		if (chan->sc_filter) {
+-			filter = chan->sc_filter;
+-			rcu_assign_pointer(chan->sc_filter, NULL);
+-			synchronize_trace();
+-			kfree(filter);
++	switch (event->u.syscall.entryexit) {
++	case LTTNG_SYSCALL_ENTRY:
++		switch (event->u.syscall.abi) {
++		case LTTNG_SYSCALL_ABI_NATIVE:
++			prefix_len = strlen(SYSCALL_ENTRY_STR);
++			break;
++		case LTTNG_SYSCALL_ABI_COMPAT:
++			prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
++			break;
+ 		}
+-		chan->syscall_all = 1;
+-		return 0;
+-	}
+-
+-	if (!chan->sc_filter) {
+-		if (chan->syscall_all) {
+-			/*
+-			 * All syscalls are already enabled.
+-			 */
+-			return -EEXIST;
++		break;
++	case LTTNG_SYSCALL_EXIT:
++		switch (event->u.syscall.abi) {
++		case LTTNG_SYSCALL_ABI_NATIVE:
++			prefix_len = strlen(SYSCALL_EXIT_STR);
++			break;
++		case LTTNG_SYSCALL_ABI_COMPAT:
++			prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
++			break;
+ 		}
+-		filter = kzalloc(sizeof(struct lttng_syscall_filter),
+-				GFP_KERNEL);
+-		if (!filter)
+-			return -ENOMEM;
+-	} else {
+-		filter = chan->sc_filter;
++		break;
+ 	}
+-	syscall_nr = get_syscall_nr(name);
+-	compat_syscall_nr = get_compat_syscall_nr(name);
+-	if (syscall_nr < 0 && compat_syscall_nr < 0) {
+-		ret = -ENOENT;
+-		goto error;
++	WARN_ON_ONCE(prefix_len == 0);
++	return event->desc->name + prefix_len;
++}
++
++int lttng_syscall_filter_enable(struct lttng_channel *chan,
++		struct lttng_event *event)
++{
++	struct lttng_syscall_filter *filter = chan->sc_filter;
++	const char *syscall_name;
++	unsigned long *bitmap;
++	int syscall_nr;
++
++	WARN_ON_ONCE(!chan->sc_table);
++
++	syscall_name = get_syscall_name(event);
++
++	switch (event->u.syscall.abi) {
++	case LTTNG_SYSCALL_ABI_NATIVE:
++		syscall_nr = get_syscall_nr(syscall_name);
++		break;
++	case LTTNG_SYSCALL_ABI_COMPAT:
++		syscall_nr = get_compat_syscall_nr(syscall_name);
++		break;
++	default:
++		return -EINVAL;
+ 	}
+-	if (syscall_nr >= 0) {
+-		if (test_bit(syscall_nr, filter->sc)) {
+-			ret = -EEXIST;
+-			goto error;
++	if (syscall_nr < 0)
++		return -ENOENT;
++
++
++	switch (event->u.syscall.entryexit) {
++	case LTTNG_SYSCALL_ENTRY:
++		switch (event->u.syscall.abi) {
++		case LTTNG_SYSCALL_ABI_NATIVE:
++			bitmap = filter->sc_entry;
++			break;
++		case LTTNG_SYSCALL_ABI_COMPAT:
++			bitmap = filter->sc_compat_entry;
++			break;
+ 		}
+-		bitmap_set(filter->sc, syscall_nr, 1);
+-	}
+-	if (compat_syscall_nr >= 0) {
+-		if (test_bit(compat_syscall_nr, filter->sc_compat)) {
+-			ret = -EEXIST;
+-			goto error;
++		break;
++	case LTTNG_SYSCALL_EXIT:
++		switch (event->u.syscall.abi) {
++		case LTTNG_SYSCALL_ABI_NATIVE:
++			bitmap = filter->sc_exit;
++			break;
++		case LTTNG_SYSCALL_ABI_COMPAT:
++			bitmap = filter->sc_compat_exit;
++			break;
+ 		}
+-		bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
++		break;
++	default:
++		return -EINVAL;
+ 	}
+-	if (!chan->sc_filter)
+-		rcu_assign_pointer(chan->sc_filter, filter);
++	if (test_bit(syscall_nr, bitmap))
++		return -EEXIST;
++	bitmap_set(bitmap, syscall_nr, 1);
+ 	return 0;
+-
+-error:
+-	if (!chan->sc_filter)
+-		kfree(filter);
+-	return ret;
+ }
+ 
+ int lttng_syscall_filter_disable(struct lttng_channel *chan,
+-		const char *name)
++		struct lttng_event *event)
+ {
+-	int syscall_nr, compat_syscall_nr, ret;
+-	struct lttng_syscall_filter *filter;
++	struct lttng_syscall_filter *filter = chan->sc_filter;
++	const char *syscall_name;
++	unsigned long *bitmap;
++	int syscall_nr;
+ 
+ 	WARN_ON_ONCE(!chan->sc_table);
+ 
+-	if (!chan->sc_filter) {
+-		if (!chan->syscall_all)
+-			return -EEXIST;
+-		filter = kzalloc(sizeof(struct lttng_syscall_filter),
+-				GFP_KERNEL);
+-		if (!filter)
+-			return -ENOMEM;
+-		/* Trace all system calls, then apply disable. */
+-		bitmap_set(filter->sc, 0, NR_syscalls);
+-		bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
+-	} else {
+-		filter = chan->sc_filter;
++	syscall_name = get_syscall_name(event);
++
++	switch (event->u.syscall.abi) {
++	case LTTNG_SYSCALL_ABI_NATIVE:
++		syscall_nr = get_syscall_nr(syscall_name);
++		break;
++	case LTTNG_SYSCALL_ABI_COMPAT:
++		syscall_nr = get_compat_syscall_nr(syscall_name);
++		break;
++	default:
++		return -EINVAL;
+ 	}
++	if (syscall_nr < 0)
++		return -ENOENT;
+ 
+-	if (!name) {
+-		/* Fail if all syscalls are already disabled. */
+-		if (bitmap_empty(filter->sc, NR_syscalls)
+-			&& bitmap_empty(filter->sc_compat,
+-				NR_compat_syscalls)) {
+-			ret = -EEXIST;
+-			goto error;
+-		}
+ 
+-		/* Disable all system calls */
+-		bitmap_clear(filter->sc, 0, NR_syscalls);
+-		bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
+-		goto apply_filter;
+-	}
+-	syscall_nr = get_syscall_nr(name);
+-	compat_syscall_nr = get_compat_syscall_nr(name);
+-	if (syscall_nr < 0 && compat_syscall_nr < 0) {
+-		ret = -ENOENT;
+-		goto error;
+-	}
+-	if (syscall_nr >= 0) {
+-		if (!test_bit(syscall_nr, filter->sc)) {
+-			ret = -EEXIST;
+-			goto error;
++	switch (event->u.syscall.entryexit) {
++	case LTTNG_SYSCALL_ENTRY:
++		switch (event->u.syscall.abi) {
++		case LTTNG_SYSCALL_ABI_NATIVE:
++			bitmap = filter->sc_entry;
++			break;
++		case LTTNG_SYSCALL_ABI_COMPAT:
++			bitmap = filter->sc_compat_entry;
++			break;
+ 		}
+-		bitmap_clear(filter->sc, syscall_nr, 1);
+-	}
+-	if (compat_syscall_nr >= 0) {
+-		if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
+-			ret = -EEXIST;
+-			goto error;
++		break;
++	case LTTNG_SYSCALL_EXIT:
++		switch (event->u.syscall.abi) {
++		case LTTNG_SYSCALL_ABI_NATIVE:
++			bitmap = filter->sc_exit;
++			break;
++		case LTTNG_SYSCALL_ABI_COMPAT:
++			bitmap = filter->sc_compat_exit;
++			break;
+ 		}
+-		bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
++		break;
++	default:
++		return -EINVAL;
+ 	}
+-apply_filter:
+-	if (!chan->sc_filter)
+-		rcu_assign_pointer(chan->sc_filter, filter);
+-	chan->syscall_all = 0;
+-	return 0;
++	if (!test_bit(syscall_nr, bitmap))
++		return -EEXIST;
++	bitmap_clear(bitmap, syscall_nr, 1);
+ 
+-error:
+-	if (!chan->sc_filter)
+-		kfree(filter);
+-	return ret;
++	return 0;
+ }
+ 
+ static
+@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
+ 	.release = seq_release,
+ };
+ 
++/*
++ * A syscall is enabled if it is traced for either entry or exit.
++ */
+ long lttng_channel_syscall_mask(struct lttng_channel *channel,
+ 		struct lttng_kernel_syscall_mask __user *usyscall_mask)
+ {
+@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
+ 		char state;
+ 
+ 		if (channel->sc_table) {
+-			if (filter)
+-				state = test_bit(bit, filter->sc);
++			if (!READ_ONCE(channel->syscall_all) && filter)
++				state = test_bit(bit, filter->sc_entry)
++					|| test_bit(bit, filter->sc_exit);
+ 			else
+ 				state = 1;
+ 		} else {
+@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
+ 		char state;
+ 
+ 		if (channel->compat_sc_table) {
+-			if (filter)
++			if (!READ_ONCE(channel->syscall_all) && filter)
+ 				state = test_bit(bit - ARRAY_SIZE(sc_table),
+-						filter->sc_compat);
++						filter->sc_compat_entry)
++					|| test_bit(bit - ARRAY_SIZE(sc_table),
++						filter->sc_compat_exit);
+ 			else
+ 				state = 1;
+ 		} else {
+-- 
+2.19.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
index 0e1a209ce8..e36b327a08 100644
--- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
+++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
@@ -11,6 +11,16 @@ include lttng-platforms.inc
 SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
            file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
+           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
+           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
+           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
+           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
+           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
+           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
+           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
+           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
+           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
+           file://0010-Fix-system-call-filter-table.patch \
            "
 
 SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
@@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
            file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
            "
-SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
+SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
 PV_class-devupstream = "2.12.2+git${SRCPV}"
 S_class-devupstream = "${WORKDIR}/git"
 SRCREV_FORMAT ?= "lttng_git"
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-14 22:34 ` [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds Bruce Ashfield
@ 2020-09-14 22:35   ` Bruce Ashfield
  2020-09-15  5:03     ` [OE-core] " Jens Rehsack
  2020-09-15  5:44   ` Jens Rehsack
  2020-09-25 16:43   ` Steve Sakoman
  2 siblings, 1 reply; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-14 22:35 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Patches and discussions about the oe-core layer

I squashed the other lttng patch to create this, and it looks like the
author is messed up and some kind of strange encoding on one of the
embedded patches.

git send email complained on the way out.

Bruce

On Mon, Sep 14, 2020 at 6:34 PM <bruce.ashfield@gmail.com> wrote:
>
> From: Jens Rehsack <sno@netbsd.org>
>
> Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> them once .3 is released, but for now, we need the fixes to build
> against the latest 5.4, 5.8 and 5.9 kernels.
>
> We also bump the devupstream SRCREV to pickup the same changes.
>
> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> ---
>  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
>  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
>  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
>  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
>  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
>  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
>  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
>  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
>  ...es-for-ext4_discard_preallocations-a.patch |  52 +
>  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
>  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
>  11 files changed, 1829 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
>
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> new file mode 100644
> index 0000000000..ae8bec45de
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> @@ -0,0 +1,54 @@
> +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> +From: Beniamin Sandu <beniaminsandu@gmail.com>
> +Date: Thu, 13 Aug 2020 16:24:39 +0300
> +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> + without CONFIG_FTRACE
> +
> +When building in-tree, one could disable CONFIG_FTRACE from kernel
> +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> +but generate a lot of linker errors like below because it leaves out
> +other stuff, e.g.:
> +
> +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> +
> +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> +enabled.
> +
> +Steps to reproduce:
> +
> +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> +
> +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> +
> +- Build will fail at linking stage
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + Kconfig | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Kconfig b/Kconfig
> +index acdab73..10eccff 100644
> +--- a/Kconfig
> ++++ b/Kconfig
> +@@ -2,7 +2,7 @@
> +
> + config LTTNG
> +       tristate "LTTng support"
> +-      select TRACEPOINTS
> ++      select TRACING
> +       help
> +         LTTng is an open source tracing framework for Linux.
> +
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> new file mode 100644
> index 0000000000..fab673b854
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> @@ -0,0 +1,41 @@
> +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 10 Aug 2020 11:22:05 -0400
> +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> +
> +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> +  Date:   Mon Jun 22 13:20:29 2020 -0700
> +
> +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> +
> +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> +
> +Upstream-Status: Backport
> +
> +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> + 1 file changed, 4 insertions(+)
> +
> +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> +index 37384a2..5a7ef1e 100644
> +--- a/probes/lttng-probe-kvm-x86-mmu.c
> ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> +@@ -24,7 +24,11 @@
> +  */
> + #include <wrapper/tracepoint.h>
> +
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> ++#else
> + #include <../../arch/x86/kvm/mmutrace.h>
> ++#endif
> +
> + #undef TRACE_INCLUDE_PATH
> + #undef TRACE_INCLUDE_FILE
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> new file mode 100644
> index 0000000000..524631cc72
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> @@ -0,0 +1,39 @@
> +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 10 Aug 2020 11:36:03 -0400
> +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> + accessor internal-only (v5.9)
> +
> +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> +  Date:   Mon Jun 22 13:20:32 2020 -0700
> +
> +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> +
> +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> +    be poking into the gory details of shadow pages.
> +
> +Upstream-Status: Backport
> +
> +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> +index 5a7ef1e..8f98186 100644
> +--- a/probes/lttng-probe-kvm-x86-mmu.c
> ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> +@@ -25,6 +25,7 @@
> + #include <wrapper/tracepoint.h>
> +
> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> + #else
> + #include <../../arch/x86/kvm/mmutrace.h>
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> new file mode 100644
> index 0000000000..e29c07252c
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> @@ -0,0 +1,84 @@
> +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 24 Aug 2020 15:26:04 -0400
> +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> + (v5.9)
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +See upstream commit:
> +
> +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> +  Author: brookxu <brookxu.cn@gmail.com>
> +  Date:   Mon Aug 17 15:36:15 2020 +0800
> +
> +    ext4: limit the length of per-inode prealloc list
> +
> +    In the scenario of writing sparse files, the per-inode prealloc list may
> +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> +    To circumvent this problem, we limit the maximum length of per-inode
> +    prealloc list to 512 and allow users to modify it.
> +
> +    After patching, we observed that the sys ratio of cpu has dropped, and
> +    the system throughput has increased significantly. We created a process
> +    to write the sparse file, and the running time of the process on the
> +    fixed kernel was significantly reduced, as follows:
> +
> +    Running time on unfixed kernel:
> +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> +    real    0m2.051s
> +    user    0m0.008s
> +    sys     0m2.026s
> +
> +    Running time on fixed kernel:
> +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> +    real    0m0.471s
> +    user    0m0.004s
> +    sys     0m0.395s
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> +---
> + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> + 1 file changed, 15 insertions(+)
> +
> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> +index 5f7ab28..72ad4c9 100644
> +--- a/instrumentation/events/lttng-module/ext4.h
> ++++ b/instrumentation/events/lttng-module/ext4.h
> +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> + )
> + #endif
> +
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> ++
> ++      TP_ARGS(inode, len, needed),
> ++
> ++      TP_FIELDS(
> ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> ++              ctf_integer(ino_t, ino, inode->i_ino)
> ++              ctf_integer(unsigned int, len, len)
> ++              ctf_integer(unsigned int, needed, needed)
> ++      )
> ++)
> ++#else
> + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> +       TP_PROTO(struct inode *inode),
> +
> +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> +               ctf_integer(ino_t, ino, inode->i_ino)
> +       )
> + )
> ++#endif
> +
> + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> +       TP_PROTO(struct super_block *sb, int needed),
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> new file mode 100644
> index 0000000000..f76e9698c8
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> @@ -0,0 +1,63 @@
> +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 24 Aug 2020 15:37:50 -0400
> +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +See upstream commit:
> +
> +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> +  Author: Theodore Ts'o <tytso@mit.edu>
> +  Date:   Wed Jul 15 11:48:55 2020 -0400
> +
> +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> +
> +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> +    whether a block bitmap is being prefetched.
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> +---
> + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> + 1 file changed, 14 insertions(+)
> +
> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> +index 72ad4c9..4476abb 100644
> +--- a/instrumentation/events/lttng-module/ext4.h
> ++++ b/instrumentation/events/lttng-module/ext4.h
> +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> +       TP_ARGS(sb, group)
> + )
> +
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> ++
> ++      TP_ARGS(sb, group, prefetch),
> ++
> ++      TP_FIELDS(
> ++              ctf_integer(dev_t, dev, sb->s_dev)
> ++              ctf_integer(__u32, group, group)
> ++              ctf_integer(bool, prefetch, prefetch)
> ++      )
> ++)
> ++#else
> + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> +
> +       TP_PROTO(struct super_block *sb, unsigned long group),
> +
> +       TP_ARGS(sb, group)
> + )
> ++#endif
> +
> + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> +
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> new file mode 100644
> index 0000000000..0970dd30aa
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> @@ -0,0 +1,391 @@
> +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Tue, 25 Aug 2020 10:56:29 -0400
> +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> +
> +See upstream commits:
> +
> +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> +  Author: Will Deacon <will@kernel.org>
> +  Date:   Tue Oct 24 11:22:47 2017 +0100
> +
> +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> +
> +    In preparation for the removal of lockless_dereference(), which is the
> +    same as READ_ONCE() on all architectures other than Alpha, add an
> +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> +    used to head dependency chains on all architectures.
> +
> +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> +  Author: Will Deacon <will.deacon@arm.com>
> +  Date:   Tue Oct 24 11:22:47 2017 +0100
> +
> +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> +
> +    In preparation for the removal of lockless_dereference(), which is the
> +    same as READ_ONCE() on all architectures other than Alpha, add an
> +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> +    used to head dependency chains on all architectures.
> +
> +Upstream-Status: Backport
> +
> +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + instrumentation/events/lttng-module/i2c.h |  4 ++--
> + lib/ringbuffer/backend.h                  |  2 +-
> + lib/ringbuffer/backend_internal.h         |  2 +-
> + lib/ringbuffer/frontend.h                 |  4 ++--
> + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> + lttng-events.c                            |  8 ++++----
> + probes/lttng-kprobes.c                    |  6 +++---
> + probes/lttng-kretprobes.c                 |  6 +++---
> + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> + probes/lttng-uprobes.c                    |  6 +++---
> + wrapper/compiler.h                        | 18 ++++++++++++++++++
> + wrapper/trace-clock.h                     | 15 +++++----------
> + 13 files changed, 51 insertions(+), 38 deletions(-)
> +
> +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> +index dcbabf6..131d134 100644
> +--- a/instrumentation/events/lttng-module/i2c.h
> ++++ b/instrumentation/events/lttng-module/i2c.h
> +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> +
> +       TP_code_pre(
> +               tp_locvar->extract_sensitive_payload =
> +-                      READ_ONCE(extract_sensitive_payload);
> ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> +       ),
> +
> +       TP_FIELDS(
> +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> +
> +       TP_code_pre(
> +               tp_locvar->extract_sensitive_payload =
> +-                      READ_ONCE(extract_sensitive_payload);
> ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> +       ),
> +
> +       TP_FIELDS(
> +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> +index da937f2..43e1d47 100644
> +--- a/lib/ringbuffer/backend.h
> ++++ b/lib/ringbuffer/backend.h
> +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> +                * Only read source character once, in case it is
> +                * modified concurrently.
> +                */
> +-              c = READ_ONCE(src[count]);
> ++              c = LTTNG_READ_ONCE(src[count]);
> +               if (!c)
> +                       break;
> +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> +index 2d6a345..1226fd8 100644
> +--- a/lib/ringbuffer/backend_internal.h
> ++++ b/lib/ringbuffer/backend_internal.h
> +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> +        * Performing a volatile access to read the sb_pages, because we want to
> +        * read a coherent version of the pointer and the associated noref flag.
> +        */
> +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> +       for (;;) {
> +               /* This check is called on the fast path for each record. */
> +               if (likely(!subbuffer_id_is_noref(config, id))) {
> +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> +index 6f516d9..41382fe 100644
> +--- a/lib/ringbuffer/frontend.h
> ++++ b/lib/ringbuffer/frontend.h
> +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> + #define for_each_channel_cpu(cpu, chan)                                       \
> +       for ((cpu) = -1;                                                \
> +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> +
> + extern struct lib_ring_buffer *channel_get_ring_buffer(
> +                               const struct lib_ring_buffer_config *config,
> +@@ -155,7 +155,7 @@ static inline
> + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> +                                struct lib_ring_buffer *buf)
> + {
> +-      int finalized = READ_ONCE(buf->finalized);
> ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> +       /*
> +        * Read finalized before counters.
> +        */
> +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> +index 3cab365..4980d20 100644
> +--- a/lib/ringbuffer/ring_buffer_frontend.c
> ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> +       int finalized;
> +
> + retry:
> +-      finalized = READ_ONCE(buf->finalized);
> ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> +       /*
> +        * Read finalized before counters.
> +        */
> +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> +               return -EBUSY;
> +       }
> + retry:
> +-      finalized = READ_ONCE(buf->finalized);
> ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> +       /*
> +        * Read finalized before counters.
> +        */
> +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> +index d25db72..7b4f20a 100644
> +--- a/lib/ringbuffer/ring_buffer_iterator.c
> ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> +@@ -46,7 +46,7 @@ restart:
> +       switch (iter->state) {
> +       case ITER_GET_SUBBUF:
> +               ret = lib_ring_buffer_get_next_subbuf(buf);
> +-              if (ret && !READ_ONCE(buf->finalized)
> ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> +                       /*
> +                        * Use "pull" scheme for global buffers. The reader
> +diff --git a/lttng-events.c b/lttng-events.c
> +index be7e389..d719294 100644
> +--- a/lttng-events.c
> ++++ b/lttng-events.c
> +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> +       size_t len;
> +       va_list ap;
> +
> +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> +
> +       va_start(ap, fmt);
> +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> + {
> +       int ret = 0;
> +
> +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> +               return 0;
> +       if (chan->channel_type == METADATA_CHANNEL)
> +               return 0;
> +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> + {
> +       int ret = 0;
> +
> +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> +               return 0;
> +
> +       if (chan->channel_type == METADATA_CHANNEL)
> +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> +       struct lttng_event *event;
> +       int ret = 0;
> +
> +-      if (!READ_ONCE(session->active))
> ++      if (!LTTNG_READ_ONCE(session->active))
> +               return 0;
> +
> +       lttng_metadata_begin(session);
> +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> +index a44eaa1..38fb72e 100644
> +--- a/probes/lttng-kprobes.c
> ++++ b/probes/lttng-kprobes.c
> +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> +       int ret;
> +       unsigned long data = (unsigned long) p->addr;
> +
> +-      if (unlikely(!READ_ONCE(chan->session->active)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(chan->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(event->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> +               return 0;
> +
> +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> +index ab98ff2..a6bcd21 100644
> +--- a/probes/lttng-kretprobes.c
> ++++ b/probes/lttng-kretprobes.c
> +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> +               unsigned long parent_ip;
> +       } payload;
> +
> +-      if (unlikely(!READ_ONCE(chan->session->active)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(chan->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(event->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> +               return 0;
> +
> +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> +index 77b8638..72a669e 100644
> +--- a/probes/lttng-tracepoint-event-impl.h
> ++++ b/probes/lttng-tracepoint-event-impl.h
> +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> +                                                                             \
> +       if (!_TP_SESSION_CHECK(session, __session))                           \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> +               return;                                                       \
> +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> +                                                                             \
> +       if (!_TP_SESSION_CHECK(session, __session))                           \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> +               return;                                                       \
> +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> +index bc10128..bda1d9b 100644
> +--- a/probes/lttng-uprobes.c
> ++++ b/probes/lttng-uprobes.c
> +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> +               unsigned long ip;
> +       } payload;
> +
> +-      if (unlikely(!READ_ONCE(chan->session->active)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(chan->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(event->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> +               return 0;
> +
> +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> +index 1496f33..b9f8c51 100644
> +--- a/wrapper/compiler.h
> ++++ b/wrapper/compiler.h
> +@@ -9,6 +9,7 @@
> + #define _LTTNG_WRAPPER_COMPILER_H
> +
> + #include <linux/compiler.h>
> ++#include <linux/version.h>
> +
> + /*
> +  * Don't allow compiling with buggy compiler.
> +@@ -39,4 +40,21 @@
> + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> + #endif
> +
> ++/*
> ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> ++ * lockless_dereference(), replicate this behavior on prior kernels
> ++ * and remove calls to smp_read_barrier_depends which was dropped
> ++ * in v5.9.
> ++ */
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> ++#else
> ++#define LTTNG_READ_ONCE(x)                    \
> ++({                                            \
> ++      typeof(x) __val = READ_ONCE(x);         \
> ++      smp_read_barrier_depends();             \
> ++      __val;                                  \
> ++})
> ++#endif
> ++
> + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> +index 9f4e366..187fc82 100644
> +--- a/wrapper/trace-clock.h
> ++++ b/wrapper/trace-clock.h
> +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> +
> + static inline u64 trace_clock_read64(void)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +       if (likely(!ltc)) {
> +               return trace_clock_read64_monotonic();
> +       } else {
> +-              read_barrier_depends(); /* load ltc before content */
> +               return ltc->read64();
> +       }
> + }
> +
> + static inline u64 trace_clock_freq(void)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +       if (!ltc) {
> +               return trace_clock_freq_monotonic();
> +       } else {
> +-              read_barrier_depends(); /* load ltc before content */
> +               return ltc->freq();
> +       }
> + }
> +
> + static inline int trace_clock_uuid(char *uuid)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +-      read_barrier_depends(); /* load ltc before content */
> +       /* Use default UUID cb when NULL */
> +       if (!ltc || !ltc->uuid) {
> +               return trace_clock_uuid_monotonic(uuid);
> +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> +
> + static inline const char *trace_clock_name(void)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +       if (!ltc) {
> +               return trace_clock_name_monotonic();
> +       } else {
> +-              read_barrier_depends(); /* load ltc before content */
> +               return ltc->name();
> +       }
> + }
> +
> + static inline const char *trace_clock_description(void)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +       if (!ltc) {
> +               return trace_clock_description_monotonic();
> +       } else {
> +-              read_barrier_depends(); /* load ltc before content */
> +               return ltc->description();
> +       }
> + }
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> new file mode 100644
> index 0000000000..2843c9cb62
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> @@ -0,0 +1,59 @@
> +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 31 Aug 2020 11:41:38 -0400
> +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> +
> +See upstream commit:
> +
> +  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.
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> +---
> + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> + 1 file changed, 15 insertions(+), 1 deletion(-)
> +
> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> +index affb4eb..ece67ad 100644
> +--- a/instrumentation/events/lttng-module/writeback.h
> ++++ b/instrumentation/events/lttng-module/writeback.h
> +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> +
> + #endif
> +
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#define show_inode_state(state)                                       \
> ++      __print_flags(state, "|",                               \
> ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> ++              {I_NEW,                 "I_NEW"},               \
> ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> ++              {I_FREEING,             "I_FREEING"},           \
> ++              {I_CLEAR,               "I_CLEAR"},             \
> ++              {I_SYNC,                "I_SYNC"},              \
> ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> ++              {I_REFERENCED,          "I_REFERENCED"}         \
> ++      )
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> + #define show_inode_state(state)                                       \
> +       __print_flags(state, "|",                               \
> +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> new file mode 100644
> index 0000000000..7a0d9a38b8
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> @@ -0,0 +1,117 @@
> +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 31 Aug 2020 14:16:01 -0400
> +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> + processing (v5.9)
> +
> +See upstream commit:
> +
> +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> +  Author: Jan Kara <jack@suse.cz>
> +  Date:   Fri May 29 16:08:58 2020 +0200
> +
> +    writeback: Fix sync livelock due to b_dirty_time processing
> +
> +    When we are processing writeback for sync(2), move_expired_inodes()
> +    didn't set any inode expiry value (older_than_this). This can result in
> +    writeback never completing if there's steady stream of inodes added to
> +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> +    round whether there's more work to be done. Fix the problem by using
> +    sync(2) start time is inode expiry value when processing b_dirty_time
> +    list similarly as for ordinarily dirtied inodes. This requires some
> +    refactoring of older_than_this handling which simplifies the code
> +    noticeably as a bonus.
> +
> +Upstream-Status: Backport
> +
> +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> + 1 file changed, 26 insertions(+), 13 deletions(-)
> +
> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> +index ece67ad..e9018dd 100644
> +--- a/instrumentation/events/lttng-module/writeback.h
> ++++ b/instrumentation/events/lttng-module/writeback.h
> +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> + #endif
> + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> +
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> ++      TP_PROTO(struct bdi_writeback *wb,
> ++               struct wb_writeback_work *work,
> ++               unsigned long dirtied_before,
> ++               int moved),
> ++      TP_ARGS(wb, work, dirtied_before, moved),
> ++      TP_FIELDS(
> ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> ++              ctf_integer(unsigned long, older, dirtied_before)
> ++              ctf_integer(int, moved, moved)
> ++      )
> ++)
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> +       TP_PROTO(struct bdi_writeback *wb,
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> +                struct wb_writeback_work *work,
> +-#else
> +-               unsigned long *older_than_this,
> +-#endif
> +                int moved),
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> +       TP_ARGS(wb, work, moved),
> +-#else
> ++      TP_FIELDS(
> ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> ++              ctf_integer(int, moved, moved)
> ++      )
> ++)
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> ++      TP_PROTO(struct bdi_writeback *wb,
> ++               unsigned long *older_than_this,
> ++               int moved),
> +       TP_ARGS(wb, older_than_this, moved),
> +-#endif
> +       TP_FIELDS(
> +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> +-#else
> +               ctf_integer(unsigned long, older,
> +                       older_than_this ? *older_than_this : 0)
> +               ctf_integer(long, age,
> +                       older_than_this ?
> +                               (jiffies - *older_than_this) * 1000 / HZ
> +                               : -1)
> +-#endif
> +               ctf_integer(int, moved, moved)
> +       )
> + )
> ++#endif
> +
> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> +       )
> + )
> +-#else
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> +
> +       writeback_global_dirty_state,
> +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> +       )
> + )
> + #endif
> +-#endif
> +
> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> +
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> new file mode 100644
> index 0000000000..346e1d63ad
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> @@ -0,0 +1,52 @@
> +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Fri, 4 Sep 2020 11:52:51 -0400
> +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> + writeback_queue_io
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> +---
> + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> + 2 files changed, 9 insertions(+), 2 deletions(-)
> +
> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> +index 4476abb..b172c8d 100644
> +--- a/instrumentation/events/lttng-module/ext4.h
> ++++ b/instrumentation/events/lttng-module/ext4.h
> +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> + )
> + #endif
> +
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> +
> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> +index e9018dd..09637d7 100644
> +--- a/instrumentation/events/lttng-module/writeback.h
> ++++ b/instrumentation/events/lttng-module/writeback.h
> +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> + #endif
> + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> +
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> +       TP_PROTO(struct bdi_writeback *wb,
> +                struct wb_writeback_work *work,
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> new file mode 100644
> index 0000000000..a16750ddb3
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> @@ -0,0 +1,918 @@
> +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Date: Tue, 28 Jan 2020 16:02:44 -0500
> +Subject: [PATCH 10/10] Fix: system call filter table
> +
> +The system call filter table has effectively been unused for a long
> +time due to system call name prefix mismatch. This means the overhead of
> +selective system call tracing was larger than it should have been because
> +the event payload preparation would be done for all system calls as soon
> +as a single system call is traced.
> +
> +However, fixing this underlying issue unearths several issues that crept
> +unnoticed when the "enabler" concept was introduced (after the original
> +implementation of the system call filter table).
> +
> +Here is a list of the issues which are resolved here:
> +
> +- Split lttng_syscalls_unregister into an unregister and destroy
> +  function, thus awaiting for a grace period (and therefore quiescence
> +  of the users) after unregistering the system call tracepoints before
> +  freeing the system call filter data structures. This effectively fixes
> +  a use-after-free.
> +
> +- The state for enabling "all" system calls vs enabling specific system
> +  calls (and sequences of enable-disable) was incorrect with respect to
> +  the "enablers" semantic. This is solved by always tracking the
> +  bitmap of enabled system calls, and keeping this bitmap even when
> +  enabling all system calls. The sc_filter is now always allocated
> +  before system call tracing is registered to tracepoints, which means
> +  it does not need to be RCU dereferenced anymore.
> +
> +Padding fields in the ABI are reserved to select whether to:
> +
> +- Trace either native or compat system call (or both, which is the
> +  behavior currently implemented),
> +- Trace either system call entry or exit (or both, which is the
> +  behavior currently implemented),
> +- Select the system call to trace by name (behavior currently
> +  implemented) or by system call number,
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + lttng-abi.c      |  43 ++++++
> + lttng-abi.h      |  26 ++++
> + lttng-events.c   | 112 +++++++++++++--
> + lttng-events.h   |  31 ++++-
> + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> + 5 files changed, 380 insertions(+), 180 deletions(-)
> +
> +diff --git a/lttng-abi.c b/lttng-abi.c
> +index 64ea99d..b33879d 100644
> +--- a/lttng-abi.c
> ++++ b/lttng-abi.c
> +@@ -1264,6 +1264,46 @@ nomem:
> +       return ret;
> + }
> +
> ++static
> ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> ++{
> ++      /* Limit ABI to implemented features. */
> ++      switch (event_param->instrumentation) {
> ++      case LTTNG_KERNEL_SYSCALL:
> ++              switch (event_param->u.syscall.entryexit) {
> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              switch (event_param->u.syscall.abi) {
> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              switch (event_param->u.syscall.match) {
> ++              case LTTNG_SYSCALL_MATCH_NAME:
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              break;
> ++
> ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> ++      case LTTNG_KERNEL_UPROBE:
> ++              break;
> ++
> ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> ++      default:
> ++              return -EINVAL;
> ++      }
> ++      return 0;
> ++}
> ++
> + static
> + int lttng_abi_create_event(struct file *channel_file,
> +                          struct lttng_kernel_event *event_param)
> +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> +               ret = -EOVERFLOW;
> +               goto refcount_error;
> +       }
> ++      ret = lttng_abi_validate_event_param(event_param);
> ++      if (ret)
> ++              goto event_error;
> +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> +               struct lttng_enabler *enabler;
> +diff --git a/lttng-abi.h b/lttng-abi.h
> +index 1d356ab..51d60e5 100644
> +--- a/lttng-abi.h
> ++++ b/lttng-abi.h
> +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> +       } u;
> + } __attribute__((packed));
> +
> ++enum lttng_kernel_syscall_entryexit {
> ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> ++};
> ++
> ++enum lttng_kernel_syscall_abi {
> ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> ++};
> ++
> ++enum lttng_kernel_syscall_match {
> ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> ++};
> ++
> ++struct lttng_kernel_syscall {
> ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> ++      uint8_t padding;
> ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> ++} __attribute__((packed));
> ++
> + /*
> +  * For syscall tracing, name = "*" means "enable all".
> +  */
> +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> +               struct lttng_kernel_kprobe kprobe;
> +               struct lttng_kernel_function_tracer ftrace;
> +               struct lttng_kernel_uprobe uprobe;
> ++              struct lttng_kernel_syscall syscall;
> +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> +       } u;
> + } __attribute__((packed));
> +diff --git a/lttng-events.c b/lttng-events.c
> +index d719294..4c0b04a 100644
> +--- a/lttng-events.c
> ++++ b/lttng-events.c
> +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> +               WARN_ON(ret);
> +       }
> +       synchronize_trace();    /* Wait for in-flight events to complete */
> ++      list_for_each_entry(chan, &session->chan, list) {
> ++              ret = lttng_syscalls_destroy(chan);
> ++              WARN_ON(ret);
> ++      }
> +       list_for_each_entry_safe(enabler, tmpenabler,
> +                       &session->enablers_head, node)
> +               lttng_enabler_destroy(enabler);
> +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> +               event->enabled = 0;
> +               event->registered = 0;
> +               event->desc = event_desc;
> ++              switch (event_param->u.syscall.entryexit) {
> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> ++                      ret = -EINVAL;
> ++                      goto register_error;
> ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> ++                      break;
> ++              }
> ++              switch (event_param->u.syscall.abi) {
> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> ++                      ret = -EINVAL;
> ++                      goto register_error;
> ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> ++                      break;
> ++              }
> +               if (!event->desc) {
> +                       ret = -EINVAL;
> +                       goto register_error;
> +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> +                                                 event);
> +               break;
> +       case LTTNG_KERNEL_SYSCALL:
> +-              ret = lttng_syscall_filter_enable(event->chan,
> +-                      desc->name);
> ++              ret = lttng_syscall_filter_enable(event->chan, event);
> +               break;
> +       case LTTNG_KERNEL_KPROBE:
> +       case LTTNG_KERNEL_UPROBE:
> +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> +               ret = 0;
> +               break;
> +       case LTTNG_KERNEL_SYSCALL:
> +-              ret = lttng_syscall_filter_disable(event->chan,
> +-                      desc->name);
> ++              ret = lttng_syscall_filter_disable(event->chan, event);
> +               break;
> +       case LTTNG_KERNEL_NOOP:
> +               ret = 0;
> +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> +               struct lttng_enabler *enabler)
> + {
> +       const char *desc_name, *enabler_name;
> ++      bool compat = false, entry = false;
> +
> +       enabler_name = enabler->event_param.name;
> +       switch (enabler->event_param.instrumentation) {
> +       case LTTNG_KERNEL_TRACEPOINT:
> +               desc_name = desc->name;
> ++              switch (enabler->type) {
> ++              case LTTNG_ENABLER_STAR_GLOB:
> ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> ++              case LTTNG_ENABLER_NAME:
> ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> ++              default:
> ++                      return -EINVAL;
> ++              }
> +               break;
> +       case LTTNG_KERNEL_SYSCALL:
> +               desc_name = desc->name;
> +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> +                       desc_name += strlen("compat_");
> ++                      compat = true;
> ++              }
> +               if (!strncmp(desc_name, "syscall_exit_",
> +                               strlen("syscall_exit_"))) {
> +                       desc_name += strlen("syscall_exit_");
> +               } else if (!strncmp(desc_name, "syscall_entry_",
> +                               strlen("syscall_entry_"))) {
> +                       desc_name += strlen("syscall_entry_");
> ++                      entry = true;
> +               } else {
> +                       WARN_ON_ONCE(1);
> +                       return -EINVAL;
> +               }
> ++              switch (enabler->event_param.u.syscall.entryexit) {
> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> ++                      if (!entry)
> ++                              return 0;
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> ++                      if (entry)
> ++                              return 0;
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              switch (enabler->event_param.u.syscall.abi) {
> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> ++                      if (compat)
> ++                              return 0;
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> ++                      if (!compat)
> ++                              return 0;
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              switch (enabler->event_param.u.syscall.match) {
> ++              case LTTNG_SYSCALL_MATCH_NAME:
> ++                      switch (enabler->type) {
> ++                      case LTTNG_ENABLER_STAR_GLOB:
> ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> ++                      case LTTNG_ENABLER_NAME:
> ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> ++                      default:
> ++                              return -EINVAL;
> ++                      }
> ++                      break;
> ++              case LTTNG_SYSCALL_MATCH_NR:
> ++                      return -EINVAL; /* Not implemented. */
> ++              default:
> ++                      return -EINVAL;
> ++              }
> +               break;
> +       default:
> +               WARN_ON_ONCE(1);
> +               return -EINVAL;
> +       }
> +-      switch (enabler->type) {
> +-      case LTTNG_ENABLER_STAR_GLOB:
> +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> +-      case LTTNG_ENABLER_NAME:
> +-              return lttng_match_enabler_name(desc_name, enabler_name);
> +-      default:
> +-              return -EINVAL;
> +-      }
> + }
> +
> + static
> +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> + static
> + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> + {
> +-      struct lttng_session *session = enabler->chan->session;
> ++      struct lttng_channel *chan = enabler->chan;
> ++      struct lttng_session *session = chan->session;
> +       struct lttng_event *event;
> +
> ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> ++                      !strcmp(enabler->event_param.name, "*")) {
> ++              if (enabler->enabled)
> ++                      WRITE_ONCE(chan->syscall_all, 1);
> ++              else
> ++                      WRITE_ONCE(chan->syscall_all, 0);
> ++      }
> ++
> +       /* First ensure that probe events are created for this enabler. */
> +       lttng_create_event_if_missing(enabler);
> +
> +diff --git a/lttng-events.h b/lttng-events.h
> +index a36a312..d4d9976 100644
> +--- a/lttng-events.h
> ++++ b/lttng-events.h
> +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> +       struct list_head node;
> + };
> +
> ++enum lttng_syscall_entryexit {
> ++      LTTNG_SYSCALL_ENTRY,
> ++      LTTNG_SYSCALL_EXIT,
> ++};
> ++
> ++enum lttng_syscall_abi {
> ++      LTTNG_SYSCALL_ABI_NATIVE,
> ++      LTTNG_SYSCALL_ABI_COMPAT,
> ++};
> ++
> + /*
> +  * lttng_event structure is referred to by the tracing fast path. It must be
> +  * kept small.
> +@@ -318,6 +328,11 @@ struct lttng_event {
> +                       struct inode *inode;
> +                       struct list_head head;
> +               } uprobe;
> ++              struct {
> ++                      char *syscall_name;
> ++                      enum lttng_syscall_entryexit entryexit;
> ++                      enum lttng_syscall_abi abi;
> ++              } syscall;
> +       } u;
> +       struct list_head list;          /* Event list in session */
> +       unsigned int metadata_dumped:1;
> +@@ -457,10 +472,10 @@ struct lttng_channel {
> +       struct lttng_syscall_filter *sc_filter;
> +       int header_type;                /* 0: unset, 1: compact, 2: large */
> +       enum channel_type channel_type;
> ++      int syscall_all;
> +       unsigned int metadata_dumped:1,
> +               sys_enter_registered:1,
> +               sys_exit_registered:1,
> +-              syscall_all:1,
> +               tstate:1;               /* Transient enable state */
> + };
> +
> +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> + int lttng_syscalls_unregister(struct lttng_channel *chan);
> ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> +-              const char *name);
> ++              struct lttng_event *event);
> + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> +-              const char *name);
> ++              struct lttng_event *event);
> + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> + #else
> +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> +       return 0;
> + }
> +
> ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> ++{
> ++      return 0;
> ++}
> ++
> + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> +-              const char *name)
> ++              struct lttng_event *event);
> + {
> +       return -ENOSYS;
> + }
> +
> + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> +-              const char *name)
> ++              struct lttng_event *event);
> + {
> +       return -ENOSYS;
> + }
> +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> +index 97f1ba9..26cead6 100644
> +--- a/lttng-syscalls.c
> ++++ b/lttng-syscalls.c
> +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> + #undef CREATE_SYSCALL_TABLE
> +
> + struct lttng_syscall_filter {
> +-      DECLARE_BITMAP(sc, NR_syscalls);
> +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> + };
> +
> + static void syscall_entry_unknown(struct lttng_event *event,
> +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> +       size_t table_len;
> +
> +       if (unlikely(in_compat_syscall())) {
> +-              struct lttng_syscall_filter *filter;
> +-
> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> +-              if (filter) {
> +-                      if (id < 0 || id >= NR_compat_syscalls
> +-                              || !test_bit(id, filter->sc_compat)) {
> +-                              /* System call filtered out. */
> +-                              return;
> +-                      }
> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> ++
> ++              if (id < 0 || id >= NR_compat_syscalls
> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> ++                      /* System call filtered out. */
> ++                      return;
> +               }
> +               table = compat_sc_table;
> +               table_len = ARRAY_SIZE(compat_sc_table);
> +               unknown_event = chan->sc_compat_unknown;
> +       } else {
> +-              struct lttng_syscall_filter *filter;
> +-
> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> +-              if (filter) {
> +-                      if (id < 0 || id >= NR_syscalls
> +-                              || !test_bit(id, filter->sc)) {
> +-                              /* System call filtered out. */
> +-                              return;
> +-                      }
> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> ++
> ++              if (id < 0 || id >= NR_syscalls
> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> ++                      /* System call filtered out. */
> ++                      return;
> +               }
> +               table = sc_table;
> +               table_len = ARRAY_SIZE(sc_table);
> +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> +
> +       id = syscall_get_nr(current, regs);
> +       if (unlikely(in_compat_syscall())) {
> +-              struct lttng_syscall_filter *filter;
> +-
> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> +-              if (filter) {
> +-                      if (id < 0 || id >= NR_compat_syscalls
> +-                              || !test_bit(id, filter->sc_compat)) {
> +-                              /* System call filtered out. */
> +-                              return;
> +-                      }
> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> ++
> ++              if (id < 0 || id >= NR_compat_syscalls
> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> ++                      /* System call filtered out. */
> ++                      return;
> +               }
> +               table = compat_sc_exit_table;
> +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> +               unknown_event = chan->compat_sc_exit_unknown;
> +       } else {
> +-              struct lttng_syscall_filter *filter;
> +-
> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> +-              if (filter) {
> +-                      if (id < 0 || id >= NR_syscalls
> +-                              || !test_bit(id, filter->sc)) {
> +-                              /* System call filtered out. */
> +-                              return;
> +-                      }
> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> ++
> ++              if (id < 0 || id >= NR_syscalls
> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> ++                      /* System call filtered out. */
> ++                      return;
> +               }
> +               table = sc_exit_table;
> +               table_len = ARRAY_SIZE(sc_exit_table);
> +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> +               memset(&ev, 0, sizeof(ev));
> +               switch (type) {
> +               case SC_TYPE_ENTRY:
> +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> +                       break;
> +               case SC_TYPE_EXIT:
> +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> +                       break;
> +               case SC_TYPE_COMPAT_ENTRY:
> +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> +                       break;
> +               case SC_TYPE_COMPAT_EXIT:
> +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> +-                      break;
> +-              default:
> +-                      BUG_ON(1);
> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> +                       break;
> +               }
> +-              strncat(ev.name, desc->name,
> +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> +                                               desc,
> +                                               ev.instrumentation);
> +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> +                                               desc,
> +                                               ev.instrumentation);
> +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> +                                               filter, desc,
> +                                               ev.instrumentation);
> +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> +                                               desc, ev.instrumentation);
> +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +       if (ret)
> +               return ret;
> + #endif
> ++
> ++      if (!chan->sc_filter) {
> ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> ++                              GFP_KERNEL);
> ++              if (!chan->sc_filter)
> ++                      return -ENOMEM;
> ++      }
> ++
> +       if (!chan->sys_enter_registered) {
> +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> +                               (void *) syscall_entry_probe, chan);
> +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> +                       return ret;
> +               chan->sys_exit_registered = 0;
> +       }
> +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> ++      return 0;
> ++}
> ++
> ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> ++{
> +       kfree(chan->sc_table);
> +       kfree(chan->sc_exit_table);
> + #ifdef CONFIG_COMPAT
> +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> + }
> +
> +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> +-              const char *name)
> ++static
> ++const char *get_syscall_name(struct lttng_event *event)
> + {
> +-      int syscall_nr, compat_syscall_nr, ret;
> +-      struct lttng_syscall_filter *filter;
> ++      size_t prefix_len = 0;
> +
> +-      WARN_ON_ONCE(!chan->sc_table);
> ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> +
> +-      if (!name) {
> +-              /* Enable all system calls by removing filter */
> +-              if (chan->sc_filter) {
> +-                      filter = chan->sc_filter;
> +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> +-                      synchronize_trace();
> +-                      kfree(filter);
> ++      switch (event->u.syscall.entryexit) {
> ++      case LTTNG_SYSCALL_ENTRY:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> ++                      break;
> +               }
> +-              chan->syscall_all = 1;
> +-              return 0;
> +-      }
> +-
> +-      if (!chan->sc_filter) {
> +-              if (chan->syscall_all) {
> +-                      /*
> +-                       * All syscalls are already enabled.
> +-                       */
> +-                      return -EEXIST;
> ++              break;
> ++      case LTTNG_SYSCALL_EXIT:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> ++                      break;
> +               }
> +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> +-                              GFP_KERNEL);
> +-              if (!filter)
> +-                      return -ENOMEM;
> +-      } else {
> +-              filter = chan->sc_filter;
> ++              break;
> +       }
> +-      syscall_nr = get_syscall_nr(name);
> +-      compat_syscall_nr = get_compat_syscall_nr(name);
> +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> +-              ret = -ENOENT;
> +-              goto error;
> ++      WARN_ON_ONCE(prefix_len == 0);
> ++      return event->desc->name + prefix_len;
> ++}
> ++
> ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> ++              struct lttng_event *event)
> ++{
> ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> ++      const char *syscall_name;
> ++      unsigned long *bitmap;
> ++      int syscall_nr;
> ++
> ++      WARN_ON_ONCE(!chan->sc_table);
> ++
> ++      syscall_name = get_syscall_name(event);
> ++
> ++      switch (event->u.syscall.abi) {
> ++      case LTTNG_SYSCALL_ABI_NATIVE:
> ++              syscall_nr = get_syscall_nr(syscall_name);
> ++              break;
> ++      case LTTNG_SYSCALL_ABI_COMPAT:
> ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> ++              break;
> ++      default:
> ++              return -EINVAL;
> +       }
> +-      if (syscall_nr >= 0) {
> +-              if (test_bit(syscall_nr, filter->sc)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> ++      if (syscall_nr < 0)
> ++              return -ENOENT;
> ++
> ++
> ++      switch (event->u.syscall.entryexit) {
> ++      case LTTNG_SYSCALL_ENTRY:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      bitmap = filter->sc_entry;
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      bitmap = filter->sc_compat_entry;
> ++                      break;
> +               }
> +-              bitmap_set(filter->sc, syscall_nr, 1);
> +-      }
> +-      if (compat_syscall_nr >= 0) {
> +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> ++              break;
> ++      case LTTNG_SYSCALL_EXIT:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      bitmap = filter->sc_exit;
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      bitmap = filter->sc_compat_exit;
> ++                      break;
> +               }
> +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> ++              break;
> ++      default:
> ++              return -EINVAL;
> +       }
> +-      if (!chan->sc_filter)
> +-              rcu_assign_pointer(chan->sc_filter, filter);
> ++      if (test_bit(syscall_nr, bitmap))
> ++              return -EEXIST;
> ++      bitmap_set(bitmap, syscall_nr, 1);
> +       return 0;
> +-
> +-error:
> +-      if (!chan->sc_filter)
> +-              kfree(filter);
> +-      return ret;
> + }
> +
> + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> +-              const char *name)
> ++              struct lttng_event *event)
> + {
> +-      int syscall_nr, compat_syscall_nr, ret;
> +-      struct lttng_syscall_filter *filter;
> ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> ++      const char *syscall_name;
> ++      unsigned long *bitmap;
> ++      int syscall_nr;
> +
> +       WARN_ON_ONCE(!chan->sc_table);
> +
> +-      if (!chan->sc_filter) {
> +-              if (!chan->syscall_all)
> +-                      return -EEXIST;
> +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> +-                              GFP_KERNEL);
> +-              if (!filter)
> +-                      return -ENOMEM;
> +-              /* Trace all system calls, then apply disable. */
> +-              bitmap_set(filter->sc, 0, NR_syscalls);
> +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> +-      } else {
> +-              filter = chan->sc_filter;
> ++      syscall_name = get_syscall_name(event);
> ++
> ++      switch (event->u.syscall.abi) {
> ++      case LTTNG_SYSCALL_ABI_NATIVE:
> ++              syscall_nr = get_syscall_nr(syscall_name);
> ++              break;
> ++      case LTTNG_SYSCALL_ABI_COMPAT:
> ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> ++              break;
> ++      default:
> ++              return -EINVAL;
> +       }
> ++      if (syscall_nr < 0)
> ++              return -ENOENT;
> +
> +-      if (!name) {
> +-              /* Fail if all syscalls are already disabled. */
> +-              if (bitmap_empty(filter->sc, NR_syscalls)
> +-                      && bitmap_empty(filter->sc_compat,
> +-                              NR_compat_syscalls)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> +-              }
> +
> +-              /* Disable all system calls */
> +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> +-              goto apply_filter;
> +-      }
> +-      syscall_nr = get_syscall_nr(name);
> +-      compat_syscall_nr = get_compat_syscall_nr(name);
> +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> +-              ret = -ENOENT;
> +-              goto error;
> +-      }
> +-      if (syscall_nr >= 0) {
> +-              if (!test_bit(syscall_nr, filter->sc)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> ++      switch (event->u.syscall.entryexit) {
> ++      case LTTNG_SYSCALL_ENTRY:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      bitmap = filter->sc_entry;
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      bitmap = filter->sc_compat_entry;
> ++                      break;
> +               }
> +-              bitmap_clear(filter->sc, syscall_nr, 1);
> +-      }
> +-      if (compat_syscall_nr >= 0) {
> +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> ++              break;
> ++      case LTTNG_SYSCALL_EXIT:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      bitmap = filter->sc_exit;
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      bitmap = filter->sc_compat_exit;
> ++                      break;
> +               }
> +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> ++              break;
> ++      default:
> ++              return -EINVAL;
> +       }
> +-apply_filter:
> +-      if (!chan->sc_filter)
> +-              rcu_assign_pointer(chan->sc_filter, filter);
> +-      chan->syscall_all = 0;
> +-      return 0;
> ++      if (!test_bit(syscall_nr, bitmap))
> ++              return -EEXIST;
> ++      bitmap_clear(bitmap, syscall_nr, 1);
> +
> +-error:
> +-      if (!chan->sc_filter)
> +-              kfree(filter);
> +-      return ret;
> ++      return 0;
> + }
> +
> + static
> +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> +       .release = seq_release,
> + };
> +
> ++/*
> ++ * A syscall is enabled if it is traced for either entry or exit.
> ++ */
> + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> + {
> +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> +               char state;
> +
> +               if (channel->sc_table) {
> +-                      if (filter)
> +-                              state = test_bit(bit, filter->sc);
> ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> ++                              state = test_bit(bit, filter->sc_entry)
> ++                                      || test_bit(bit, filter->sc_exit);
> +                       else
> +                               state = 1;
> +               } else {
> +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> +               char state;
> +
> +               if (channel->compat_sc_table) {
> +-                      if (filter)
> ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> +-                                              filter->sc_compat);
> ++                                              filter->sc_compat_entry)
> ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> ++                                              filter->sc_compat_exit);
> +                       else
> +                               state = 1;
> +               } else {
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> index 0e1a209ce8..e36b327a08 100644
> --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> @@ -11,6 +11,16 @@ include lttng-platforms.inc
>  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
>             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
>             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> +           file://0010-Fix-system-call-filter-table.patch \
>             "
>
>  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
>             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
>             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
>             "
> -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
>  PV_class-devupstream = "2.12.2+git${SRCPV}"
>  S_class-devupstream = "${WORKDIR}/git"
>  SRCREV_FORMAT ?= "lttng_git"
> --
> 2.19.1
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-14 22:35   ` Bruce Ashfield
@ 2020-09-15  5:03     ` Jens Rehsack
  2020-09-15 11:37       ` Bruce Ashfield
  0 siblings, 1 reply; 23+ messages in thread
From: Jens Rehsack @ 2020-09-15  5:03 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 90170 bytes --]



> Am 15.09.2020 um 00:35 schrieb Bruce Ashfield <bruce.ashfield@gmail.com>:
> 
> I squashed the other lttng patch to create this, and it looks like the
> author is messed up and some kind of strange encoding on one of the

No worries about that :)

> embedded patches.
> 
> git send email complained on the way out.
> 
> Bruce
> 
> On Mon, Sep 14, 2020 at 6:34 PM <bruce.ashfield@gmail.com> wrote:
>> 
>> From: Jens Rehsack <sno@netbsd.org>
>> 
>> Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
>> them once .3 is released, but for now, we need the fixes to build
>> against the latest 5.4, 5.8 and 5.9 kernels.
>> 
>> We also bump the devupstream SRCREV to pickup the same changes.
>> 
>> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
>> ---
>> ...ndency-issue-when-building-in-tree-w.patch |  54 ++
>> ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
>> ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
>> ...he-length-of-per-inode-prealloc-list.patch |  84 ++
>> ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
>> ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
>> ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
>> ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
>> ...es-for-ext4_discard_preallocations-a.patch |  52 +
>> .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
>> .../lttng/lttng-modules_2.12.2.bb             |  12 +-
>> 11 files changed, 1829 insertions(+), 1 deletion(-)
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
>> create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
>> 
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
>> new file mode 100644
>> index 0000000000..ae8bec45de
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
>> @@ -0,0 +1,54 @@
>> +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
>> +From: Beniamin Sandu <beniaminsandu@gmail.com>
>> +Date: Thu, 13 Aug 2020 16:24:39 +0300
>> +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
>> + without CONFIG_FTRACE
>> +
>> +When building in-tree, one could disable CONFIG_FTRACE from kernel
>> +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
>> +but generate a lot of linker errors like below because it leaves out
>> +other stuff, e.g.:
>> +
>> +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
>> +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
>> +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
>> +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
>> +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
>> +
>> +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
>> +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
>> +enabled.
>> +
>> +Steps to reproduce:
>> +
>> +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
>> +
>> +- Configure a standard x86-64 build, enable built-in LTTNG but disable
>> +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
>> +
>> +- Build will fail at linking stage
>> +
>> +Upstream-Status: Backport
>> +
>> +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +---
>> + Kconfig | 2 +-
>> + 1 file changed, 1 insertion(+), 1 deletion(-)
>> +
>> +diff --git a/Kconfig b/Kconfig
>> +index acdab73..10eccff 100644
>> +--- a/Kconfig
>> ++++ b/Kconfig
>> +@@ -2,7 +2,7 @@
>> +
>> + config LTTNG
>> +       tristate "LTTng support"
>> +-      select TRACEPOINTS
>> ++      select TRACING
>> +       help
>> +         LTTng is an open source tracing framework for Linux.
>> +
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
>> new file mode 100644
>> index 0000000000..fab673b854
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
>> @@ -0,0 +1,41 @@
>> +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
>> +From: Michael Jeanson <mjeanson@efficios.com>
>> +Date: Mon, 10 Aug 2020 11:22:05 -0400
>> +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
>> +
>> +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
>> +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
>> +  Date:   Mon Jun 22 13:20:29 2020 -0700
>> +
>> +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
>> +
>> +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
>> +
>> +Upstream-Status: Backport
>> +
>> +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
>> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +---
>> + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
>> + 1 file changed, 4 insertions(+)
>> +
>> +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
>> +index 37384a2..5a7ef1e 100644
>> +--- a/probes/lttng-probe-kvm-x86-mmu.c
>> ++++ b/probes/lttng-probe-kvm-x86-mmu.c
>> +@@ -24,7 +24,11 @@
>> +  */
>> + #include <wrapper/tracepoint.h>
>> +
>> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
>> ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
>> ++#else
>> + #include <../../arch/x86/kvm/mmutrace.h>
>> ++#endif
>> +
>> + #undef TRACE_INCLUDE_PATH
>> + #undef TRACE_INCLUDE_FILE
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
>> new file mode 100644
>> index 0000000000..524631cc72
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
>> @@ -0,0 +1,39 @@
>> +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
>> +From: Michael Jeanson <mjeanson@efficios.com>
>> +Date: Mon, 10 Aug 2020 11:36:03 -0400
>> +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
>> + accessor internal-only (v5.9)
>> +
>> +  commit 985ab2780164698ec6e7d73fad523d50449261dd
>> +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
>> +  Date:   Mon Jun 22 13:20:32 2020 -0700
>> +
>> +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
>> +
>> +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
>> +    be poking into the gory details of shadow pages.
>> +
>> +Upstream-Status: Backport
>> +
>> +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
>> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +---
>> + probes/lttng-probe-kvm-x86-mmu.c | 1 +
>> + 1 file changed, 1 insertion(+)
>> +
>> +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
>> +index 5a7ef1e..8f98186 100644
>> +--- a/probes/lttng-probe-kvm-x86-mmu.c
>> ++++ b/probes/lttng-probe-kvm-x86-mmu.c
>> +@@ -25,6 +25,7 @@
>> + #include <wrapper/tracepoint.h>
>> +
>> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
>> ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
>> + #include <../../arch/x86/kvm/mmu/mmutrace.h>
>> + #else
>> + #include <../../arch/x86/kvm/mmutrace.h>
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
>> new file mode 100644
>> index 0000000000..e29c07252c
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
>> @@ -0,0 +1,84 @@
>> +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
>> +From: Michael Jeanson <mjeanson@efficios.com>
>> +Date: Mon, 24 Aug 2020 15:26:04 -0400
>> +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
>> + (v5.9)
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +See upstream commit:
>> +
>> +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
>> +  Author: brookxu <brookxu.cn@gmail.com>
>> +  Date:   Mon Aug 17 15:36:15 2020 +0800
>> +
>> +    ext4: limit the length of per-inode prealloc list
>> +
>> +    In the scenario of writing sparse files, the per-inode prealloc list may
>> +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
>> +    To circumvent this problem, we limit the maximum length of per-inode
>> +    prealloc list to 512 and allow users to modify it.
>> +
>> +    After patching, we observed that the sys ratio of cpu has dropped, and
>> +    the system throughput has increased significantly. We created a process
>> +    to write the sparse file, and the running time of the process on the
>> +    fixed kernel was significantly reduced, as follows:
>> +
>> +    Running time on unfixed kernel:
>> +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
>> +    real    0m2.051s
>> +    user    0m0.008s
>> +    sys     0m2.026s
>> +
>> +    Running time on fixed kernel:
>> +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
>> +    real    0m0.471s
>> +    user    0m0.004s
>> +    sys     0m0.395s
>> +
>> +Upstream-Status: Backport
>> +
>> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
>> +---
>> + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
>> + 1 file changed, 15 insertions(+)
>> +
>> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
>> +index 5f7ab28..72ad4c9 100644
>> +--- a/instrumentation/events/lttng-module/ext4.h
>> ++++ b/instrumentation/events/lttng-module/ext4.h
>> +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
>> + )
>> + #endif
>> +
>> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
>> ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
>> ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
>> ++
>> ++      TP_ARGS(inode, len, needed),
>> ++
>> ++      TP_FIELDS(
>> ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
>> ++              ctf_integer(ino_t, ino, inode->i_ino)
>> ++              ctf_integer(unsigned int, len, len)
>> ++              ctf_integer(unsigned int, needed, needed)
>> ++      )
>> ++)
>> ++#else
>> + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
>> +       TP_PROTO(struct inode *inode),
>> +
>> +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
>> +               ctf_integer(ino_t, ino, inode->i_ino)
>> +       )
>> + )
>> ++#endif
>> +
>> + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
>> +       TP_PROTO(struct super_block *sb, int needed),
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
>> new file mode 100644
>> index 0000000000..f76e9698c8
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
>> @@ -0,0 +1,63 @@
>> +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
>> +From: Michael Jeanson <mjeanson@efficios.com>
>> +Date: Mon, 24 Aug 2020 15:37:50 -0400
>> +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
>> + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
>> +MIME-Version: 1.0
>> +Content-Type: text/plain; charset=UTF-8
>> +Content-Transfer-Encoding: 8bit
>> +
>> +See upstream commit:
>> +
>> +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
>> +  Author: Theodore Ts'o <tytso@mit.edu>
>> +  Date:   Wed Jul 15 11:48:55 2020 -0400
>> +
>> +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
>> +
>> +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
>> +    whether a block bitmap is being prefetched.
>> +
>> +Upstream-Status: Backport
>> +
>> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
>> +---
>> + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
>> + 1 file changed, 14 insertions(+)
>> +
>> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
>> +index 72ad4c9..4476abb 100644
>> +--- a/instrumentation/events/lttng-module/ext4.h
>> ++++ b/instrumentation/events/lttng-module/ext4.h
>> +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
>> +       TP_ARGS(sb, group)
>> + )
>> +
>> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
>> ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
>> ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
>> ++
>> ++      TP_ARGS(sb, group, prefetch),
>> ++
>> ++      TP_FIELDS(
>> ++              ctf_integer(dev_t, dev, sb->s_dev)
>> ++              ctf_integer(__u32, group, group)
>> ++              ctf_integer(bool, prefetch, prefetch)
>> ++      )
>> ++)
>> ++#else
>> + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
>> +
>> +       TP_PROTO(struct super_block *sb, unsigned long group),
>> +
>> +       TP_ARGS(sb, group)
>> + )
>> ++#endif
>> +
>> + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
>> +
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
>> new file mode 100644
>> index 0000000000..0970dd30aa
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
>> @@ -0,0 +1,391 @@
>> +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
>> +From: Michael Jeanson <mjeanson@efficios.com>
>> +Date: Tue, 25 Aug 2020 10:56:29 -0400
>> +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
>> +
>> +See upstream commits:
>> +
>> +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
>> +  Author: Will Deacon <will@kernel.org>
>> +  Date:   Tue Oct 24 11:22:47 2017 +0100
>> +
>> +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
>> +
>> +    In preparation for the removal of lockless_dereference(), which is the
>> +    same as READ_ONCE() on all architectures other than Alpha, add an
>> +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
>> +    used to head dependency chains on all architectures.
>> +
>> +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
>> +  Author: Will Deacon <will.deacon@arm.com>
>> +  Date:   Tue Oct 24 11:22:47 2017 +0100
>> +
>> +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
>> +
>> +    In preparation for the removal of lockless_dereference(), which is the
>> +    same as READ_ONCE() on all architectures other than Alpha, add an
>> +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
>> +    used to head dependency chains on all architectures.
>> +
>> +Upstream-Status: Backport
>> +
>> +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
>> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +---
>> + instrumentation/events/lttng-module/i2c.h |  4 ++--
>> + lib/ringbuffer/backend.h                  |  2 +-
>> + lib/ringbuffer/backend_internal.h         |  2 +-
>> + lib/ringbuffer/frontend.h                 |  4 ++--
>> + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
>> + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
>> + lttng-events.c                            |  8 ++++----
>> + probes/lttng-kprobes.c                    |  6 +++---
>> + probes/lttng-kretprobes.c                 |  6 +++---
>> + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
>> + probes/lttng-uprobes.c                    |  6 +++---
>> + wrapper/compiler.h                        | 18 ++++++++++++++++++
>> + wrapper/trace-clock.h                     | 15 +++++----------
>> + 13 files changed, 51 insertions(+), 38 deletions(-)
>> +
>> +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
>> +index dcbabf6..131d134 100644
>> +--- a/instrumentation/events/lttng-module/i2c.h
>> ++++ b/instrumentation/events/lttng-module/i2c.h
>> +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
>> +
>> +       TP_code_pre(
>> +               tp_locvar->extract_sensitive_payload =
>> +-                      READ_ONCE(extract_sensitive_payload);
>> ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
>> +       ),
>> +
>> +       TP_FIELDS(
>> +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
>> +
>> +       TP_code_pre(
>> +               tp_locvar->extract_sensitive_payload =
>> +-                      READ_ONCE(extract_sensitive_payload);
>> ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
>> +       ),
>> +
>> +       TP_FIELDS(
>> +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
>> +index da937f2..43e1d47 100644
>> +--- a/lib/ringbuffer/backend.h
>> ++++ b/lib/ringbuffer/backend.h
>> +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
>> +                * Only read source character once, in case it is
>> +                * modified concurrently.
>> +                */
>> +-              c = READ_ONCE(src[count]);
>> ++              c = LTTNG_READ_ONCE(src[count]);
>> +               if (!c)
>> +                       break;
>> +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
>> +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
>> +index 2d6a345..1226fd8 100644
>> +--- a/lib/ringbuffer/backend_internal.h
>> ++++ b/lib/ringbuffer/backend_internal.h
>> +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
>> +        * Performing a volatile access to read the sb_pages, because we want to
>> +        * read a coherent version of the pointer and the associated noref flag.
>> +        */
>> +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
>> ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
>> +       for (;;) {
>> +               /* This check is called on the fast path for each record. */
>> +               if (likely(!subbuffer_id_is_noref(config, id))) {
>> +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
>> +index 6f516d9..41382fe 100644
>> +--- a/lib/ringbuffer/frontend.h
>> ++++ b/lib/ringbuffer/frontend.h
>> +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
>> + #define for_each_channel_cpu(cpu, chan)                                       \
>> +       for ((cpu) = -1;                                                \
>> +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
>> +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
>> ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
>> +
>> + extern struct lib_ring_buffer *channel_get_ring_buffer(
>> +                               const struct lib_ring_buffer_config *config,
>> +@@ -155,7 +155,7 @@ static inline
>> + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
>> +                                struct lib_ring_buffer *buf)
>> + {
>> +-      int finalized = READ_ONCE(buf->finalized);
>> ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
>> +       /*
>> +        * Read finalized before counters.
>> +        */
>> +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
>> +index 3cab365..4980d20 100644
>> +--- a/lib/ringbuffer/ring_buffer_frontend.c
>> ++++ b/lib/ringbuffer/ring_buffer_frontend.c
>> +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
>> +       int finalized;
>> +
>> + retry:
>> +-      finalized = READ_ONCE(buf->finalized);
>> ++      finalized = LTTNG_READ_ONCE(buf->finalized);
>> +       /*
>> +        * Read finalized before counters.
>> +        */
>> +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
>> +               return -EBUSY;
>> +       }
>> + retry:
>> +-      finalized = READ_ONCE(buf->finalized);
>> ++      finalized = LTTNG_READ_ONCE(buf->finalized);
>> +       /*
>> +        * Read finalized before counters.
>> +        */
>> +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
>> +index d25db72..7b4f20a 100644
>> +--- a/lib/ringbuffer/ring_buffer_iterator.c
>> ++++ b/lib/ringbuffer/ring_buffer_iterator.c
>> +@@ -46,7 +46,7 @@ restart:
>> +       switch (iter->state) {
>> +       case ITER_GET_SUBBUF:
>> +               ret = lib_ring_buffer_get_next_subbuf(buf);
>> +-              if (ret && !READ_ONCE(buf->finalized)
>> ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
>> +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
>> +                       /*
>> +                        * Use "pull" scheme for global buffers. The reader
>> +diff --git a/lttng-events.c b/lttng-events.c
>> +index be7e389..d719294 100644
>> +--- a/lttng-events.c
>> ++++ b/lttng-events.c
>> +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
>> +       size_t len;
>> +       va_list ap;
>> +
>> +-      WARN_ON_ONCE(!READ_ONCE(session->active));
>> ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
>> +
>> +       va_start(ap, fmt);
>> +       str = kvasprintf(GFP_KERNEL, fmt, ap);
>> +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
>> + {
>> +       int ret = 0;
>> +
>> +-      if (event->metadata_dumped || !READ_ONCE(session->active))
>> ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
>> +               return 0;
>> +       if (chan->channel_type == METADATA_CHANNEL)
>> +               return 0;
>> +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
>> + {
>> +       int ret = 0;
>> +
>> +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
>> ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
>> +               return 0;
>> +
>> +       if (chan->channel_type == METADATA_CHANNEL)
>> +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
>> +       struct lttng_event *event;
>> +       int ret = 0;
>> +
>> +-      if (!READ_ONCE(session->active))
>> ++      if (!LTTNG_READ_ONCE(session->active))
>> +               return 0;
>> +
>> +       lttng_metadata_begin(session);
>> +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
>> +index a44eaa1..38fb72e 100644
>> +--- a/probes/lttng-kprobes.c
>> ++++ b/probes/lttng-kprobes.c
>> +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
>> +       int ret;
>> +       unsigned long data = (unsigned long) p->addr;
>> +
>> +-      if (unlikely(!READ_ONCE(chan->session->active)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
>> +               return 0;
>> +-      if (unlikely(!READ_ONCE(chan->enabled)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
>> +               return 0;
>> +-      if (unlikely(!READ_ONCE(event->enabled)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
>> +               return 0;
>> +
>> +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
>> +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
>> +index ab98ff2..a6bcd21 100644
>> +--- a/probes/lttng-kretprobes.c
>> ++++ b/probes/lttng-kretprobes.c
>> +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
>> +               unsigned long parent_ip;
>> +       } payload;
>> +
>> +-      if (unlikely(!READ_ONCE(chan->session->active)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
>> +               return 0;
>> +-      if (unlikely(!READ_ONCE(chan->enabled)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
>> +               return 0;
>> +-      if (unlikely(!READ_ONCE(event->enabled)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
>> +               return 0;
>> +
>> +       payload.ip = (unsigned long) krpi->rp->kp.addr;
>> +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
>> +index 77b8638..72a669e 100644
>> +--- a/probes/lttng-tracepoint-event-impl.h
>> ++++ b/probes/lttng-tracepoint-event-impl.h
>> +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
>> +                                                                             \
>> +       if (!_TP_SESSION_CHECK(session, __session))                           \
>> +               return;                                                       \
>> +-      if (unlikely(!READ_ONCE(__session->active)))                          \
>> ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
>> +               return;                                                       \
>> +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
>> ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
>> +               return;                                                       \
>> +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
>> ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
>> +               return;                                                       \
>> +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
>> +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
>> +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
>> +                                                                             \
>> +       if (!_TP_SESSION_CHECK(session, __session))                           \
>> +               return;                                                       \
>> +-      if (unlikely(!READ_ONCE(__session->active)))                          \
>> ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
>> +               return;                                                       \
>> +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
>> ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
>> +               return;                                                       \
>> +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
>> ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
>> +               return;                                                       \
>> +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
>> +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
>> +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
>> +index bc10128..bda1d9b 100644
>> +--- a/probes/lttng-uprobes.c
>> ++++ b/probes/lttng-uprobes.c
>> +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
>> +               unsigned long ip;
>> +       } payload;
>> +
>> +-      if (unlikely(!READ_ONCE(chan->session->active)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
>> +               return 0;
>> +-      if (unlikely(!READ_ONCE(chan->enabled)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
>> +               return 0;
>> +-      if (unlikely(!READ_ONCE(event->enabled)))
>> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
>> +               return 0;
>> +
>> +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
>> +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
>> +index 1496f33..b9f8c51 100644
>> +--- a/wrapper/compiler.h
>> ++++ b/wrapper/compiler.h
>> +@@ -9,6 +9,7 @@
>> + #define _LTTNG_WRAPPER_COMPILER_H
>> +
>> + #include <linux/compiler.h>
>> ++#include <linux/version.h>
>> +
>> + /*
>> +  * Don't allow compiling with buggy compiler.
>> +@@ -39,4 +40,21 @@
>> + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
>> + #endif
>> +
>> ++/*
>> ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
>> ++ * lockless_dereference(), replicate this behavior on prior kernels
>> ++ * and remove calls to smp_read_barrier_depends which was dropped
>> ++ * in v5.9.
>> ++ */
>> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
>> ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
>> ++#else
>> ++#define LTTNG_READ_ONCE(x)                    \
>> ++({                                            \
>> ++      typeof(x) __val = READ_ONCE(x);         \
>> ++      smp_read_barrier_depends();             \
>> ++      __val;                                  \
>> ++})
>> ++#endif
>> ++
>> + #endif /* _LTTNG_WRAPPER_COMPILER_H */
>> +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
>> +index 9f4e366..187fc82 100644
>> +--- a/wrapper/trace-clock.h
>> ++++ b/wrapper/trace-clock.h
>> +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
>> +
>> + static inline u64 trace_clock_read64(void)
>> + {
>> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
>> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
>> +
>> +       if (likely(!ltc)) {
>> +               return trace_clock_read64_monotonic();
>> +       } else {
>> +-              read_barrier_depends(); /* load ltc before content */
>> +               return ltc->read64();
>> +       }
>> + }
>> +
>> + static inline u64 trace_clock_freq(void)
>> + {
>> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
>> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
>> +
>> +       if (!ltc) {
>> +               return trace_clock_freq_monotonic();
>> +       } else {
>> +-              read_barrier_depends(); /* load ltc before content */
>> +               return ltc->freq();
>> +       }
>> + }
>> +
>> + static inline int trace_clock_uuid(char *uuid)
>> + {
>> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
>> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
>> +
>> +-      read_barrier_depends(); /* load ltc before content */
>> +       /* Use default UUID cb when NULL */
>> +       if (!ltc || !ltc->uuid) {
>> +               return trace_clock_uuid_monotonic(uuid);
>> +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
>> +
>> + static inline const char *trace_clock_name(void)
>> + {
>> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
>> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
>> +
>> +       if (!ltc) {
>> +               return trace_clock_name_monotonic();
>> +       } else {
>> +-              read_barrier_depends(); /* load ltc before content */
>> +               return ltc->name();
>> +       }
>> + }
>> +
>> + static inline const char *trace_clock_description(void)
>> + {
>> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
>> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
>> +
>> +       if (!ltc) {
>> +               return trace_clock_description_monotonic();
>> +       } else {
>> +-              read_barrier_depends(); /* load ltc before content */
>> +               return ltc->description();
>> +       }
>> + }
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
>> new file mode 100644
>> index 0000000000..2843c9cb62
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
>> @@ -0,0 +1,59 @@
>> +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
>> +From: Michael Jeanson <mjeanson@efficios.com>
>> +Date: Mon, 31 Aug 2020 11:41:38 -0400
>> +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
>> +
>> +See upstream commit:
>> +
>> +  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.
>> +
>> +Upstream-Status: Backport
>> +
>> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
>> +---
>> + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
>> + 1 file changed, 15 insertions(+), 1 deletion(-)
>> +
>> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
>> +index affb4eb..ece67ad 100644
>> +--- a/instrumentation/events/lttng-module/writeback.h
>> ++++ b/instrumentation/events/lttng-module/writeback.h
>> +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
>> +
>> + #endif
>> +
>> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
>> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))

This one is needed for 5.4.62+, too.

>> ++#define show_inode_state(state)                                       \
>> ++      __print_flags(state, "|",                               \
>> ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
>> ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
>> ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
>> ++              {I_NEW,                 "I_NEW"},               \
>> ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
>> ++              {I_FREEING,             "I_FREEING"},           \
>> ++              {I_CLEAR,               "I_CLEAR"},             \
>> ++              {I_SYNC,                "I_SYNC"},              \
>> ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
>> ++              {I_REFERENCED,          "I_REFERENCED"}         \
>> ++      )
>> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
>> + #define show_inode_state(state)                                       \
>> +       __print_flags(state, "|",                               \
>> +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
>> new file mode 100644
>> index 0000000000..7a0d9a38b8
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
>> @@ -0,0 +1,117 @@
>> +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
>> +From: Michael Jeanson <mjeanson@efficios.com>
>> +Date: Mon, 31 Aug 2020 14:16:01 -0400
>> +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
>> + processing (v5.9)
>> +
>> +See upstream commit:
>> +
>> +  commit f9cae926f35e8230330f28c7b743ad088611a8de
>> +  Author: Jan Kara <jack@suse.cz>
>> +  Date:   Fri May 29 16:08:58 2020 +0200
>> +
>> +    writeback: Fix sync livelock due to b_dirty_time processing
>> +
>> +    When we are processing writeback for sync(2), move_expired_inodes()
>> +    didn't set any inode expiry value (older_than_this). This can result in
>> +    writeback never completing if there's steady stream of inodes added to
>> +    b_dirty_time list as writeback rechecks dirty lists after each writeback
>> +    round whether there's more work to be done. Fix the problem by using
>> +    sync(2) start time is inode expiry value when processing b_dirty_time
>> +    list similarly as for ordinarily dirtied inodes. This requires some
>> +    refactoring of older_than_this handling which simplifies the code
>> +    noticeably as a bonus.
>> +
>> +Upstream-Status: Backport
>> +
>> +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
>> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +---
>> + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
>> + 1 file changed, 26 insertions(+), 13 deletions(-)
>> +
>> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
>> +index ece67ad..e9018dd 100644
>> +--- a/instrumentation/events/lttng-module/writeback.h
>> ++++ b/instrumentation/events/lttng-module/writeback.h
>> +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
>> + #endif
>> + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
>> +
>> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
>> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
>> ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
>> ++      TP_PROTO(struct bdi_writeback *wb,
>> ++               struct wb_writeback_work *work,
>> ++               unsigned long dirtied_before,
>> ++               int moved),
>> ++      TP_ARGS(wb, work, dirtied_before, moved),
>> ++      TP_FIELDS(
>> ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
>> ++              ctf_integer(unsigned long, older, dirtied_before)
>> ++              ctf_integer(int, moved, moved)
>> ++      )
>> ++)
>> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
>> + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
>> +       TP_PROTO(struct bdi_writeback *wb,
>> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
>> +                struct wb_writeback_work *work,
>> +-#else
>> +-               unsigned long *older_than_this,
>> +-#endif
>> +                int moved),
>> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
>> +       TP_ARGS(wb, work, moved),
>> +-#else
>> ++      TP_FIELDS(
>> ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
>> ++              ctf_integer(int, moved, moved)
>> ++      )
>> ++)
>> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
>> ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
>> ++      TP_PROTO(struct bdi_writeback *wb,
>> ++               unsigned long *older_than_this,
>> ++               int moved),
>> +       TP_ARGS(wb, older_than_this, moved),
>> +-#endif
>> +       TP_FIELDS(
>> +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
>> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
>> +-#else
>> +               ctf_integer(unsigned long, older,
>> +                       older_than_this ? *older_than_this : 0)
>> +               ctf_integer(long, age,
>> +                       older_than_this ?
>> +                               (jiffies - *older_than_this) * 1000 / HZ
>> +                               : -1)
>> +-#endif
>> +               ctf_integer(int, moved, moved)
>> +       )
>> + )
>> ++#endif
>> +
>> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
>> + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
>> +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
>> +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
>> +       )
>> + )
>> +-#else
>> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
>> + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
>> +
>> +       writeback_global_dirty_state,
>> +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
>> +       )
>> + )
>> + #endif
>> +-#endif
>> +
>> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
>> +
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
>> new file mode 100644
>> index 0000000000..346e1d63ad
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
>> @@ -0,0 +1,52 @@
>> +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
>> +From: Michael Jeanson <mjeanson@efficios.com>
>> +Date: Fri, 4 Sep 2020 11:52:51 -0400
>> +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
>> + writeback_queue_io
>> +
>> +Upstream-Status: Backport
>> +
>> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
>> +---
>> + instrumentation/events/lttng-module/ext4.h      | 3 ++-
>> + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
>> + 2 files changed, 9 insertions(+), 2 deletions(-)
>> +
>> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
>> +index 4476abb..b172c8d 100644
>> +--- a/instrumentation/events/lttng-module/ext4.h
>> ++++ b/instrumentation/events/lttng-module/ext4.h
>> +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
>> + )
>> + #endif
>> +
>> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
>> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
>> ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
>> + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
>> +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
>> +
>> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
>> +index e9018dd..09637d7 100644
>> +--- a/instrumentation/events/lttng-module/writeback.h
>> ++++ b/instrumentation/events/lttng-module/writeback.h
>> +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
>> + #endif
>> + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
>> +
>> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
>> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
>> ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
>> ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
>> ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
>> ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
>> ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
>> ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
>> + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
>> +       TP_PROTO(struct bdi_writeback *wb,
>> +                struct wb_writeback_work *work,
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
>> new file mode 100644
>> index 0000000000..a16750ddb3
>> --- /dev/null
>> +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
>> @@ -0,0 +1,918 @@
>> +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
>> +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +Date: Tue, 28 Jan 2020 16:02:44 -0500
>> +Subject: [PATCH 10/10] Fix: system call filter table
>> +
>> +The system call filter table has effectively been unused for a long
>> +time due to system call name prefix mismatch. This means the overhead of
>> +selective system call tracing was larger than it should have been because
>> +the event payload preparation would be done for all system calls as soon
>> +as a single system call is traced.
>> +
>> +However, fixing this underlying issue unearths several issues that crept
>> +unnoticed when the "enabler" concept was introduced (after the original
>> +implementation of the system call filter table).
>> +
>> +Here is a list of the issues which are resolved here:
>> +
>> +- Split lttng_syscalls_unregister into an unregister and destroy
>> +  function, thus awaiting for a grace period (and therefore quiescence
>> +  of the users) after unregistering the system call tracepoints before
>> +  freeing the system call filter data structures. This effectively fixes
>> +  a use-after-free.
>> +
>> +- The state for enabling "all" system calls vs enabling specific system
>> +  calls (and sequences of enable-disable) was incorrect with respect to
>> +  the "enablers" semantic. This is solved by always tracking the
>> +  bitmap of enabled system calls, and keeping this bitmap even when
>> +  enabling all system calls. The sc_filter is now always allocated
>> +  before system call tracing is registered to tracepoints, which means
>> +  it does not need to be RCU dereferenced anymore.
>> +
>> +Padding fields in the ABI are reserved to select whether to:
>> +
>> +- Trace either native or compat system call (or both, which is the
>> +  behavior currently implemented),
>> +- Trace either system call entry or exit (or both, which is the
>> +  behavior currently implemented),
>> +- Select the system call to trace by name (behavior currently
>> +  implemented) or by system call number,
>> +
>> +Upstream-Status: Backport
>> +
>> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> +---
>> + lttng-abi.c      |  43 ++++++
>> + lttng-abi.h      |  26 ++++
>> + lttng-events.c   | 112 +++++++++++++--
>> + lttng-events.h   |  31 ++++-
>> + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
>> + 5 files changed, 380 insertions(+), 180 deletions(-)
>> +
>> +diff --git a/lttng-abi.c b/lttng-abi.c
>> +index 64ea99d..b33879d 100644
>> +--- a/lttng-abi.c
>> ++++ b/lttng-abi.c
>> +@@ -1264,6 +1264,46 @@ nomem:
>> +       return ret;
>> + }
>> +
>> ++static
>> ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
>> ++{
>> ++      /* Limit ABI to implemented features. */
>> ++      switch (event_param->instrumentation) {
>> ++      case LTTNG_KERNEL_SYSCALL:
>> ++              switch (event_param->u.syscall.entryexit) {
>> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
>> ++                      break;
>> ++              default:
>> ++                      return -EINVAL;
>> ++              }
>> ++              switch (event_param->u.syscall.abi) {
>> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
>> ++                      break;
>> ++              default:
>> ++                      return -EINVAL;
>> ++              }
>> ++              switch (event_param->u.syscall.match) {
>> ++              case LTTNG_SYSCALL_MATCH_NAME:
>> ++                      break;
>> ++              default:
>> ++                      return -EINVAL;
>> ++              }
>> ++              break;
>> ++
>> ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
>> ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
>> ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
>> ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
>> ++      case LTTNG_KERNEL_UPROBE:
>> ++              break;
>> ++
>> ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
>> ++      default:
>> ++              return -EINVAL;
>> ++      }
>> ++      return 0;
>> ++}
>> ++
>> + static
>> + int lttng_abi_create_event(struct file *channel_file,
>> +                          struct lttng_kernel_event *event_param)
>> +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
>> +               ret = -EOVERFLOW;
>> +               goto refcount_error;
>> +       }
>> ++      ret = lttng_abi_validate_event_param(event_param);
>> ++      if (ret)
>> ++              goto event_error;
>> +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
>> +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
>> +               struct lttng_enabler *enabler;
>> +diff --git a/lttng-abi.h b/lttng-abi.h
>> +index 1d356ab..51d60e5 100644
>> +--- a/lttng-abi.h
>> ++++ b/lttng-abi.h
>> +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
>> +       } u;
>> + } __attribute__((packed));
>> +
>> ++enum lttng_kernel_syscall_entryexit {
>> ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
>> ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
>> ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
>> ++};
>> ++
>> ++enum lttng_kernel_syscall_abi {
>> ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
>> ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
>> ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
>> ++};
>> ++
>> ++enum lttng_kernel_syscall_match {
>> ++      LTTNG_SYSCALL_MATCH_NAME = 0,
>> ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
>> ++};
>> ++
>> ++struct lttng_kernel_syscall {
>> ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
>> ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
>> ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
>> ++      uint8_t padding;
>> ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
>> ++} __attribute__((packed));
>> ++
>> + /*
>> +  * For syscall tracing, name = "*" means "enable all".
>> +  */
>> +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
>> +               struct lttng_kernel_kprobe kprobe;
>> +               struct lttng_kernel_function_tracer ftrace;
>> +               struct lttng_kernel_uprobe uprobe;
>> ++              struct lttng_kernel_syscall syscall;
>> +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
>> +       } u;
>> + } __attribute__((packed));
>> +diff --git a/lttng-events.c b/lttng-events.c
>> +index d719294..4c0b04a 100644
>> +--- a/lttng-events.c
>> ++++ b/lttng-events.c
>> +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
>> +               WARN_ON(ret);
>> +       }
>> +       synchronize_trace();    /* Wait for in-flight events to complete */
>> ++      list_for_each_entry(chan, &session->chan, list) {
>> ++              ret = lttng_syscalls_destroy(chan);
>> ++              WARN_ON(ret);
>> ++      }
>> +       list_for_each_entry_safe(enabler, tmpenabler,
>> +                       &session->enablers_head, node)
>> +               lttng_enabler_destroy(enabler);
>> +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
>> +               event->enabled = 0;
>> +               event->registered = 0;
>> +               event->desc = event_desc;
>> ++              switch (event_param->u.syscall.entryexit) {
>> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
>> ++                      ret = -EINVAL;
>> ++                      goto register_error;
>> ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
>> ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
>> ++                      break;
>> ++              case LTTNG_KERNEL_SYSCALL_EXIT:
>> ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
>> ++                      break;
>> ++              }
>> ++              switch (event_param->u.syscall.abi) {
>> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
>> ++                      ret = -EINVAL;
>> ++                      goto register_error;
>> ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
>> ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
>> ++                      break;
>> ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
>> ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
>> ++                      break;
>> ++              }
>> +               if (!event->desc) {
>> +                       ret = -EINVAL;
>> +                       goto register_error;
>> +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
>> +                                                 event);
>> +               break;
>> +       case LTTNG_KERNEL_SYSCALL:
>> +-              ret = lttng_syscall_filter_enable(event->chan,
>> +-                      desc->name);
>> ++              ret = lttng_syscall_filter_enable(event->chan, event);
>> +               break;
>> +       case LTTNG_KERNEL_KPROBE:
>> +       case LTTNG_KERNEL_UPROBE:
>> +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
>> +               ret = 0;
>> +               break;
>> +       case LTTNG_KERNEL_SYSCALL:
>> +-              ret = lttng_syscall_filter_disable(event->chan,
>> +-                      desc->name);
>> ++              ret = lttng_syscall_filter_disable(event->chan, event);
>> +               break;
>> +       case LTTNG_KERNEL_NOOP:
>> +               ret = 0;
>> +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
>> +               struct lttng_enabler *enabler)
>> + {
>> +       const char *desc_name, *enabler_name;
>> ++      bool compat = false, entry = false;
>> +
>> +       enabler_name = enabler->event_param.name;
>> +       switch (enabler->event_param.instrumentation) {
>> +       case LTTNG_KERNEL_TRACEPOINT:
>> +               desc_name = desc->name;
>> ++              switch (enabler->type) {
>> ++              case LTTNG_ENABLER_STAR_GLOB:
>> ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
>> ++              case LTTNG_ENABLER_NAME:
>> ++                      return lttng_match_enabler_name(desc_name, enabler_name);
>> ++              default:
>> ++                      return -EINVAL;
>> ++              }
>> +               break;
>> +       case LTTNG_KERNEL_SYSCALL:
>> +               desc_name = desc->name;
>> +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
>> ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
>> +                       desc_name += strlen("compat_");
>> ++                      compat = true;
>> ++              }
>> +               if (!strncmp(desc_name, "syscall_exit_",
>> +                               strlen("syscall_exit_"))) {
>> +                       desc_name += strlen("syscall_exit_");
>> +               } else if (!strncmp(desc_name, "syscall_entry_",
>> +                               strlen("syscall_entry_"))) {
>> +                       desc_name += strlen("syscall_entry_");
>> ++                      entry = true;
>> +               } else {
>> +                       WARN_ON_ONCE(1);
>> +                       return -EINVAL;
>> +               }
>> ++              switch (enabler->event_param.u.syscall.entryexit) {
>> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
>> ++                      break;
>> ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
>> ++                      if (!entry)
>> ++                              return 0;
>> ++                      break;
>> ++              case LTTNG_KERNEL_SYSCALL_EXIT:
>> ++                      if (entry)
>> ++                              return 0;
>> ++                      break;
>> ++              default:
>> ++                      return -EINVAL;
>> ++              }
>> ++              switch (enabler->event_param.u.syscall.abi) {
>> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
>> ++                      break;
>> ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
>> ++                      if (compat)
>> ++                              return 0;
>> ++                      break;
>> ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
>> ++                      if (!compat)
>> ++                              return 0;
>> ++                      break;
>> ++              default:
>> ++                      return -EINVAL;
>> ++              }
>> ++              switch (enabler->event_param.u.syscall.match) {
>> ++              case LTTNG_SYSCALL_MATCH_NAME:
>> ++                      switch (enabler->type) {
>> ++                      case LTTNG_ENABLER_STAR_GLOB:
>> ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
>> ++                      case LTTNG_ENABLER_NAME:
>> ++                              return lttng_match_enabler_name(desc_name, enabler_name);
>> ++                      default:
>> ++                              return -EINVAL;
>> ++                      }
>> ++                      break;
>> ++              case LTTNG_SYSCALL_MATCH_NR:
>> ++                      return -EINVAL; /* Not implemented. */
>> ++              default:
>> ++                      return -EINVAL;
>> ++              }
>> +               break;
>> +       default:
>> +               WARN_ON_ONCE(1);
>> +               return -EINVAL;
>> +       }
>> +-      switch (enabler->type) {
>> +-      case LTTNG_ENABLER_STAR_GLOB:
>> +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
>> +-      case LTTNG_ENABLER_NAME:
>> +-              return lttng_match_enabler_name(desc_name, enabler_name);
>> +-      default:
>> +-              return -EINVAL;
>> +-      }
>> + }
>> +
>> + static
>> +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
>> + static
>> + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
>> + {
>> +-      struct lttng_session *session = enabler->chan->session;
>> ++      struct lttng_channel *chan = enabler->chan;
>> ++      struct lttng_session *session = chan->session;
>> +       struct lttng_event *event;
>> +
>> ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
>> ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
>> ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
>> ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
>> ++                      !strcmp(enabler->event_param.name, "*")) {
>> ++              if (enabler->enabled)
>> ++                      WRITE_ONCE(chan->syscall_all, 1);
>> ++              else
>> ++                      WRITE_ONCE(chan->syscall_all, 0);
>> ++      }
>> ++
>> +       /* First ensure that probe events are created for this enabler. */
>> +       lttng_create_event_if_missing(enabler);
>> +
>> +diff --git a/lttng-events.h b/lttng-events.h
>> +index a36a312..d4d9976 100644
>> +--- a/lttng-events.h
>> ++++ b/lttng-events.h
>> +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
>> +       struct list_head node;
>> + };
>> +
>> ++enum lttng_syscall_entryexit {
>> ++      LTTNG_SYSCALL_ENTRY,
>> ++      LTTNG_SYSCALL_EXIT,
>> ++};
>> ++
>> ++enum lttng_syscall_abi {
>> ++      LTTNG_SYSCALL_ABI_NATIVE,
>> ++      LTTNG_SYSCALL_ABI_COMPAT,
>> ++};
>> ++
>> + /*
>> +  * lttng_event structure is referred to by the tracing fast path. It must be
>> +  * kept small.
>> +@@ -318,6 +328,11 @@ struct lttng_event {
>> +                       struct inode *inode;
>> +                       struct list_head head;
>> +               } uprobe;
>> ++              struct {
>> ++                      char *syscall_name;
>> ++                      enum lttng_syscall_entryexit entryexit;
>> ++                      enum lttng_syscall_abi abi;
>> ++              } syscall;
>> +       } u;
>> +       struct list_head list;          /* Event list in session */
>> +       unsigned int metadata_dumped:1;
>> +@@ -457,10 +472,10 @@ struct lttng_channel {
>> +       struct lttng_syscall_filter *sc_filter;
>> +       int header_type;                /* 0: unset, 1: compact, 2: large */
>> +       enum channel_type channel_type;
>> ++      int syscall_all;
>> +       unsigned int metadata_dumped:1,
>> +               sys_enter_registered:1,
>> +               sys_exit_registered:1,
>> +-              syscall_all:1,
>> +               tstate:1;               /* Transient enable state */
>> + };
>> +
>> +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
>> + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
>> + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
>> + int lttng_syscalls_unregister(struct lttng_channel *chan);
>> ++int lttng_syscalls_destroy(struct lttng_channel *chan);
>> + int lttng_syscall_filter_enable(struct lttng_channel *chan,
>> +-              const char *name);
>> ++              struct lttng_event *event);
>> + int lttng_syscall_filter_disable(struct lttng_channel *chan,
>> +-              const char *name);
>> ++              struct lttng_event *event);
>> + long lttng_channel_syscall_mask(struct lttng_channel *channel,
>> +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
>> + #else
>> +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
>> +       return 0;
>> + }
>> +
>> ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
>> ++{
>> ++      return 0;
>> ++}
>> ++
>> + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
>> +-              const char *name)
>> ++              struct lttng_event *event);
>> + {
>> +       return -ENOSYS;
>> + }
>> +
>> + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
>> +-              const char *name)
>> ++              struct lttng_event *event);
>> + {
>> +       return -ENOSYS;
>> + }
>> +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
>> +index 97f1ba9..26cead6 100644
>> +--- a/lttng-syscalls.c
>> ++++ b/lttng-syscalls.c
>> +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
>> + #undef CREATE_SYSCALL_TABLE
>> +
>> + struct lttng_syscall_filter {
>> +-      DECLARE_BITMAP(sc, NR_syscalls);
>> +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
>> ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
>> ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
>> ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
>> ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
>> + };
>> +
>> + static void syscall_entry_unknown(struct lttng_event *event,
>> +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
>> +       size_t table_len;
>> +
>> +       if (unlikely(in_compat_syscall())) {
>> +-              struct lttng_syscall_filter *filter;
>> +-
>> +-              filter = lttng_rcu_dereference(chan->sc_filter);
>> +-              if (filter) {
>> +-                      if (id < 0 || id >= NR_compat_syscalls
>> +-                              || !test_bit(id, filter->sc_compat)) {
>> +-                              /* System call filtered out. */
>> +-                              return;
>> +-                      }
>> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
>> ++
>> ++              if (id < 0 || id >= NR_compat_syscalls
>> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
>> ++                      /* System call filtered out. */
>> ++                      return;
>> +               }
>> +               table = compat_sc_table;
>> +               table_len = ARRAY_SIZE(compat_sc_table);
>> +               unknown_event = chan->sc_compat_unknown;
>> +       } else {
>> +-              struct lttng_syscall_filter *filter;
>> +-
>> +-              filter = lttng_rcu_dereference(chan->sc_filter);
>> +-              if (filter) {
>> +-                      if (id < 0 || id >= NR_syscalls
>> +-                              || !test_bit(id, filter->sc)) {
>> +-                              /* System call filtered out. */
>> +-                              return;
>> +-                      }
>> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
>> ++
>> ++              if (id < 0 || id >= NR_syscalls
>> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
>> ++                      /* System call filtered out. */
>> ++                      return;
>> +               }
>> +               table = sc_table;
>> +               table_len = ARRAY_SIZE(sc_table);
>> +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
>> +
>> +       id = syscall_get_nr(current, regs);
>> +       if (unlikely(in_compat_syscall())) {
>> +-              struct lttng_syscall_filter *filter;
>> +-
>> +-              filter = lttng_rcu_dereference(chan->sc_filter);
>> +-              if (filter) {
>> +-                      if (id < 0 || id >= NR_compat_syscalls
>> +-                              || !test_bit(id, filter->sc_compat)) {
>> +-                              /* System call filtered out. */
>> +-                              return;
>> +-                      }
>> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
>> ++
>> ++              if (id < 0 || id >= NR_compat_syscalls
>> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
>> ++                      /* System call filtered out. */
>> ++                      return;
>> +               }
>> +               table = compat_sc_exit_table;
>> +               table_len = ARRAY_SIZE(compat_sc_exit_table);
>> +               unknown_event = chan->compat_sc_exit_unknown;
>> +       } else {
>> +-              struct lttng_syscall_filter *filter;
>> +-
>> +-              filter = lttng_rcu_dereference(chan->sc_filter);
>> +-              if (filter) {
>> +-                      if (id < 0 || id >= NR_syscalls
>> +-                              || !test_bit(id, filter->sc)) {
>> +-                              /* System call filtered out. */
>> +-                              return;
>> +-                      }
>> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
>> ++
>> ++              if (id < 0 || id >= NR_syscalls
>> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
>> ++                      /* System call filtered out. */
>> ++                      return;
>> +               }
>> +               table = sc_exit_table;
>> +               table_len = ARRAY_SIZE(sc_exit_table);
>> +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
>> +               memset(&ev, 0, sizeof(ev));
>> +               switch (type) {
>> +               case SC_TYPE_ENTRY:
>> +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
>> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
>> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
>> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
>> +                       break;
>> +               case SC_TYPE_EXIT:
>> +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
>> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
>> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
>> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
>> +                       break;
>> +               case SC_TYPE_COMPAT_ENTRY:
>> +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
>> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
>> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
>> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
>> +                       break;
>> +               case SC_TYPE_COMPAT_EXIT:
>> +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
>> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
>> +-                      break;
>> +-              default:
>> +-                      BUG_ON(1);
>> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
>> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
>> +                       break;
>> +               }
>> +-              strncat(ev.name, desc->name,
>> +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
>> ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
>> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
>> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
>> +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
>> +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
>> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
>> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
>> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
>> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
>> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
>> +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
>> +                                               desc,
>> +                                               ev.instrumentation);
>> +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
>> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
>> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
>> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
>> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
>> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
>> +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
>> +                                               desc,
>> +                                               ev.instrumentation);
>> +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
>> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
>> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
>> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
>> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
>> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
>> +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
>> +                                               filter, desc,
>> +                                               ev.instrumentation);
>> +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
>> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
>> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
>> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
>> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
>> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
>> +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
>> +                                               desc, ev.instrumentation);
>> +               WARN_ON_ONCE(!chan->sc_exit_unknown);
>> +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
>> +       if (ret)
>> +               return ret;
>> + #endif
>> ++
>> ++      if (!chan->sc_filter) {
>> ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
>> ++                              GFP_KERNEL);
>> ++              if (!chan->sc_filter)
>> ++                      return -ENOMEM;
>> ++      }
>> ++
>> +       if (!chan->sys_enter_registered) {
>> +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
>> +                               (void *) syscall_entry_probe, chan);
>> +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
>> +                       return ret;
>> +               chan->sys_exit_registered = 0;
>> +       }
>> +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
>> ++      return 0;
>> ++}
>> ++
>> ++int lttng_syscalls_destroy(struct lttng_channel *chan)
>> ++{
>> +       kfree(chan->sc_table);
>> +       kfree(chan->sc_exit_table);
>> + #ifdef CONFIG_COMPAT
>> +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
>> +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
>> + }
>> +
>> +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
>> +-              const char *name)
>> ++static
>> ++const char *get_syscall_name(struct lttng_event *event)
>> + {
>> +-      int syscall_nr, compat_syscall_nr, ret;
>> +-      struct lttng_syscall_filter *filter;
>> ++      size_t prefix_len = 0;
>> +
>> +-      WARN_ON_ONCE(!chan->sc_table);
>> ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
>> +
>> +-      if (!name) {
>> +-              /* Enable all system calls by removing filter */
>> +-              if (chan->sc_filter) {
>> +-                      filter = chan->sc_filter;
>> +-                      rcu_assign_pointer(chan->sc_filter, NULL);
>> +-                      synchronize_trace();
>> +-                      kfree(filter);
>> ++      switch (event->u.syscall.entryexit) {
>> ++      case LTTNG_SYSCALL_ENTRY:
>> ++              switch (event->u.syscall.abi) {
>> ++              case LTTNG_SYSCALL_ABI_NATIVE:
>> ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
>> ++                      break;
>> ++              case LTTNG_SYSCALL_ABI_COMPAT:
>> ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
>> ++                      break;
>> +               }
>> +-              chan->syscall_all = 1;
>> +-              return 0;
>> +-      }
>> +-
>> +-      if (!chan->sc_filter) {
>> +-              if (chan->syscall_all) {
>> +-                      /*
>> +-                       * All syscalls are already enabled.
>> +-                       */
>> +-                      return -EEXIST;
>> ++              break;
>> ++      case LTTNG_SYSCALL_EXIT:
>> ++              switch (event->u.syscall.abi) {
>> ++              case LTTNG_SYSCALL_ABI_NATIVE:
>> ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
>> ++                      break;
>> ++              case LTTNG_SYSCALL_ABI_COMPAT:
>> ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
>> ++                      break;
>> +               }
>> +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
>> +-                              GFP_KERNEL);
>> +-              if (!filter)
>> +-                      return -ENOMEM;
>> +-      } else {
>> +-              filter = chan->sc_filter;
>> ++              break;
>> +       }
>> +-      syscall_nr = get_syscall_nr(name);
>> +-      compat_syscall_nr = get_compat_syscall_nr(name);
>> +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
>> +-              ret = -ENOENT;
>> +-              goto error;
>> ++      WARN_ON_ONCE(prefix_len == 0);
>> ++      return event->desc->name + prefix_len;
>> ++}
>> ++
>> ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
>> ++              struct lttng_event *event)
>> ++{
>> ++      struct lttng_syscall_filter *filter = chan->sc_filter;
>> ++      const char *syscall_name;
>> ++      unsigned long *bitmap;
>> ++      int syscall_nr;
>> ++
>> ++      WARN_ON_ONCE(!chan->sc_table);
>> ++
>> ++      syscall_name = get_syscall_name(event);
>> ++
>> ++      switch (event->u.syscall.abi) {
>> ++      case LTTNG_SYSCALL_ABI_NATIVE:
>> ++              syscall_nr = get_syscall_nr(syscall_name);
>> ++              break;
>> ++      case LTTNG_SYSCALL_ABI_COMPAT:
>> ++              syscall_nr = get_compat_syscall_nr(syscall_name);
>> ++              break;
>> ++      default:
>> ++              return -EINVAL;
>> +       }
>> +-      if (syscall_nr >= 0) {
>> +-              if (test_bit(syscall_nr, filter->sc)) {
>> +-                      ret = -EEXIST;
>> +-                      goto error;
>> ++      if (syscall_nr < 0)
>> ++              return -ENOENT;
>> ++
>> ++
>> ++      switch (event->u.syscall.entryexit) {
>> ++      case LTTNG_SYSCALL_ENTRY:
>> ++              switch (event->u.syscall.abi) {
>> ++              case LTTNG_SYSCALL_ABI_NATIVE:
>> ++                      bitmap = filter->sc_entry;
>> ++                      break;
>> ++              case LTTNG_SYSCALL_ABI_COMPAT:
>> ++                      bitmap = filter->sc_compat_entry;
>> ++                      break;
>> +               }
>> +-              bitmap_set(filter->sc, syscall_nr, 1);
>> +-      }
>> +-      if (compat_syscall_nr >= 0) {
>> +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
>> +-                      ret = -EEXIST;
>> +-                      goto error;
>> ++              break;
>> ++      case LTTNG_SYSCALL_EXIT:
>> ++              switch (event->u.syscall.abi) {
>> ++              case LTTNG_SYSCALL_ABI_NATIVE:
>> ++                      bitmap = filter->sc_exit;
>> ++                      break;
>> ++              case LTTNG_SYSCALL_ABI_COMPAT:
>> ++                      bitmap = filter->sc_compat_exit;
>> ++                      break;
>> +               }
>> +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
>> ++              break;
>> ++      default:
>> ++              return -EINVAL;
>> +       }
>> +-      if (!chan->sc_filter)
>> +-              rcu_assign_pointer(chan->sc_filter, filter);
>> ++      if (test_bit(syscall_nr, bitmap))
>> ++              return -EEXIST;
>> ++      bitmap_set(bitmap, syscall_nr, 1);
>> +       return 0;
>> +-
>> +-error:
>> +-      if (!chan->sc_filter)
>> +-              kfree(filter);
>> +-      return ret;
>> + }
>> +
>> + int lttng_syscall_filter_disable(struct lttng_channel *chan,
>> +-              const char *name)
>> ++              struct lttng_event *event)
>> + {
>> +-      int syscall_nr, compat_syscall_nr, ret;
>> +-      struct lttng_syscall_filter *filter;
>> ++      struct lttng_syscall_filter *filter = chan->sc_filter;
>> ++      const char *syscall_name;
>> ++      unsigned long *bitmap;
>> ++      int syscall_nr;
>> +
>> +       WARN_ON_ONCE(!chan->sc_table);
>> +
>> +-      if (!chan->sc_filter) {
>> +-              if (!chan->syscall_all)
>> +-                      return -EEXIST;
>> +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
>> +-                              GFP_KERNEL);
>> +-              if (!filter)
>> +-                      return -ENOMEM;
>> +-              /* Trace all system calls, then apply disable. */
>> +-              bitmap_set(filter->sc, 0, NR_syscalls);
>> +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
>> +-      } else {
>> +-              filter = chan->sc_filter;
>> ++      syscall_name = get_syscall_name(event);
>> ++
>> ++      switch (event->u.syscall.abi) {
>> ++      case LTTNG_SYSCALL_ABI_NATIVE:
>> ++              syscall_nr = get_syscall_nr(syscall_name);
>> ++              break;
>> ++      case LTTNG_SYSCALL_ABI_COMPAT:
>> ++              syscall_nr = get_compat_syscall_nr(syscall_name);
>> ++              break;
>> ++      default:
>> ++              return -EINVAL;
>> +       }
>> ++      if (syscall_nr < 0)
>> ++              return -ENOENT;
>> +
>> +-      if (!name) {
>> +-              /* Fail if all syscalls are already disabled. */
>> +-              if (bitmap_empty(filter->sc, NR_syscalls)
>> +-                      && bitmap_empty(filter->sc_compat,
>> +-                              NR_compat_syscalls)) {
>> +-                      ret = -EEXIST;
>> +-                      goto error;
>> +-              }
>> +
>> +-              /* Disable all system calls */
>> +-              bitmap_clear(filter->sc, 0, NR_syscalls);
>> +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
>> +-              goto apply_filter;
>> +-      }
>> +-      syscall_nr = get_syscall_nr(name);
>> +-      compat_syscall_nr = get_compat_syscall_nr(name);
>> +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
>> +-              ret = -ENOENT;
>> +-              goto error;
>> +-      }
>> +-      if (syscall_nr >= 0) {
>> +-              if (!test_bit(syscall_nr, filter->sc)) {
>> +-                      ret = -EEXIST;
>> +-                      goto error;
>> ++      switch (event->u.syscall.entryexit) {
>> ++      case LTTNG_SYSCALL_ENTRY:
>> ++              switch (event->u.syscall.abi) {
>> ++              case LTTNG_SYSCALL_ABI_NATIVE:
>> ++                      bitmap = filter->sc_entry;
>> ++                      break;
>> ++              case LTTNG_SYSCALL_ABI_COMPAT:
>> ++                      bitmap = filter->sc_compat_entry;
>> ++                      break;
>> +               }
>> +-              bitmap_clear(filter->sc, syscall_nr, 1);
>> +-      }
>> +-      if (compat_syscall_nr >= 0) {
>> +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
>> +-                      ret = -EEXIST;
>> +-                      goto error;
>> ++              break;
>> ++      case LTTNG_SYSCALL_EXIT:
>> ++              switch (event->u.syscall.abi) {
>> ++              case LTTNG_SYSCALL_ABI_NATIVE:
>> ++                      bitmap = filter->sc_exit;
>> ++                      break;
>> ++              case LTTNG_SYSCALL_ABI_COMPAT:
>> ++                      bitmap = filter->sc_compat_exit;
>> ++                      break;
>> +               }
>> +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
>> ++              break;
>> ++      default:
>> ++              return -EINVAL;
>> +       }
>> +-apply_filter:
>> +-      if (!chan->sc_filter)
>> +-              rcu_assign_pointer(chan->sc_filter, filter);
>> +-      chan->syscall_all = 0;
>> +-      return 0;
>> ++      if (!test_bit(syscall_nr, bitmap))
>> ++              return -EEXIST;
>> ++      bitmap_clear(bitmap, syscall_nr, 1);
>> +
>> +-error:
>> +-      if (!chan->sc_filter)
>> +-              kfree(filter);
>> +-      return ret;
>> ++      return 0;
>> + }
>> +
>> + static
>> +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
>> +       .release = seq_release,
>> + };
>> +
>> ++/*
>> ++ * A syscall is enabled if it is traced for either entry or exit.
>> ++ */
>> + long lttng_channel_syscall_mask(struct lttng_channel *channel,
>> +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
>> + {
>> +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
>> +               char state;
>> +
>> +               if (channel->sc_table) {
>> +-                      if (filter)
>> +-                              state = test_bit(bit, filter->sc);
>> ++                      if (!READ_ONCE(channel->syscall_all) && filter)
>> ++                              state = test_bit(bit, filter->sc_entry)
>> ++                                      || test_bit(bit, filter->sc_exit);
>> +                       else
>> +                               state = 1;
>> +               } else {
>> +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
>> +               char state;
>> +
>> +               if (channel->compat_sc_table) {
>> +-                      if (filter)
>> ++                      if (!READ_ONCE(channel->syscall_all) && filter)
>> +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
>> +-                                              filter->sc_compat);
>> ++                                              filter->sc_compat_entry)
>> ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
>> ++                                              filter->sc_compat_exit);
>> +                       else
>> +                               state = 1;
>> +               } else {
>> +--
>> +2.19.1
>> +
>> diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
>> index 0e1a209ce8..e36b327a08 100644
>> --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
>> +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
>> @@ -11,6 +11,16 @@ include lttng-platforms.inc
>> SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
>>            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
>>            file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
>> +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
>> +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
>> +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
>> +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
>> +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
>> +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
>> +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
>> +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
>> +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
>> +           file://0010-Fix-system-call-filter-table.patch \
>>            "
>> 
>> SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
>> @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
>>            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
>>            file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
>>            "
>> -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
>> +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
>> PV_class-devupstream = "2.12.2+git${SRCPV}"
>> S_class-devupstream = "${WORKDIR}/git"
>> SRCREV_FORMAT ?= "lttng_git"
>> --
>> 2.19.1
>> 
> 
> 
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
> 

--
Jens Rehsack - rehsack@gmail.com


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-14 22:34 ` [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds Bruce Ashfield
  2020-09-14 22:35   ` Bruce Ashfield
@ 2020-09-15  5:44   ` Jens Rehsack
  2020-09-15 11:33     ` Bruce Ashfield
  2020-09-25 16:43   ` Steve Sakoman
  2 siblings, 1 reply; 23+ messages in thread
From: Jens Rehsack @ 2020-09-15  5:44 UTC (permalink / raw)
  To: Bruce Ashfield; +Cc: richard.purdie, openembedded-core

[-- Attachment #1: Type: text/plain, Size: 604 bytes --]



> Am 15.09.2020 um 00:34 schrieb Bruce Ashfield <bruce.ashfield@gmail.com>:
> 
> From: Jens Rehsack <sno@netbsd.org>
> 
> Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> them once .3 is released, but for now, we need the fixes to build

Yet another question: there is a stable-2.12 branch ... wouldn't it be reasonable to use this one as upstream source instead of the tarball?

> against the latest 5.4, 5.8 and 5.9 kernels.
> 
> We also bump the devupstream SRCREV to pickup the same changes.
> -=-=-=-=-=-=-=-=-=-=-=-

--
Jens Rehsack - rehsack@gmail.com


[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 849 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-15  5:44   ` Jens Rehsack
@ 2020-09-15 11:33     ` Bruce Ashfield
  2020-09-15 11:45       ` Richard Purdie
  0 siblings, 1 reply; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-15 11:33 UTC (permalink / raw)
  To: Jens Rehsack
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

On Tue, Sep 15, 2020 at 1:44 AM Jens Rehsack <rehsack@gmail.com> wrote:
>
>
>
> > Am 15.09.2020 um 00:34 schrieb Bruce Ashfield <bruce.ashfield@gmail.com>:
> >
> > From: Jens Rehsack <sno@netbsd.org>
> >
> > Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> > them once .3 is released, but for now, we need the fixes to build
>
> Yet another question: there is a stable-2.12 branch ... wouldn't it be reasonable to use this one as upstream source instead of the tarball?
>

We used to do that .. yes. But then the lttng recipe was changed away
from git to using the tgz.

I complained at the time (I'm sure it is in the archives for all to
see), since I'm constantly doing new kernels and have to do this sort
of exercise.

The devupstream bbclass allows me to keep moving on my new kernels
when I need to pick up changes for -dev, and luckily -stable doesn't
normally need this sort of thing.

IIRC it was switched to tgz since things like AUH work better with the
tarballs, but I can't be sure.

But let's just say that I agree that this recipe is better as a branch
based, git recipe and not a tgz based recipe. I just haven't waded
into the discussion to switch it back :)

Bruce

> > against the latest 5.4, 5.8 and 5.9 kernels.
> >
> > We also bump the devupstream SRCREV to pickup the same changes.
> > -=-=-=-=-=-=-=-=-=-=-=-
>
> --
> Jens Rehsack - rehsack@gmail.com
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-15  5:03     ` [OE-core] " Jens Rehsack
@ 2020-09-15 11:37       ` Bruce Ashfield
  0 siblings, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-15 11:37 UTC (permalink / raw)
  To: Jens Rehsack
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

On Tue, Sep 15, 2020 at 1:03 AM Jens Rehsack <rehsack@gmail.com> wrote:
>
>
>
> > Am 15.09.2020 um 00:35 schrieb Bruce Ashfield <bruce.ashfield@gmail.com>:
> >
> > I squashed the other lttng patch to create this, and it looks like the
> > author is messed up and some kind of strange encoding on one of the
>
> No worries about that :)
>
> > embedded patches.
> >
> > git send email complained on the way out.
> >
> > Bruce
> >
> > On Mon, Sep 14, 2020 at 6:34 PM <bruce.ashfield@gmail.com> wrote:
> >>
> >> From: Jens Rehsack <sno@netbsd.org>
> >>
> >> Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> >> them once .3 is released, but for now, we need the fixes to build
> >> against the latest 5.4, 5.8 and 5.9 kernels.
> >>
> >> We also bump the devupstream SRCREV to pickup the same changes.
> >>
> >> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> >> ---
> >> ...ndency-issue-when-building-in-tree-w.patch |  54 ++
> >> ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
> >> ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
> >> ...he-length-of-per-inode-prealloc-list.patch |  84 ++
> >> ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
> >> ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
> >> ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
> >> ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
> >> ...es-for-ext4_discard_preallocations-a.patch |  52 +
> >> .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
> >> .../lttng/lttng-modules_2.12.2.bb             |  12 +-
> >> 11 files changed, 1829 insertions(+), 1 deletion(-)

<snip>

> >> + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> >> + 1 file changed, 15 insertions(+), 1 deletion(-)
> >> +
> >> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> >> +index affb4eb..ece67ad 100644
> >> +--- a/instrumentation/events/lttng-module/writeback.h
> >> ++++ b/instrumentation/events/lttng-module/writeback.h
> >> +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> >> +
> >> + #endif
> >> +
> >> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> >> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
>
> This one is needed for 5.4.62+, too.

Yah, I realize that it should be .. but yet, my build against 5.4.65
worked fine without that version check.

I was going to crawl -stable today and figure out which commit fixed
it in the kernel tree, since I can't see how else it was fixed.

Bruce

>
> >> ++#define show_inode_state(state)                                       \
> >> ++      __print_flags(state, "|",                               \
> >> ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> >> ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> >> ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> >> ++              {I_NEW,                 "I_NEW"},               \
> >> ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> >> ++              {I_FREEING,             "I_FREEING"},           \
> >> ++              {I_CLEAR,               "I_CLEAR"},             \
> >> ++              {I_SYNC,                "I_SYNC"},              \
> >> ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> >> ++              {I_REFERENCED,          "I_REFERENCED"}         \
> >> ++      )
> >> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> >> + #define show_inode_state(state)                                       \
> >> +       __print_flags(state, "|",                               \
> >> +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> >> +--
> >> +2.19.1
> >> +
> >> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> >> new file mode 100644
> >> index 0000000000..7a0d9a38b8
> >> --- /dev/null
> >> +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> >> @@ -0,0 +1,117 @@
> >> +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> >> +From: Michael Jeanson <mjeanson@efficios.com>
> >> +Date: Mon, 31 Aug 2020 14:16:01 -0400
> >> +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> >> + processing (v5.9)
> >> +
> >> +See upstream commit:
> >> +
> >> +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> >> +  Author: Jan Kara <jack@suse.cz>
> >> +  Date:   Fri May 29 16:08:58 2020 +0200
> >> +
> >> +    writeback: Fix sync livelock due to b_dirty_time processing
> >> +
> >> +    When we are processing writeback for sync(2), move_expired_inodes()
> >> +    didn't set any inode expiry value (older_than_this). This can result in
> >> +    writeback never completing if there's steady stream of inodes added to
> >> +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> >> +    round whether there's more work to be done. Fix the problem by using
> >> +    sync(2) start time is inode expiry value when processing b_dirty_time
> >> +    list similarly as for ordinarily dirtied inodes. This requires some
> >> +    refactoring of older_than_this handling which simplifies the code
> >> +    noticeably as a bonus.
> >> +
> >> +Upstream-Status: Backport
> >> +
> >> +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> >> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> >> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> >> +---
> >> + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> >> + 1 file changed, 26 insertions(+), 13 deletions(-)
> >> +
> >> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> >> +index ece67ad..e9018dd 100644
> >> +--- a/instrumentation/events/lttng-module/writeback.h
> >> ++++ b/instrumentation/events/lttng-module/writeback.h
> >> +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> >> + #endif
> >> + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> >> +
> >> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> >> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> >> ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> >> ++      TP_PROTO(struct bdi_writeback *wb,
> >> ++               struct wb_writeback_work *work,
> >> ++               unsigned long dirtied_before,
> >> ++               int moved),
> >> ++      TP_ARGS(wb, work, dirtied_before, moved),
> >> ++      TP_FIELDS(
> >> ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> >> ++              ctf_integer(unsigned long, older, dirtied_before)
> >> ++              ctf_integer(int, moved, moved)
> >> ++      )
> >> ++)
> >> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> >> + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> >> +       TP_PROTO(struct bdi_writeback *wb,
> >> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> >> +                struct wb_writeback_work *work,
> >> +-#else
> >> +-               unsigned long *older_than_this,
> >> +-#endif
> >> +                int moved),
> >> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> >> +       TP_ARGS(wb, work, moved),
> >> +-#else
> >> ++      TP_FIELDS(
> >> ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> >> ++              ctf_integer(int, moved, moved)
> >> ++      )
> >> ++)
> >> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> >> ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> >> ++      TP_PROTO(struct bdi_writeback *wb,
> >> ++               unsigned long *older_than_this,
> >> ++               int moved),
> >> +       TP_ARGS(wb, older_than_this, moved),
> >> +-#endif
> >> +       TP_FIELDS(
> >> +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> >> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> >> +-#else
> >> +               ctf_integer(unsigned long, older,
> >> +                       older_than_this ? *older_than_this : 0)
> >> +               ctf_integer(long, age,
> >> +                       older_than_this ?
> >> +                               (jiffies - *older_than_this) * 1000 / HZ
> >> +                               : -1)
> >> +-#endif
> >> +               ctf_integer(int, moved, moved)
> >> +       )
> >> + )
> >> ++#endif
> >> +
> >> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> >> + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> >> +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> >> +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> >> +       )
> >> + )
> >> +-#else
> >> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> >> + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> >> +
> >> +       writeback_global_dirty_state,
> >> +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> >> +       )
> >> + )
> >> + #endif
> >> +-#endif
> >> +
> >> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> >> +
> >> +--
> >> +2.19.1
> >> +
> >> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> >> new file mode 100644
> >> index 0000000000..346e1d63ad
> >> --- /dev/null
> >> +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> >> @@ -0,0 +1,52 @@
> >> +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> >> +From: Michael Jeanson <mjeanson@efficios.com>
> >> +Date: Fri, 4 Sep 2020 11:52:51 -0400
> >> +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> >> + writeback_queue_io
> >> +
> >> +Upstream-Status: Backport
> >> +
> >> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> >> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> >> +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> >> +---
> >> + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> >> + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> >> + 2 files changed, 9 insertions(+), 2 deletions(-)
> >> +
> >> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> >> +index 4476abb..b172c8d 100644
> >> +--- a/instrumentation/events/lttng-module/ext4.h
> >> ++++ b/instrumentation/events/lttng-module/ext4.h
> >> +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> >> + )
> >> + #endif
> >> +
> >> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> >> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> >> ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> >> + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> >> +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> >> +
> >> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> >> +index e9018dd..09637d7 100644
> >> +--- a/instrumentation/events/lttng-module/writeback.h
> >> ++++ b/instrumentation/events/lttng-module/writeback.h
> >> +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> >> + #endif
> >> + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> >> +
> >> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> >> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> >> ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> >> ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> >> ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> >> ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> >> ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> >> ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> >> + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> >> +       TP_PROTO(struct bdi_writeback *wb,
> >> +                struct wb_writeback_work *work,
> >> +--
> >> +2.19.1
> >> +
> >> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> >> new file mode 100644
> >> index 0000000000..a16750ddb3
> >> --- /dev/null
> >> +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> >> @@ -0,0 +1,918 @@
> >> +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> >> +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> >> +Date: Tue, 28 Jan 2020 16:02:44 -0500
> >> +Subject: [PATCH 10/10] Fix: system call filter table
> >> +
> >> +The system call filter table has effectively been unused for a long
> >> +time due to system call name prefix mismatch. This means the overhead of
> >> +selective system call tracing was larger than it should have been because
> >> +the event payload preparation would be done for all system calls as soon
> >> +as a single system call is traced.
> >> +
> >> +However, fixing this underlying issue unearths several issues that crept
> >> +unnoticed when the "enabler" concept was introduced (after the original
> >> +implementation of the system call filter table).
> >> +
> >> +Here is a list of the issues which are resolved here:
> >> +
> >> +- Split lttng_syscalls_unregister into an unregister and destroy
> >> +  function, thus awaiting for a grace period (and therefore quiescence
> >> +  of the users) after unregistering the system call tracepoints before
> >> +  freeing the system call filter data structures. This effectively fixes
> >> +  a use-after-free.
> >> +
> >> +- The state for enabling "all" system calls vs enabling specific system
> >> +  calls (and sequences of enable-disable) was incorrect with respect to
> >> +  the "enablers" semantic. This is solved by always tracking the
> >> +  bitmap of enabled system calls, and keeping this bitmap even when
> >> +  enabling all system calls. The sc_filter is now always allocated
> >> +  before system call tracing is registered to tracepoints, which means
> >> +  it does not need to be RCU dereferenced anymore.
> >> +
> >> +Padding fields in the ABI are reserved to select whether to:
> >> +
> >> +- Trace either native or compat system call (or both, which is the
> >> +  behavior currently implemented),
> >> +- Trace either system call entry or exit (or both, which is the
> >> +  behavior currently implemented),
> >> +- Select the system call to trace by name (behavior currently
> >> +  implemented) or by system call number,
> >> +
> >> +Upstream-Status: Backport
> >> +
> >> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> >> +---
> >> + lttng-abi.c      |  43 ++++++
> >> + lttng-abi.h      |  26 ++++
> >> + lttng-events.c   | 112 +++++++++++++--
> >> + lttng-events.h   |  31 ++++-
> >> + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> >> + 5 files changed, 380 insertions(+), 180 deletions(-)
> >> +
> >> +diff --git a/lttng-abi.c b/lttng-abi.c
> >> +index 64ea99d..b33879d 100644
> >> +--- a/lttng-abi.c
> >> ++++ b/lttng-abi.c
> >> +@@ -1264,6 +1264,46 @@ nomem:
> >> +       return ret;
> >> + }
> >> +
> >> ++static
> >> ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> >> ++{
> >> ++      /* Limit ABI to implemented features. */
> >> ++      switch (event_param->instrumentation) {
> >> ++      case LTTNG_KERNEL_SYSCALL:
> >> ++              switch (event_param->u.syscall.entryexit) {
> >> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> >> ++                      break;
> >> ++              default:
> >> ++                      return -EINVAL;
> >> ++              }
> >> ++              switch (event_param->u.syscall.abi) {
> >> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> >> ++                      break;
> >> ++              default:
> >> ++                      return -EINVAL;
> >> ++              }
> >> ++              switch (event_param->u.syscall.match) {
> >> ++              case LTTNG_SYSCALL_MATCH_NAME:
> >> ++                      break;
> >> ++              default:
> >> ++                      return -EINVAL;
> >> ++              }
> >> ++              break;
> >> ++
> >> ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> >> ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> >> ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> >> ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> >> ++      case LTTNG_KERNEL_UPROBE:
> >> ++              break;
> >> ++
> >> ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> >> ++      default:
> >> ++              return -EINVAL;
> >> ++      }
> >> ++      return 0;
> >> ++}
> >> ++
> >> + static
> >> + int lttng_abi_create_event(struct file *channel_file,
> >> +                          struct lttng_kernel_event *event_param)
> >> +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> >> +               ret = -EOVERFLOW;
> >> +               goto refcount_error;
> >> +       }
> >> ++      ret = lttng_abi_validate_event_param(event_param);
> >> ++      if (ret)
> >> ++              goto event_error;
> >> +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> >> +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> >> +               struct lttng_enabler *enabler;
> >> +diff --git a/lttng-abi.h b/lttng-abi.h
> >> +index 1d356ab..51d60e5 100644
> >> +--- a/lttng-abi.h
> >> ++++ b/lttng-abi.h
> >> +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> >> +       } u;
> >> + } __attribute__((packed));
> >> +
> >> ++enum lttng_kernel_syscall_entryexit {
> >> ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> >> ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> >> ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> >> ++};
> >> ++
> >> ++enum lttng_kernel_syscall_abi {
> >> ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> >> ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> >> ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> >> ++};
> >> ++
> >> ++enum lttng_kernel_syscall_match {
> >> ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> >> ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> >> ++};
> >> ++
> >> ++struct lttng_kernel_syscall {
> >> ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> >> ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> >> ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> >> ++      uint8_t padding;
> >> ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> >> ++} __attribute__((packed));
> >> ++
> >> + /*
> >> +  * For syscall tracing, name = "*" means "enable all".
> >> +  */
> >> +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> >> +               struct lttng_kernel_kprobe kprobe;
> >> +               struct lttng_kernel_function_tracer ftrace;
> >> +               struct lttng_kernel_uprobe uprobe;
> >> ++              struct lttng_kernel_syscall syscall;
> >> +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> >> +       } u;
> >> + } __attribute__((packed));
> >> +diff --git a/lttng-events.c b/lttng-events.c
> >> +index d719294..4c0b04a 100644
> >> +--- a/lttng-events.c
> >> ++++ b/lttng-events.c
> >> +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> >> +               WARN_ON(ret);
> >> +       }
> >> +       synchronize_trace();    /* Wait for in-flight events to complete */
> >> ++      list_for_each_entry(chan, &session->chan, list) {
> >> ++              ret = lttng_syscalls_destroy(chan);
> >> ++              WARN_ON(ret);
> >> ++      }
> >> +       list_for_each_entry_safe(enabler, tmpenabler,
> >> +                       &session->enablers_head, node)
> >> +               lttng_enabler_destroy(enabler);
> >> +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> >> +               event->enabled = 0;
> >> +               event->registered = 0;
> >> +               event->desc = event_desc;
> >> ++              switch (event_param->u.syscall.entryexit) {
> >> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> >> ++                      ret = -EINVAL;
> >> ++                      goto register_error;
> >> ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> >> ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> >> ++                      break;
> >> ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> >> ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> >> ++                      break;
> >> ++              }
> >> ++              switch (event_param->u.syscall.abi) {
> >> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> >> ++                      ret = -EINVAL;
> >> ++                      goto register_error;
> >> ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> >> ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> >> ++                      break;
> >> ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> >> ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> >> ++                      break;
> >> ++              }
> >> +               if (!event->desc) {
> >> +                       ret = -EINVAL;
> >> +                       goto register_error;
> >> +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> >> +                                                 event);
> >> +               break;
> >> +       case LTTNG_KERNEL_SYSCALL:
> >> +-              ret = lttng_syscall_filter_enable(event->chan,
> >> +-                      desc->name);
> >> ++              ret = lttng_syscall_filter_enable(event->chan, event);
> >> +               break;
> >> +       case LTTNG_KERNEL_KPROBE:
> >> +       case LTTNG_KERNEL_UPROBE:
> >> +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> >> +               ret = 0;
> >> +               break;
> >> +       case LTTNG_KERNEL_SYSCALL:
> >> +-              ret = lttng_syscall_filter_disable(event->chan,
> >> +-                      desc->name);
> >> ++              ret = lttng_syscall_filter_disable(event->chan, event);
> >> +               break;
> >> +       case LTTNG_KERNEL_NOOP:
> >> +               ret = 0;
> >> +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> >> +               struct lttng_enabler *enabler)
> >> + {
> >> +       const char *desc_name, *enabler_name;
> >> ++      bool compat = false, entry = false;
> >> +
> >> +       enabler_name = enabler->event_param.name;
> >> +       switch (enabler->event_param.instrumentation) {
> >> +       case LTTNG_KERNEL_TRACEPOINT:
> >> +               desc_name = desc->name;
> >> ++              switch (enabler->type) {
> >> ++              case LTTNG_ENABLER_STAR_GLOB:
> >> ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> >> ++              case LTTNG_ENABLER_NAME:
> >> ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> >> ++              default:
> >> ++                      return -EINVAL;
> >> ++              }
> >> +               break;
> >> +       case LTTNG_KERNEL_SYSCALL:
> >> +               desc_name = desc->name;
> >> +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> >> ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> >> +                       desc_name += strlen("compat_");
> >> ++                      compat = true;
> >> ++              }
> >> +               if (!strncmp(desc_name, "syscall_exit_",
> >> +                               strlen("syscall_exit_"))) {
> >> +                       desc_name += strlen("syscall_exit_");
> >> +               } else if (!strncmp(desc_name, "syscall_entry_",
> >> +                               strlen("syscall_entry_"))) {
> >> +                       desc_name += strlen("syscall_entry_");
> >> ++                      entry = true;
> >> +               } else {
> >> +                       WARN_ON_ONCE(1);
> >> +                       return -EINVAL;
> >> +               }
> >> ++              switch (enabler->event_param.u.syscall.entryexit) {
> >> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> >> ++                      break;
> >> ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> >> ++                      if (!entry)
> >> ++                              return 0;
> >> ++                      break;
> >> ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> >> ++                      if (entry)
> >> ++                              return 0;
> >> ++                      break;
> >> ++              default:
> >> ++                      return -EINVAL;
> >> ++              }
> >> ++              switch (enabler->event_param.u.syscall.abi) {
> >> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> >> ++                      break;
> >> ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> >> ++                      if (compat)
> >> ++                              return 0;
> >> ++                      break;
> >> ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> >> ++                      if (!compat)
> >> ++                              return 0;
> >> ++                      break;
> >> ++              default:
> >> ++                      return -EINVAL;
> >> ++              }
> >> ++              switch (enabler->event_param.u.syscall.match) {
> >> ++              case LTTNG_SYSCALL_MATCH_NAME:
> >> ++                      switch (enabler->type) {
> >> ++                      case LTTNG_ENABLER_STAR_GLOB:
> >> ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> >> ++                      case LTTNG_ENABLER_NAME:
> >> ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> >> ++                      default:
> >> ++                              return -EINVAL;
> >> ++                      }
> >> ++                      break;
> >> ++              case LTTNG_SYSCALL_MATCH_NR:
> >> ++                      return -EINVAL; /* Not implemented. */
> >> ++              default:
> >> ++                      return -EINVAL;
> >> ++              }
> >> +               break;
> >> +       default:
> >> +               WARN_ON_ONCE(1);
> >> +               return -EINVAL;
> >> +       }
> >> +-      switch (enabler->type) {
> >> +-      case LTTNG_ENABLER_STAR_GLOB:
> >> +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> >> +-      case LTTNG_ENABLER_NAME:
> >> +-              return lttng_match_enabler_name(desc_name, enabler_name);
> >> +-      default:
> >> +-              return -EINVAL;
> >> +-      }
> >> + }
> >> +
> >> + static
> >> +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> >> + static
> >> + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> >> + {
> >> +-      struct lttng_session *session = enabler->chan->session;
> >> ++      struct lttng_channel *chan = enabler->chan;
> >> ++      struct lttng_session *session = chan->session;
> >> +       struct lttng_event *event;
> >> +
> >> ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> >> ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> >> ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> >> ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> >> ++                      !strcmp(enabler->event_param.name, "*")) {
> >> ++              if (enabler->enabled)
> >> ++                      WRITE_ONCE(chan->syscall_all, 1);
> >> ++              else
> >> ++                      WRITE_ONCE(chan->syscall_all, 0);
> >> ++      }
> >> ++
> >> +       /* First ensure that probe events are created for this enabler. */
> >> +       lttng_create_event_if_missing(enabler);
> >> +
> >> +diff --git a/lttng-events.h b/lttng-events.h
> >> +index a36a312..d4d9976 100644
> >> +--- a/lttng-events.h
> >> ++++ b/lttng-events.h
> >> +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> >> +       struct list_head node;
> >> + };
> >> +
> >> ++enum lttng_syscall_entryexit {
> >> ++      LTTNG_SYSCALL_ENTRY,
> >> ++      LTTNG_SYSCALL_EXIT,
> >> ++};
> >> ++
> >> ++enum lttng_syscall_abi {
> >> ++      LTTNG_SYSCALL_ABI_NATIVE,
> >> ++      LTTNG_SYSCALL_ABI_COMPAT,
> >> ++};
> >> ++
> >> + /*
> >> +  * lttng_event structure is referred to by the tracing fast path. It must be
> >> +  * kept small.
> >> +@@ -318,6 +328,11 @@ struct lttng_event {
> >> +                       struct inode *inode;
> >> +                       struct list_head head;
> >> +               } uprobe;
> >> ++              struct {
> >> ++                      char *syscall_name;
> >> ++                      enum lttng_syscall_entryexit entryexit;
> >> ++                      enum lttng_syscall_abi abi;
> >> ++              } syscall;
> >> +       } u;
> >> +       struct list_head list;          /* Event list in session */
> >> +       unsigned int metadata_dumped:1;
> >> +@@ -457,10 +472,10 @@ struct lttng_channel {
> >> +       struct lttng_syscall_filter *sc_filter;
> >> +       int header_type;                /* 0: unset, 1: compact, 2: large */
> >> +       enum channel_type channel_type;
> >> ++      int syscall_all;
> >> +       unsigned int metadata_dumped:1,
> >> +               sys_enter_registered:1,
> >> +               sys_exit_registered:1,
> >> +-              syscall_all:1,
> >> +               tstate:1;               /* Transient enable state */
> >> + };
> >> +
> >> +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> >> + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> >> + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> >> + int lttng_syscalls_unregister(struct lttng_channel *chan);
> >> ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> >> + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> >> +-              const char *name);
> >> ++              struct lttng_event *event);
> >> + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> >> +-              const char *name);
> >> ++              struct lttng_event *event);
> >> + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> >> +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> >> + #else
> >> +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> >> +       return 0;
> >> + }
> >> +
> >> ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> >> ++{
> >> ++      return 0;
> >> ++}
> >> ++
> >> + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> >> +-              const char *name)
> >> ++              struct lttng_event *event);
> >> + {
> >> +       return -ENOSYS;
> >> + }
> >> +
> >> + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> >> +-              const char *name)
> >> ++              struct lttng_event *event);
> >> + {
> >> +       return -ENOSYS;
> >> + }
> >> +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> >> +index 97f1ba9..26cead6 100644
> >> +--- a/lttng-syscalls.c
> >> ++++ b/lttng-syscalls.c
> >> +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> >> + #undef CREATE_SYSCALL_TABLE
> >> +
> >> + struct lttng_syscall_filter {
> >> +-      DECLARE_BITMAP(sc, NR_syscalls);
> >> +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> >> ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> >> ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> >> ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> >> ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> >> + };
> >> +
> >> + static void syscall_entry_unknown(struct lttng_event *event,
> >> +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> >> +       size_t table_len;
> >> +
> >> +       if (unlikely(in_compat_syscall())) {
> >> +-              struct lttng_syscall_filter *filter;
> >> +-
> >> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> >> +-              if (filter) {
> >> +-                      if (id < 0 || id >= NR_compat_syscalls
> >> +-                              || !test_bit(id, filter->sc_compat)) {
> >> +-                              /* System call filtered out. */
> >> +-                              return;
> >> +-                      }
> >> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> >> ++
> >> ++              if (id < 0 || id >= NR_compat_syscalls
> >> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> >> ++                      /* System call filtered out. */
> >> ++                      return;
> >> +               }
> >> +               table = compat_sc_table;
> >> +               table_len = ARRAY_SIZE(compat_sc_table);
> >> +               unknown_event = chan->sc_compat_unknown;
> >> +       } else {
> >> +-              struct lttng_syscall_filter *filter;
> >> +-
> >> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> >> +-              if (filter) {
> >> +-                      if (id < 0 || id >= NR_syscalls
> >> +-                              || !test_bit(id, filter->sc)) {
> >> +-                              /* System call filtered out. */
> >> +-                              return;
> >> +-                      }
> >> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> >> ++
> >> ++              if (id < 0 || id >= NR_syscalls
> >> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> >> ++                      /* System call filtered out. */
> >> ++                      return;
> >> +               }
> >> +               table = sc_table;
> >> +               table_len = ARRAY_SIZE(sc_table);
> >> +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> >> +
> >> +       id = syscall_get_nr(current, regs);
> >> +       if (unlikely(in_compat_syscall())) {
> >> +-              struct lttng_syscall_filter *filter;
> >> +-
> >> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> >> +-              if (filter) {
> >> +-                      if (id < 0 || id >= NR_compat_syscalls
> >> +-                              || !test_bit(id, filter->sc_compat)) {
> >> +-                              /* System call filtered out. */
> >> +-                              return;
> >> +-                      }
> >> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> >> ++
> >> ++              if (id < 0 || id >= NR_compat_syscalls
> >> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> >> ++                      /* System call filtered out. */
> >> ++                      return;
> >> +               }
> >> +               table = compat_sc_exit_table;
> >> +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> >> +               unknown_event = chan->compat_sc_exit_unknown;
> >> +       } else {
> >> +-              struct lttng_syscall_filter *filter;
> >> +-
> >> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> >> +-              if (filter) {
> >> +-                      if (id < 0 || id >= NR_syscalls
> >> +-                              || !test_bit(id, filter->sc)) {
> >> +-                              /* System call filtered out. */
> >> +-                              return;
> >> +-                      }
> >> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> >> ++
> >> ++              if (id < 0 || id >= NR_syscalls
> >> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> >> ++                      /* System call filtered out. */
> >> ++                      return;
> >> +               }
> >> +               table = sc_exit_table;
> >> +               table_len = ARRAY_SIZE(sc_exit_table);
> >> +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> >> +               memset(&ev, 0, sizeof(ev));
> >> +               switch (type) {
> >> +               case SC_TYPE_ENTRY:
> >> +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> >> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> >> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> >> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> >> +                       break;
> >> +               case SC_TYPE_EXIT:
> >> +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> >> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> >> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> >> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> >> +                       break;
> >> +               case SC_TYPE_COMPAT_ENTRY:
> >> +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> >> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> >> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> >> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> >> +                       break;
> >> +               case SC_TYPE_COMPAT_EXIT:
> >> +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> >> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> >> +-                      break;
> >> +-              default:
> >> +-                      BUG_ON(1);
> >> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> >> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> >> +                       break;
> >> +               }
> >> +-              strncat(ev.name, desc->name,
> >> +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> >> ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> >> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> >> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> >> +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> >> +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> >> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> >> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> >> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> >> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> >> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> >> +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> >> +                                               desc,
> >> +                                               ev.instrumentation);
> >> +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> >> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> >> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> >> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> >> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> >> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> >> +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> >> +                                               desc,
> >> +                                               ev.instrumentation);
> >> +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> >> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> >> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> >> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> >> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> >> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> >> +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> >> +                                               filter, desc,
> >> +                                               ev.instrumentation);
> >> +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> >> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> >> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> >> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> >> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> >> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> >> +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> >> +                                               desc, ev.instrumentation);
> >> +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> >> +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> >> +       if (ret)
> >> +               return ret;
> >> + #endif
> >> ++
> >> ++      if (!chan->sc_filter) {
> >> ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> >> ++                              GFP_KERNEL);
> >> ++              if (!chan->sc_filter)
> >> ++                      return -ENOMEM;
> >> ++      }
> >> ++
> >> +       if (!chan->sys_enter_registered) {
> >> +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> >> +                               (void *) syscall_entry_probe, chan);
> >> +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> >> +                       return ret;
> >> +               chan->sys_exit_registered = 0;
> >> +       }
> >> +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> >> ++      return 0;
> >> ++}
> >> ++
> >> ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> >> ++{
> >> +       kfree(chan->sc_table);
> >> +       kfree(chan->sc_exit_table);
> >> + #ifdef CONFIG_COMPAT
> >> +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> >> +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> >> + }
> >> +
> >> +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> >> +-              const char *name)
> >> ++static
> >> ++const char *get_syscall_name(struct lttng_event *event)
> >> + {
> >> +-      int syscall_nr, compat_syscall_nr, ret;
> >> +-      struct lttng_syscall_filter *filter;
> >> ++      size_t prefix_len = 0;
> >> +
> >> +-      WARN_ON_ONCE(!chan->sc_table);
> >> ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> >> +
> >> +-      if (!name) {
> >> +-              /* Enable all system calls by removing filter */
> >> +-              if (chan->sc_filter) {
> >> +-                      filter = chan->sc_filter;
> >> +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> >> +-                      synchronize_trace();
> >> +-                      kfree(filter);
> >> ++      switch (event->u.syscall.entryexit) {
> >> ++      case LTTNG_SYSCALL_ENTRY:
> >> ++              switch (event->u.syscall.abi) {
> >> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> >> ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> >> ++                      break;
> >> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> >> ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> >> ++                      break;
> >> +               }
> >> +-              chan->syscall_all = 1;
> >> +-              return 0;
> >> +-      }
> >> +-
> >> +-      if (!chan->sc_filter) {
> >> +-              if (chan->syscall_all) {
> >> +-                      /*
> >> +-                       * All syscalls are already enabled.
> >> +-                       */
> >> +-                      return -EEXIST;
> >> ++              break;
> >> ++      case LTTNG_SYSCALL_EXIT:
> >> ++              switch (event->u.syscall.abi) {
> >> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> >> ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> >> ++                      break;
> >> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> >> ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> >> ++                      break;
> >> +               }
> >> +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> >> +-                              GFP_KERNEL);
> >> +-              if (!filter)
> >> +-                      return -ENOMEM;
> >> +-      } else {
> >> +-              filter = chan->sc_filter;
> >> ++              break;
> >> +       }
> >> +-      syscall_nr = get_syscall_nr(name);
> >> +-      compat_syscall_nr = get_compat_syscall_nr(name);
> >> +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> >> +-              ret = -ENOENT;
> >> +-              goto error;
> >> ++      WARN_ON_ONCE(prefix_len == 0);
> >> ++      return event->desc->name + prefix_len;
> >> ++}
> >> ++
> >> ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> >> ++              struct lttng_event *event)
> >> ++{
> >> ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> >> ++      const char *syscall_name;
> >> ++      unsigned long *bitmap;
> >> ++      int syscall_nr;
> >> ++
> >> ++      WARN_ON_ONCE(!chan->sc_table);
> >> ++
> >> ++      syscall_name = get_syscall_name(event);
> >> ++
> >> ++      switch (event->u.syscall.abi) {
> >> ++      case LTTNG_SYSCALL_ABI_NATIVE:
> >> ++              syscall_nr = get_syscall_nr(syscall_name);
> >> ++              break;
> >> ++      case LTTNG_SYSCALL_ABI_COMPAT:
> >> ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> >> ++              break;
> >> ++      default:
> >> ++              return -EINVAL;
> >> +       }
> >> +-      if (syscall_nr >= 0) {
> >> +-              if (test_bit(syscall_nr, filter->sc)) {
> >> +-                      ret = -EEXIST;
> >> +-                      goto error;
> >> ++      if (syscall_nr < 0)
> >> ++              return -ENOENT;
> >> ++
> >> ++
> >> ++      switch (event->u.syscall.entryexit) {
> >> ++      case LTTNG_SYSCALL_ENTRY:
> >> ++              switch (event->u.syscall.abi) {
> >> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> >> ++                      bitmap = filter->sc_entry;
> >> ++                      break;
> >> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> >> ++                      bitmap = filter->sc_compat_entry;
> >> ++                      break;
> >> +               }
> >> +-              bitmap_set(filter->sc, syscall_nr, 1);
> >> +-      }
> >> +-      if (compat_syscall_nr >= 0) {
> >> +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> >> +-                      ret = -EEXIST;
> >> +-                      goto error;
> >> ++              break;
> >> ++      case LTTNG_SYSCALL_EXIT:
> >> ++              switch (event->u.syscall.abi) {
> >> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> >> ++                      bitmap = filter->sc_exit;
> >> ++                      break;
> >> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> >> ++                      bitmap = filter->sc_compat_exit;
> >> ++                      break;
> >> +               }
> >> +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> >> ++              break;
> >> ++      default:
> >> ++              return -EINVAL;
> >> +       }
> >> +-      if (!chan->sc_filter)
> >> +-              rcu_assign_pointer(chan->sc_filter, filter);
> >> ++      if (test_bit(syscall_nr, bitmap))
> >> ++              return -EEXIST;
> >> ++      bitmap_set(bitmap, syscall_nr, 1);
> >> +       return 0;
> >> +-
> >> +-error:
> >> +-      if (!chan->sc_filter)
> >> +-              kfree(filter);
> >> +-      return ret;
> >> + }
> >> +
> >> + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> >> +-              const char *name)
> >> ++              struct lttng_event *event)
> >> + {
> >> +-      int syscall_nr, compat_syscall_nr, ret;
> >> +-      struct lttng_syscall_filter *filter;
> >> ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> >> ++      const char *syscall_name;
> >> ++      unsigned long *bitmap;
> >> ++      int syscall_nr;
> >> +
> >> +       WARN_ON_ONCE(!chan->sc_table);
> >> +
> >> +-      if (!chan->sc_filter) {
> >> +-              if (!chan->syscall_all)
> >> +-                      return -EEXIST;
> >> +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> >> +-                              GFP_KERNEL);
> >> +-              if (!filter)
> >> +-                      return -ENOMEM;
> >> +-              /* Trace all system calls, then apply disable. */
> >> +-              bitmap_set(filter->sc, 0, NR_syscalls);
> >> +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> >> +-      } else {
> >> +-              filter = chan->sc_filter;
> >> ++      syscall_name = get_syscall_name(event);
> >> ++
> >> ++      switch (event->u.syscall.abi) {
> >> ++      case LTTNG_SYSCALL_ABI_NATIVE:
> >> ++              syscall_nr = get_syscall_nr(syscall_name);
> >> ++              break;
> >> ++      case LTTNG_SYSCALL_ABI_COMPAT:
> >> ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> >> ++              break;
> >> ++      default:
> >> ++              return -EINVAL;
> >> +       }
> >> ++      if (syscall_nr < 0)
> >> ++              return -ENOENT;
> >> +
> >> +-      if (!name) {
> >> +-              /* Fail if all syscalls are already disabled. */
> >> +-              if (bitmap_empty(filter->sc, NR_syscalls)
> >> +-                      && bitmap_empty(filter->sc_compat,
> >> +-                              NR_compat_syscalls)) {
> >> +-                      ret = -EEXIST;
> >> +-                      goto error;
> >> +-              }
> >> +
> >> +-              /* Disable all system calls */
> >> +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> >> +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> >> +-              goto apply_filter;
> >> +-      }
> >> +-      syscall_nr = get_syscall_nr(name);
> >> +-      compat_syscall_nr = get_compat_syscall_nr(name);
> >> +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> >> +-              ret = -ENOENT;
> >> +-              goto error;
> >> +-      }
> >> +-      if (syscall_nr >= 0) {
> >> +-              if (!test_bit(syscall_nr, filter->sc)) {
> >> +-                      ret = -EEXIST;
> >> +-                      goto error;
> >> ++      switch (event->u.syscall.entryexit) {
> >> ++      case LTTNG_SYSCALL_ENTRY:
> >> ++              switch (event->u.syscall.abi) {
> >> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> >> ++                      bitmap = filter->sc_entry;
> >> ++                      break;
> >> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> >> ++                      bitmap = filter->sc_compat_entry;
> >> ++                      break;
> >> +               }
> >> +-              bitmap_clear(filter->sc, syscall_nr, 1);
> >> +-      }
> >> +-      if (compat_syscall_nr >= 0) {
> >> +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> >> +-                      ret = -EEXIST;
> >> +-                      goto error;
> >> ++              break;
> >> ++      case LTTNG_SYSCALL_EXIT:
> >> ++              switch (event->u.syscall.abi) {
> >> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> >> ++                      bitmap = filter->sc_exit;
> >> ++                      break;
> >> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> >> ++                      bitmap = filter->sc_compat_exit;
> >> ++                      break;
> >> +               }
> >> +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> >> ++              break;
> >> ++      default:
> >> ++              return -EINVAL;
> >> +       }
> >> +-apply_filter:
> >> +-      if (!chan->sc_filter)
> >> +-              rcu_assign_pointer(chan->sc_filter, filter);
> >> +-      chan->syscall_all = 0;
> >> +-      return 0;
> >> ++      if (!test_bit(syscall_nr, bitmap))
> >> ++              return -EEXIST;
> >> ++      bitmap_clear(bitmap, syscall_nr, 1);
> >> +
> >> +-error:
> >> +-      if (!chan->sc_filter)
> >> +-              kfree(filter);
> >> +-      return ret;
> >> ++      return 0;
> >> + }
> >> +
> >> + static
> >> +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> >> +       .release = seq_release,
> >> + };
> >> +
> >> ++/*
> >> ++ * A syscall is enabled if it is traced for either entry or exit.
> >> ++ */
> >> + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> >> +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> >> + {
> >> +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> >> +               char state;
> >> +
> >> +               if (channel->sc_table) {
> >> +-                      if (filter)
> >> +-                              state = test_bit(bit, filter->sc);
> >> ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> >> ++                              state = test_bit(bit, filter->sc_entry)
> >> ++                                      || test_bit(bit, filter->sc_exit);
> >> +                       else
> >> +                               state = 1;
> >> +               } else {
> >> +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> >> +               char state;
> >> +
> >> +               if (channel->compat_sc_table) {
> >> +-                      if (filter)
> >> ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> >> +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> >> +-                                              filter->sc_compat);
> >> ++                                              filter->sc_compat_entry)
> >> ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> >> ++                                              filter->sc_compat_exit);
> >> +                       else
> >> +                               state = 1;
> >> +               } else {
> >> +--
> >> +2.19.1
> >> +
> >> diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> >> index 0e1a209ce8..e36b327a08 100644
> >> --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> >> +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> >> @@ -11,6 +11,16 @@ include lttng-platforms.inc
> >> SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
> >>            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> >>            file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> >> +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> >> +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> >> +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> >> +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> >> +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> >> +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> >> +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> >> +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> >> +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> >> +           file://0010-Fix-system-call-filter-table.patch \
> >>            "
> >>
> >> SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> >> @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
> >>            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> >>            file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> >>            "
> >> -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> >> +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
> >> PV_class-devupstream = "2.12.2+git${SRCPV}"
> >> S_class-devupstream = "${WORKDIR}/git"
> >> SRCREV_FORMAT ?= "lttng_git"
> >> --
> >> 2.19.1
> >>
> >
> >
> > --
> > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > thee at its end
> > - "Use the force Harry" - Gandalf, Star Trek II
> > 
>
> --
> Jens Rehsack - rehsack@gmail.com
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-15 11:33     ` Bruce Ashfield
@ 2020-09-15 11:45       ` Richard Purdie
  2020-09-15 11:53         ` Bruce Ashfield
  0 siblings, 1 reply; 23+ messages in thread
From: Richard Purdie @ 2020-09-15 11:45 UTC (permalink / raw)
  To: Bruce Ashfield, Jens Rehsack
  Cc: Patches and discussions about the oe-core layer

On Tue, 2020-09-15 at 07:33 -0400, Bruce Ashfield wrote:
> On Tue, Sep 15, 2020 at 1:44 AM Jens Rehsack <rehsack@gmail.com>
> wrote:
> > 
> > 
> > > Am 15.09.2020 um 00:34 schrieb Bruce Ashfield <
> > > bruce.ashfield@gmail.com>:
> > > 
> > > From: Jens Rehsack <sno@netbsd.org>
> > > 
> > > Backporting the 10 patches since the lttng 2.12.2 release. We'll
> > > drop
> > > them once .3 is released, but for now, we need the fixes to build
> > 
> > Yet another question: there is a stable-2.12 branch ... wouldn't it
> > be reasonable to use this one as upstream source instead of the
> > tarball?
> > 
> 
> We used to do that .. yes. But then the lttng recipe was changed away
> from git to using the tgz.
> 
> I complained at the time (I'm sure it is in the archives for all to
> see), since I'm constantly doing new kernels and have to do this sort
> of exercise.
> 
> The devupstream bbclass allows me to keep moving on my new kernels
> when I need to pick up changes for -dev, and luckily -stable doesn't
> normally need this sort of thing.
> 
> IIRC it was switched to tgz since things like AUH work better with the
> tarballs, but I can't be sure.
> 
> But let's just say that I agree that this recipe is better as a branch
> based, git recipe and not a tgz based recipe. I just haven't waded
> into the discussion to switch it back :)

Perhaps we have a need for both?

Cheers,

Richard


^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-15 11:45       ` Richard Purdie
@ 2020-09-15 11:53         ` Bruce Ashfield
  0 siblings, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-15 11:53 UTC (permalink / raw)
  To: Richard Purdie
  Cc: Jens Rehsack, Patches and discussions about the oe-core layer

On Tue, Sep 15, 2020 at 7:45 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Tue, 2020-09-15 at 07:33 -0400, Bruce Ashfield wrote:
> > On Tue, Sep 15, 2020 at 1:44 AM Jens Rehsack <rehsack@gmail.com>
> > wrote:
> > >
> > >
> > > > Am 15.09.2020 um 00:34 schrieb Bruce Ashfield <
> > > > bruce.ashfield@gmail.com>:
> > > >
> > > > From: Jens Rehsack <sno@netbsd.org>
> > > >
> > > > Backporting the 10 patches since the lttng 2.12.2 release. We'll
> > > > drop
> > > > them once .3 is released, but for now, we need the fixes to build
> > >
> > > Yet another question: there is a stable-2.12 branch ... wouldn't it
> > > be reasonable to use this one as upstream source instead of the
> > > tarball?
> > >
> >
> > We used to do that .. yes. But then the lttng recipe was changed away
> > from git to using the tgz.
> >
> > I complained at the time (I'm sure it is in the archives for all to
> > see), since I'm constantly doing new kernels and have to do this sort
> > of exercise.
> >
> > The devupstream bbclass allows me to keep moving on my new kernels
> > when I need to pick up changes for -dev, and luckily -stable doesn't
> > normally need this sort of thing.
> >
> > IIRC it was switched to tgz since things like AUH work better with the
> > tarballs, but I can't be sure.
> >
> > But let's just say that I agree that this recipe is better as a branch
> > based, git recipe and not a tgz based recipe. I just haven't waded
> > into the discussion to switch it back :)
>
> Perhaps we have a need for both?

I suppose we could, but once we've switched back to the git based
recipe, I don't see the need for the tgz based one at all (maybe I'm
missing something though, see below for my rambling).

And by that, I don't see enough pull to a stable/released version of
lttng versus just using the stable/released branches. If we march the
branches forward like this, they are good for all users. i.e. I don't
see anyone carrying a preferred version to pickup and older released
tgz variant, since it wouldn't be the one getting build testing, etc.

devupstream can continue to point at the development/master branch,
and that should cover all the use cases, no ?

Bruce

>
> Cheers,
>
> Richard
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-14 22:34 ` [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds Bruce Ashfield
  2020-09-14 22:35   ` Bruce Ashfield
  2020-09-15  5:44   ` Jens Rehsack
@ 2020-09-25 16:43   ` Steve Sakoman
  2020-09-25 16:52     ` Bruce Ashfield
  2 siblings, 1 reply; 23+ messages in thread
From: Steve Sakoman @ 2020-09-25 16:43 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

Dunfell is still at 2.11.2.  Will there be a need for patches to this
version too?  Or should I take the lttng version bump along with the
5.4 version bumps that cause the issue?

Thanks!

Steve

On Mon, Sep 14, 2020 at 12:34 PM Bruce Ashfield
<bruce.ashfield@gmail.com> wrote:
>
> From: Jens Rehsack <sno@netbsd.org>
>
> Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> them once .3 is released, but for now, we need the fixes to build
> against the latest 5.4, 5.8 and 5.9 kernels.
>
> We also bump the devupstream SRCREV to pickup the same changes.
>
> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> ---
>  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
>  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
>  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
>  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
>  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
>  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
>  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
>  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
>  ...es-for-ext4_discard_preallocations-a.patch |  52 +
>  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
>  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
>  11 files changed, 1829 insertions(+), 1 deletion(-)
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
>  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
>
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> new file mode 100644
> index 0000000000..ae8bec45de
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> @@ -0,0 +1,54 @@
> +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> +From: Beniamin Sandu <beniaminsandu@gmail.com>
> +Date: Thu, 13 Aug 2020 16:24:39 +0300
> +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> + without CONFIG_FTRACE
> +
> +When building in-tree, one could disable CONFIG_FTRACE from kernel
> +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> +but generate a lot of linker errors like below because it leaves out
> +other stuff, e.g.:
> +
> +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> +
> +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> +enabled.
> +
> +Steps to reproduce:
> +
> +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> +
> +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> +
> +- Build will fail at linking stage
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + Kconfig | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Kconfig b/Kconfig
> +index acdab73..10eccff 100644
> +--- a/Kconfig
> ++++ b/Kconfig
> +@@ -2,7 +2,7 @@
> +
> + config LTTNG
> +       tristate "LTTng support"
> +-      select TRACEPOINTS
> ++      select TRACING
> +       help
> +         LTTng is an open source tracing framework for Linux.
> +
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> new file mode 100644
> index 0000000000..fab673b854
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> @@ -0,0 +1,41 @@
> +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 10 Aug 2020 11:22:05 -0400
> +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> +
> +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> +  Date:   Mon Jun 22 13:20:29 2020 -0700
> +
> +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> +
> +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> +
> +Upstream-Status: Backport
> +
> +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> + 1 file changed, 4 insertions(+)
> +
> +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> +index 37384a2..5a7ef1e 100644
> +--- a/probes/lttng-probe-kvm-x86-mmu.c
> ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> +@@ -24,7 +24,11 @@
> +  */
> + #include <wrapper/tracepoint.h>
> +
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> ++#else
> + #include <../../arch/x86/kvm/mmutrace.h>
> ++#endif
> +
> + #undef TRACE_INCLUDE_PATH
> + #undef TRACE_INCLUDE_FILE
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> new file mode 100644
> index 0000000000..524631cc72
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> @@ -0,0 +1,39 @@
> +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 10 Aug 2020 11:36:03 -0400
> +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> + accessor internal-only (v5.9)
> +
> +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> +  Date:   Mon Jun 22 13:20:32 2020 -0700
> +
> +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> +
> +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> +    be poking into the gory details of shadow pages.
> +
> +Upstream-Status: Backport
> +
> +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> + 1 file changed, 1 insertion(+)
> +
> +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> +index 5a7ef1e..8f98186 100644
> +--- a/probes/lttng-probe-kvm-x86-mmu.c
> ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> +@@ -25,6 +25,7 @@
> + #include <wrapper/tracepoint.h>
> +
> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> + #else
> + #include <../../arch/x86/kvm/mmutrace.h>
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> new file mode 100644
> index 0000000000..e29c07252c
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> @@ -0,0 +1,84 @@
> +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 24 Aug 2020 15:26:04 -0400
> +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> + (v5.9)
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +See upstream commit:
> +
> +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> +  Author: brookxu <brookxu.cn@gmail.com>
> +  Date:   Mon Aug 17 15:36:15 2020 +0800
> +
> +    ext4: limit the length of per-inode prealloc list
> +
> +    In the scenario of writing sparse files, the per-inode prealloc list may
> +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> +    To circumvent this problem, we limit the maximum length of per-inode
> +    prealloc list to 512 and allow users to modify it.
> +
> +    After patching, we observed that the sys ratio of cpu has dropped, and
> +    the system throughput has increased significantly. We created a process
> +    to write the sparse file, and the running time of the process on the
> +    fixed kernel was significantly reduced, as follows:
> +
> +    Running time on unfixed kernel:
> +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> +    real    0m2.051s
> +    user    0m0.008s
> +    sys     0m2.026s
> +
> +    Running time on fixed kernel:
> +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> +    real    0m0.471s
> +    user    0m0.004s
> +    sys     0m0.395s
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> +---
> + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> + 1 file changed, 15 insertions(+)
> +
> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> +index 5f7ab28..72ad4c9 100644
> +--- a/instrumentation/events/lttng-module/ext4.h
> ++++ b/instrumentation/events/lttng-module/ext4.h
> +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> + )
> + #endif
> +
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> ++
> ++      TP_ARGS(inode, len, needed),
> ++
> ++      TP_FIELDS(
> ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> ++              ctf_integer(ino_t, ino, inode->i_ino)
> ++              ctf_integer(unsigned int, len, len)
> ++              ctf_integer(unsigned int, needed, needed)
> ++      )
> ++)
> ++#else
> + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> +       TP_PROTO(struct inode *inode),
> +
> +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> +               ctf_integer(ino_t, ino, inode->i_ino)
> +       )
> + )
> ++#endif
> +
> + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> +       TP_PROTO(struct super_block *sb, int needed),
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> new file mode 100644
> index 0000000000..f76e9698c8
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> @@ -0,0 +1,63 @@
> +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 24 Aug 2020 15:37:50 -0400
> +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> +MIME-Version: 1.0
> +Content-Type: text/plain; charset=UTF-8
> +Content-Transfer-Encoding: 8bit
> +
> +See upstream commit:
> +
> +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> +  Author: Theodore Ts'o <tytso@mit.edu>
> +  Date:   Wed Jul 15 11:48:55 2020 -0400
> +
> +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> +
> +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> +    whether a block bitmap is being prefetched.
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> +---
> + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> + 1 file changed, 14 insertions(+)
> +
> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> +index 72ad4c9..4476abb 100644
> +--- a/instrumentation/events/lttng-module/ext4.h
> ++++ b/instrumentation/events/lttng-module/ext4.h
> +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> +       TP_ARGS(sb, group)
> + )
> +
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> ++
> ++      TP_ARGS(sb, group, prefetch),
> ++
> ++      TP_FIELDS(
> ++              ctf_integer(dev_t, dev, sb->s_dev)
> ++              ctf_integer(__u32, group, group)
> ++              ctf_integer(bool, prefetch, prefetch)
> ++      )
> ++)
> ++#else
> + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> +
> +       TP_PROTO(struct super_block *sb, unsigned long group),
> +
> +       TP_ARGS(sb, group)
> + )
> ++#endif
> +
> + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> +
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> new file mode 100644
> index 0000000000..0970dd30aa
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> @@ -0,0 +1,391 @@
> +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Tue, 25 Aug 2020 10:56:29 -0400
> +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> +
> +See upstream commits:
> +
> +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> +  Author: Will Deacon <will@kernel.org>
> +  Date:   Tue Oct 24 11:22:47 2017 +0100
> +
> +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> +
> +    In preparation for the removal of lockless_dereference(), which is the
> +    same as READ_ONCE() on all architectures other than Alpha, add an
> +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> +    used to head dependency chains on all architectures.
> +
> +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> +  Author: Will Deacon <will.deacon@arm.com>
> +  Date:   Tue Oct 24 11:22:47 2017 +0100
> +
> +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> +
> +    In preparation for the removal of lockless_dereference(), which is the
> +    same as READ_ONCE() on all architectures other than Alpha, add an
> +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> +    used to head dependency chains on all architectures.
> +
> +Upstream-Status: Backport
> +
> +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + instrumentation/events/lttng-module/i2c.h |  4 ++--
> + lib/ringbuffer/backend.h                  |  2 +-
> + lib/ringbuffer/backend_internal.h         |  2 +-
> + lib/ringbuffer/frontend.h                 |  4 ++--
> + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> + lttng-events.c                            |  8 ++++----
> + probes/lttng-kprobes.c                    |  6 +++---
> + probes/lttng-kretprobes.c                 |  6 +++---
> + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> + probes/lttng-uprobes.c                    |  6 +++---
> + wrapper/compiler.h                        | 18 ++++++++++++++++++
> + wrapper/trace-clock.h                     | 15 +++++----------
> + 13 files changed, 51 insertions(+), 38 deletions(-)
> +
> +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> +index dcbabf6..131d134 100644
> +--- a/instrumentation/events/lttng-module/i2c.h
> ++++ b/instrumentation/events/lttng-module/i2c.h
> +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> +
> +       TP_code_pre(
> +               tp_locvar->extract_sensitive_payload =
> +-                      READ_ONCE(extract_sensitive_payload);
> ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> +       ),
> +
> +       TP_FIELDS(
> +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> +
> +       TP_code_pre(
> +               tp_locvar->extract_sensitive_payload =
> +-                      READ_ONCE(extract_sensitive_payload);
> ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> +       ),
> +
> +       TP_FIELDS(
> +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> +index da937f2..43e1d47 100644
> +--- a/lib/ringbuffer/backend.h
> ++++ b/lib/ringbuffer/backend.h
> +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> +                * Only read source character once, in case it is
> +                * modified concurrently.
> +                */
> +-              c = READ_ONCE(src[count]);
> ++              c = LTTNG_READ_ONCE(src[count]);
> +               if (!c)
> +                       break;
> +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> +index 2d6a345..1226fd8 100644
> +--- a/lib/ringbuffer/backend_internal.h
> ++++ b/lib/ringbuffer/backend_internal.h
> +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> +        * Performing a volatile access to read the sb_pages, because we want to
> +        * read a coherent version of the pointer and the associated noref flag.
> +        */
> +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> +       for (;;) {
> +               /* This check is called on the fast path for each record. */
> +               if (likely(!subbuffer_id_is_noref(config, id))) {
> +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> +index 6f516d9..41382fe 100644
> +--- a/lib/ringbuffer/frontend.h
> ++++ b/lib/ringbuffer/frontend.h
> +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> + #define for_each_channel_cpu(cpu, chan)                                       \
> +       for ((cpu) = -1;                                                \
> +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> +
> + extern struct lib_ring_buffer *channel_get_ring_buffer(
> +                               const struct lib_ring_buffer_config *config,
> +@@ -155,7 +155,7 @@ static inline
> + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> +                                struct lib_ring_buffer *buf)
> + {
> +-      int finalized = READ_ONCE(buf->finalized);
> ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> +       /*
> +        * Read finalized before counters.
> +        */
> +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> +index 3cab365..4980d20 100644
> +--- a/lib/ringbuffer/ring_buffer_frontend.c
> ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> +       int finalized;
> +
> + retry:
> +-      finalized = READ_ONCE(buf->finalized);
> ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> +       /*
> +        * Read finalized before counters.
> +        */
> +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> +               return -EBUSY;
> +       }
> + retry:
> +-      finalized = READ_ONCE(buf->finalized);
> ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> +       /*
> +        * Read finalized before counters.
> +        */
> +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> +index d25db72..7b4f20a 100644
> +--- a/lib/ringbuffer/ring_buffer_iterator.c
> ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> +@@ -46,7 +46,7 @@ restart:
> +       switch (iter->state) {
> +       case ITER_GET_SUBBUF:
> +               ret = lib_ring_buffer_get_next_subbuf(buf);
> +-              if (ret && !READ_ONCE(buf->finalized)
> ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> +                       /*
> +                        * Use "pull" scheme for global buffers. The reader
> +diff --git a/lttng-events.c b/lttng-events.c
> +index be7e389..d719294 100644
> +--- a/lttng-events.c
> ++++ b/lttng-events.c
> +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> +       size_t len;
> +       va_list ap;
> +
> +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> +
> +       va_start(ap, fmt);
> +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> + {
> +       int ret = 0;
> +
> +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> +               return 0;
> +       if (chan->channel_type == METADATA_CHANNEL)
> +               return 0;
> +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> + {
> +       int ret = 0;
> +
> +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> +               return 0;
> +
> +       if (chan->channel_type == METADATA_CHANNEL)
> +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> +       struct lttng_event *event;
> +       int ret = 0;
> +
> +-      if (!READ_ONCE(session->active))
> ++      if (!LTTNG_READ_ONCE(session->active))
> +               return 0;
> +
> +       lttng_metadata_begin(session);
> +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> +index a44eaa1..38fb72e 100644
> +--- a/probes/lttng-kprobes.c
> ++++ b/probes/lttng-kprobes.c
> +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> +       int ret;
> +       unsigned long data = (unsigned long) p->addr;
> +
> +-      if (unlikely(!READ_ONCE(chan->session->active)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(chan->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(event->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> +               return 0;
> +
> +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> +index ab98ff2..a6bcd21 100644
> +--- a/probes/lttng-kretprobes.c
> ++++ b/probes/lttng-kretprobes.c
> +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> +               unsigned long parent_ip;
> +       } payload;
> +
> +-      if (unlikely(!READ_ONCE(chan->session->active)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(chan->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(event->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> +               return 0;
> +
> +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> +index 77b8638..72a669e 100644
> +--- a/probes/lttng-tracepoint-event-impl.h
> ++++ b/probes/lttng-tracepoint-event-impl.h
> +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> +                                                                             \
> +       if (!_TP_SESSION_CHECK(session, __session))                           \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> +               return;                                                       \
> +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> +                                                                             \
> +       if (!_TP_SESSION_CHECK(session, __session))                           \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> +               return;                                                       \
> +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> +               return;                                                       \
> +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> +index bc10128..bda1d9b 100644
> +--- a/probes/lttng-uprobes.c
> ++++ b/probes/lttng-uprobes.c
> +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> +               unsigned long ip;
> +       } payload;
> +
> +-      if (unlikely(!READ_ONCE(chan->session->active)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(chan->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> +               return 0;
> +-      if (unlikely(!READ_ONCE(event->enabled)))
> ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> +               return 0;
> +
> +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> +index 1496f33..b9f8c51 100644
> +--- a/wrapper/compiler.h
> ++++ b/wrapper/compiler.h
> +@@ -9,6 +9,7 @@
> + #define _LTTNG_WRAPPER_COMPILER_H
> +
> + #include <linux/compiler.h>
> ++#include <linux/version.h>
> +
> + /*
> +  * Don't allow compiling with buggy compiler.
> +@@ -39,4 +40,21 @@
> + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> + #endif
> +
> ++/*
> ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> ++ * lockless_dereference(), replicate this behavior on prior kernels
> ++ * and remove calls to smp_read_barrier_depends which was dropped
> ++ * in v5.9.
> ++ */
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> ++#else
> ++#define LTTNG_READ_ONCE(x)                    \
> ++({                                            \
> ++      typeof(x) __val = READ_ONCE(x);         \
> ++      smp_read_barrier_depends();             \
> ++      __val;                                  \
> ++})
> ++#endif
> ++
> + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> +index 9f4e366..187fc82 100644
> +--- a/wrapper/trace-clock.h
> ++++ b/wrapper/trace-clock.h
> +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> +
> + static inline u64 trace_clock_read64(void)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +       if (likely(!ltc)) {
> +               return trace_clock_read64_monotonic();
> +       } else {
> +-              read_barrier_depends(); /* load ltc before content */
> +               return ltc->read64();
> +       }
> + }
> +
> + static inline u64 trace_clock_freq(void)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +       if (!ltc) {
> +               return trace_clock_freq_monotonic();
> +       } else {
> +-              read_barrier_depends(); /* load ltc before content */
> +               return ltc->freq();
> +       }
> + }
> +
> + static inline int trace_clock_uuid(char *uuid)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +-      read_barrier_depends(); /* load ltc before content */
> +       /* Use default UUID cb when NULL */
> +       if (!ltc || !ltc->uuid) {
> +               return trace_clock_uuid_monotonic(uuid);
> +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> +
> + static inline const char *trace_clock_name(void)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +       if (!ltc) {
> +               return trace_clock_name_monotonic();
> +       } else {
> +-              read_barrier_depends(); /* load ltc before content */
> +               return ltc->name();
> +       }
> + }
> +
> + static inline const char *trace_clock_description(void)
> + {
> +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> +
> +       if (!ltc) {
> +               return trace_clock_description_monotonic();
> +       } else {
> +-              read_barrier_depends(); /* load ltc before content */
> +               return ltc->description();
> +       }
> + }
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> new file mode 100644
> index 0000000000..2843c9cb62
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> @@ -0,0 +1,59 @@
> +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 31 Aug 2020 11:41:38 -0400
> +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> +
> +See upstream commit:
> +
> +  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.
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> +---
> + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> + 1 file changed, 15 insertions(+), 1 deletion(-)
> +
> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> +index affb4eb..ece67ad 100644
> +--- a/instrumentation/events/lttng-module/writeback.h
> ++++ b/instrumentation/events/lttng-module/writeback.h
> +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> +
> + #endif
> +
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#define show_inode_state(state)                                       \
> ++      __print_flags(state, "|",                               \
> ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> ++              {I_NEW,                 "I_NEW"},               \
> ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> ++              {I_FREEING,             "I_FREEING"},           \
> ++              {I_CLEAR,               "I_CLEAR"},             \
> ++              {I_SYNC,                "I_SYNC"},              \
> ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> ++              {I_REFERENCED,          "I_REFERENCED"}         \
> ++      )
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> + #define show_inode_state(state)                                       \
> +       __print_flags(state, "|",                               \
> +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> new file mode 100644
> index 0000000000..7a0d9a38b8
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> @@ -0,0 +1,117 @@
> +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Mon, 31 Aug 2020 14:16:01 -0400
> +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> + processing (v5.9)
> +
> +See upstream commit:
> +
> +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> +  Author: Jan Kara <jack@suse.cz>
> +  Date:   Fri May 29 16:08:58 2020 +0200
> +
> +    writeback: Fix sync livelock due to b_dirty_time processing
> +
> +    When we are processing writeback for sync(2), move_expired_inodes()
> +    didn't set any inode expiry value (older_than_this). This can result in
> +    writeback never completing if there's steady stream of inodes added to
> +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> +    round whether there's more work to be done. Fix the problem by using
> +    sync(2) start time is inode expiry value when processing b_dirty_time
> +    list similarly as for ordinarily dirtied inodes. This requires some
> +    refactoring of older_than_this handling which simplifies the code
> +    noticeably as a bonus.
> +
> +Upstream-Status: Backport
> +
> +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> + 1 file changed, 26 insertions(+), 13 deletions(-)
> +
> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> +index ece67ad..e9018dd 100644
> +--- a/instrumentation/events/lttng-module/writeback.h
> ++++ b/instrumentation/events/lttng-module/writeback.h
> +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> + #endif
> + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> +
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> ++      TP_PROTO(struct bdi_writeback *wb,
> ++               struct wb_writeback_work *work,
> ++               unsigned long dirtied_before,
> ++               int moved),
> ++      TP_ARGS(wb, work, dirtied_before, moved),
> ++      TP_FIELDS(
> ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> ++              ctf_integer(unsigned long, older, dirtied_before)
> ++              ctf_integer(int, moved, moved)
> ++      )
> ++)
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> +       TP_PROTO(struct bdi_writeback *wb,
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> +                struct wb_writeback_work *work,
> +-#else
> +-               unsigned long *older_than_this,
> +-#endif
> +                int moved),
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> +       TP_ARGS(wb, work, moved),
> +-#else
> ++      TP_FIELDS(
> ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> ++              ctf_integer(int, moved, moved)
> ++      )
> ++)
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> ++      TP_PROTO(struct bdi_writeback *wb,
> ++               unsigned long *older_than_this,
> ++               int moved),
> +       TP_ARGS(wb, older_than_this, moved),
> +-#endif
> +       TP_FIELDS(
> +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> +-#else
> +               ctf_integer(unsigned long, older,
> +                       older_than_this ? *older_than_this : 0)
> +               ctf_integer(long, age,
> +                       older_than_this ?
> +                               (jiffies - *older_than_this) * 1000 / HZ
> +                               : -1)
> +-#endif
> +               ctf_integer(int, moved, moved)
> +       )
> + )
> ++#endif
> +
> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> +       )
> + )
> +-#else
> ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> +
> +       writeback_global_dirty_state,
> +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> +       )
> + )
> + #endif
> +-#endif
> +
> + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> +
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> new file mode 100644
> index 0000000000..346e1d63ad
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> @@ -0,0 +1,52 @@
> +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> +From: Michael Jeanson <mjeanson@efficios.com>
> +Date: Fri, 4 Sep 2020 11:52:51 -0400
> +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> + writeback_queue_io
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> +---
> + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> + 2 files changed, 9 insertions(+), 2 deletions(-)
> +
> +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> +index 4476abb..b172c8d 100644
> +--- a/instrumentation/events/lttng-module/ext4.h
> ++++ b/instrumentation/events/lttng-module/ext4.h
> +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> + )
> + #endif
> +
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> +
> +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> +index e9018dd..09637d7 100644
> +--- a/instrumentation/events/lttng-module/writeback.h
> ++++ b/instrumentation/events/lttng-module/writeback.h
> +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> + #endif
> + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> +
> +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> +       TP_PROTO(struct bdi_writeback *wb,
> +                struct wb_writeback_work *work,
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> new file mode 100644
> index 0000000000..a16750ddb3
> --- /dev/null
> +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> @@ -0,0 +1,918 @@
> +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +Date: Tue, 28 Jan 2020 16:02:44 -0500
> +Subject: [PATCH 10/10] Fix: system call filter table
> +
> +The system call filter table has effectively been unused for a long
> +time due to system call name prefix mismatch. This means the overhead of
> +selective system call tracing was larger than it should have been because
> +the event payload preparation would be done for all system calls as soon
> +as a single system call is traced.
> +
> +However, fixing this underlying issue unearths several issues that crept
> +unnoticed when the "enabler" concept was introduced (after the original
> +implementation of the system call filter table).
> +
> +Here is a list of the issues which are resolved here:
> +
> +- Split lttng_syscalls_unregister into an unregister and destroy
> +  function, thus awaiting for a grace period (and therefore quiescence
> +  of the users) after unregistering the system call tracepoints before
> +  freeing the system call filter data structures. This effectively fixes
> +  a use-after-free.
> +
> +- The state for enabling "all" system calls vs enabling specific system
> +  calls (and sequences of enable-disable) was incorrect with respect to
> +  the "enablers" semantic. This is solved by always tracking the
> +  bitmap of enabled system calls, and keeping this bitmap even when
> +  enabling all system calls. The sc_filter is now always allocated
> +  before system call tracing is registered to tracepoints, which means
> +  it does not need to be RCU dereferenced anymore.
> +
> +Padding fields in the ABI are reserved to select whether to:
> +
> +- Trace either native or compat system call (or both, which is the
> +  behavior currently implemented),
> +- Trace either system call entry or exit (or both, which is the
> +  behavior currently implemented),
> +- Select the system call to trace by name (behavior currently
> +  implemented) or by system call number,
> +
> +Upstream-Status: Backport
> +
> +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> +---
> + lttng-abi.c      |  43 ++++++
> + lttng-abi.h      |  26 ++++
> + lttng-events.c   | 112 +++++++++++++--
> + lttng-events.h   |  31 ++++-
> + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> + 5 files changed, 380 insertions(+), 180 deletions(-)
> +
> +diff --git a/lttng-abi.c b/lttng-abi.c
> +index 64ea99d..b33879d 100644
> +--- a/lttng-abi.c
> ++++ b/lttng-abi.c
> +@@ -1264,6 +1264,46 @@ nomem:
> +       return ret;
> + }
> +
> ++static
> ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> ++{
> ++      /* Limit ABI to implemented features. */
> ++      switch (event_param->instrumentation) {
> ++      case LTTNG_KERNEL_SYSCALL:
> ++              switch (event_param->u.syscall.entryexit) {
> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              switch (event_param->u.syscall.abi) {
> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              switch (event_param->u.syscall.match) {
> ++              case LTTNG_SYSCALL_MATCH_NAME:
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              break;
> ++
> ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> ++      case LTTNG_KERNEL_UPROBE:
> ++              break;
> ++
> ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> ++      default:
> ++              return -EINVAL;
> ++      }
> ++      return 0;
> ++}
> ++
> + static
> + int lttng_abi_create_event(struct file *channel_file,
> +                          struct lttng_kernel_event *event_param)
> +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> +               ret = -EOVERFLOW;
> +               goto refcount_error;
> +       }
> ++      ret = lttng_abi_validate_event_param(event_param);
> ++      if (ret)
> ++              goto event_error;
> +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> +               struct lttng_enabler *enabler;
> +diff --git a/lttng-abi.h b/lttng-abi.h
> +index 1d356ab..51d60e5 100644
> +--- a/lttng-abi.h
> ++++ b/lttng-abi.h
> +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> +       } u;
> + } __attribute__((packed));
> +
> ++enum lttng_kernel_syscall_entryexit {
> ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> ++};
> ++
> ++enum lttng_kernel_syscall_abi {
> ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> ++};
> ++
> ++enum lttng_kernel_syscall_match {
> ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> ++};
> ++
> ++struct lttng_kernel_syscall {
> ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> ++      uint8_t padding;
> ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> ++} __attribute__((packed));
> ++
> + /*
> +  * For syscall tracing, name = "*" means "enable all".
> +  */
> +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> +               struct lttng_kernel_kprobe kprobe;
> +               struct lttng_kernel_function_tracer ftrace;
> +               struct lttng_kernel_uprobe uprobe;
> ++              struct lttng_kernel_syscall syscall;
> +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> +       } u;
> + } __attribute__((packed));
> +diff --git a/lttng-events.c b/lttng-events.c
> +index d719294..4c0b04a 100644
> +--- a/lttng-events.c
> ++++ b/lttng-events.c
> +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> +               WARN_ON(ret);
> +       }
> +       synchronize_trace();    /* Wait for in-flight events to complete */
> ++      list_for_each_entry(chan, &session->chan, list) {
> ++              ret = lttng_syscalls_destroy(chan);
> ++              WARN_ON(ret);
> ++      }
> +       list_for_each_entry_safe(enabler, tmpenabler,
> +                       &session->enablers_head, node)
> +               lttng_enabler_destroy(enabler);
> +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> +               event->enabled = 0;
> +               event->registered = 0;
> +               event->desc = event_desc;
> ++              switch (event_param->u.syscall.entryexit) {
> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> ++                      ret = -EINVAL;
> ++                      goto register_error;
> ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> ++                      break;
> ++              }
> ++              switch (event_param->u.syscall.abi) {
> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> ++                      ret = -EINVAL;
> ++                      goto register_error;
> ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> ++                      break;
> ++              }
> +               if (!event->desc) {
> +                       ret = -EINVAL;
> +                       goto register_error;
> +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> +                                                 event);
> +               break;
> +       case LTTNG_KERNEL_SYSCALL:
> +-              ret = lttng_syscall_filter_enable(event->chan,
> +-                      desc->name);
> ++              ret = lttng_syscall_filter_enable(event->chan, event);
> +               break;
> +       case LTTNG_KERNEL_KPROBE:
> +       case LTTNG_KERNEL_UPROBE:
> +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> +               ret = 0;
> +               break;
> +       case LTTNG_KERNEL_SYSCALL:
> +-              ret = lttng_syscall_filter_disable(event->chan,
> +-                      desc->name);
> ++              ret = lttng_syscall_filter_disable(event->chan, event);
> +               break;
> +       case LTTNG_KERNEL_NOOP:
> +               ret = 0;
> +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> +               struct lttng_enabler *enabler)
> + {
> +       const char *desc_name, *enabler_name;
> ++      bool compat = false, entry = false;
> +
> +       enabler_name = enabler->event_param.name;
> +       switch (enabler->event_param.instrumentation) {
> +       case LTTNG_KERNEL_TRACEPOINT:
> +               desc_name = desc->name;
> ++              switch (enabler->type) {
> ++              case LTTNG_ENABLER_STAR_GLOB:
> ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> ++              case LTTNG_ENABLER_NAME:
> ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> ++              default:
> ++                      return -EINVAL;
> ++              }
> +               break;
> +       case LTTNG_KERNEL_SYSCALL:
> +               desc_name = desc->name;
> +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> +                       desc_name += strlen("compat_");
> ++                      compat = true;
> ++              }
> +               if (!strncmp(desc_name, "syscall_exit_",
> +                               strlen("syscall_exit_"))) {
> +                       desc_name += strlen("syscall_exit_");
> +               } else if (!strncmp(desc_name, "syscall_entry_",
> +                               strlen("syscall_entry_"))) {
> +                       desc_name += strlen("syscall_entry_");
> ++                      entry = true;
> +               } else {
> +                       WARN_ON_ONCE(1);
> +                       return -EINVAL;
> +               }
> ++              switch (enabler->event_param.u.syscall.entryexit) {
> ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> ++                      if (!entry)
> ++                              return 0;
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> ++                      if (entry)
> ++                              return 0;
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              switch (enabler->event_param.u.syscall.abi) {
> ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> ++                      if (compat)
> ++                              return 0;
> ++                      break;
> ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> ++                      if (!compat)
> ++                              return 0;
> ++                      break;
> ++              default:
> ++                      return -EINVAL;
> ++              }
> ++              switch (enabler->event_param.u.syscall.match) {
> ++              case LTTNG_SYSCALL_MATCH_NAME:
> ++                      switch (enabler->type) {
> ++                      case LTTNG_ENABLER_STAR_GLOB:
> ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> ++                      case LTTNG_ENABLER_NAME:
> ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> ++                      default:
> ++                              return -EINVAL;
> ++                      }
> ++                      break;
> ++              case LTTNG_SYSCALL_MATCH_NR:
> ++                      return -EINVAL; /* Not implemented. */
> ++              default:
> ++                      return -EINVAL;
> ++              }
> +               break;
> +       default:
> +               WARN_ON_ONCE(1);
> +               return -EINVAL;
> +       }
> +-      switch (enabler->type) {
> +-      case LTTNG_ENABLER_STAR_GLOB:
> +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> +-      case LTTNG_ENABLER_NAME:
> +-              return lttng_match_enabler_name(desc_name, enabler_name);
> +-      default:
> +-              return -EINVAL;
> +-      }
> + }
> +
> + static
> +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> + static
> + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> + {
> +-      struct lttng_session *session = enabler->chan->session;
> ++      struct lttng_channel *chan = enabler->chan;
> ++      struct lttng_session *session = chan->session;
> +       struct lttng_event *event;
> +
> ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> ++                      !strcmp(enabler->event_param.name, "*")) {
> ++              if (enabler->enabled)
> ++                      WRITE_ONCE(chan->syscall_all, 1);
> ++              else
> ++                      WRITE_ONCE(chan->syscall_all, 0);
> ++      }
> ++
> +       /* First ensure that probe events are created for this enabler. */
> +       lttng_create_event_if_missing(enabler);
> +
> +diff --git a/lttng-events.h b/lttng-events.h
> +index a36a312..d4d9976 100644
> +--- a/lttng-events.h
> ++++ b/lttng-events.h
> +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> +       struct list_head node;
> + };
> +
> ++enum lttng_syscall_entryexit {
> ++      LTTNG_SYSCALL_ENTRY,
> ++      LTTNG_SYSCALL_EXIT,
> ++};
> ++
> ++enum lttng_syscall_abi {
> ++      LTTNG_SYSCALL_ABI_NATIVE,
> ++      LTTNG_SYSCALL_ABI_COMPAT,
> ++};
> ++
> + /*
> +  * lttng_event structure is referred to by the tracing fast path. It must be
> +  * kept small.
> +@@ -318,6 +328,11 @@ struct lttng_event {
> +                       struct inode *inode;
> +                       struct list_head head;
> +               } uprobe;
> ++              struct {
> ++                      char *syscall_name;
> ++                      enum lttng_syscall_entryexit entryexit;
> ++                      enum lttng_syscall_abi abi;
> ++              } syscall;
> +       } u;
> +       struct list_head list;          /* Event list in session */
> +       unsigned int metadata_dumped:1;
> +@@ -457,10 +472,10 @@ struct lttng_channel {
> +       struct lttng_syscall_filter *sc_filter;
> +       int header_type;                /* 0: unset, 1: compact, 2: large */
> +       enum channel_type channel_type;
> ++      int syscall_all;
> +       unsigned int metadata_dumped:1,
> +               sys_enter_registered:1,
> +               sys_exit_registered:1,
> +-              syscall_all:1,
> +               tstate:1;               /* Transient enable state */
> + };
> +
> +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> + int lttng_syscalls_unregister(struct lttng_channel *chan);
> ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> +-              const char *name);
> ++              struct lttng_event *event);
> + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> +-              const char *name);
> ++              struct lttng_event *event);
> + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> + #else
> +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> +       return 0;
> + }
> +
> ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> ++{
> ++      return 0;
> ++}
> ++
> + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> +-              const char *name)
> ++              struct lttng_event *event);
> + {
> +       return -ENOSYS;
> + }
> +
> + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> +-              const char *name)
> ++              struct lttng_event *event);
> + {
> +       return -ENOSYS;
> + }
> +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> +index 97f1ba9..26cead6 100644
> +--- a/lttng-syscalls.c
> ++++ b/lttng-syscalls.c
> +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> + #undef CREATE_SYSCALL_TABLE
> +
> + struct lttng_syscall_filter {
> +-      DECLARE_BITMAP(sc, NR_syscalls);
> +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> + };
> +
> + static void syscall_entry_unknown(struct lttng_event *event,
> +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> +       size_t table_len;
> +
> +       if (unlikely(in_compat_syscall())) {
> +-              struct lttng_syscall_filter *filter;
> +-
> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> +-              if (filter) {
> +-                      if (id < 0 || id >= NR_compat_syscalls
> +-                              || !test_bit(id, filter->sc_compat)) {
> +-                              /* System call filtered out. */
> +-                              return;
> +-                      }
> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> ++
> ++              if (id < 0 || id >= NR_compat_syscalls
> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> ++                      /* System call filtered out. */
> ++                      return;
> +               }
> +               table = compat_sc_table;
> +               table_len = ARRAY_SIZE(compat_sc_table);
> +               unknown_event = chan->sc_compat_unknown;
> +       } else {
> +-              struct lttng_syscall_filter *filter;
> +-
> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> +-              if (filter) {
> +-                      if (id < 0 || id >= NR_syscalls
> +-                              || !test_bit(id, filter->sc)) {
> +-                              /* System call filtered out. */
> +-                              return;
> +-                      }
> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> ++
> ++              if (id < 0 || id >= NR_syscalls
> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> ++                      /* System call filtered out. */
> ++                      return;
> +               }
> +               table = sc_table;
> +               table_len = ARRAY_SIZE(sc_table);
> +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> +
> +       id = syscall_get_nr(current, regs);
> +       if (unlikely(in_compat_syscall())) {
> +-              struct lttng_syscall_filter *filter;
> +-
> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> +-              if (filter) {
> +-                      if (id < 0 || id >= NR_compat_syscalls
> +-                              || !test_bit(id, filter->sc_compat)) {
> +-                              /* System call filtered out. */
> +-                              return;
> +-                      }
> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> ++
> ++              if (id < 0 || id >= NR_compat_syscalls
> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> ++                      /* System call filtered out. */
> ++                      return;
> +               }
> +               table = compat_sc_exit_table;
> +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> +               unknown_event = chan->compat_sc_exit_unknown;
> +       } else {
> +-              struct lttng_syscall_filter *filter;
> +-
> +-              filter = lttng_rcu_dereference(chan->sc_filter);
> +-              if (filter) {
> +-                      if (id < 0 || id >= NR_syscalls
> +-                              || !test_bit(id, filter->sc)) {
> +-                              /* System call filtered out. */
> +-                              return;
> +-                      }
> ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> ++
> ++              if (id < 0 || id >= NR_syscalls
> ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> ++                      /* System call filtered out. */
> ++                      return;
> +               }
> +               table = sc_exit_table;
> +               table_len = ARRAY_SIZE(sc_exit_table);
> +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> +               memset(&ev, 0, sizeof(ev));
> +               switch (type) {
> +               case SC_TYPE_ENTRY:
> +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> +                       break;
> +               case SC_TYPE_EXIT:
> +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> +                       break;
> +               case SC_TYPE_COMPAT_ENTRY:
> +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> +                       break;
> +               case SC_TYPE_COMPAT_EXIT:
> +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> +-                      break;
> +-              default:
> +-                      BUG_ON(1);
> ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> +                       break;
> +               }
> +-              strncat(ev.name, desc->name,
> +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> +                                               desc,
> +                                               ev.instrumentation);
> +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> +                                               desc,
> +                                               ev.instrumentation);
> +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> +                                               filter, desc,
> +                                               ev.instrumentation);
> +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> +                                               desc, ev.instrumentation);
> +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> +       if (ret)
> +               return ret;
> + #endif
> ++
> ++      if (!chan->sc_filter) {
> ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> ++                              GFP_KERNEL);
> ++              if (!chan->sc_filter)
> ++                      return -ENOMEM;
> ++      }
> ++
> +       if (!chan->sys_enter_registered) {
> +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> +                               (void *) syscall_entry_probe, chan);
> +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> +                       return ret;
> +               chan->sys_exit_registered = 0;
> +       }
> +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> ++      return 0;
> ++}
> ++
> ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> ++{
> +       kfree(chan->sc_table);
> +       kfree(chan->sc_exit_table);
> + #ifdef CONFIG_COMPAT
> +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> + }
> +
> +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> +-              const char *name)
> ++static
> ++const char *get_syscall_name(struct lttng_event *event)
> + {
> +-      int syscall_nr, compat_syscall_nr, ret;
> +-      struct lttng_syscall_filter *filter;
> ++      size_t prefix_len = 0;
> +
> +-      WARN_ON_ONCE(!chan->sc_table);
> ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> +
> +-      if (!name) {
> +-              /* Enable all system calls by removing filter */
> +-              if (chan->sc_filter) {
> +-                      filter = chan->sc_filter;
> +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> +-                      synchronize_trace();
> +-                      kfree(filter);
> ++      switch (event->u.syscall.entryexit) {
> ++      case LTTNG_SYSCALL_ENTRY:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> ++                      break;
> +               }
> +-              chan->syscall_all = 1;
> +-              return 0;
> +-      }
> +-
> +-      if (!chan->sc_filter) {
> +-              if (chan->syscall_all) {
> +-                      /*
> +-                       * All syscalls are already enabled.
> +-                       */
> +-                      return -EEXIST;
> ++              break;
> ++      case LTTNG_SYSCALL_EXIT:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> ++                      break;
> +               }
> +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> +-                              GFP_KERNEL);
> +-              if (!filter)
> +-                      return -ENOMEM;
> +-      } else {
> +-              filter = chan->sc_filter;
> ++              break;
> +       }
> +-      syscall_nr = get_syscall_nr(name);
> +-      compat_syscall_nr = get_compat_syscall_nr(name);
> +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> +-              ret = -ENOENT;
> +-              goto error;
> ++      WARN_ON_ONCE(prefix_len == 0);
> ++      return event->desc->name + prefix_len;
> ++}
> ++
> ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> ++              struct lttng_event *event)
> ++{
> ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> ++      const char *syscall_name;
> ++      unsigned long *bitmap;
> ++      int syscall_nr;
> ++
> ++      WARN_ON_ONCE(!chan->sc_table);
> ++
> ++      syscall_name = get_syscall_name(event);
> ++
> ++      switch (event->u.syscall.abi) {
> ++      case LTTNG_SYSCALL_ABI_NATIVE:
> ++              syscall_nr = get_syscall_nr(syscall_name);
> ++              break;
> ++      case LTTNG_SYSCALL_ABI_COMPAT:
> ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> ++              break;
> ++      default:
> ++              return -EINVAL;
> +       }
> +-      if (syscall_nr >= 0) {
> +-              if (test_bit(syscall_nr, filter->sc)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> ++      if (syscall_nr < 0)
> ++              return -ENOENT;
> ++
> ++
> ++      switch (event->u.syscall.entryexit) {
> ++      case LTTNG_SYSCALL_ENTRY:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      bitmap = filter->sc_entry;
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      bitmap = filter->sc_compat_entry;
> ++                      break;
> +               }
> +-              bitmap_set(filter->sc, syscall_nr, 1);
> +-      }
> +-      if (compat_syscall_nr >= 0) {
> +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> ++              break;
> ++      case LTTNG_SYSCALL_EXIT:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      bitmap = filter->sc_exit;
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      bitmap = filter->sc_compat_exit;
> ++                      break;
> +               }
> +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> ++              break;
> ++      default:
> ++              return -EINVAL;
> +       }
> +-      if (!chan->sc_filter)
> +-              rcu_assign_pointer(chan->sc_filter, filter);
> ++      if (test_bit(syscall_nr, bitmap))
> ++              return -EEXIST;
> ++      bitmap_set(bitmap, syscall_nr, 1);
> +       return 0;
> +-
> +-error:
> +-      if (!chan->sc_filter)
> +-              kfree(filter);
> +-      return ret;
> + }
> +
> + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> +-              const char *name)
> ++              struct lttng_event *event)
> + {
> +-      int syscall_nr, compat_syscall_nr, ret;
> +-      struct lttng_syscall_filter *filter;
> ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> ++      const char *syscall_name;
> ++      unsigned long *bitmap;
> ++      int syscall_nr;
> +
> +       WARN_ON_ONCE(!chan->sc_table);
> +
> +-      if (!chan->sc_filter) {
> +-              if (!chan->syscall_all)
> +-                      return -EEXIST;
> +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> +-                              GFP_KERNEL);
> +-              if (!filter)
> +-                      return -ENOMEM;
> +-              /* Trace all system calls, then apply disable. */
> +-              bitmap_set(filter->sc, 0, NR_syscalls);
> +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> +-      } else {
> +-              filter = chan->sc_filter;
> ++      syscall_name = get_syscall_name(event);
> ++
> ++      switch (event->u.syscall.abi) {
> ++      case LTTNG_SYSCALL_ABI_NATIVE:
> ++              syscall_nr = get_syscall_nr(syscall_name);
> ++              break;
> ++      case LTTNG_SYSCALL_ABI_COMPAT:
> ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> ++              break;
> ++      default:
> ++              return -EINVAL;
> +       }
> ++      if (syscall_nr < 0)
> ++              return -ENOENT;
> +
> +-      if (!name) {
> +-              /* Fail if all syscalls are already disabled. */
> +-              if (bitmap_empty(filter->sc, NR_syscalls)
> +-                      && bitmap_empty(filter->sc_compat,
> +-                              NR_compat_syscalls)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> +-              }
> +
> +-              /* Disable all system calls */
> +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> +-              goto apply_filter;
> +-      }
> +-      syscall_nr = get_syscall_nr(name);
> +-      compat_syscall_nr = get_compat_syscall_nr(name);
> +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> +-              ret = -ENOENT;
> +-              goto error;
> +-      }
> +-      if (syscall_nr >= 0) {
> +-              if (!test_bit(syscall_nr, filter->sc)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> ++      switch (event->u.syscall.entryexit) {
> ++      case LTTNG_SYSCALL_ENTRY:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      bitmap = filter->sc_entry;
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      bitmap = filter->sc_compat_entry;
> ++                      break;
> +               }
> +-              bitmap_clear(filter->sc, syscall_nr, 1);
> +-      }
> +-      if (compat_syscall_nr >= 0) {
> +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> +-                      ret = -EEXIST;
> +-                      goto error;
> ++              break;
> ++      case LTTNG_SYSCALL_EXIT:
> ++              switch (event->u.syscall.abi) {
> ++              case LTTNG_SYSCALL_ABI_NATIVE:
> ++                      bitmap = filter->sc_exit;
> ++                      break;
> ++              case LTTNG_SYSCALL_ABI_COMPAT:
> ++                      bitmap = filter->sc_compat_exit;
> ++                      break;
> +               }
> +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> ++              break;
> ++      default:
> ++              return -EINVAL;
> +       }
> +-apply_filter:
> +-      if (!chan->sc_filter)
> +-              rcu_assign_pointer(chan->sc_filter, filter);
> +-      chan->syscall_all = 0;
> +-      return 0;
> ++      if (!test_bit(syscall_nr, bitmap))
> ++              return -EEXIST;
> ++      bitmap_clear(bitmap, syscall_nr, 1);
> +
> +-error:
> +-      if (!chan->sc_filter)
> +-              kfree(filter);
> +-      return ret;
> ++      return 0;
> + }
> +
> + static
> +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> +       .release = seq_release,
> + };
> +
> ++/*
> ++ * A syscall is enabled if it is traced for either entry or exit.
> ++ */
> + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> + {
> +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> +               char state;
> +
> +               if (channel->sc_table) {
> +-                      if (filter)
> +-                              state = test_bit(bit, filter->sc);
> ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> ++                              state = test_bit(bit, filter->sc_entry)
> ++                                      || test_bit(bit, filter->sc_exit);
> +                       else
> +                               state = 1;
> +               } else {
> +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> +               char state;
> +
> +               if (channel->compat_sc_table) {
> +-                      if (filter)
> ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> +-                                              filter->sc_compat);
> ++                                              filter->sc_compat_entry)
> ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> ++                                              filter->sc_compat_exit);
> +                       else
> +                               state = 1;
> +               } else {
> +--
> +2.19.1
> +
> diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> index 0e1a209ce8..e36b327a08 100644
> --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> @@ -11,6 +11,16 @@ include lttng-platforms.inc
>  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
>             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
>             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> +           file://0010-Fix-system-call-filter-table.patch \
>             "
>
>  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
>             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
>             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
>             "
> -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
>  PV_class-devupstream = "2.12.2+git${SRCPV}"
>  S_class-devupstream = "${WORKDIR}/git"
>  SRCREV_FORMAT ?= "lttng_git"
> --
> 2.19.1
>
> 

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-25 16:43   ` Steve Sakoman
@ 2020-09-25 16:52     ` Bruce Ashfield
  2020-09-25 19:48       ` Steve Sakoman
  0 siblings, 1 reply; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-25 16:52 UTC (permalink / raw)
  To: Steve Sakoman
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

On Fri, Sep 25, 2020 at 12:43 PM Steve Sakoman <steve@sakoman.com> wrote:
>
> Dunfell is still at 2.11.2.  Will there be a need for patches to this
> version too?  Or should I take the lttng version bump along with the
> 5.4 version bumps that cause the issue?

I don't see a lot of options on that front. Unless we do some custom backports.

I just checked the lttng 2.11 branch, and the last commit is from January, which
is too old to cover these -stable kernel bump issues.

I can have a go at the backports, but we should be prepared to bend the version
upgrade rule if that gets too complex (and for the record, I've never
had much luck
with lttng fixes).

Bruce


>
> Thanks!
>
> Steve
>
> On Mon, Sep 14, 2020 at 12:34 PM Bruce Ashfield
> <bruce.ashfield@gmail.com> wrote:
> >
> > From: Jens Rehsack <sno@netbsd.org>
> >
> > Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> > them once .3 is released, but for now, we need the fixes to build
> > against the latest 5.4, 5.8 and 5.9 kernels.
> >
> > We also bump the devupstream SRCREV to pickup the same changes.
> >
> > Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> > ---
> >  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
> >  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
> >  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
> >  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
> >  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
> >  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
> >  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
> >  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
> >  ...es-for-ext4_discard_preallocations-a.patch |  52 +
> >  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
> >  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
> >  11 files changed, 1829 insertions(+), 1 deletion(-)
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> >
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > new file mode 100644
> > index 0000000000..ae8bec45de
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > @@ -0,0 +1,54 @@
> > +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> > +From: Beniamin Sandu <beniaminsandu@gmail.com>
> > +Date: Thu, 13 Aug 2020 16:24:39 +0300
> > +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> > + without CONFIG_FTRACE
> > +
> > +When building in-tree, one could disable CONFIG_FTRACE from kernel
> > +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> > +but generate a lot of linker errors like below because it leaves out
> > +other stuff, e.g.:
> > +
> > +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> > +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> > +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> > +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> > +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> > +
> > +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> > +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> > +enabled.
> > +
> > +Steps to reproduce:
> > +
> > +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> > +
> > +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> > +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> > +
> > +- Build will fail at linking stage
> > +
> > +Upstream-Status: Backport
> > +
> > +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +---
> > + Kconfig | 2 +-
> > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > +
> > +diff --git a/Kconfig b/Kconfig
> > +index acdab73..10eccff 100644
> > +--- a/Kconfig
> > ++++ b/Kconfig
> > +@@ -2,7 +2,7 @@
> > +
> > + config LTTNG
> > +       tristate "LTTng support"
> > +-      select TRACEPOINTS
> > ++      select TRACING
> > +       help
> > +         LTTng is an open source tracing framework for Linux.
> > +
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > new file mode 100644
> > index 0000000000..fab673b854
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > @@ -0,0 +1,41 @@
> > +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> > +From: Michael Jeanson <mjeanson@efficios.com>
> > +Date: Mon, 10 Aug 2020 11:22:05 -0400
> > +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> > +
> > +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > +  Date:   Mon Jun 22 13:20:29 2020 -0700
> > +
> > +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> > +
> > +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> > +
> > +Upstream-Status: Backport
> > +
> > +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +---
> > + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> > + 1 file changed, 4 insertions(+)
> > +
> > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > +index 37384a2..5a7ef1e 100644
> > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > +@@ -24,7 +24,11 @@
> > +  */
> > + #include <wrapper/tracepoint.h>
> > +
> > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> > ++#else
> > + #include <../../arch/x86/kvm/mmutrace.h>
> > ++#endif
> > +
> > + #undef TRACE_INCLUDE_PATH
> > + #undef TRACE_INCLUDE_FILE
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > new file mode 100644
> > index 0000000000..524631cc72
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > @@ -0,0 +1,39 @@
> > +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> > +From: Michael Jeanson <mjeanson@efficios.com>
> > +Date: Mon, 10 Aug 2020 11:36:03 -0400
> > +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> > + accessor internal-only (v5.9)
> > +
> > +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > +  Date:   Mon Jun 22 13:20:32 2020 -0700
> > +
> > +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> > +
> > +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> > +    be poking into the gory details of shadow pages.
> > +
> > +Upstream-Status: Backport
> > +
> > +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +---
> > + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> > + 1 file changed, 1 insertion(+)
> > +
> > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > +index 5a7ef1e..8f98186 100644
> > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > +@@ -25,6 +25,7 @@
> > + #include <wrapper/tracepoint.h>
> > +
> > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> > + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> > + #else
> > + #include <../../arch/x86/kvm/mmutrace.h>
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > new file mode 100644
> > index 0000000000..e29c07252c
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > @@ -0,0 +1,84 @@
> > +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> > +From: Michael Jeanson <mjeanson@efficios.com>
> > +Date: Mon, 24 Aug 2020 15:26:04 -0400
> > +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> > + (v5.9)
> > +MIME-Version: 1.0
> > +Content-Type: text/plain; charset=UTF-8
> > +Content-Transfer-Encoding: 8bit
> > +
> > +See upstream commit:
> > +
> > +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> > +  Author: brookxu <brookxu.cn@gmail.com>
> > +  Date:   Mon Aug 17 15:36:15 2020 +0800
> > +
> > +    ext4: limit the length of per-inode prealloc list
> > +
> > +    In the scenario of writing sparse files, the per-inode prealloc list may
> > +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> > +    To circumvent this problem, we limit the maximum length of per-inode
> > +    prealloc list to 512 and allow users to modify it.
> > +
> > +    After patching, we observed that the sys ratio of cpu has dropped, and
> > +    the system throughput has increased significantly. We created a process
> > +    to write the sparse file, and the running time of the process on the
> > +    fixed kernel was significantly reduced, as follows:
> > +
> > +    Running time on unfixed kernel:
> > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > +    real    0m2.051s
> > +    user    0m0.008s
> > +    sys     0m2.026s
> > +
> > +    Running time on fixed kernel:
> > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > +    real    0m0.471s
> > +    user    0m0.004s
> > +    sys     0m0.395s
> > +
> > +Upstream-Status: Backport
> > +
> > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> > +---
> > + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> > + 1 file changed, 15 insertions(+)
> > +
> > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > +index 5f7ab28..72ad4c9 100644
> > +--- a/instrumentation/events/lttng-module/ext4.h
> > ++++ b/instrumentation/events/lttng-module/ext4.h
> > +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > + )
> > + #endif
> > +
> > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > ++
> > ++      TP_ARGS(inode, len, needed),
> > ++
> > ++      TP_FIELDS(
> > ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> > ++              ctf_integer(ino_t, ino, inode->i_ino)
> > ++              ctf_integer(unsigned int, len, len)
> > ++              ctf_integer(unsigned int, needed, needed)
> > ++      )
> > ++)
> > ++#else
> > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > +       TP_PROTO(struct inode *inode),
> > +
> > +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > +               ctf_integer(ino_t, ino, inode->i_ino)
> > +       )
> > + )
> > ++#endif
> > +
> > + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> > +       TP_PROTO(struct super_block *sb, int needed),
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > new file mode 100644
> > index 0000000000..f76e9698c8
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > @@ -0,0 +1,63 @@
> > +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> > +From: Michael Jeanson <mjeanson@efficios.com>
> > +Date: Mon, 24 Aug 2020 15:37:50 -0400
> > +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> > + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> > +MIME-Version: 1.0
> > +Content-Type: text/plain; charset=UTF-8
> > +Content-Transfer-Encoding: 8bit
> > +
> > +See upstream commit:
> > +
> > +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> > +  Author: Theodore Ts'o <tytso@mit.edu>
> > +  Date:   Wed Jul 15 11:48:55 2020 -0400
> > +
> > +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> > +
> > +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> > +    whether a block bitmap is being prefetched.
> > +
> > +Upstream-Status: Backport
> > +
> > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> > +---
> > + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> > + 1 file changed, 14 insertions(+)
> > +
> > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > +index 72ad4c9..4476abb 100644
> > +--- a/instrumentation/events/lttng-module/ext4.h
> > ++++ b/instrumentation/events/lttng-module/ext4.h
> > +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> > +       TP_ARGS(sb, group)
> > + )
> > +
> > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> > ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> > ++
> > ++      TP_ARGS(sb, group, prefetch),
> > ++
> > ++      TP_FIELDS(
> > ++              ctf_integer(dev_t, dev, sb->s_dev)
> > ++              ctf_integer(__u32, group, group)
> > ++              ctf_integer(bool, prefetch, prefetch)
> > ++      )
> > ++)
> > ++#else
> > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> > +
> > +       TP_PROTO(struct super_block *sb, unsigned long group),
> > +
> > +       TP_ARGS(sb, group)
> > + )
> > ++#endif
> > +
> > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> > +
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > new file mode 100644
> > index 0000000000..0970dd30aa
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > @@ -0,0 +1,391 @@
> > +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> > +From: Michael Jeanson <mjeanson@efficios.com>
> > +Date: Tue, 25 Aug 2020 10:56:29 -0400
> > +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> > +
> > +See upstream commits:
> > +
> > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > +  Author: Will Deacon <will@kernel.org>
> > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > +
> > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > +
> > +    In preparation for the removal of lockless_dereference(), which is the
> > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > +    used to head dependency chains on all architectures.
> > +
> > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > +  Author: Will Deacon <will.deacon@arm.com>
> > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > +
> > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > +
> > +    In preparation for the removal of lockless_dereference(), which is the
> > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > +    used to head dependency chains on all architectures.
> > +
> > +Upstream-Status: Backport
> > +
> > +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +---
> > + instrumentation/events/lttng-module/i2c.h |  4 ++--
> > + lib/ringbuffer/backend.h                  |  2 +-
> > + lib/ringbuffer/backend_internal.h         |  2 +-
> > + lib/ringbuffer/frontend.h                 |  4 ++--
> > + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> > + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> > + lttng-events.c                            |  8 ++++----
> > + probes/lttng-kprobes.c                    |  6 +++---
> > + probes/lttng-kretprobes.c                 |  6 +++---
> > + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> > + probes/lttng-uprobes.c                    |  6 +++---
> > + wrapper/compiler.h                        | 18 ++++++++++++++++++
> > + wrapper/trace-clock.h                     | 15 +++++----------
> > + 13 files changed, 51 insertions(+), 38 deletions(-)
> > +
> > +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> > +index dcbabf6..131d134 100644
> > +--- a/instrumentation/events/lttng-module/i2c.h
> > ++++ b/instrumentation/events/lttng-module/i2c.h
> > +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> > +
> > +       TP_code_pre(
> > +               tp_locvar->extract_sensitive_payload =
> > +-                      READ_ONCE(extract_sensitive_payload);
> > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > +       ),
> > +
> > +       TP_FIELDS(
> > +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> > +
> > +       TP_code_pre(
> > +               tp_locvar->extract_sensitive_payload =
> > +-                      READ_ONCE(extract_sensitive_payload);
> > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > +       ),
> > +
> > +       TP_FIELDS(
> > +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> > +index da937f2..43e1d47 100644
> > +--- a/lib/ringbuffer/backend.h
> > ++++ b/lib/ringbuffer/backend.h
> > +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> > +                * Only read source character once, in case it is
> > +                * modified concurrently.
> > +                */
> > +-              c = READ_ONCE(src[count]);
> > ++              c = LTTNG_READ_ONCE(src[count]);
> > +               if (!c)
> > +                       break;
> > +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> > +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> > +index 2d6a345..1226fd8 100644
> > +--- a/lib/ringbuffer/backend_internal.h
> > ++++ b/lib/ringbuffer/backend_internal.h
> > +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> > +        * Performing a volatile access to read the sb_pages, because we want to
> > +        * read a coherent version of the pointer and the associated noref flag.
> > +        */
> > +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> > ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> > +       for (;;) {
> > +               /* This check is called on the fast path for each record. */
> > +               if (likely(!subbuffer_id_is_noref(config, id))) {
> > +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> > +index 6f516d9..41382fe 100644
> > +--- a/lib/ringbuffer/frontend.h
> > ++++ b/lib/ringbuffer/frontend.h
> > +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> > + #define for_each_channel_cpu(cpu, chan)                                       \
> > +       for ((cpu) = -1;                                                \
> > +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> > +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> > ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> > +
> > + extern struct lib_ring_buffer *channel_get_ring_buffer(
> > +                               const struct lib_ring_buffer_config *config,
> > +@@ -155,7 +155,7 @@ static inline
> > + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> > +                                struct lib_ring_buffer *buf)
> > + {
> > +-      int finalized = READ_ONCE(buf->finalized);
> > ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> > +       /*
> > +        * Read finalized before counters.
> > +        */
> > +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> > +index 3cab365..4980d20 100644
> > +--- a/lib/ringbuffer/ring_buffer_frontend.c
> > ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> > +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> > +       int finalized;
> > +
> > + retry:
> > +-      finalized = READ_ONCE(buf->finalized);
> > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > +       /*
> > +        * Read finalized before counters.
> > +        */
> > +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> > +               return -EBUSY;
> > +       }
> > + retry:
> > +-      finalized = READ_ONCE(buf->finalized);
> > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > +       /*
> > +        * Read finalized before counters.
> > +        */
> > +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> > +index d25db72..7b4f20a 100644
> > +--- a/lib/ringbuffer/ring_buffer_iterator.c
> > ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> > +@@ -46,7 +46,7 @@ restart:
> > +       switch (iter->state) {
> > +       case ITER_GET_SUBBUF:
> > +               ret = lib_ring_buffer_get_next_subbuf(buf);
> > +-              if (ret && !READ_ONCE(buf->finalized)
> > ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> > +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> > +                       /*
> > +                        * Use "pull" scheme for global buffers. The reader
> > +diff --git a/lttng-events.c b/lttng-events.c
> > +index be7e389..d719294 100644
> > +--- a/lttng-events.c
> > ++++ b/lttng-events.c
> > +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> > +       size_t len;
> > +       va_list ap;
> > +
> > +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> > ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> > +
> > +       va_start(ap, fmt);
> > +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> > +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> > + {
> > +       int ret = 0;
> > +
> > +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> > ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > +               return 0;
> > +       if (chan->channel_type == METADATA_CHANNEL)
> > +               return 0;
> > +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> > + {
> > +       int ret = 0;
> > +
> > +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> > ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > +               return 0;
> > +
> > +       if (chan->channel_type == METADATA_CHANNEL)
> > +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> > +       struct lttng_event *event;
> > +       int ret = 0;
> > +
> > +-      if (!READ_ONCE(session->active))
> > ++      if (!LTTNG_READ_ONCE(session->active))
> > +               return 0;
> > +
> > +       lttng_metadata_begin(session);
> > +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> > +index a44eaa1..38fb72e 100644
> > +--- a/probes/lttng-kprobes.c
> > ++++ b/probes/lttng-kprobes.c
> > +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> > +       int ret;
> > +       unsigned long data = (unsigned long) p->addr;
> > +
> > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > +               return 0;
> > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > +               return 0;
> > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > +               return 0;
> > +
> > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> > +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> > +index ab98ff2..a6bcd21 100644
> > +--- a/probes/lttng-kretprobes.c
> > ++++ b/probes/lttng-kretprobes.c
> > +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> > +               unsigned long parent_ip;
> > +       } payload;
> > +
> > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > +               return 0;
> > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > +               return 0;
> > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > +               return 0;
> > +
> > +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> > +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> > +index 77b8638..72a669e 100644
> > +--- a/probes/lttng-tracepoint-event-impl.h
> > ++++ b/probes/lttng-tracepoint-event-impl.h
> > +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> > +                                                                             \
> > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > +               return;                                                       \
> > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > +               return;                                                       \
> > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > +               return;                                                       \
> > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > +               return;                                                       \
> > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> > +                                                                             \
> > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > +               return;                                                       \
> > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > +               return;                                                       \
> > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > +               return;                                                       \
> > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > +               return;                                                       \
> > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> > +index bc10128..bda1d9b 100644
> > +--- a/probes/lttng-uprobes.c
> > ++++ b/probes/lttng-uprobes.c
> > +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> > +               unsigned long ip;
> > +       } payload;
> > +
> > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > +               return 0;
> > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > +               return 0;
> > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > +               return 0;
> > +
> > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> > +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> > +index 1496f33..b9f8c51 100644
> > +--- a/wrapper/compiler.h
> > ++++ b/wrapper/compiler.h
> > +@@ -9,6 +9,7 @@
> > + #define _LTTNG_WRAPPER_COMPILER_H
> > +
> > + #include <linux/compiler.h>
> > ++#include <linux/version.h>
> > +
> > + /*
> > +  * Don't allow compiling with buggy compiler.
> > +@@ -39,4 +40,21 @@
> > + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> > + #endif
> > +
> > ++/*
> > ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> > ++ * lockless_dereference(), replicate this behavior on prior kernels
> > ++ * and remove calls to smp_read_barrier_depends which was dropped
> > ++ * in v5.9.
> > ++ */
> > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> > ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> > ++#else
> > ++#define LTTNG_READ_ONCE(x)                    \
> > ++({                                            \
> > ++      typeof(x) __val = READ_ONCE(x);         \
> > ++      smp_read_barrier_depends();             \
> > ++      __val;                                  \
> > ++})
> > ++#endif
> > ++
> > + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> > +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> > +index 9f4e366..187fc82 100644
> > +--- a/wrapper/trace-clock.h
> > ++++ b/wrapper/trace-clock.h
> > +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> > +
> > + static inline u64 trace_clock_read64(void)
> > + {
> > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > +
> > +       if (likely(!ltc)) {
> > +               return trace_clock_read64_monotonic();
> > +       } else {
> > +-              read_barrier_depends(); /* load ltc before content */
> > +               return ltc->read64();
> > +       }
> > + }
> > +
> > + static inline u64 trace_clock_freq(void)
> > + {
> > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > +
> > +       if (!ltc) {
> > +               return trace_clock_freq_monotonic();
> > +       } else {
> > +-              read_barrier_depends(); /* load ltc before content */
> > +               return ltc->freq();
> > +       }
> > + }
> > +
> > + static inline int trace_clock_uuid(char *uuid)
> > + {
> > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > +
> > +-      read_barrier_depends(); /* load ltc before content */
> > +       /* Use default UUID cb when NULL */
> > +       if (!ltc || !ltc->uuid) {
> > +               return trace_clock_uuid_monotonic(uuid);
> > +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> > +
> > + static inline const char *trace_clock_name(void)
> > + {
> > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > +
> > +       if (!ltc) {
> > +               return trace_clock_name_monotonic();
> > +       } else {
> > +-              read_barrier_depends(); /* load ltc before content */
> > +               return ltc->name();
> > +       }
> > + }
> > +
> > + static inline const char *trace_clock_description(void)
> > + {
> > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > +
> > +       if (!ltc) {
> > +               return trace_clock_description_monotonic();
> > +       } else {
> > +-              read_barrier_depends(); /* load ltc before content */
> > +               return ltc->description();
> > +       }
> > + }
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > new file mode 100644
> > index 0000000000..2843c9cb62
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > @@ -0,0 +1,59 @@
> > +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> > +From: Michael Jeanson <mjeanson@efficios.com>
> > +Date: Mon, 31 Aug 2020 11:41:38 -0400
> > +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> > +
> > +See upstream commit:
> > +
> > +  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.
> > +
> > +Upstream-Status: Backport
> > +
> > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> > +---
> > + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> > + 1 file changed, 15 insertions(+), 1 deletion(-)
> > +
> > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > +index affb4eb..ece67ad 100644
> > +--- a/instrumentation/events/lttng-module/writeback.h
> > ++++ b/instrumentation/events/lttng-module/writeback.h
> > +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> > +
> > + #endif
> > +
> > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > ++#define show_inode_state(state)                                       \
> > ++      __print_flags(state, "|",                               \
> > ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> > ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> > ++              {I_NEW,                 "I_NEW"},               \
> > ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> > ++              {I_FREEING,             "I_FREEING"},           \
> > ++              {I_CLEAR,               "I_CLEAR"},             \
> > ++              {I_SYNC,                "I_SYNC"},              \
> > ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> > ++              {I_REFERENCED,          "I_REFERENCED"}         \
> > ++      )
> > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > + #define show_inode_state(state)                                       \
> > +       __print_flags(state, "|",                               \
> > +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > new file mode 100644
> > index 0000000000..7a0d9a38b8
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > @@ -0,0 +1,117 @@
> > +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> > +From: Michael Jeanson <mjeanson@efficios.com>
> > +Date: Mon, 31 Aug 2020 14:16:01 -0400
> > +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> > + processing (v5.9)
> > +
> > +See upstream commit:
> > +
> > +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> > +  Author: Jan Kara <jack@suse.cz>
> > +  Date:   Fri May 29 16:08:58 2020 +0200
> > +
> > +    writeback: Fix sync livelock due to b_dirty_time processing
> > +
> > +    When we are processing writeback for sync(2), move_expired_inodes()
> > +    didn't set any inode expiry value (older_than_this). This can result in
> > +    writeback never completing if there's steady stream of inodes added to
> > +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> > +    round whether there's more work to be done. Fix the problem by using
> > +    sync(2) start time is inode expiry value when processing b_dirty_time
> > +    list similarly as for ordinarily dirtied inodes. This requires some
> > +    refactoring of older_than_this handling which simplifies the code
> > +    noticeably as a bonus.
> > +
> > +Upstream-Status: Backport
> > +
> > +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +---
> > + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> > + 1 file changed, 26 insertions(+), 13 deletions(-)
> > +
> > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > +index ece67ad..e9018dd 100644
> > +--- a/instrumentation/events/lttng-module/writeback.h
> > ++++ b/instrumentation/events/lttng-module/writeback.h
> > +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > + #endif
> > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > +
> > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > ++      TP_PROTO(struct bdi_writeback *wb,
> > ++               struct wb_writeback_work *work,
> > ++               unsigned long dirtied_before,
> > ++               int moved),
> > ++      TP_ARGS(wb, work, dirtied_before, moved),
> > ++      TP_FIELDS(
> > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > ++              ctf_integer(unsigned long, older, dirtied_before)
> > ++              ctf_integer(int, moved, moved)
> > ++      )
> > ++)
> > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > +       TP_PROTO(struct bdi_writeback *wb,
> > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > +                struct wb_writeback_work *work,
> > +-#else
> > +-               unsigned long *older_than_this,
> > +-#endif
> > +                int moved),
> > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > +       TP_ARGS(wb, work, moved),
> > +-#else
> > ++      TP_FIELDS(
> > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > ++              ctf_integer(int, moved, moved)
> > ++      )
> > ++)
> > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > ++      TP_PROTO(struct bdi_writeback *wb,
> > ++               unsigned long *older_than_this,
> > ++               int moved),
> > +       TP_ARGS(wb, older_than_this, moved),
> > +-#endif
> > +       TP_FIELDS(
> > +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > +-#else
> > +               ctf_integer(unsigned long, older,
> > +                       older_than_this ? *older_than_this : 0)
> > +               ctf_integer(long, age,
> > +                       older_than_this ?
> > +                               (jiffies - *older_than_this) * 1000 / HZ
> > +                               : -1)
> > +-#endif
> > +               ctf_integer(int, moved, moved)
> > +       )
> > + )
> > ++#endif
> > +
> > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> > +       )
> > + )
> > +-#else
> > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > +
> > +       writeback_global_dirty_state,
> > +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > +       )
> > + )
> > + #endif
> > +-#endif
> > +
> > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > +
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > new file mode 100644
> > index 0000000000..346e1d63ad
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > @@ -0,0 +1,52 @@
> > +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> > +From: Michael Jeanson <mjeanson@efficios.com>
> > +Date: Fri, 4 Sep 2020 11:52:51 -0400
> > +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> > + writeback_queue_io
> > +
> > +Upstream-Status: Backport
> > +
> > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> > +---
> > + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> > + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> > + 2 files changed, 9 insertions(+), 2 deletions(-)
> > +
> > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > +index 4476abb..b172c8d 100644
> > +--- a/instrumentation/events/lttng-module/ext4.h
> > ++++ b/instrumentation/events/lttng-module/ext4.h
> > +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > + )
> > + #endif
> > +
> > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > +
> > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > +index e9018dd..09637d7 100644
> > +--- a/instrumentation/events/lttng-module/writeback.h
> > ++++ b/instrumentation/events/lttng-module/writeback.h
> > +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > + #endif
> > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > +
> > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> > ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> > ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> > ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> > ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> > ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > +       TP_PROTO(struct bdi_writeback *wb,
> > +                struct wb_writeback_work *work,
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > new file mode 100644
> > index 0000000000..a16750ddb3
> > --- /dev/null
> > +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > @@ -0,0 +1,918 @@
> > +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> > +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +Date: Tue, 28 Jan 2020 16:02:44 -0500
> > +Subject: [PATCH 10/10] Fix: system call filter table
> > +
> > +The system call filter table has effectively been unused for a long
> > +time due to system call name prefix mismatch. This means the overhead of
> > +selective system call tracing was larger than it should have been because
> > +the event payload preparation would be done for all system calls as soon
> > +as a single system call is traced.
> > +
> > +However, fixing this underlying issue unearths several issues that crept
> > +unnoticed when the "enabler" concept was introduced (after the original
> > +implementation of the system call filter table).
> > +
> > +Here is a list of the issues which are resolved here:
> > +
> > +- Split lttng_syscalls_unregister into an unregister and destroy
> > +  function, thus awaiting for a grace period (and therefore quiescence
> > +  of the users) after unregistering the system call tracepoints before
> > +  freeing the system call filter data structures. This effectively fixes
> > +  a use-after-free.
> > +
> > +- The state for enabling "all" system calls vs enabling specific system
> > +  calls (and sequences of enable-disable) was incorrect with respect to
> > +  the "enablers" semantic. This is solved by always tracking the
> > +  bitmap of enabled system calls, and keeping this bitmap even when
> > +  enabling all system calls. The sc_filter is now always allocated
> > +  before system call tracing is registered to tracepoints, which means
> > +  it does not need to be RCU dereferenced anymore.
> > +
> > +Padding fields in the ABI are reserved to select whether to:
> > +
> > +- Trace either native or compat system call (or both, which is the
> > +  behavior currently implemented),
> > +- Trace either system call entry or exit (or both, which is the
> > +  behavior currently implemented),
> > +- Select the system call to trace by name (behavior currently
> > +  implemented) or by system call number,
> > +
> > +Upstream-Status: Backport
> > +
> > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > +---
> > + lttng-abi.c      |  43 ++++++
> > + lttng-abi.h      |  26 ++++
> > + lttng-events.c   | 112 +++++++++++++--
> > + lttng-events.h   |  31 ++++-
> > + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> > + 5 files changed, 380 insertions(+), 180 deletions(-)
> > +
> > +diff --git a/lttng-abi.c b/lttng-abi.c
> > +index 64ea99d..b33879d 100644
> > +--- a/lttng-abi.c
> > ++++ b/lttng-abi.c
> > +@@ -1264,6 +1264,46 @@ nomem:
> > +       return ret;
> > + }
> > +
> > ++static
> > ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> > ++{
> > ++      /* Limit ABI to implemented features. */
> > ++      switch (event_param->instrumentation) {
> > ++      case LTTNG_KERNEL_SYSCALL:
> > ++              switch (event_param->u.syscall.entryexit) {
> > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > ++                      break;
> > ++              default:
> > ++                      return -EINVAL;
> > ++              }
> > ++              switch (event_param->u.syscall.abi) {
> > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > ++                      break;
> > ++              default:
> > ++                      return -EINVAL;
> > ++              }
> > ++              switch (event_param->u.syscall.match) {
> > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > ++                      break;
> > ++              default:
> > ++                      return -EINVAL;
> > ++              }
> > ++              break;
> > ++
> > ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> > ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> > ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> > ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> > ++      case LTTNG_KERNEL_UPROBE:
> > ++              break;
> > ++
> > ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> > ++      default:
> > ++              return -EINVAL;
> > ++      }
> > ++      return 0;
> > ++}
> > ++
> > + static
> > + int lttng_abi_create_event(struct file *channel_file,
> > +                          struct lttng_kernel_event *event_param)
> > +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> > +               ret = -EOVERFLOW;
> > +               goto refcount_error;
> > +       }
> > ++      ret = lttng_abi_validate_event_param(event_param);
> > ++      if (ret)
> > ++              goto event_error;
> > +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> > +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> > +               struct lttng_enabler *enabler;
> > +diff --git a/lttng-abi.h b/lttng-abi.h
> > +index 1d356ab..51d60e5 100644
> > +--- a/lttng-abi.h
> > ++++ b/lttng-abi.h
> > +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> > +       } u;
> > + } __attribute__((packed));
> > +
> > ++enum lttng_kernel_syscall_entryexit {
> > ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> > ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> > ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> > ++};
> > ++
> > ++enum lttng_kernel_syscall_abi {
> > ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> > ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> > ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> > ++};
> > ++
> > ++enum lttng_kernel_syscall_match {
> > ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> > ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> > ++};
> > ++
> > ++struct lttng_kernel_syscall {
> > ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> > ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> > ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> > ++      uint8_t padding;
> > ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> > ++} __attribute__((packed));
> > ++
> > + /*
> > +  * For syscall tracing, name = "*" means "enable all".
> > +  */
> > +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> > +               struct lttng_kernel_kprobe kprobe;
> > +               struct lttng_kernel_function_tracer ftrace;
> > +               struct lttng_kernel_uprobe uprobe;
> > ++              struct lttng_kernel_syscall syscall;
> > +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> > +       } u;
> > + } __attribute__((packed));
> > +diff --git a/lttng-events.c b/lttng-events.c
> > +index d719294..4c0b04a 100644
> > +--- a/lttng-events.c
> > ++++ b/lttng-events.c
> > +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> > +               WARN_ON(ret);
> > +       }
> > +       synchronize_trace();    /* Wait for in-flight events to complete */
> > ++      list_for_each_entry(chan, &session->chan, list) {
> > ++              ret = lttng_syscalls_destroy(chan);
> > ++              WARN_ON(ret);
> > ++      }
> > +       list_for_each_entry_safe(enabler, tmpenabler,
> > +                       &session->enablers_head, node)
> > +               lttng_enabler_destroy(enabler);
> > +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> > +               event->enabled = 0;
> > +               event->registered = 0;
> > +               event->desc = event_desc;
> > ++              switch (event_param->u.syscall.entryexit) {
> > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > ++                      ret = -EINVAL;
> > ++                      goto register_error;
> > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> > ++                      break;
> > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> > ++                      break;
> > ++              }
> > ++              switch (event_param->u.syscall.abi) {
> > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > ++                      ret = -EINVAL;
> > ++                      goto register_error;
> > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> > ++                      break;
> > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> > ++                      break;
> > ++              }
> > +               if (!event->desc) {
> > +                       ret = -EINVAL;
> > +                       goto register_error;
> > +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> > +                                                 event);
> > +               break;
> > +       case LTTNG_KERNEL_SYSCALL:
> > +-              ret = lttng_syscall_filter_enable(event->chan,
> > +-                      desc->name);
> > ++              ret = lttng_syscall_filter_enable(event->chan, event);
> > +               break;
> > +       case LTTNG_KERNEL_KPROBE:
> > +       case LTTNG_KERNEL_UPROBE:
> > +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> > +               ret = 0;
> > +               break;
> > +       case LTTNG_KERNEL_SYSCALL:
> > +-              ret = lttng_syscall_filter_disable(event->chan,
> > +-                      desc->name);
> > ++              ret = lttng_syscall_filter_disable(event->chan, event);
> > +               break;
> > +       case LTTNG_KERNEL_NOOP:
> > +               ret = 0;
> > +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> > +               struct lttng_enabler *enabler)
> > + {
> > +       const char *desc_name, *enabler_name;
> > ++      bool compat = false, entry = false;
> > +
> > +       enabler_name = enabler->event_param.name;
> > +       switch (enabler->event_param.instrumentation) {
> > +       case LTTNG_KERNEL_TRACEPOINT:
> > +               desc_name = desc->name;
> > ++              switch (enabler->type) {
> > ++              case LTTNG_ENABLER_STAR_GLOB:
> > ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > ++              case LTTNG_ENABLER_NAME:
> > ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> > ++              default:
> > ++                      return -EINVAL;
> > ++              }
> > +               break;
> > +       case LTTNG_KERNEL_SYSCALL:
> > +               desc_name = desc->name;
> > +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> > ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> > +                       desc_name += strlen("compat_");
> > ++                      compat = true;
> > ++              }
> > +               if (!strncmp(desc_name, "syscall_exit_",
> > +                               strlen("syscall_exit_"))) {
> > +                       desc_name += strlen("syscall_exit_");
> > +               } else if (!strncmp(desc_name, "syscall_entry_",
> > +                               strlen("syscall_entry_"))) {
> > +                       desc_name += strlen("syscall_entry_");
> > ++                      entry = true;
> > +               } else {
> > +                       WARN_ON_ONCE(1);
> > +                       return -EINVAL;
> > +               }
> > ++              switch (enabler->event_param.u.syscall.entryexit) {
> > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > ++                      break;
> > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > ++                      if (!entry)
> > ++                              return 0;
> > ++                      break;
> > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > ++                      if (entry)
> > ++                              return 0;
> > ++                      break;
> > ++              default:
> > ++                      return -EINVAL;
> > ++              }
> > ++              switch (enabler->event_param.u.syscall.abi) {
> > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > ++                      break;
> > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > ++                      if (compat)
> > ++                              return 0;
> > ++                      break;
> > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > ++                      if (!compat)
> > ++                              return 0;
> > ++                      break;
> > ++              default:
> > ++                      return -EINVAL;
> > ++              }
> > ++              switch (enabler->event_param.u.syscall.match) {
> > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > ++                      switch (enabler->type) {
> > ++                      case LTTNG_ENABLER_STAR_GLOB:
> > ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > ++                      case LTTNG_ENABLER_NAME:
> > ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> > ++                      default:
> > ++                              return -EINVAL;
> > ++                      }
> > ++                      break;
> > ++              case LTTNG_SYSCALL_MATCH_NR:
> > ++                      return -EINVAL; /* Not implemented. */
> > ++              default:
> > ++                      return -EINVAL;
> > ++              }
> > +               break;
> > +       default:
> > +               WARN_ON_ONCE(1);
> > +               return -EINVAL;
> > +       }
> > +-      switch (enabler->type) {
> > +-      case LTTNG_ENABLER_STAR_GLOB:
> > +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > +-      case LTTNG_ENABLER_NAME:
> > +-              return lttng_match_enabler_name(desc_name, enabler_name);
> > +-      default:
> > +-              return -EINVAL;
> > +-      }
> > + }
> > +
> > + static
> > +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> > + static
> > + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> > + {
> > +-      struct lttng_session *session = enabler->chan->session;
> > ++      struct lttng_channel *chan = enabler->chan;
> > ++      struct lttng_session *session = chan->session;
> > +       struct lttng_event *event;
> > +
> > ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> > ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> > ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> > ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> > ++                      !strcmp(enabler->event_param.name, "*")) {
> > ++              if (enabler->enabled)
> > ++                      WRITE_ONCE(chan->syscall_all, 1);
> > ++              else
> > ++                      WRITE_ONCE(chan->syscall_all, 0);
> > ++      }
> > ++
> > +       /* First ensure that probe events are created for this enabler. */
> > +       lttng_create_event_if_missing(enabler);
> > +
> > +diff --git a/lttng-events.h b/lttng-events.h
> > +index a36a312..d4d9976 100644
> > +--- a/lttng-events.h
> > ++++ b/lttng-events.h
> > +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> > +       struct list_head node;
> > + };
> > +
> > ++enum lttng_syscall_entryexit {
> > ++      LTTNG_SYSCALL_ENTRY,
> > ++      LTTNG_SYSCALL_EXIT,
> > ++};
> > ++
> > ++enum lttng_syscall_abi {
> > ++      LTTNG_SYSCALL_ABI_NATIVE,
> > ++      LTTNG_SYSCALL_ABI_COMPAT,
> > ++};
> > ++
> > + /*
> > +  * lttng_event structure is referred to by the tracing fast path. It must be
> > +  * kept small.
> > +@@ -318,6 +328,11 @@ struct lttng_event {
> > +                       struct inode *inode;
> > +                       struct list_head head;
> > +               } uprobe;
> > ++              struct {
> > ++                      char *syscall_name;
> > ++                      enum lttng_syscall_entryexit entryexit;
> > ++                      enum lttng_syscall_abi abi;
> > ++              } syscall;
> > +       } u;
> > +       struct list_head list;          /* Event list in session */
> > +       unsigned int metadata_dumped:1;
> > +@@ -457,10 +472,10 @@ struct lttng_channel {
> > +       struct lttng_syscall_filter *sc_filter;
> > +       int header_type;                /* 0: unset, 1: compact, 2: large */
> > +       enum channel_type channel_type;
> > ++      int syscall_all;
> > +       unsigned int metadata_dumped:1,
> > +               sys_enter_registered:1,
> > +               sys_exit_registered:1,
> > +-              syscall_all:1,
> > +               tstate:1;               /* Transient enable state */
> > + };
> > +
> > +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> > + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> > + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> > + int lttng_syscalls_unregister(struct lttng_channel *chan);
> > ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> > + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > +-              const char *name);
> > ++              struct lttng_event *event);
> > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > +-              const char *name);
> > ++              struct lttng_event *event);
> > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> > + #else
> > +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> > +       return 0;
> > + }
> > +
> > ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> > ++{
> > ++      return 0;
> > ++}
> > ++
> > + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > +-              const char *name)
> > ++              struct lttng_event *event);
> > + {
> > +       return -ENOSYS;
> > + }
> > +
> > + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > +-              const char *name)
> > ++              struct lttng_event *event);
> > + {
> > +       return -ENOSYS;
> > + }
> > +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> > +index 97f1ba9..26cead6 100644
> > +--- a/lttng-syscalls.c
> > ++++ b/lttng-syscalls.c
> > +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> > + #undef CREATE_SYSCALL_TABLE
> > +
> > + struct lttng_syscall_filter {
> > +-      DECLARE_BITMAP(sc, NR_syscalls);
> > +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> > ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> > ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> > ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> > ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> > + };
> > +
> > + static void syscall_entry_unknown(struct lttng_event *event,
> > +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> > +       size_t table_len;
> > +
> > +       if (unlikely(in_compat_syscall())) {
> > +-              struct lttng_syscall_filter *filter;
> > +-
> > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > +-              if (filter) {
> > +-                      if (id < 0 || id >= NR_compat_syscalls
> > +-                              || !test_bit(id, filter->sc_compat)) {
> > +-                              /* System call filtered out. */
> > +-                              return;
> > +-                      }
> > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > ++
> > ++              if (id < 0 || id >= NR_compat_syscalls
> > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> > ++                      /* System call filtered out. */
> > ++                      return;
> > +               }
> > +               table = compat_sc_table;
> > +               table_len = ARRAY_SIZE(compat_sc_table);
> > +               unknown_event = chan->sc_compat_unknown;
> > +       } else {
> > +-              struct lttng_syscall_filter *filter;
> > +-
> > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > +-              if (filter) {
> > +-                      if (id < 0 || id >= NR_syscalls
> > +-                              || !test_bit(id, filter->sc)) {
> > +-                              /* System call filtered out. */
> > +-                              return;
> > +-                      }
> > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > ++
> > ++              if (id < 0 || id >= NR_syscalls
> > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> > ++                      /* System call filtered out. */
> > ++                      return;
> > +               }
> > +               table = sc_table;
> > +               table_len = ARRAY_SIZE(sc_table);
> > +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> > +
> > +       id = syscall_get_nr(current, regs);
> > +       if (unlikely(in_compat_syscall())) {
> > +-              struct lttng_syscall_filter *filter;
> > +-
> > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > +-              if (filter) {
> > +-                      if (id < 0 || id >= NR_compat_syscalls
> > +-                              || !test_bit(id, filter->sc_compat)) {
> > +-                              /* System call filtered out. */
> > +-                              return;
> > +-                      }
> > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > ++
> > ++              if (id < 0 || id >= NR_compat_syscalls
> > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> > ++                      /* System call filtered out. */
> > ++                      return;
> > +               }
> > +               table = compat_sc_exit_table;
> > +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> > +               unknown_event = chan->compat_sc_exit_unknown;
> > +       } else {
> > +-              struct lttng_syscall_filter *filter;
> > +-
> > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > +-              if (filter) {
> > +-                      if (id < 0 || id >= NR_syscalls
> > +-                              || !test_bit(id, filter->sc)) {
> > +-                              /* System call filtered out. */
> > +-                              return;
> > +-                      }
> > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > ++
> > ++              if (id < 0 || id >= NR_syscalls
> > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> > ++                      /* System call filtered out. */
> > ++                      return;
> > +               }
> > +               table = sc_exit_table;
> > +               table_len = ARRAY_SIZE(sc_exit_table);
> > +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> > +               memset(&ev, 0, sizeof(ev));
> > +               switch (type) {
> > +               case SC_TYPE_ENTRY:
> > +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > +                       break;
> > +               case SC_TYPE_EXIT:
> > +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > +                       break;
> > +               case SC_TYPE_COMPAT_ENTRY:
> > +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > +                       break;
> > +               case SC_TYPE_COMPAT_EXIT:
> > +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > +-                      break;
> > +-              default:
> > +-                      BUG_ON(1);
> > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > +                       break;
> > +               }
> > +-              strncat(ev.name, desc->name,
> > +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> > ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> > +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> > +                                               desc,
> > +                                               ev.instrumentation);
> > +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> > +                                               desc,
> > +                                               ev.instrumentation);
> > +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> > +                                               filter, desc,
> > +                                               ev.instrumentation);
> > +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> > +                                               desc, ev.instrumentation);
> > +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> > +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > +       if (ret)
> > +               return ret;
> > + #endif
> > ++
> > ++      if (!chan->sc_filter) {
> > ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > ++                              GFP_KERNEL);
> > ++              if (!chan->sc_filter)
> > ++                      return -ENOMEM;
> > ++      }
> > ++
> > +       if (!chan->sys_enter_registered) {
> > +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> > +                               (void *) syscall_entry_probe, chan);
> > +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> > +                       return ret;
> > +               chan->sys_exit_registered = 0;
> > +       }
> > +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> > ++      return 0;
> > ++}
> > ++
> > ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> > ++{
> > +       kfree(chan->sc_table);
> > +       kfree(chan->sc_exit_table);
> > + #ifdef CONFIG_COMPAT
> > +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> > +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> > + }
> > +
> > +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > +-              const char *name)
> > ++static
> > ++const char *get_syscall_name(struct lttng_event *event)
> > + {
> > +-      int syscall_nr, compat_syscall_nr, ret;
> > +-      struct lttng_syscall_filter *filter;
> > ++      size_t prefix_len = 0;
> > +
> > +-      WARN_ON_ONCE(!chan->sc_table);
> > ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> > +
> > +-      if (!name) {
> > +-              /* Enable all system calls by removing filter */
> > +-              if (chan->sc_filter) {
> > +-                      filter = chan->sc_filter;
> > +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> > +-                      synchronize_trace();
> > +-                      kfree(filter);
> > ++      switch (event->u.syscall.entryexit) {
> > ++      case LTTNG_SYSCALL_ENTRY:
> > ++              switch (event->u.syscall.abi) {
> > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> > ++                      break;
> > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> > ++                      break;
> > +               }
> > +-              chan->syscall_all = 1;
> > +-              return 0;
> > +-      }
> > +-
> > +-      if (!chan->sc_filter) {
> > +-              if (chan->syscall_all) {
> > +-                      /*
> > +-                       * All syscalls are already enabled.
> > +-                       */
> > +-                      return -EEXIST;
> > ++              break;
> > ++      case LTTNG_SYSCALL_EXIT:
> > ++              switch (event->u.syscall.abi) {
> > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> > ++                      break;
> > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> > ++                      break;
> > +               }
> > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > +-                              GFP_KERNEL);
> > +-              if (!filter)
> > +-                      return -ENOMEM;
> > +-      } else {
> > +-              filter = chan->sc_filter;
> > ++              break;
> > +       }
> > +-      syscall_nr = get_syscall_nr(name);
> > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > +-              ret = -ENOENT;
> > +-              goto error;
> > ++      WARN_ON_ONCE(prefix_len == 0);
> > ++      return event->desc->name + prefix_len;
> > ++}
> > ++
> > ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > ++              struct lttng_event *event)
> > ++{
> > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > ++      const char *syscall_name;
> > ++      unsigned long *bitmap;
> > ++      int syscall_nr;
> > ++
> > ++      WARN_ON_ONCE(!chan->sc_table);
> > ++
> > ++      syscall_name = get_syscall_name(event);
> > ++
> > ++      switch (event->u.syscall.abi) {
> > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > ++              syscall_nr = get_syscall_nr(syscall_name);
> > ++              break;
> > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > ++              break;
> > ++      default:
> > ++              return -EINVAL;
> > +       }
> > +-      if (syscall_nr >= 0) {
> > +-              if (test_bit(syscall_nr, filter->sc)) {
> > +-                      ret = -EEXIST;
> > +-                      goto error;
> > ++      if (syscall_nr < 0)
> > ++              return -ENOENT;
> > ++
> > ++
> > ++      switch (event->u.syscall.entryexit) {
> > ++      case LTTNG_SYSCALL_ENTRY:
> > ++              switch (event->u.syscall.abi) {
> > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > ++                      bitmap = filter->sc_entry;
> > ++                      break;
> > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > ++                      bitmap = filter->sc_compat_entry;
> > ++                      break;
> > +               }
> > +-              bitmap_set(filter->sc, syscall_nr, 1);
> > +-      }
> > +-      if (compat_syscall_nr >= 0) {
> > +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> > +-                      ret = -EEXIST;
> > +-                      goto error;
> > ++              break;
> > ++      case LTTNG_SYSCALL_EXIT:
> > ++              switch (event->u.syscall.abi) {
> > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > ++                      bitmap = filter->sc_exit;
> > ++                      break;
> > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > ++                      bitmap = filter->sc_compat_exit;
> > ++                      break;
> > +               }
> > +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> > ++              break;
> > ++      default:
> > ++              return -EINVAL;
> > +       }
> > +-      if (!chan->sc_filter)
> > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > ++      if (test_bit(syscall_nr, bitmap))
> > ++              return -EEXIST;
> > ++      bitmap_set(bitmap, syscall_nr, 1);
> > +       return 0;
> > +-
> > +-error:
> > +-      if (!chan->sc_filter)
> > +-              kfree(filter);
> > +-      return ret;
> > + }
> > +
> > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > +-              const char *name)
> > ++              struct lttng_event *event)
> > + {
> > +-      int syscall_nr, compat_syscall_nr, ret;
> > +-      struct lttng_syscall_filter *filter;
> > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > ++      const char *syscall_name;
> > ++      unsigned long *bitmap;
> > ++      int syscall_nr;
> > +
> > +       WARN_ON_ONCE(!chan->sc_table);
> > +
> > +-      if (!chan->sc_filter) {
> > +-              if (!chan->syscall_all)
> > +-                      return -EEXIST;
> > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > +-                              GFP_KERNEL);
> > +-              if (!filter)
> > +-                      return -ENOMEM;
> > +-              /* Trace all system calls, then apply disable. */
> > +-              bitmap_set(filter->sc, 0, NR_syscalls);
> > +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> > +-      } else {
> > +-              filter = chan->sc_filter;
> > ++      syscall_name = get_syscall_name(event);
> > ++
> > ++      switch (event->u.syscall.abi) {
> > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > ++              syscall_nr = get_syscall_nr(syscall_name);
> > ++              break;
> > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > ++              break;
> > ++      default:
> > ++              return -EINVAL;
> > +       }
> > ++      if (syscall_nr < 0)
> > ++              return -ENOENT;
> > +
> > +-      if (!name) {
> > +-              /* Fail if all syscalls are already disabled. */
> > +-              if (bitmap_empty(filter->sc, NR_syscalls)
> > +-                      && bitmap_empty(filter->sc_compat,
> > +-                              NR_compat_syscalls)) {
> > +-                      ret = -EEXIST;
> > +-                      goto error;
> > +-              }
> > +
> > +-              /* Disable all system calls */
> > +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> > +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> > +-              goto apply_filter;
> > +-      }
> > +-      syscall_nr = get_syscall_nr(name);
> > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > +-              ret = -ENOENT;
> > +-              goto error;
> > +-      }
> > +-      if (syscall_nr >= 0) {
> > +-              if (!test_bit(syscall_nr, filter->sc)) {
> > +-                      ret = -EEXIST;
> > +-                      goto error;
> > ++      switch (event->u.syscall.entryexit) {
> > ++      case LTTNG_SYSCALL_ENTRY:
> > ++              switch (event->u.syscall.abi) {
> > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > ++                      bitmap = filter->sc_entry;
> > ++                      break;
> > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > ++                      bitmap = filter->sc_compat_entry;
> > ++                      break;
> > +               }
> > +-              bitmap_clear(filter->sc, syscall_nr, 1);
> > +-      }
> > +-      if (compat_syscall_nr >= 0) {
> > +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> > +-                      ret = -EEXIST;
> > +-                      goto error;
> > ++              break;
> > ++      case LTTNG_SYSCALL_EXIT:
> > ++              switch (event->u.syscall.abi) {
> > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > ++                      bitmap = filter->sc_exit;
> > ++                      break;
> > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > ++                      bitmap = filter->sc_compat_exit;
> > ++                      break;
> > +               }
> > +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> > ++              break;
> > ++      default:
> > ++              return -EINVAL;
> > +       }
> > +-apply_filter:
> > +-      if (!chan->sc_filter)
> > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > +-      chan->syscall_all = 0;
> > +-      return 0;
> > ++      if (!test_bit(syscall_nr, bitmap))
> > ++              return -EEXIST;
> > ++      bitmap_clear(bitmap, syscall_nr, 1);
> > +
> > +-error:
> > +-      if (!chan->sc_filter)
> > +-              kfree(filter);
> > +-      return ret;
> > ++      return 0;
> > + }
> > +
> > + static
> > +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> > +       .release = seq_release,
> > + };
> > +
> > ++/*
> > ++ * A syscall is enabled if it is traced for either entry or exit.
> > ++ */
> > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> > + {
> > +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > +               char state;
> > +
> > +               if (channel->sc_table) {
> > +-                      if (filter)
> > +-                              state = test_bit(bit, filter->sc);
> > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > ++                              state = test_bit(bit, filter->sc_entry)
> > ++                                      || test_bit(bit, filter->sc_exit);
> > +                       else
> > +                               state = 1;
> > +               } else {
> > +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > +               char state;
> > +
> > +               if (channel->compat_sc_table) {
> > +-                      if (filter)
> > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> > +-                                              filter->sc_compat);
> > ++                                              filter->sc_compat_entry)
> > ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> > ++                                              filter->sc_compat_exit);
> > +                       else
> > +                               state = 1;
> > +               } else {
> > +--
> > +2.19.1
> > +
> > diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > index 0e1a209ce8..e36b327a08 100644
> > --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > @@ -11,6 +11,16 @@ include lttng-platforms.inc
> >  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
> >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> > +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> > +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> > +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> > +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> > +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> > +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> > +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> > +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> > +           file://0010-Fix-system-call-filter-table.patch \
> >             "
> >
> >  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> > @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
> >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> >             "
> > -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> > +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
> >  PV_class-devupstream = "2.12.2+git${SRCPV}"
> >  S_class-devupstream = "${WORKDIR}/git"
> >  SRCREV_FORMAT ?= "lttng_git"
> > --
> > 2.19.1
> >
> > 



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-25 16:52     ` Bruce Ashfield
@ 2020-09-25 19:48       ` Steve Sakoman
  2020-09-27 21:18         ` Bruce Ashfield
       [not found]         ` <1638C0AFDA43827E.8201@lists.openembedded.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Steve Sakoman @ 2020-09-25 19:48 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

On Fri, Sep 25, 2020 at 6:52 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
>
> On Fri, Sep 25, 2020 at 12:43 PM Steve Sakoman <steve@sakoman.com> wrote:
> >
> > Dunfell is still at 2.11.2.  Will there be a need for patches to this
> > version too?  Or should I take the lttng version bump along with the
> > 5.4 version bumps that cause the issue?
>
> I don't see a lot of options on that front. Unless we do some custom backports.
>
> I just checked the lttng 2.11 branch, and the last commit is from January, which
> is too old to cover these -stable kernel bump issues.
>
> I can have a go at the backports, but we should be prepared to bend the version
> upgrade rule if that gets too complex (and for the record, I've never
> had much luck
> with lttng fixes).

Totally understood!  I think this is likely one of those cases where
we'll have to take an exception to the upgrade rule.

If you see issues with a backport just let me know and I'll go with
the version upgrade approach.

While I have your attention, what about "linux-yocto/config:
netfilter: Enable nat for ipv4 and ipv6" for dunfell?  I'll have to
prune out the changes for 5.8 in the commit, but does it make sense
for 5.4?

Thanks!

Steve


 >
> > On Mon, Sep 14, 2020 at 12:34 PM Bruce Ashfield
> > <bruce.ashfield@gmail.com> wrote:
> > >
> > > From: Jens Rehsack <sno@netbsd.org>
> > >
> > > Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> > > them once .3 is released, but for now, we need the fixes to build
> > > against the latest 5.4, 5.8 and 5.9 kernels.
> > >
> > > We also bump the devupstream SRCREV to pickup the same changes.
> > >
> > > Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> > > ---
> > >  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
> > >  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
> > >  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
> > >  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
> > >  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
> > >  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
> > >  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
> > >  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
> > >  ...es-for-ext4_discard_preallocations-a.patch |  52 +
> > >  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
> > >  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
> > >  11 files changed, 1829 insertions(+), 1 deletion(-)
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > >
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > new file mode 100644
> > > index 0000000000..ae8bec45de
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > @@ -0,0 +1,54 @@
> > > +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> > > +From: Beniamin Sandu <beniaminsandu@gmail.com>
> > > +Date: Thu, 13 Aug 2020 16:24:39 +0300
> > > +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> > > + without CONFIG_FTRACE
> > > +
> > > +When building in-tree, one could disable CONFIG_FTRACE from kernel
> > > +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> > > +but generate a lot of linker errors like below because it leaves out
> > > +other stuff, e.g.:
> > > +
> > > +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> > > +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> > > +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> > > +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> > > +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> > > +
> > > +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> > > +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> > > +enabled.
> > > +
> > > +Steps to reproduce:
> > > +
> > > +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> > > +
> > > +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> > > +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> > > +
> > > +- Build will fail at linking stage
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +---
> > > + Kconfig | 2 +-
> > > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > > +
> > > +diff --git a/Kconfig b/Kconfig
> > > +index acdab73..10eccff 100644
> > > +--- a/Kconfig
> > > ++++ b/Kconfig
> > > +@@ -2,7 +2,7 @@
> > > +
> > > + config LTTNG
> > > +       tristate "LTTng support"
> > > +-      select TRACEPOINTS
> > > ++      select TRACING
> > > +       help
> > > +         LTTng is an open source tracing framework for Linux.
> > > +
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > new file mode 100644
> > > index 0000000000..fab673b854
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > @@ -0,0 +1,41 @@
> > > +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > +Date: Mon, 10 Aug 2020 11:22:05 -0400
> > > +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> > > +
> > > +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > +  Date:   Mon Jun 22 13:20:29 2020 -0700
> > > +
> > > +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> > > +
> > > +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +---
> > > + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> > > + 1 file changed, 4 insertions(+)
> > > +
> > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > +index 37384a2..5a7ef1e 100644
> > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > +@@ -24,7 +24,11 @@
> > > +  */
> > > + #include <wrapper/tracepoint.h>
> > > +
> > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > ++#else
> > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > ++#endif
> > > +
> > > + #undef TRACE_INCLUDE_PATH
> > > + #undef TRACE_INCLUDE_FILE
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > new file mode 100644
> > > index 0000000000..524631cc72
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > @@ -0,0 +1,39 @@
> > > +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > +Date: Mon, 10 Aug 2020 11:36:03 -0400
> > > +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> > > + accessor internal-only (v5.9)
> > > +
> > > +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > +  Date:   Mon Jun 22 13:20:32 2020 -0700
> > > +
> > > +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> > > +
> > > +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> > > +    be poking into the gory details of shadow pages.
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +---
> > > + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> > > + 1 file changed, 1 insertion(+)
> > > +
> > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > +index 5a7ef1e..8f98186 100644
> > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > +@@ -25,6 +25,7 @@
> > > + #include <wrapper/tracepoint.h>
> > > +
> > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> > > + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > + #else
> > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > new file mode 100644
> > > index 0000000000..e29c07252c
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > @@ -0,0 +1,84 @@
> > > +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > +Date: Mon, 24 Aug 2020 15:26:04 -0400
> > > +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> > > + (v5.9)
> > > +MIME-Version: 1.0
> > > +Content-Type: text/plain; charset=UTF-8
> > > +Content-Transfer-Encoding: 8bit
> > > +
> > > +See upstream commit:
> > > +
> > > +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> > > +  Author: brookxu <brookxu.cn@gmail.com>
> > > +  Date:   Mon Aug 17 15:36:15 2020 +0800
> > > +
> > > +    ext4: limit the length of per-inode prealloc list
> > > +
> > > +    In the scenario of writing sparse files, the per-inode prealloc list may
> > > +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> > > +    To circumvent this problem, we limit the maximum length of per-inode
> > > +    prealloc list to 512 and allow users to modify it.
> > > +
> > > +    After patching, we observed that the sys ratio of cpu has dropped, and
> > > +    the system throughput has increased significantly. We created a process
> > > +    to write the sparse file, and the running time of the process on the
> > > +    fixed kernel was significantly reduced, as follows:
> > > +
> > > +    Running time on unfixed kernel:
> > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > +    real    0m2.051s
> > > +    user    0m0.008s
> > > +    sys     0m2.026s
> > > +
> > > +    Running time on fixed kernel:
> > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > +    real    0m0.471s
> > > +    user    0m0.004s
> > > +    sys     0m0.395s
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> > > +---
> > > + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> > > + 1 file changed, 15 insertions(+)
> > > +
> > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > +index 5f7ab28..72ad4c9 100644
> > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > + )
> > > + #endif
> > > +
> > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > ++
> > > ++      TP_ARGS(inode, len, needed),
> > > ++
> > > ++      TP_FIELDS(
> > > ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> > > ++              ctf_integer(ino_t, ino, inode->i_ino)
> > > ++              ctf_integer(unsigned int, len, len)
> > > ++              ctf_integer(unsigned int, needed, needed)
> > > ++      )
> > > ++)
> > > ++#else
> > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > +       TP_PROTO(struct inode *inode),
> > > +
> > > +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > +               ctf_integer(ino_t, ino, inode->i_ino)
> > > +       )
> > > + )
> > > ++#endif
> > > +
> > > + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> > > +       TP_PROTO(struct super_block *sb, int needed),
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > new file mode 100644
> > > index 0000000000..f76e9698c8
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > @@ -0,0 +1,63 @@
> > > +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > +Date: Mon, 24 Aug 2020 15:37:50 -0400
> > > +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> > > + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> > > +MIME-Version: 1.0
> > > +Content-Type: text/plain; charset=UTF-8
> > > +Content-Transfer-Encoding: 8bit
> > > +
> > > +See upstream commit:
> > > +
> > > +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> > > +  Author: Theodore Ts'o <tytso@mit.edu>
> > > +  Date:   Wed Jul 15 11:48:55 2020 -0400
> > > +
> > > +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> > > +
> > > +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> > > +    whether a block bitmap is being prefetched.
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> > > +---
> > > + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> > > + 1 file changed, 14 insertions(+)
> > > +
> > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > +index 72ad4c9..4476abb 100644
> > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> > > +       TP_ARGS(sb, group)
> > > + )
> > > +
> > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> > > ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> > > ++
> > > ++      TP_ARGS(sb, group, prefetch),
> > > ++
> > > ++      TP_FIELDS(
> > > ++              ctf_integer(dev_t, dev, sb->s_dev)
> > > ++              ctf_integer(__u32, group, group)
> > > ++              ctf_integer(bool, prefetch, prefetch)
> > > ++      )
> > > ++)
> > > ++#else
> > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> > > +
> > > +       TP_PROTO(struct super_block *sb, unsigned long group),
> > > +
> > > +       TP_ARGS(sb, group)
> > > + )
> > > ++#endif
> > > +
> > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> > > +
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > new file mode 100644
> > > index 0000000000..0970dd30aa
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > @@ -0,0 +1,391 @@
> > > +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > +Date: Tue, 25 Aug 2020 10:56:29 -0400
> > > +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> > > +
> > > +See upstream commits:
> > > +
> > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > +  Author: Will Deacon <will@kernel.org>
> > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > +
> > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > +
> > > +    In preparation for the removal of lockless_dereference(), which is the
> > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > +    used to head dependency chains on all architectures.
> > > +
> > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > +  Author: Will Deacon <will.deacon@arm.com>
> > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > +
> > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > +
> > > +    In preparation for the removal of lockless_dereference(), which is the
> > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > +    used to head dependency chains on all architectures.
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +---
> > > + instrumentation/events/lttng-module/i2c.h |  4 ++--
> > > + lib/ringbuffer/backend.h                  |  2 +-
> > > + lib/ringbuffer/backend_internal.h         |  2 +-
> > > + lib/ringbuffer/frontend.h                 |  4 ++--
> > > + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> > > + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> > > + lttng-events.c                            |  8 ++++----
> > > + probes/lttng-kprobes.c                    |  6 +++---
> > > + probes/lttng-kretprobes.c                 |  6 +++---
> > > + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> > > + probes/lttng-uprobes.c                    |  6 +++---
> > > + wrapper/compiler.h                        | 18 ++++++++++++++++++
> > > + wrapper/trace-clock.h                     | 15 +++++----------
> > > + 13 files changed, 51 insertions(+), 38 deletions(-)
> > > +
> > > +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> > > +index dcbabf6..131d134 100644
> > > +--- a/instrumentation/events/lttng-module/i2c.h
> > > ++++ b/instrumentation/events/lttng-module/i2c.h
> > > +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> > > +
> > > +       TP_code_pre(
> > > +               tp_locvar->extract_sensitive_payload =
> > > +-                      READ_ONCE(extract_sensitive_payload);
> > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > +       ),
> > > +
> > > +       TP_FIELDS(
> > > +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> > > +
> > > +       TP_code_pre(
> > > +               tp_locvar->extract_sensitive_payload =
> > > +-                      READ_ONCE(extract_sensitive_payload);
> > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > +       ),
> > > +
> > > +       TP_FIELDS(
> > > +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> > > +index da937f2..43e1d47 100644
> > > +--- a/lib/ringbuffer/backend.h
> > > ++++ b/lib/ringbuffer/backend.h
> > > +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> > > +                * Only read source character once, in case it is
> > > +                * modified concurrently.
> > > +                */
> > > +-              c = READ_ONCE(src[count]);
> > > ++              c = LTTNG_READ_ONCE(src[count]);
> > > +               if (!c)
> > > +                       break;
> > > +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> > > +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> > > +index 2d6a345..1226fd8 100644
> > > +--- a/lib/ringbuffer/backend_internal.h
> > > ++++ b/lib/ringbuffer/backend_internal.h
> > > +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> > > +        * Performing a volatile access to read the sb_pages, because we want to
> > > +        * read a coherent version of the pointer and the associated noref flag.
> > > +        */
> > > +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> > > ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> > > +       for (;;) {
> > > +               /* This check is called on the fast path for each record. */
> > > +               if (likely(!subbuffer_id_is_noref(config, id))) {
> > > +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> > > +index 6f516d9..41382fe 100644
> > > +--- a/lib/ringbuffer/frontend.h
> > > ++++ b/lib/ringbuffer/frontend.h
> > > +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> > > + #define for_each_channel_cpu(cpu, chan)                                       \
> > > +       for ((cpu) = -1;                                                \
> > > +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> > > +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> > > ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> > > +
> > > + extern struct lib_ring_buffer *channel_get_ring_buffer(
> > > +                               const struct lib_ring_buffer_config *config,
> > > +@@ -155,7 +155,7 @@ static inline
> > > + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> > > +                                struct lib_ring_buffer *buf)
> > > + {
> > > +-      int finalized = READ_ONCE(buf->finalized);
> > > ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> > > +       /*
> > > +        * Read finalized before counters.
> > > +        */
> > > +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> > > +index 3cab365..4980d20 100644
> > > +--- a/lib/ringbuffer/ring_buffer_frontend.c
> > > ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> > > +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> > > +       int finalized;
> > > +
> > > + retry:
> > > +-      finalized = READ_ONCE(buf->finalized);
> > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > +       /*
> > > +        * Read finalized before counters.
> > > +        */
> > > +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> > > +               return -EBUSY;
> > > +       }
> > > + retry:
> > > +-      finalized = READ_ONCE(buf->finalized);
> > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > +       /*
> > > +        * Read finalized before counters.
> > > +        */
> > > +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> > > +index d25db72..7b4f20a 100644
> > > +--- a/lib/ringbuffer/ring_buffer_iterator.c
> > > ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> > > +@@ -46,7 +46,7 @@ restart:
> > > +       switch (iter->state) {
> > > +       case ITER_GET_SUBBUF:
> > > +               ret = lib_ring_buffer_get_next_subbuf(buf);
> > > +-              if (ret && !READ_ONCE(buf->finalized)
> > > ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> > > +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> > > +                       /*
> > > +                        * Use "pull" scheme for global buffers. The reader
> > > +diff --git a/lttng-events.c b/lttng-events.c
> > > +index be7e389..d719294 100644
> > > +--- a/lttng-events.c
> > > ++++ b/lttng-events.c
> > > +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> > > +       size_t len;
> > > +       va_list ap;
> > > +
> > > +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> > > ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> > > +
> > > +       va_start(ap, fmt);
> > > +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> > > +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> > > + {
> > > +       int ret = 0;
> > > +
> > > +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> > > ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > +               return 0;
> > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > +               return 0;
> > > +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> > > + {
> > > +       int ret = 0;
> > > +
> > > +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> > > ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > +               return 0;
> > > +
> > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> > > +       struct lttng_event *event;
> > > +       int ret = 0;
> > > +
> > > +-      if (!READ_ONCE(session->active))
> > > ++      if (!LTTNG_READ_ONCE(session->active))
> > > +               return 0;
> > > +
> > > +       lttng_metadata_begin(session);
> > > +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> > > +index a44eaa1..38fb72e 100644
> > > +--- a/probes/lttng-kprobes.c
> > > ++++ b/probes/lttng-kprobes.c
> > > +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> > > +       int ret;
> > > +       unsigned long data = (unsigned long) p->addr;
> > > +
> > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > +               return 0;
> > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > +               return 0;
> > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > +               return 0;
> > > +
> > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> > > +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> > > +index ab98ff2..a6bcd21 100644
> > > +--- a/probes/lttng-kretprobes.c
> > > ++++ b/probes/lttng-kretprobes.c
> > > +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> > > +               unsigned long parent_ip;
> > > +       } payload;
> > > +
> > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > +               return 0;
> > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > +               return 0;
> > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > +               return 0;
> > > +
> > > +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> > > +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> > > +index 77b8638..72a669e 100644
> > > +--- a/probes/lttng-tracepoint-event-impl.h
> > > ++++ b/probes/lttng-tracepoint-event-impl.h
> > > +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> > > +                                                                             \
> > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > +               return;                                                       \
> > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > +               return;                                                       \
> > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > +               return;                                                       \
> > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > +               return;                                                       \
> > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> > > +                                                                             \
> > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > +               return;                                                       \
> > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > +               return;                                                       \
> > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > +               return;                                                       \
> > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > +               return;                                                       \
> > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> > > +index bc10128..bda1d9b 100644
> > > +--- a/probes/lttng-uprobes.c
> > > ++++ b/probes/lttng-uprobes.c
> > > +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> > > +               unsigned long ip;
> > > +       } payload;
> > > +
> > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > +               return 0;
> > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > +               return 0;
> > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > +               return 0;
> > > +
> > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> > > +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> > > +index 1496f33..b9f8c51 100644
> > > +--- a/wrapper/compiler.h
> > > ++++ b/wrapper/compiler.h
> > > +@@ -9,6 +9,7 @@
> > > + #define _LTTNG_WRAPPER_COMPILER_H
> > > +
> > > + #include <linux/compiler.h>
> > > ++#include <linux/version.h>
> > > +
> > > + /*
> > > +  * Don't allow compiling with buggy compiler.
> > > +@@ -39,4 +40,21 @@
> > > + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> > > + #endif
> > > +
> > > ++/*
> > > ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> > > ++ * lockless_dereference(), replicate this behavior on prior kernels
> > > ++ * and remove calls to smp_read_barrier_depends which was dropped
> > > ++ * in v5.9.
> > > ++ */
> > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> > > ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> > > ++#else
> > > ++#define LTTNG_READ_ONCE(x)                    \
> > > ++({                                            \
> > > ++      typeof(x) __val = READ_ONCE(x);         \
> > > ++      smp_read_barrier_depends();             \
> > > ++      __val;                                  \
> > > ++})
> > > ++#endif
> > > ++
> > > + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> > > +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> > > +index 9f4e366..187fc82 100644
> > > +--- a/wrapper/trace-clock.h
> > > ++++ b/wrapper/trace-clock.h
> > > +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> > > +
> > > + static inline u64 trace_clock_read64(void)
> > > + {
> > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > +
> > > +       if (likely(!ltc)) {
> > > +               return trace_clock_read64_monotonic();
> > > +       } else {
> > > +-              read_barrier_depends(); /* load ltc before content */
> > > +               return ltc->read64();
> > > +       }
> > > + }
> > > +
> > > + static inline u64 trace_clock_freq(void)
> > > + {
> > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > +
> > > +       if (!ltc) {
> > > +               return trace_clock_freq_monotonic();
> > > +       } else {
> > > +-              read_barrier_depends(); /* load ltc before content */
> > > +               return ltc->freq();
> > > +       }
> > > + }
> > > +
> > > + static inline int trace_clock_uuid(char *uuid)
> > > + {
> > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > +
> > > +-      read_barrier_depends(); /* load ltc before content */
> > > +       /* Use default UUID cb when NULL */
> > > +       if (!ltc || !ltc->uuid) {
> > > +               return trace_clock_uuid_monotonic(uuid);
> > > +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> > > +
> > > + static inline const char *trace_clock_name(void)
> > > + {
> > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > +
> > > +       if (!ltc) {
> > > +               return trace_clock_name_monotonic();
> > > +       } else {
> > > +-              read_barrier_depends(); /* load ltc before content */
> > > +               return ltc->name();
> > > +       }
> > > + }
> > > +
> > > + static inline const char *trace_clock_description(void)
> > > + {
> > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > +
> > > +       if (!ltc) {
> > > +               return trace_clock_description_monotonic();
> > > +       } else {
> > > +-              read_barrier_depends(); /* load ltc before content */
> > > +               return ltc->description();
> > > +       }
> > > + }
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > new file mode 100644
> > > index 0000000000..2843c9cb62
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > @@ -0,0 +1,59 @@
> > > +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > +Date: Mon, 31 Aug 2020 11:41:38 -0400
> > > +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> > > +
> > > +See upstream commit:
> > > +
> > > +  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.
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> > > +---
> > > + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> > > + 1 file changed, 15 insertions(+), 1 deletion(-)
> > > +
> > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > +index affb4eb..ece67ad 100644
> > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> > > +
> > > + #endif
> > > +
> > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > ++#define show_inode_state(state)                                       \
> > > ++      __print_flags(state, "|",                               \
> > > ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> > > ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> > > ++              {I_NEW,                 "I_NEW"},               \
> > > ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> > > ++              {I_FREEING,             "I_FREEING"},           \
> > > ++              {I_CLEAR,               "I_CLEAR"},             \
> > > ++              {I_SYNC,                "I_SYNC"},              \
> > > ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> > > ++              {I_REFERENCED,          "I_REFERENCED"}         \
> > > ++      )
> > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > + #define show_inode_state(state)                                       \
> > > +       __print_flags(state, "|",                               \
> > > +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > new file mode 100644
> > > index 0000000000..7a0d9a38b8
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > @@ -0,0 +1,117 @@
> > > +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > +Date: Mon, 31 Aug 2020 14:16:01 -0400
> > > +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> > > + processing (v5.9)
> > > +
> > > +See upstream commit:
> > > +
> > > +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> > > +  Author: Jan Kara <jack@suse.cz>
> > > +  Date:   Fri May 29 16:08:58 2020 +0200
> > > +
> > > +    writeback: Fix sync livelock due to b_dirty_time processing
> > > +
> > > +    When we are processing writeback for sync(2), move_expired_inodes()
> > > +    didn't set any inode expiry value (older_than_this). This can result in
> > > +    writeback never completing if there's steady stream of inodes added to
> > > +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> > > +    round whether there's more work to be done. Fix the problem by using
> > > +    sync(2) start time is inode expiry value when processing b_dirty_time
> > > +    list similarly as for ordinarily dirtied inodes. This requires some
> > > +    refactoring of older_than_this handling which simplifies the code
> > > +    noticeably as a bonus.
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +---
> > > + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> > > + 1 file changed, 26 insertions(+), 13 deletions(-)
> > > +
> > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > +index ece67ad..e9018dd 100644
> > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > + #endif
> > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > +
> > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > ++               struct wb_writeback_work *work,
> > > ++               unsigned long dirtied_before,
> > > ++               int moved),
> > > ++      TP_ARGS(wb, work, dirtied_before, moved),
> > > ++      TP_FIELDS(
> > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > ++              ctf_integer(unsigned long, older, dirtied_before)
> > > ++              ctf_integer(int, moved, moved)
> > > ++      )
> > > ++)
> > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > +       TP_PROTO(struct bdi_writeback *wb,
> > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > +                struct wb_writeback_work *work,
> > > +-#else
> > > +-               unsigned long *older_than_this,
> > > +-#endif
> > > +                int moved),
> > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > +       TP_ARGS(wb, work, moved),
> > > +-#else
> > > ++      TP_FIELDS(
> > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > ++              ctf_integer(int, moved, moved)
> > > ++      )
> > > ++)
> > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > ++               unsigned long *older_than_this,
> > > ++               int moved),
> > > +       TP_ARGS(wb, older_than_this, moved),
> > > +-#endif
> > > +       TP_FIELDS(
> > > +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > +-#else
> > > +               ctf_integer(unsigned long, older,
> > > +                       older_than_this ? *older_than_this : 0)
> > > +               ctf_integer(long, age,
> > > +                       older_than_this ?
> > > +                               (jiffies - *older_than_this) * 1000 / HZ
> > > +                               : -1)
> > > +-#endif
> > > +               ctf_integer(int, moved, moved)
> > > +       )
> > > + )
> > > ++#endif
> > > +
> > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> > > +       )
> > > + )
> > > +-#else
> > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > +
> > > +       writeback_global_dirty_state,
> > > +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > +       )
> > > + )
> > > + #endif
> > > +-#endif
> > > +
> > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > +
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > new file mode 100644
> > > index 0000000000..346e1d63ad
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > @@ -0,0 +1,52 @@
> > > +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > +Date: Fri, 4 Sep 2020 11:52:51 -0400
> > > +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> > > + writeback_queue_io
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> > > +---
> > > + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> > > + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> > > + 2 files changed, 9 insertions(+), 2 deletions(-)
> > > +
> > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > +index 4476abb..b172c8d 100644
> > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > + )
> > > + #endif
> > > +
> > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > +
> > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > +index e9018dd..09637d7 100644
> > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > + #endif
> > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > +
> > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> > > ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> > > ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> > > ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> > > ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> > > ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > +       TP_PROTO(struct bdi_writeback *wb,
> > > +                struct wb_writeback_work *work,
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > new file mode 100644
> > > index 0000000000..a16750ddb3
> > > --- /dev/null
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > @@ -0,0 +1,918 @@
> > > +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> > > +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +Date: Tue, 28 Jan 2020 16:02:44 -0500
> > > +Subject: [PATCH 10/10] Fix: system call filter table
> > > +
> > > +The system call filter table has effectively been unused for a long
> > > +time due to system call name prefix mismatch. This means the overhead of
> > > +selective system call tracing was larger than it should have been because
> > > +the event payload preparation would be done for all system calls as soon
> > > +as a single system call is traced.
> > > +
> > > +However, fixing this underlying issue unearths several issues that crept
> > > +unnoticed when the "enabler" concept was introduced (after the original
> > > +implementation of the system call filter table).
> > > +
> > > +Here is a list of the issues which are resolved here:
> > > +
> > > +- Split lttng_syscalls_unregister into an unregister and destroy
> > > +  function, thus awaiting for a grace period (and therefore quiescence
> > > +  of the users) after unregistering the system call tracepoints before
> > > +  freeing the system call filter data structures. This effectively fixes
> > > +  a use-after-free.
> > > +
> > > +- The state for enabling "all" system calls vs enabling specific system
> > > +  calls (and sequences of enable-disable) was incorrect with respect to
> > > +  the "enablers" semantic. This is solved by always tracking the
> > > +  bitmap of enabled system calls, and keeping this bitmap even when
> > > +  enabling all system calls. The sc_filter is now always allocated
> > > +  before system call tracing is registered to tracepoints, which means
> > > +  it does not need to be RCU dereferenced anymore.
> > > +
> > > +Padding fields in the ABI are reserved to select whether to:
> > > +
> > > +- Trace either native or compat system call (or both, which is the
> > > +  behavior currently implemented),
> > > +- Trace either system call entry or exit (or both, which is the
> > > +  behavior currently implemented),
> > > +- Select the system call to trace by name (behavior currently
> > > +  implemented) or by system call number,
> > > +
> > > +Upstream-Status: Backport
> > > +
> > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > +---
> > > + lttng-abi.c      |  43 ++++++
> > > + lttng-abi.h      |  26 ++++
> > > + lttng-events.c   | 112 +++++++++++++--
> > > + lttng-events.h   |  31 ++++-
> > > + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> > > + 5 files changed, 380 insertions(+), 180 deletions(-)
> > > +
> > > +diff --git a/lttng-abi.c b/lttng-abi.c
> > > +index 64ea99d..b33879d 100644
> > > +--- a/lttng-abi.c
> > > ++++ b/lttng-abi.c
> > > +@@ -1264,6 +1264,46 @@ nomem:
> > > +       return ret;
> > > + }
> > > +
> > > ++static
> > > ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> > > ++{
> > > ++      /* Limit ABI to implemented features. */
> > > ++      switch (event_param->instrumentation) {
> > > ++      case LTTNG_KERNEL_SYSCALL:
> > > ++              switch (event_param->u.syscall.entryexit) {
> > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > ++                      break;
> > > ++              default:
> > > ++                      return -EINVAL;
> > > ++              }
> > > ++              switch (event_param->u.syscall.abi) {
> > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > ++                      break;
> > > ++              default:
> > > ++                      return -EINVAL;
> > > ++              }
> > > ++              switch (event_param->u.syscall.match) {
> > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > ++                      break;
> > > ++              default:
> > > ++                      return -EINVAL;
> > > ++              }
> > > ++              break;
> > > ++
> > > ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> > > ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> > > ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> > > ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> > > ++      case LTTNG_KERNEL_UPROBE:
> > > ++              break;
> > > ++
> > > ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> > > ++      default:
> > > ++              return -EINVAL;
> > > ++      }
> > > ++      return 0;
> > > ++}
> > > ++
> > > + static
> > > + int lttng_abi_create_event(struct file *channel_file,
> > > +                          struct lttng_kernel_event *event_param)
> > > +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> > > +               ret = -EOVERFLOW;
> > > +               goto refcount_error;
> > > +       }
> > > ++      ret = lttng_abi_validate_event_param(event_param);
> > > ++      if (ret)
> > > ++              goto event_error;
> > > +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> > > +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> > > +               struct lttng_enabler *enabler;
> > > +diff --git a/lttng-abi.h b/lttng-abi.h
> > > +index 1d356ab..51d60e5 100644
> > > +--- a/lttng-abi.h
> > > ++++ b/lttng-abi.h
> > > +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> > > +       } u;
> > > + } __attribute__((packed));
> > > +
> > > ++enum lttng_kernel_syscall_entryexit {
> > > ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> > > ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> > > ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> > > ++};
> > > ++
> > > ++enum lttng_kernel_syscall_abi {
> > > ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> > > ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> > > ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> > > ++};
> > > ++
> > > ++enum lttng_kernel_syscall_match {
> > > ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> > > ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> > > ++};
> > > ++
> > > ++struct lttng_kernel_syscall {
> > > ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> > > ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> > > ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> > > ++      uint8_t padding;
> > > ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> > > ++} __attribute__((packed));
> > > ++
> > > + /*
> > > +  * For syscall tracing, name = "*" means "enable all".
> > > +  */
> > > +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> > > +               struct lttng_kernel_kprobe kprobe;
> > > +               struct lttng_kernel_function_tracer ftrace;
> > > +               struct lttng_kernel_uprobe uprobe;
> > > ++              struct lttng_kernel_syscall syscall;
> > > +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> > > +       } u;
> > > + } __attribute__((packed));
> > > +diff --git a/lttng-events.c b/lttng-events.c
> > > +index d719294..4c0b04a 100644
> > > +--- a/lttng-events.c
> > > ++++ b/lttng-events.c
> > > +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> > > +               WARN_ON(ret);
> > > +       }
> > > +       synchronize_trace();    /* Wait for in-flight events to complete */
> > > ++      list_for_each_entry(chan, &session->chan, list) {
> > > ++              ret = lttng_syscalls_destroy(chan);
> > > ++              WARN_ON(ret);
> > > ++      }
> > > +       list_for_each_entry_safe(enabler, tmpenabler,
> > > +                       &session->enablers_head, node)
> > > +               lttng_enabler_destroy(enabler);
> > > +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> > > +               event->enabled = 0;
> > > +               event->registered = 0;
> > > +               event->desc = event_desc;
> > > ++              switch (event_param->u.syscall.entryexit) {
> > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > ++                      ret = -EINVAL;
> > > ++                      goto register_error;
> > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> > > ++                      break;
> > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> > > ++                      break;
> > > ++              }
> > > ++              switch (event_param->u.syscall.abi) {
> > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > ++                      ret = -EINVAL;
> > > ++                      goto register_error;
> > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> > > ++                      break;
> > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> > > ++                      break;
> > > ++              }
> > > +               if (!event->desc) {
> > > +                       ret = -EINVAL;
> > > +                       goto register_error;
> > > +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> > > +                                                 event);
> > > +               break;
> > > +       case LTTNG_KERNEL_SYSCALL:
> > > +-              ret = lttng_syscall_filter_enable(event->chan,
> > > +-                      desc->name);
> > > ++              ret = lttng_syscall_filter_enable(event->chan, event);
> > > +               break;
> > > +       case LTTNG_KERNEL_KPROBE:
> > > +       case LTTNG_KERNEL_UPROBE:
> > > +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> > > +               ret = 0;
> > > +               break;
> > > +       case LTTNG_KERNEL_SYSCALL:
> > > +-              ret = lttng_syscall_filter_disable(event->chan,
> > > +-                      desc->name);
> > > ++              ret = lttng_syscall_filter_disable(event->chan, event);
> > > +               break;
> > > +       case LTTNG_KERNEL_NOOP:
> > > +               ret = 0;
> > > +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> > > +               struct lttng_enabler *enabler)
> > > + {
> > > +       const char *desc_name, *enabler_name;
> > > ++      bool compat = false, entry = false;
> > > +
> > > +       enabler_name = enabler->event_param.name;
> > > +       switch (enabler->event_param.instrumentation) {
> > > +       case LTTNG_KERNEL_TRACEPOINT:
> > > +               desc_name = desc->name;
> > > ++              switch (enabler->type) {
> > > ++              case LTTNG_ENABLER_STAR_GLOB:
> > > ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > ++              case LTTNG_ENABLER_NAME:
> > > ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> > > ++              default:
> > > ++                      return -EINVAL;
> > > ++              }
> > > +               break;
> > > +       case LTTNG_KERNEL_SYSCALL:
> > > +               desc_name = desc->name;
> > > +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> > > ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> > > +                       desc_name += strlen("compat_");
> > > ++                      compat = true;
> > > ++              }
> > > +               if (!strncmp(desc_name, "syscall_exit_",
> > > +                               strlen("syscall_exit_"))) {
> > > +                       desc_name += strlen("syscall_exit_");
> > > +               } else if (!strncmp(desc_name, "syscall_entry_",
> > > +                               strlen("syscall_entry_"))) {
> > > +                       desc_name += strlen("syscall_entry_");
> > > ++                      entry = true;
> > > +               } else {
> > > +                       WARN_ON_ONCE(1);
> > > +                       return -EINVAL;
> > > +               }
> > > ++              switch (enabler->event_param.u.syscall.entryexit) {
> > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > ++                      break;
> > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > ++                      if (!entry)
> > > ++                              return 0;
> > > ++                      break;
> > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > ++                      if (entry)
> > > ++                              return 0;
> > > ++                      break;
> > > ++              default:
> > > ++                      return -EINVAL;
> > > ++              }
> > > ++              switch (enabler->event_param.u.syscall.abi) {
> > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > ++                      break;
> > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > ++                      if (compat)
> > > ++                              return 0;
> > > ++                      break;
> > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > ++                      if (!compat)
> > > ++                              return 0;
> > > ++                      break;
> > > ++              default:
> > > ++                      return -EINVAL;
> > > ++              }
> > > ++              switch (enabler->event_param.u.syscall.match) {
> > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > ++                      switch (enabler->type) {
> > > ++                      case LTTNG_ENABLER_STAR_GLOB:
> > > ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > ++                      case LTTNG_ENABLER_NAME:
> > > ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> > > ++                      default:
> > > ++                              return -EINVAL;
> > > ++                      }
> > > ++                      break;
> > > ++              case LTTNG_SYSCALL_MATCH_NR:
> > > ++                      return -EINVAL; /* Not implemented. */
> > > ++              default:
> > > ++                      return -EINVAL;
> > > ++              }
> > > +               break;
> > > +       default:
> > > +               WARN_ON_ONCE(1);
> > > +               return -EINVAL;
> > > +       }
> > > +-      switch (enabler->type) {
> > > +-      case LTTNG_ENABLER_STAR_GLOB:
> > > +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > +-      case LTTNG_ENABLER_NAME:
> > > +-              return lttng_match_enabler_name(desc_name, enabler_name);
> > > +-      default:
> > > +-              return -EINVAL;
> > > +-      }
> > > + }
> > > +
> > > + static
> > > +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> > > + static
> > > + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> > > + {
> > > +-      struct lttng_session *session = enabler->chan->session;
> > > ++      struct lttng_channel *chan = enabler->chan;
> > > ++      struct lttng_session *session = chan->session;
> > > +       struct lttng_event *event;
> > > +
> > > ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> > > ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> > > ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> > > ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> > > ++                      !strcmp(enabler->event_param.name, "*")) {
> > > ++              if (enabler->enabled)
> > > ++                      WRITE_ONCE(chan->syscall_all, 1);
> > > ++              else
> > > ++                      WRITE_ONCE(chan->syscall_all, 0);
> > > ++      }
> > > ++
> > > +       /* First ensure that probe events are created for this enabler. */
> > > +       lttng_create_event_if_missing(enabler);
> > > +
> > > +diff --git a/lttng-events.h b/lttng-events.h
> > > +index a36a312..d4d9976 100644
> > > +--- a/lttng-events.h
> > > ++++ b/lttng-events.h
> > > +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> > > +       struct list_head node;
> > > + };
> > > +
> > > ++enum lttng_syscall_entryexit {
> > > ++      LTTNG_SYSCALL_ENTRY,
> > > ++      LTTNG_SYSCALL_EXIT,
> > > ++};
> > > ++
> > > ++enum lttng_syscall_abi {
> > > ++      LTTNG_SYSCALL_ABI_NATIVE,
> > > ++      LTTNG_SYSCALL_ABI_COMPAT,
> > > ++};
> > > ++
> > > + /*
> > > +  * lttng_event structure is referred to by the tracing fast path. It must be
> > > +  * kept small.
> > > +@@ -318,6 +328,11 @@ struct lttng_event {
> > > +                       struct inode *inode;
> > > +                       struct list_head head;
> > > +               } uprobe;
> > > ++              struct {
> > > ++                      char *syscall_name;
> > > ++                      enum lttng_syscall_entryexit entryexit;
> > > ++                      enum lttng_syscall_abi abi;
> > > ++              } syscall;
> > > +       } u;
> > > +       struct list_head list;          /* Event list in session */
> > > +       unsigned int metadata_dumped:1;
> > > +@@ -457,10 +472,10 @@ struct lttng_channel {
> > > +       struct lttng_syscall_filter *sc_filter;
> > > +       int header_type;                /* 0: unset, 1: compact, 2: large */
> > > +       enum channel_type channel_type;
> > > ++      int syscall_all;
> > > +       unsigned int metadata_dumped:1,
> > > +               sys_enter_registered:1,
> > > +               sys_exit_registered:1,
> > > +-              syscall_all:1,
> > > +               tstate:1;               /* Transient enable state */
> > > + };
> > > +
> > > +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> > > + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> > > + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> > > + int lttng_syscalls_unregister(struct lttng_channel *chan);
> > > ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> > > + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > +-              const char *name);
> > > ++              struct lttng_event *event);
> > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > +-              const char *name);
> > > ++              struct lttng_event *event);
> > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> > > + #else
> > > +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > +       return 0;
> > > + }
> > > +
> > > ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > ++{
> > > ++      return 0;
> > > ++}
> > > ++
> > > + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > +-              const char *name)
> > > ++              struct lttng_event *event);
> > > + {
> > > +       return -ENOSYS;
> > > + }
> > > +
> > > + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > +-              const char *name)
> > > ++              struct lttng_event *event);
> > > + {
> > > +       return -ENOSYS;
> > > + }
> > > +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> > > +index 97f1ba9..26cead6 100644
> > > +--- a/lttng-syscalls.c
> > > ++++ b/lttng-syscalls.c
> > > +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> > > + #undef CREATE_SYSCALL_TABLE
> > > +
> > > + struct lttng_syscall_filter {
> > > +-      DECLARE_BITMAP(sc, NR_syscalls);
> > > +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> > > ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> > > ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> > > ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> > > ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> > > + };
> > > +
> > > + static void syscall_entry_unknown(struct lttng_event *event,
> > > +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> > > +       size_t table_len;
> > > +
> > > +       if (unlikely(in_compat_syscall())) {
> > > +-              struct lttng_syscall_filter *filter;
> > > +-
> > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > +-              if (filter) {
> > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > +-                              /* System call filtered out. */
> > > +-                              return;
> > > +-                      }
> > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > ++
> > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> > > ++                      /* System call filtered out. */
> > > ++                      return;
> > > +               }
> > > +               table = compat_sc_table;
> > > +               table_len = ARRAY_SIZE(compat_sc_table);
> > > +               unknown_event = chan->sc_compat_unknown;
> > > +       } else {
> > > +-              struct lttng_syscall_filter *filter;
> > > +-
> > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > +-              if (filter) {
> > > +-                      if (id < 0 || id >= NR_syscalls
> > > +-                              || !test_bit(id, filter->sc)) {
> > > +-                              /* System call filtered out. */
> > > +-                              return;
> > > +-                      }
> > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > ++
> > > ++              if (id < 0 || id >= NR_syscalls
> > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> > > ++                      /* System call filtered out. */
> > > ++                      return;
> > > +               }
> > > +               table = sc_table;
> > > +               table_len = ARRAY_SIZE(sc_table);
> > > +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> > > +
> > > +       id = syscall_get_nr(current, regs);
> > > +       if (unlikely(in_compat_syscall())) {
> > > +-              struct lttng_syscall_filter *filter;
> > > +-
> > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > +-              if (filter) {
> > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > +-                              /* System call filtered out. */
> > > +-                              return;
> > > +-                      }
> > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > ++
> > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> > > ++                      /* System call filtered out. */
> > > ++                      return;
> > > +               }
> > > +               table = compat_sc_exit_table;
> > > +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> > > +               unknown_event = chan->compat_sc_exit_unknown;
> > > +       } else {
> > > +-              struct lttng_syscall_filter *filter;
> > > +-
> > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > +-              if (filter) {
> > > +-                      if (id < 0 || id >= NR_syscalls
> > > +-                              || !test_bit(id, filter->sc)) {
> > > +-                              /* System call filtered out. */
> > > +-                              return;
> > > +-                      }
> > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > ++
> > > ++              if (id < 0 || id >= NR_syscalls
> > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> > > ++                      /* System call filtered out. */
> > > ++                      return;
> > > +               }
> > > +               table = sc_exit_table;
> > > +               table_len = ARRAY_SIZE(sc_exit_table);
> > > +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> > > +               memset(&ev, 0, sizeof(ev));
> > > +               switch (type) {
> > > +               case SC_TYPE_ENTRY:
> > > +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > +                       break;
> > > +               case SC_TYPE_EXIT:
> > > +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > +                       break;
> > > +               case SC_TYPE_COMPAT_ENTRY:
> > > +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > +                       break;
> > > +               case SC_TYPE_COMPAT_EXIT:
> > > +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > +-                      break;
> > > +-              default:
> > > +-                      BUG_ON(1);
> > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > +                       break;
> > > +               }
> > > +-              strncat(ev.name, desc->name,
> > > +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> > > ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> > > +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> > > +                                               desc,
> > > +                                               ev.instrumentation);
> > > +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> > > +                                               desc,
> > > +                                               ev.instrumentation);
> > > +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> > > +                                               filter, desc,
> > > +                                               ev.instrumentation);
> > > +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> > > +                                               desc, ev.instrumentation);
> > > +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> > > +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > +       if (ret)
> > > +               return ret;
> > > + #endif
> > > ++
> > > ++      if (!chan->sc_filter) {
> > > ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > ++                              GFP_KERNEL);
> > > ++              if (!chan->sc_filter)
> > > ++                      return -ENOMEM;
> > > ++      }
> > > ++
> > > +       if (!chan->sys_enter_registered) {
> > > +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> > > +                               (void *) syscall_entry_probe, chan);
> > > +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > +                       return ret;
> > > +               chan->sys_exit_registered = 0;
> > > +       }
> > > +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> > > ++      return 0;
> > > ++}
> > > ++
> > > ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > ++{
> > > +       kfree(chan->sc_table);
> > > +       kfree(chan->sc_exit_table);
> > > + #ifdef CONFIG_COMPAT
> > > +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> > > +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> > > + }
> > > +
> > > +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > +-              const char *name)
> > > ++static
> > > ++const char *get_syscall_name(struct lttng_event *event)
> > > + {
> > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > +-      struct lttng_syscall_filter *filter;
> > > ++      size_t prefix_len = 0;
> > > +
> > > +-      WARN_ON_ONCE(!chan->sc_table);
> > > ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> > > +
> > > +-      if (!name) {
> > > +-              /* Enable all system calls by removing filter */
> > > +-              if (chan->sc_filter) {
> > > +-                      filter = chan->sc_filter;
> > > +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> > > +-                      synchronize_trace();
> > > +-                      kfree(filter);
> > > ++      switch (event->u.syscall.entryexit) {
> > > ++      case LTTNG_SYSCALL_ENTRY:
> > > ++              switch (event->u.syscall.abi) {
> > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> > > ++                      break;
> > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> > > ++                      break;
> > > +               }
> > > +-              chan->syscall_all = 1;
> > > +-              return 0;
> > > +-      }
> > > +-
> > > +-      if (!chan->sc_filter) {
> > > +-              if (chan->syscall_all) {
> > > +-                      /*
> > > +-                       * All syscalls are already enabled.
> > > +-                       */
> > > +-                      return -EEXIST;
> > > ++              break;
> > > ++      case LTTNG_SYSCALL_EXIT:
> > > ++              switch (event->u.syscall.abi) {
> > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> > > ++                      break;
> > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> > > ++                      break;
> > > +               }
> > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > +-                              GFP_KERNEL);
> > > +-              if (!filter)
> > > +-                      return -ENOMEM;
> > > +-      } else {
> > > +-              filter = chan->sc_filter;
> > > ++              break;
> > > +       }
> > > +-      syscall_nr = get_syscall_nr(name);
> > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > +-              ret = -ENOENT;
> > > +-              goto error;
> > > ++      WARN_ON_ONCE(prefix_len == 0);
> > > ++      return event->desc->name + prefix_len;
> > > ++}
> > > ++
> > > ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > ++              struct lttng_event *event)
> > > ++{
> > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > ++      const char *syscall_name;
> > > ++      unsigned long *bitmap;
> > > ++      int syscall_nr;
> > > ++
> > > ++      WARN_ON_ONCE(!chan->sc_table);
> > > ++
> > > ++      syscall_name = get_syscall_name(event);
> > > ++
> > > ++      switch (event->u.syscall.abi) {
> > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > ++              break;
> > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > ++              break;
> > > ++      default:
> > > ++              return -EINVAL;
> > > +       }
> > > +-      if (syscall_nr >= 0) {
> > > +-              if (test_bit(syscall_nr, filter->sc)) {
> > > +-                      ret = -EEXIST;
> > > +-                      goto error;
> > > ++      if (syscall_nr < 0)
> > > ++              return -ENOENT;
> > > ++
> > > ++
> > > ++      switch (event->u.syscall.entryexit) {
> > > ++      case LTTNG_SYSCALL_ENTRY:
> > > ++              switch (event->u.syscall.abi) {
> > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > ++                      bitmap = filter->sc_entry;
> > > ++                      break;
> > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > ++                      bitmap = filter->sc_compat_entry;
> > > ++                      break;
> > > +               }
> > > +-              bitmap_set(filter->sc, syscall_nr, 1);
> > > +-      }
> > > +-      if (compat_syscall_nr >= 0) {
> > > +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > +-                      ret = -EEXIST;
> > > +-                      goto error;
> > > ++              break;
> > > ++      case LTTNG_SYSCALL_EXIT:
> > > ++              switch (event->u.syscall.abi) {
> > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > ++                      bitmap = filter->sc_exit;
> > > ++                      break;
> > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > ++                      bitmap = filter->sc_compat_exit;
> > > ++                      break;
> > > +               }
> > > +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> > > ++              break;
> > > ++      default:
> > > ++              return -EINVAL;
> > > +       }
> > > +-      if (!chan->sc_filter)
> > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > ++      if (test_bit(syscall_nr, bitmap))
> > > ++              return -EEXIST;
> > > ++      bitmap_set(bitmap, syscall_nr, 1);
> > > +       return 0;
> > > +-
> > > +-error:
> > > +-      if (!chan->sc_filter)
> > > +-              kfree(filter);
> > > +-      return ret;
> > > + }
> > > +
> > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > +-              const char *name)
> > > ++              struct lttng_event *event)
> > > + {
> > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > +-      struct lttng_syscall_filter *filter;
> > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > ++      const char *syscall_name;
> > > ++      unsigned long *bitmap;
> > > ++      int syscall_nr;
> > > +
> > > +       WARN_ON_ONCE(!chan->sc_table);
> > > +
> > > +-      if (!chan->sc_filter) {
> > > +-              if (!chan->syscall_all)
> > > +-                      return -EEXIST;
> > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > +-                              GFP_KERNEL);
> > > +-              if (!filter)
> > > +-                      return -ENOMEM;
> > > +-              /* Trace all system calls, then apply disable. */
> > > +-              bitmap_set(filter->sc, 0, NR_syscalls);
> > > +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> > > +-      } else {
> > > +-              filter = chan->sc_filter;
> > > ++      syscall_name = get_syscall_name(event);
> > > ++
> > > ++      switch (event->u.syscall.abi) {
> > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > ++              break;
> > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > ++              break;
> > > ++      default:
> > > ++              return -EINVAL;
> > > +       }
> > > ++      if (syscall_nr < 0)
> > > ++              return -ENOENT;
> > > +
> > > +-      if (!name) {
> > > +-              /* Fail if all syscalls are already disabled. */
> > > +-              if (bitmap_empty(filter->sc, NR_syscalls)
> > > +-                      && bitmap_empty(filter->sc_compat,
> > > +-                              NR_compat_syscalls)) {
> > > +-                      ret = -EEXIST;
> > > +-                      goto error;
> > > +-              }
> > > +
> > > +-              /* Disable all system calls */
> > > +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> > > +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> > > +-              goto apply_filter;
> > > +-      }
> > > +-      syscall_nr = get_syscall_nr(name);
> > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > +-              ret = -ENOENT;
> > > +-              goto error;
> > > +-      }
> > > +-      if (syscall_nr >= 0) {
> > > +-              if (!test_bit(syscall_nr, filter->sc)) {
> > > +-                      ret = -EEXIST;
> > > +-                      goto error;
> > > ++      switch (event->u.syscall.entryexit) {
> > > ++      case LTTNG_SYSCALL_ENTRY:
> > > ++              switch (event->u.syscall.abi) {
> > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > ++                      bitmap = filter->sc_entry;
> > > ++                      break;
> > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > ++                      bitmap = filter->sc_compat_entry;
> > > ++                      break;
> > > +               }
> > > +-              bitmap_clear(filter->sc, syscall_nr, 1);
> > > +-      }
> > > +-      if (compat_syscall_nr >= 0) {
> > > +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > +-                      ret = -EEXIST;
> > > +-                      goto error;
> > > ++              break;
> > > ++      case LTTNG_SYSCALL_EXIT:
> > > ++              switch (event->u.syscall.abi) {
> > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > ++                      bitmap = filter->sc_exit;
> > > ++                      break;
> > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > ++                      bitmap = filter->sc_compat_exit;
> > > ++                      break;
> > > +               }
> > > +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> > > ++              break;
> > > ++      default:
> > > ++              return -EINVAL;
> > > +       }
> > > +-apply_filter:
> > > +-      if (!chan->sc_filter)
> > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > +-      chan->syscall_all = 0;
> > > +-      return 0;
> > > ++      if (!test_bit(syscall_nr, bitmap))
> > > ++              return -EEXIST;
> > > ++      bitmap_clear(bitmap, syscall_nr, 1);
> > > +
> > > +-error:
> > > +-      if (!chan->sc_filter)
> > > +-              kfree(filter);
> > > +-      return ret;
> > > ++      return 0;
> > > + }
> > > +
> > > + static
> > > +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> > > +       .release = seq_release,
> > > + };
> > > +
> > > ++/*
> > > ++ * A syscall is enabled if it is traced for either entry or exit.
> > > ++ */
> > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> > > + {
> > > +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > +               char state;
> > > +
> > > +               if (channel->sc_table) {
> > > +-                      if (filter)
> > > +-                              state = test_bit(bit, filter->sc);
> > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > ++                              state = test_bit(bit, filter->sc_entry)
> > > ++                                      || test_bit(bit, filter->sc_exit);
> > > +                       else
> > > +                               state = 1;
> > > +               } else {
> > > +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > +               char state;
> > > +
> > > +               if (channel->compat_sc_table) {
> > > +-                      if (filter)
> > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> > > +-                                              filter->sc_compat);
> > > ++                                              filter->sc_compat_entry)
> > > ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> > > ++                                              filter->sc_compat_exit);
> > > +                       else
> > > +                               state = 1;
> > > +               } else {
> > > +--
> > > +2.19.1
> > > +
> > > diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > index 0e1a209ce8..e36b327a08 100644
> > > --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > @@ -11,6 +11,16 @@ include lttng-platforms.inc
> > >  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
> > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> > > +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> > > +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> > > +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> > > +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> > > +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> > > +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> > > +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> > > +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> > > +           file://0010-Fix-system-call-filter-table.patch \
> > >             "
> > >
> > >  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> > > @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
> > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > >             "
> > > -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> > > +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
> > >  PV_class-devupstream = "2.12.2+git${SRCPV}"
> > >  S_class-devupstream = "${WORKDIR}/git"
> > >  SRCREV_FORMAT ?= "lttng_git"
> > > --
> > > 2.19.1
> > >
> > > 
>
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-25 19:48       ` Steve Sakoman
@ 2020-09-27 21:18         ` Bruce Ashfield
       [not found]         ` <1638C0AFDA43827E.8201@lists.openembedded.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-27 21:18 UTC (permalink / raw)
  To: Steve Sakoman
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

On Fri, Sep 25, 2020 at 3:49 PM Steve Sakoman <steve@sakoman.com> wrote:
>
> On Fri, Sep 25, 2020 at 6:52 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> >
> > On Fri, Sep 25, 2020 at 12:43 PM Steve Sakoman <steve@sakoman.com> wrote:
> > >
> > > Dunfell is still at 2.11.2.  Will there be a need for patches to this
> > > version too?  Or should I take the lttng version bump along with the
> > > 5.4 version bumps that cause the issue?
> >
> > I don't see a lot of options on that front. Unless we do some custom backports.
> >
> > I just checked the lttng 2.11 branch, and the last commit is from January, which
> > is too old to cover these -stable kernel bump issues.
> >
> > I can have a go at the backports, but we should be prepared to bend the version
> > upgrade rule if that gets too complex (and for the record, I've never
> > had much luck
> > with lttng fixes).
>
> Totally understood!  I think this is likely one of those cases where
> we'll have to take an exception to the upgrade rule.
>
> If you see issues with a backport just let me know and I'll go with
> the version upgrade approach.

I'll have a go at some backports on Monday and send info by end of day.

>
> While I have your attention, what about "linux-yocto/config:
> netfilter: Enable nat for ipv4 and ipv6" for dunfell?  I'll have to
> prune out the changes for 5.8 in the commit, but does it make sense
> for 5.4?

It isn't a bugfix by a strict definition, but it also  won't hurt
anything. It does
make sense to keep 5.4 & 5.8 kernel configuration consistent whenever
possible, so I'd say go ahead and do the port.

Bruce

>
> Thanks!
>
> Steve
>
>
>  >
> > > On Mon, Sep 14, 2020 at 12:34 PM Bruce Ashfield
> > > <bruce.ashfield@gmail.com> wrote:
> > > >
> > > > From: Jens Rehsack <sno@netbsd.org>
> > > >
> > > > Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> > > > them once .3 is released, but for now, we need the fixes to build
> > > > against the latest 5.4, 5.8 and 5.9 kernels.
> > > >
> > > > We also bump the devupstream SRCREV to pickup the same changes.
> > > >
> > > > Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> > > > ---
> > > >  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
> > > >  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
> > > >  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
> > > >  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
> > > >  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
> > > >  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
> > > >  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
> > > >  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
> > > >  ...es-for-ext4_discard_preallocations-a.patch |  52 +
> > > >  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
> > > >  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
> > > >  11 files changed, 1829 insertions(+), 1 deletion(-)
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > >
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > new file mode 100644
> > > > index 0000000000..ae8bec45de
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > @@ -0,0 +1,54 @@
> > > > +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> > > > +From: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > +Date: Thu, 13 Aug 2020 16:24:39 +0300
> > > > +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> > > > + without CONFIG_FTRACE
> > > > +
> > > > +When building in-tree, one could disable CONFIG_FTRACE from kernel
> > > > +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> > > > +but generate a lot of linker errors like below because it leaves out
> > > > +other stuff, e.g.:
> > > > +
> > > > +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> > > > +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> > > > +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> > > > +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> > > > +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> > > > +
> > > > +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> > > > +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> > > > +enabled.
> > > > +
> > > > +Steps to reproduce:
> > > > +
> > > > +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> > > > +
> > > > +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> > > > +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> > > > +
> > > > +- Build will fail at linking stage
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +---
> > > > + Kconfig | 2 +-
> > > > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > +
> > > > +diff --git a/Kconfig b/Kconfig
> > > > +index acdab73..10eccff 100644
> > > > +--- a/Kconfig
> > > > ++++ b/Kconfig
> > > > +@@ -2,7 +2,7 @@
> > > > +
> > > > + config LTTNG
> > > > +       tristate "LTTng support"
> > > > +-      select TRACEPOINTS
> > > > ++      select TRACING
> > > > +       help
> > > > +         LTTng is an open source tracing framework for Linux.
> > > > +
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > new file mode 100644
> > > > index 0000000000..fab673b854
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > @@ -0,0 +1,41 @@
> > > > +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > +Date: Mon, 10 Aug 2020 11:22:05 -0400
> > > > +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> > > > +
> > > > +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > +  Date:   Mon Jun 22 13:20:29 2020 -0700
> > > > +
> > > > +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> > > > +
> > > > +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +---
> > > > + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> > > > + 1 file changed, 4 insertions(+)
> > > > +
> > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > +index 37384a2..5a7ef1e 100644
> > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > +@@ -24,7 +24,11 @@
> > > > +  */
> > > > + #include <wrapper/tracepoint.h>
> > > > +
> > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > ++#else
> > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > ++#endif
> > > > +
> > > > + #undef TRACE_INCLUDE_PATH
> > > > + #undef TRACE_INCLUDE_FILE
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > new file mode 100644
> > > > index 0000000000..524631cc72
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > @@ -0,0 +1,39 @@
> > > > +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > +Date: Mon, 10 Aug 2020 11:36:03 -0400
> > > > +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> > > > + accessor internal-only (v5.9)
> > > > +
> > > > +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > +  Date:   Mon Jun 22 13:20:32 2020 -0700
> > > > +
> > > > +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> > > > +
> > > > +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> > > > +    be poking into the gory details of shadow pages.
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +---
> > > > + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> > > > + 1 file changed, 1 insertion(+)
> > > > +
> > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > +index 5a7ef1e..8f98186 100644
> > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > +@@ -25,6 +25,7 @@
> > > > + #include <wrapper/tracepoint.h>
> > > > +
> > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> > > > + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > + #else
> > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > new file mode 100644
> > > > index 0000000000..e29c07252c
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > @@ -0,0 +1,84 @@
> > > > +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > +Date: Mon, 24 Aug 2020 15:26:04 -0400
> > > > +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> > > > + (v5.9)
> > > > +MIME-Version: 1.0
> > > > +Content-Type: text/plain; charset=UTF-8
> > > > +Content-Transfer-Encoding: 8bit
> > > > +
> > > > +See upstream commit:
> > > > +
> > > > +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> > > > +  Author: brookxu <brookxu.cn@gmail.com>
> > > > +  Date:   Mon Aug 17 15:36:15 2020 +0800
> > > > +
> > > > +    ext4: limit the length of per-inode prealloc list
> > > > +
> > > > +    In the scenario of writing sparse files, the per-inode prealloc list may
> > > > +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> > > > +    To circumvent this problem, we limit the maximum length of per-inode
> > > > +    prealloc list to 512 and allow users to modify it.
> > > > +
> > > > +    After patching, we observed that the sys ratio of cpu has dropped, and
> > > > +    the system throughput has increased significantly. We created a process
> > > > +    to write the sparse file, and the running time of the process on the
> > > > +    fixed kernel was significantly reduced, as follows:
> > > > +
> > > > +    Running time on unfixed kernel:
> > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > +    real    0m2.051s
> > > > +    user    0m0.008s
> > > > +    sys     0m2.026s
> > > > +
> > > > +    Running time on fixed kernel:
> > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > +    real    0m0.471s
> > > > +    user    0m0.004s
> > > > +    sys     0m0.395s
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> > > > +---
> > > > + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> > > > + 1 file changed, 15 insertions(+)
> > > > +
> > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > +index 5f7ab28..72ad4c9 100644
> > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > + )
> > > > + #endif
> > > > +
> > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > ++
> > > > ++      TP_ARGS(inode, len, needed),
> > > > ++
> > > > ++      TP_FIELDS(
> > > > ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> > > > ++              ctf_integer(ino_t, ino, inode->i_ino)
> > > > ++              ctf_integer(unsigned int, len, len)
> > > > ++              ctf_integer(unsigned int, needed, needed)
> > > > ++      )
> > > > ++)
> > > > ++#else
> > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > +       TP_PROTO(struct inode *inode),
> > > > +
> > > > +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > +               ctf_integer(ino_t, ino, inode->i_ino)
> > > > +       )
> > > > + )
> > > > ++#endif
> > > > +
> > > > + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> > > > +       TP_PROTO(struct super_block *sb, int needed),
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > new file mode 100644
> > > > index 0000000000..f76e9698c8
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > @@ -0,0 +1,63 @@
> > > > +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > +Date: Mon, 24 Aug 2020 15:37:50 -0400
> > > > +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> > > > + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> > > > +MIME-Version: 1.0
> > > > +Content-Type: text/plain; charset=UTF-8
> > > > +Content-Transfer-Encoding: 8bit
> > > > +
> > > > +See upstream commit:
> > > > +
> > > > +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> > > > +  Author: Theodore Ts'o <tytso@mit.edu>
> > > > +  Date:   Wed Jul 15 11:48:55 2020 -0400
> > > > +
> > > > +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> > > > +
> > > > +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> > > > +    whether a block bitmap is being prefetched.
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> > > > +---
> > > > + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> > > > + 1 file changed, 14 insertions(+)
> > > > +
> > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > +index 72ad4c9..4476abb 100644
> > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> > > > +       TP_ARGS(sb, group)
> > > > + )
> > > > +
> > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> > > > ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> > > > ++
> > > > ++      TP_ARGS(sb, group, prefetch),
> > > > ++
> > > > ++      TP_FIELDS(
> > > > ++              ctf_integer(dev_t, dev, sb->s_dev)
> > > > ++              ctf_integer(__u32, group, group)
> > > > ++              ctf_integer(bool, prefetch, prefetch)
> > > > ++      )
> > > > ++)
> > > > ++#else
> > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> > > > +
> > > > +       TP_PROTO(struct super_block *sb, unsigned long group),
> > > > +
> > > > +       TP_ARGS(sb, group)
> > > > + )
> > > > ++#endif
> > > > +
> > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> > > > +
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > new file mode 100644
> > > > index 0000000000..0970dd30aa
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > @@ -0,0 +1,391 @@
> > > > +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > +Date: Tue, 25 Aug 2020 10:56:29 -0400
> > > > +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> > > > +
> > > > +See upstream commits:
> > > > +
> > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > +  Author: Will Deacon <will@kernel.org>
> > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > +
> > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > +
> > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > +    used to head dependency chains on all architectures.
> > > > +
> > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > +  Author: Will Deacon <will.deacon@arm.com>
> > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > +
> > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > +
> > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > +    used to head dependency chains on all architectures.
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +---
> > > > + instrumentation/events/lttng-module/i2c.h |  4 ++--
> > > > + lib/ringbuffer/backend.h                  |  2 +-
> > > > + lib/ringbuffer/backend_internal.h         |  2 +-
> > > > + lib/ringbuffer/frontend.h                 |  4 ++--
> > > > + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> > > > + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> > > > + lttng-events.c                            |  8 ++++----
> > > > + probes/lttng-kprobes.c                    |  6 +++---
> > > > + probes/lttng-kretprobes.c                 |  6 +++---
> > > > + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> > > > + probes/lttng-uprobes.c                    |  6 +++---
> > > > + wrapper/compiler.h                        | 18 ++++++++++++++++++
> > > > + wrapper/trace-clock.h                     | 15 +++++----------
> > > > + 13 files changed, 51 insertions(+), 38 deletions(-)
> > > > +
> > > > +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> > > > +index dcbabf6..131d134 100644
> > > > +--- a/instrumentation/events/lttng-module/i2c.h
> > > > ++++ b/instrumentation/events/lttng-module/i2c.h
> > > > +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> > > > +
> > > > +       TP_code_pre(
> > > > +               tp_locvar->extract_sensitive_payload =
> > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > +       ),
> > > > +
> > > > +       TP_FIELDS(
> > > > +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> > > > +
> > > > +       TP_code_pre(
> > > > +               tp_locvar->extract_sensitive_payload =
> > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > +       ),
> > > > +
> > > > +       TP_FIELDS(
> > > > +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> > > > +index da937f2..43e1d47 100644
> > > > +--- a/lib/ringbuffer/backend.h
> > > > ++++ b/lib/ringbuffer/backend.h
> > > > +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> > > > +                * Only read source character once, in case it is
> > > > +                * modified concurrently.
> > > > +                */
> > > > +-              c = READ_ONCE(src[count]);
> > > > ++              c = LTTNG_READ_ONCE(src[count]);
> > > > +               if (!c)
> > > > +                       break;
> > > > +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> > > > +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> > > > +index 2d6a345..1226fd8 100644
> > > > +--- a/lib/ringbuffer/backend_internal.h
> > > > ++++ b/lib/ringbuffer/backend_internal.h
> > > > +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> > > > +        * Performing a volatile access to read the sb_pages, because we want to
> > > > +        * read a coherent version of the pointer and the associated noref flag.
> > > > +        */
> > > > +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> > > > ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> > > > +       for (;;) {
> > > > +               /* This check is called on the fast path for each record. */
> > > > +               if (likely(!subbuffer_id_is_noref(config, id))) {
> > > > +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> > > > +index 6f516d9..41382fe 100644
> > > > +--- a/lib/ringbuffer/frontend.h
> > > > ++++ b/lib/ringbuffer/frontend.h
> > > > +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> > > > + #define for_each_channel_cpu(cpu, chan)                                       \
> > > > +       for ((cpu) = -1;                                                \
> > > > +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> > > > +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> > > > ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> > > > +
> > > > + extern struct lib_ring_buffer *channel_get_ring_buffer(
> > > > +                               const struct lib_ring_buffer_config *config,
> > > > +@@ -155,7 +155,7 @@ static inline
> > > > + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> > > > +                                struct lib_ring_buffer *buf)
> > > > + {
> > > > +-      int finalized = READ_ONCE(buf->finalized);
> > > > ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > +       /*
> > > > +        * Read finalized before counters.
> > > > +        */
> > > > +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> > > > +index 3cab365..4980d20 100644
> > > > +--- a/lib/ringbuffer/ring_buffer_frontend.c
> > > > ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> > > > +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> > > > +       int finalized;
> > > > +
> > > > + retry:
> > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > +       /*
> > > > +        * Read finalized before counters.
> > > > +        */
> > > > +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> > > > +               return -EBUSY;
> > > > +       }
> > > > + retry:
> > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > +       /*
> > > > +        * Read finalized before counters.
> > > > +        */
> > > > +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> > > > +index d25db72..7b4f20a 100644
> > > > +--- a/lib/ringbuffer/ring_buffer_iterator.c
> > > > ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> > > > +@@ -46,7 +46,7 @@ restart:
> > > > +       switch (iter->state) {
> > > > +       case ITER_GET_SUBBUF:
> > > > +               ret = lib_ring_buffer_get_next_subbuf(buf);
> > > > +-              if (ret && !READ_ONCE(buf->finalized)
> > > > ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> > > > +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> > > > +                       /*
> > > > +                        * Use "pull" scheme for global buffers. The reader
> > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > +index be7e389..d719294 100644
> > > > +--- a/lttng-events.c
> > > > ++++ b/lttng-events.c
> > > > +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> > > > +       size_t len;
> > > > +       va_list ap;
> > > > +
> > > > +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> > > > ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> > > > +
> > > > +       va_start(ap, fmt);
> > > > +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> > > > +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> > > > + {
> > > > +       int ret = 0;
> > > > +
> > > > +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> > > > ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > +               return 0;
> > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > +               return 0;
> > > > +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> > > > + {
> > > > +       int ret = 0;
> > > > +
> > > > +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> > > > ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > +               return 0;
> > > > +
> > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> > > > +       struct lttng_event *event;
> > > > +       int ret = 0;
> > > > +
> > > > +-      if (!READ_ONCE(session->active))
> > > > ++      if (!LTTNG_READ_ONCE(session->active))
> > > > +               return 0;
> > > > +
> > > > +       lttng_metadata_begin(session);
> > > > +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> > > > +index a44eaa1..38fb72e 100644
> > > > +--- a/probes/lttng-kprobes.c
> > > > ++++ b/probes/lttng-kprobes.c
> > > > +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> > > > +       int ret;
> > > > +       unsigned long data = (unsigned long) p->addr;
> > > > +
> > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > +               return 0;
> > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > +               return 0;
> > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > +               return 0;
> > > > +
> > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> > > > +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> > > > +index ab98ff2..a6bcd21 100644
> > > > +--- a/probes/lttng-kretprobes.c
> > > > ++++ b/probes/lttng-kretprobes.c
> > > > +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> > > > +               unsigned long parent_ip;
> > > > +       } payload;
> > > > +
> > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > +               return 0;
> > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > +               return 0;
> > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > +               return 0;
> > > > +
> > > > +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> > > > +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> > > > +index 77b8638..72a669e 100644
> > > > +--- a/probes/lttng-tracepoint-event-impl.h
> > > > ++++ b/probes/lttng-tracepoint-event-impl.h
> > > > +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> > > > +                                                                             \
> > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > +               return;                                                       \
> > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > +               return;                                                       \
> > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > +               return;                                                       \
> > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > +               return;                                                       \
> > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> > > > +                                                                             \
> > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > +               return;                                                       \
> > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > +               return;                                                       \
> > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > +               return;                                                       \
> > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > +               return;                                                       \
> > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> > > > +index bc10128..bda1d9b 100644
> > > > +--- a/probes/lttng-uprobes.c
> > > > ++++ b/probes/lttng-uprobes.c
> > > > +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> > > > +               unsigned long ip;
> > > > +       } payload;
> > > > +
> > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > +               return 0;
> > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > +               return 0;
> > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > +               return 0;
> > > > +
> > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> > > > +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> > > > +index 1496f33..b9f8c51 100644
> > > > +--- a/wrapper/compiler.h
> > > > ++++ b/wrapper/compiler.h
> > > > +@@ -9,6 +9,7 @@
> > > > + #define _LTTNG_WRAPPER_COMPILER_H
> > > > +
> > > > + #include <linux/compiler.h>
> > > > ++#include <linux/version.h>
> > > > +
> > > > + /*
> > > > +  * Don't allow compiling with buggy compiler.
> > > > +@@ -39,4 +40,21 @@
> > > > + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> > > > + #endif
> > > > +
> > > > ++/*
> > > > ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> > > > ++ * lockless_dereference(), replicate this behavior on prior kernels
> > > > ++ * and remove calls to smp_read_barrier_depends which was dropped
> > > > ++ * in v5.9.
> > > > ++ */
> > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> > > > ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> > > > ++#else
> > > > ++#define LTTNG_READ_ONCE(x)                    \
> > > > ++({                                            \
> > > > ++      typeof(x) __val = READ_ONCE(x);         \
> > > > ++      smp_read_barrier_depends();             \
> > > > ++      __val;                                  \
> > > > ++})
> > > > ++#endif
> > > > ++
> > > > + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> > > > +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> > > > +index 9f4e366..187fc82 100644
> > > > +--- a/wrapper/trace-clock.h
> > > > ++++ b/wrapper/trace-clock.h
> > > > +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> > > > +
> > > > + static inline u64 trace_clock_read64(void)
> > > > + {
> > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > +
> > > > +       if (likely(!ltc)) {
> > > > +               return trace_clock_read64_monotonic();
> > > > +       } else {
> > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > +               return ltc->read64();
> > > > +       }
> > > > + }
> > > > +
> > > > + static inline u64 trace_clock_freq(void)
> > > > + {
> > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > +
> > > > +       if (!ltc) {
> > > > +               return trace_clock_freq_monotonic();
> > > > +       } else {
> > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > +               return ltc->freq();
> > > > +       }
> > > > + }
> > > > +
> > > > + static inline int trace_clock_uuid(char *uuid)
> > > > + {
> > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > +
> > > > +-      read_barrier_depends(); /* load ltc before content */
> > > > +       /* Use default UUID cb when NULL */
> > > > +       if (!ltc || !ltc->uuid) {
> > > > +               return trace_clock_uuid_monotonic(uuid);
> > > > +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> > > > +
> > > > + static inline const char *trace_clock_name(void)
> > > > + {
> > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > +
> > > > +       if (!ltc) {
> > > > +               return trace_clock_name_monotonic();
> > > > +       } else {
> > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > +               return ltc->name();
> > > > +       }
> > > > + }
> > > > +
> > > > + static inline const char *trace_clock_description(void)
> > > > + {
> > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > +
> > > > +       if (!ltc) {
> > > > +               return trace_clock_description_monotonic();
> > > > +       } else {
> > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > +               return ltc->description();
> > > > +       }
> > > > + }
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > new file mode 100644
> > > > index 0000000000..2843c9cb62
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > @@ -0,0 +1,59 @@
> > > > +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > +Date: Mon, 31 Aug 2020 11:41:38 -0400
> > > > +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> > > > +
> > > > +See upstream commit:
> > > > +
> > > > +  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.
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> > > > +---
> > > > + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> > > > + 1 file changed, 15 insertions(+), 1 deletion(-)
> > > > +
> > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > +index affb4eb..ece67ad 100644
> > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> > > > +
> > > > + #endif
> > > > +
> > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > ++#define show_inode_state(state)                                       \
> > > > ++      __print_flags(state, "|",                               \
> > > > ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> > > > ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> > > > ++              {I_NEW,                 "I_NEW"},               \
> > > > ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> > > > ++              {I_FREEING,             "I_FREEING"},           \
> > > > ++              {I_CLEAR,               "I_CLEAR"},             \
> > > > ++              {I_SYNC,                "I_SYNC"},              \
> > > > ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> > > > ++              {I_REFERENCED,          "I_REFERENCED"}         \
> > > > ++      )
> > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > + #define show_inode_state(state)                                       \
> > > > +       __print_flags(state, "|",                               \
> > > > +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > new file mode 100644
> > > > index 0000000000..7a0d9a38b8
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > @@ -0,0 +1,117 @@
> > > > +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > +Date: Mon, 31 Aug 2020 14:16:01 -0400
> > > > +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> > > > + processing (v5.9)
> > > > +
> > > > +See upstream commit:
> > > > +
> > > > +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> > > > +  Author: Jan Kara <jack@suse.cz>
> > > > +  Date:   Fri May 29 16:08:58 2020 +0200
> > > > +
> > > > +    writeback: Fix sync livelock due to b_dirty_time processing
> > > > +
> > > > +    When we are processing writeback for sync(2), move_expired_inodes()
> > > > +    didn't set any inode expiry value (older_than_this). This can result in
> > > > +    writeback never completing if there's steady stream of inodes added to
> > > > +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> > > > +    round whether there's more work to be done. Fix the problem by using
> > > > +    sync(2) start time is inode expiry value when processing b_dirty_time
> > > > +    list similarly as for ordinarily dirtied inodes. This requires some
> > > > +    refactoring of older_than_this handling which simplifies the code
> > > > +    noticeably as a bonus.
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +---
> > > > + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> > > > + 1 file changed, 26 insertions(+), 13 deletions(-)
> > > > +
> > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > +index ece67ad..e9018dd 100644
> > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > + #endif
> > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > +
> > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > ++               struct wb_writeback_work *work,
> > > > ++               unsigned long dirtied_before,
> > > > ++               int moved),
> > > > ++      TP_ARGS(wb, work, dirtied_before, moved),
> > > > ++      TP_FIELDS(
> > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > ++              ctf_integer(unsigned long, older, dirtied_before)
> > > > ++              ctf_integer(int, moved, moved)
> > > > ++      )
> > > > ++)
> > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > +                struct wb_writeback_work *work,
> > > > +-#else
> > > > +-               unsigned long *older_than_this,
> > > > +-#endif
> > > > +                int moved),
> > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > +       TP_ARGS(wb, work, moved),
> > > > +-#else
> > > > ++      TP_FIELDS(
> > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > ++              ctf_integer(int, moved, moved)
> > > > ++      )
> > > > ++)
> > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > ++               unsigned long *older_than_this,
> > > > ++               int moved),
> > > > +       TP_ARGS(wb, older_than_this, moved),
> > > > +-#endif
> > > > +       TP_FIELDS(
> > > > +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > +-#else
> > > > +               ctf_integer(unsigned long, older,
> > > > +                       older_than_this ? *older_than_this : 0)
> > > > +               ctf_integer(long, age,
> > > > +                       older_than_this ?
> > > > +                               (jiffies - *older_than_this) * 1000 / HZ
> > > > +                               : -1)
> > > > +-#endif
> > > > +               ctf_integer(int, moved, moved)
> > > > +       )
> > > > + )
> > > > ++#endif
> > > > +
> > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> > > > +       )
> > > > + )
> > > > +-#else
> > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > +
> > > > +       writeback_global_dirty_state,
> > > > +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > +       )
> > > > + )
> > > > + #endif
> > > > +-#endif
> > > > +
> > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > +
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > new file mode 100644
> > > > index 0000000000..346e1d63ad
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > @@ -0,0 +1,52 @@
> > > > +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > +Date: Fri, 4 Sep 2020 11:52:51 -0400
> > > > +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> > > > + writeback_queue_io
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> > > > +---
> > > > + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> > > > + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> > > > + 2 files changed, 9 insertions(+), 2 deletions(-)
> > > > +
> > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > +index 4476abb..b172c8d 100644
> > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > + )
> > > > + #endif
> > > > +
> > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > +
> > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > +index e9018dd..09637d7 100644
> > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > + #endif
> > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > +
> > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> > > > ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> > > > ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> > > > ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> > > > ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> > > > ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > +                struct wb_writeback_work *work,
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > new file mode 100644
> > > > index 0000000000..a16750ddb3
> > > > --- /dev/null
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > @@ -0,0 +1,918 @@
> > > > +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> > > > +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +Date: Tue, 28 Jan 2020 16:02:44 -0500
> > > > +Subject: [PATCH 10/10] Fix: system call filter table
> > > > +
> > > > +The system call filter table has effectively been unused for a long
> > > > +time due to system call name prefix mismatch. This means the overhead of
> > > > +selective system call tracing was larger than it should have been because
> > > > +the event payload preparation would be done for all system calls as soon
> > > > +as a single system call is traced.
> > > > +
> > > > +However, fixing this underlying issue unearths several issues that crept
> > > > +unnoticed when the "enabler" concept was introduced (after the original
> > > > +implementation of the system call filter table).
> > > > +
> > > > +Here is a list of the issues which are resolved here:
> > > > +
> > > > +- Split lttng_syscalls_unregister into an unregister and destroy
> > > > +  function, thus awaiting for a grace period (and therefore quiescence
> > > > +  of the users) after unregistering the system call tracepoints before
> > > > +  freeing the system call filter data structures. This effectively fixes
> > > > +  a use-after-free.
> > > > +
> > > > +- The state for enabling "all" system calls vs enabling specific system
> > > > +  calls (and sequences of enable-disable) was incorrect with respect to
> > > > +  the "enablers" semantic. This is solved by always tracking the
> > > > +  bitmap of enabled system calls, and keeping this bitmap even when
> > > > +  enabling all system calls. The sc_filter is now always allocated
> > > > +  before system call tracing is registered to tracepoints, which means
> > > > +  it does not need to be RCU dereferenced anymore.
> > > > +
> > > > +Padding fields in the ABI are reserved to select whether to:
> > > > +
> > > > +- Trace either native or compat system call (or both, which is the
> > > > +  behavior currently implemented),
> > > > +- Trace either system call entry or exit (or both, which is the
> > > > +  behavior currently implemented),
> > > > +- Select the system call to trace by name (behavior currently
> > > > +  implemented) or by system call number,
> > > > +
> > > > +Upstream-Status: Backport
> > > > +
> > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > +---
> > > > + lttng-abi.c      |  43 ++++++
> > > > + lttng-abi.h      |  26 ++++
> > > > + lttng-events.c   | 112 +++++++++++++--
> > > > + lttng-events.h   |  31 ++++-
> > > > + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> > > > + 5 files changed, 380 insertions(+), 180 deletions(-)
> > > > +
> > > > +diff --git a/lttng-abi.c b/lttng-abi.c
> > > > +index 64ea99d..b33879d 100644
> > > > +--- a/lttng-abi.c
> > > > ++++ b/lttng-abi.c
> > > > +@@ -1264,6 +1264,46 @@ nomem:
> > > > +       return ret;
> > > > + }
> > > > +
> > > > ++static
> > > > ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> > > > ++{
> > > > ++      /* Limit ABI to implemented features. */
> > > > ++      switch (event_param->instrumentation) {
> > > > ++      case LTTNG_KERNEL_SYSCALL:
> > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > ++                      break;
> > > > ++              default:
> > > > ++                      return -EINVAL;
> > > > ++              }
> > > > ++              switch (event_param->u.syscall.abi) {
> > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > ++                      break;
> > > > ++              default:
> > > > ++                      return -EINVAL;
> > > > ++              }
> > > > ++              switch (event_param->u.syscall.match) {
> > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > ++                      break;
> > > > ++              default:
> > > > ++                      return -EINVAL;
> > > > ++              }
> > > > ++              break;
> > > > ++
> > > > ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> > > > ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> > > > ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> > > > ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> > > > ++      case LTTNG_KERNEL_UPROBE:
> > > > ++              break;
> > > > ++
> > > > ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> > > > ++      default:
> > > > ++              return -EINVAL;
> > > > ++      }
> > > > ++      return 0;
> > > > ++}
> > > > ++
> > > > + static
> > > > + int lttng_abi_create_event(struct file *channel_file,
> > > > +                          struct lttng_kernel_event *event_param)
> > > > +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> > > > +               ret = -EOVERFLOW;
> > > > +               goto refcount_error;
> > > > +       }
> > > > ++      ret = lttng_abi_validate_event_param(event_param);
> > > > ++      if (ret)
> > > > ++              goto event_error;
> > > > +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> > > > +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> > > > +               struct lttng_enabler *enabler;
> > > > +diff --git a/lttng-abi.h b/lttng-abi.h
> > > > +index 1d356ab..51d60e5 100644
> > > > +--- a/lttng-abi.h
> > > > ++++ b/lttng-abi.h
> > > > +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> > > > +       } u;
> > > > + } __attribute__((packed));
> > > > +
> > > > ++enum lttng_kernel_syscall_entryexit {
> > > > ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> > > > ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> > > > ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> > > > ++};
> > > > ++
> > > > ++enum lttng_kernel_syscall_abi {
> > > > ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> > > > ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> > > > ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> > > > ++};
> > > > ++
> > > > ++enum lttng_kernel_syscall_match {
> > > > ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> > > > ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> > > > ++};
> > > > ++
> > > > ++struct lttng_kernel_syscall {
> > > > ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> > > > ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> > > > ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> > > > ++      uint8_t padding;
> > > > ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> > > > ++} __attribute__((packed));
> > > > ++
> > > > + /*
> > > > +  * For syscall tracing, name = "*" means "enable all".
> > > > +  */
> > > > +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> > > > +               struct lttng_kernel_kprobe kprobe;
> > > > +               struct lttng_kernel_function_tracer ftrace;
> > > > +               struct lttng_kernel_uprobe uprobe;
> > > > ++              struct lttng_kernel_syscall syscall;
> > > > +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> > > > +       } u;
> > > > + } __attribute__((packed));
> > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > +index d719294..4c0b04a 100644
> > > > +--- a/lttng-events.c
> > > > ++++ b/lttng-events.c
> > > > +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> > > > +               WARN_ON(ret);
> > > > +       }
> > > > +       synchronize_trace();    /* Wait for in-flight events to complete */
> > > > ++      list_for_each_entry(chan, &session->chan, list) {
> > > > ++              ret = lttng_syscalls_destroy(chan);
> > > > ++              WARN_ON(ret);
> > > > ++      }
> > > > +       list_for_each_entry_safe(enabler, tmpenabler,
> > > > +                       &session->enablers_head, node)
> > > > +               lttng_enabler_destroy(enabler);
> > > > +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> > > > +               event->enabled = 0;
> > > > +               event->registered = 0;
> > > > +               event->desc = event_desc;
> > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > ++                      ret = -EINVAL;
> > > > ++                      goto register_error;
> > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> > > > ++                      break;
> > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> > > > ++                      break;
> > > > ++              }
> > > > ++              switch (event_param->u.syscall.abi) {
> > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > ++                      ret = -EINVAL;
> > > > ++                      goto register_error;
> > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> > > > ++                      break;
> > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> > > > ++                      break;
> > > > ++              }
> > > > +               if (!event->desc) {
> > > > +                       ret = -EINVAL;
> > > > +                       goto register_error;
> > > > +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> > > > +                                                 event);
> > > > +               break;
> > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > +-              ret = lttng_syscall_filter_enable(event->chan,
> > > > +-                      desc->name);
> > > > ++              ret = lttng_syscall_filter_enable(event->chan, event);
> > > > +               break;
> > > > +       case LTTNG_KERNEL_KPROBE:
> > > > +       case LTTNG_KERNEL_UPROBE:
> > > > +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> > > > +               ret = 0;
> > > > +               break;
> > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > +-              ret = lttng_syscall_filter_disable(event->chan,
> > > > +-                      desc->name);
> > > > ++              ret = lttng_syscall_filter_disable(event->chan, event);
> > > > +               break;
> > > > +       case LTTNG_KERNEL_NOOP:
> > > > +               ret = 0;
> > > > +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> > > > +               struct lttng_enabler *enabler)
> > > > + {
> > > > +       const char *desc_name, *enabler_name;
> > > > ++      bool compat = false, entry = false;
> > > > +
> > > > +       enabler_name = enabler->event_param.name;
> > > > +       switch (enabler->event_param.instrumentation) {
> > > > +       case LTTNG_KERNEL_TRACEPOINT:
> > > > +               desc_name = desc->name;
> > > > ++              switch (enabler->type) {
> > > > ++              case LTTNG_ENABLER_STAR_GLOB:
> > > > ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > ++              case LTTNG_ENABLER_NAME:
> > > > ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> > > > ++              default:
> > > > ++                      return -EINVAL;
> > > > ++              }
> > > > +               break;
> > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > +               desc_name = desc->name;
> > > > +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> > > > ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> > > > +                       desc_name += strlen("compat_");
> > > > ++                      compat = true;
> > > > ++              }
> > > > +               if (!strncmp(desc_name, "syscall_exit_",
> > > > +                               strlen("syscall_exit_"))) {
> > > > +                       desc_name += strlen("syscall_exit_");
> > > > +               } else if (!strncmp(desc_name, "syscall_entry_",
> > > > +                               strlen("syscall_entry_"))) {
> > > > +                       desc_name += strlen("syscall_entry_");
> > > > ++                      entry = true;
> > > > +               } else {
> > > > +                       WARN_ON_ONCE(1);
> > > > +                       return -EINVAL;
> > > > +               }
> > > > ++              switch (enabler->event_param.u.syscall.entryexit) {
> > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > ++                      break;
> > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > ++                      if (!entry)
> > > > ++                              return 0;
> > > > ++                      break;
> > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > ++                      if (entry)
> > > > ++                              return 0;
> > > > ++                      break;
> > > > ++              default:
> > > > ++                      return -EINVAL;
> > > > ++              }
> > > > ++              switch (enabler->event_param.u.syscall.abi) {
> > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > ++                      break;
> > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > ++                      if (compat)
> > > > ++                              return 0;
> > > > ++                      break;
> > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > ++                      if (!compat)
> > > > ++                              return 0;
> > > > ++                      break;
> > > > ++              default:
> > > > ++                      return -EINVAL;
> > > > ++              }
> > > > ++              switch (enabler->event_param.u.syscall.match) {
> > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > ++                      switch (enabler->type) {
> > > > ++                      case LTTNG_ENABLER_STAR_GLOB:
> > > > ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > ++                      case LTTNG_ENABLER_NAME:
> > > > ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > ++                      default:
> > > > ++                              return -EINVAL;
> > > > ++                      }
> > > > ++                      break;
> > > > ++              case LTTNG_SYSCALL_MATCH_NR:
> > > > ++                      return -EINVAL; /* Not implemented. */
> > > > ++              default:
> > > > ++                      return -EINVAL;
> > > > ++              }
> > > > +               break;
> > > > +       default:
> > > > +               WARN_ON_ONCE(1);
> > > > +               return -EINVAL;
> > > > +       }
> > > > +-      switch (enabler->type) {
> > > > +-      case LTTNG_ENABLER_STAR_GLOB:
> > > > +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > +-      case LTTNG_ENABLER_NAME:
> > > > +-              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > +-      default:
> > > > +-              return -EINVAL;
> > > > +-      }
> > > > + }
> > > > +
> > > > + static
> > > > +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> > > > + static
> > > > + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> > > > + {
> > > > +-      struct lttng_session *session = enabler->chan->session;
> > > > ++      struct lttng_channel *chan = enabler->chan;
> > > > ++      struct lttng_session *session = chan->session;
> > > > +       struct lttng_event *event;
> > > > +
> > > > ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> > > > ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> > > > ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> > > > ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> > > > ++                      !strcmp(enabler->event_param.name, "*")) {
> > > > ++              if (enabler->enabled)
> > > > ++                      WRITE_ONCE(chan->syscall_all, 1);
> > > > ++              else
> > > > ++                      WRITE_ONCE(chan->syscall_all, 0);
> > > > ++      }
> > > > ++
> > > > +       /* First ensure that probe events are created for this enabler. */
> > > > +       lttng_create_event_if_missing(enabler);
> > > > +
> > > > +diff --git a/lttng-events.h b/lttng-events.h
> > > > +index a36a312..d4d9976 100644
> > > > +--- a/lttng-events.h
> > > > ++++ b/lttng-events.h
> > > > +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> > > > +       struct list_head node;
> > > > + };
> > > > +
> > > > ++enum lttng_syscall_entryexit {
> > > > ++      LTTNG_SYSCALL_ENTRY,
> > > > ++      LTTNG_SYSCALL_EXIT,
> > > > ++};
> > > > ++
> > > > ++enum lttng_syscall_abi {
> > > > ++      LTTNG_SYSCALL_ABI_NATIVE,
> > > > ++      LTTNG_SYSCALL_ABI_COMPAT,
> > > > ++};
> > > > ++
> > > > + /*
> > > > +  * lttng_event structure is referred to by the tracing fast path. It must be
> > > > +  * kept small.
> > > > +@@ -318,6 +328,11 @@ struct lttng_event {
> > > > +                       struct inode *inode;
> > > > +                       struct list_head head;
> > > > +               } uprobe;
> > > > ++              struct {
> > > > ++                      char *syscall_name;
> > > > ++                      enum lttng_syscall_entryexit entryexit;
> > > > ++                      enum lttng_syscall_abi abi;
> > > > ++              } syscall;
> > > > +       } u;
> > > > +       struct list_head list;          /* Event list in session */
> > > > +       unsigned int metadata_dumped:1;
> > > > +@@ -457,10 +472,10 @@ struct lttng_channel {
> > > > +       struct lttng_syscall_filter *sc_filter;
> > > > +       int header_type;                /* 0: unset, 1: compact, 2: large */
> > > > +       enum channel_type channel_type;
> > > > ++      int syscall_all;
> > > > +       unsigned int metadata_dumped:1,
> > > > +               sys_enter_registered:1,
> > > > +               sys_exit_registered:1,
> > > > +-              syscall_all:1,
> > > > +               tstate:1;               /* Transient enable state */
> > > > + };
> > > > +
> > > > +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> > > > + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> > > > + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> > > > + int lttng_syscalls_unregister(struct lttng_channel *chan);
> > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> > > > + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > +-              const char *name);
> > > > ++              struct lttng_event *event);
> > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > +-              const char *name);
> > > > ++              struct lttng_event *event);
> > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> > > > + #else
> > > > +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > +       return 0;
> > > > + }
> > > > +
> > > > ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > ++{
> > > > ++      return 0;
> > > > ++}
> > > > ++
> > > > + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > +-              const char *name)
> > > > ++              struct lttng_event *event);
> > > > + {
> > > > +       return -ENOSYS;
> > > > + }
> > > > +
> > > > + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > +-              const char *name)
> > > > ++              struct lttng_event *event);
> > > > + {
> > > > +       return -ENOSYS;
> > > > + }
> > > > +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> > > > +index 97f1ba9..26cead6 100644
> > > > +--- a/lttng-syscalls.c
> > > > ++++ b/lttng-syscalls.c
> > > > +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> > > > + #undef CREATE_SYSCALL_TABLE
> > > > +
> > > > + struct lttng_syscall_filter {
> > > > +-      DECLARE_BITMAP(sc, NR_syscalls);
> > > > +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> > > > ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> > > > ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> > > > ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> > > > ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> > > > + };
> > > > +
> > > > + static void syscall_entry_unknown(struct lttng_event *event,
> > > > +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> > > > +       size_t table_len;
> > > > +
> > > > +       if (unlikely(in_compat_syscall())) {
> > > > +-              struct lttng_syscall_filter *filter;
> > > > +-
> > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > +-              if (filter) {
> > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > +-                              /* System call filtered out. */
> > > > +-                              return;
> > > > +-                      }
> > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > ++
> > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> > > > ++                      /* System call filtered out. */
> > > > ++                      return;
> > > > +               }
> > > > +               table = compat_sc_table;
> > > > +               table_len = ARRAY_SIZE(compat_sc_table);
> > > > +               unknown_event = chan->sc_compat_unknown;
> > > > +       } else {
> > > > +-              struct lttng_syscall_filter *filter;
> > > > +-
> > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > +-              if (filter) {
> > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > +-                              || !test_bit(id, filter->sc)) {
> > > > +-                              /* System call filtered out. */
> > > > +-                              return;
> > > > +-                      }
> > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > ++
> > > > ++              if (id < 0 || id >= NR_syscalls
> > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> > > > ++                      /* System call filtered out. */
> > > > ++                      return;
> > > > +               }
> > > > +               table = sc_table;
> > > > +               table_len = ARRAY_SIZE(sc_table);
> > > > +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> > > > +
> > > > +       id = syscall_get_nr(current, regs);
> > > > +       if (unlikely(in_compat_syscall())) {
> > > > +-              struct lttng_syscall_filter *filter;
> > > > +-
> > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > +-              if (filter) {
> > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > +-                              /* System call filtered out. */
> > > > +-                              return;
> > > > +-                      }
> > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > ++
> > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> > > > ++                      /* System call filtered out. */
> > > > ++                      return;
> > > > +               }
> > > > +               table = compat_sc_exit_table;
> > > > +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> > > > +               unknown_event = chan->compat_sc_exit_unknown;
> > > > +       } else {
> > > > +-              struct lttng_syscall_filter *filter;
> > > > +-
> > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > +-              if (filter) {
> > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > +-                              || !test_bit(id, filter->sc)) {
> > > > +-                              /* System call filtered out. */
> > > > +-                              return;
> > > > +-                      }
> > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > ++
> > > > ++              if (id < 0 || id >= NR_syscalls
> > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> > > > ++                      /* System call filtered out. */
> > > > ++                      return;
> > > > +               }
> > > > +               table = sc_exit_table;
> > > > +               table_len = ARRAY_SIZE(sc_exit_table);
> > > > +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> > > > +               memset(&ev, 0, sizeof(ev));
> > > > +               switch (type) {
> > > > +               case SC_TYPE_ENTRY:
> > > > +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > +                       break;
> > > > +               case SC_TYPE_EXIT:
> > > > +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > +                       break;
> > > > +               case SC_TYPE_COMPAT_ENTRY:
> > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > +                       break;
> > > > +               case SC_TYPE_COMPAT_EXIT:
> > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > +-                      break;
> > > > +-              default:
> > > > +-                      BUG_ON(1);
> > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > +                       break;
> > > > +               }
> > > > +-              strncat(ev.name, desc->name,
> > > > +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> > > > ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> > > > +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> > > > +                                               desc,
> > > > +                                               ev.instrumentation);
> > > > +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> > > > +                                               desc,
> > > > +                                               ev.instrumentation);
> > > > +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> > > > +                                               filter, desc,
> > > > +                                               ev.instrumentation);
> > > > +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> > > > +                                               desc, ev.instrumentation);
> > > > +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> > > > +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > +       if (ret)
> > > > +               return ret;
> > > > + #endif
> > > > ++
> > > > ++      if (!chan->sc_filter) {
> > > > ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > ++                              GFP_KERNEL);
> > > > ++              if (!chan->sc_filter)
> > > > ++                      return -ENOMEM;
> > > > ++      }
> > > > ++
> > > > +       if (!chan->sys_enter_registered) {
> > > > +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> > > > +                               (void *) syscall_entry_probe, chan);
> > > > +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > +                       return ret;
> > > > +               chan->sys_exit_registered = 0;
> > > > +       }
> > > > +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> > > > ++      return 0;
> > > > ++}
> > > > ++
> > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > ++{
> > > > +       kfree(chan->sc_table);
> > > > +       kfree(chan->sc_exit_table);
> > > > + #ifdef CONFIG_COMPAT
> > > > +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> > > > +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> > > > + }
> > > > +
> > > > +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > +-              const char *name)
> > > > ++static
> > > > ++const char *get_syscall_name(struct lttng_event *event)
> > > > + {
> > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > +-      struct lttng_syscall_filter *filter;
> > > > ++      size_t prefix_len = 0;
> > > > +
> > > > +-      WARN_ON_ONCE(!chan->sc_table);
> > > > ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> > > > +
> > > > +-      if (!name) {
> > > > +-              /* Enable all system calls by removing filter */
> > > > +-              if (chan->sc_filter) {
> > > > +-                      filter = chan->sc_filter;
> > > > +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> > > > +-                      synchronize_trace();
> > > > +-                      kfree(filter);
> > > > ++      switch (event->u.syscall.entryexit) {
> > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > ++              switch (event->u.syscall.abi) {
> > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> > > > ++                      break;
> > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> > > > ++                      break;
> > > > +               }
> > > > +-              chan->syscall_all = 1;
> > > > +-              return 0;
> > > > +-      }
> > > > +-
> > > > +-      if (!chan->sc_filter) {
> > > > +-              if (chan->syscall_all) {
> > > > +-                      /*
> > > > +-                       * All syscalls are already enabled.
> > > > +-                       */
> > > > +-                      return -EEXIST;
> > > > ++              break;
> > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > ++              switch (event->u.syscall.abi) {
> > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> > > > ++                      break;
> > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> > > > ++                      break;
> > > > +               }
> > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > +-                              GFP_KERNEL);
> > > > +-              if (!filter)
> > > > +-                      return -ENOMEM;
> > > > +-      } else {
> > > > +-              filter = chan->sc_filter;
> > > > ++              break;
> > > > +       }
> > > > +-      syscall_nr = get_syscall_nr(name);
> > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > +-              ret = -ENOENT;
> > > > +-              goto error;
> > > > ++      WARN_ON_ONCE(prefix_len == 0);
> > > > ++      return event->desc->name + prefix_len;
> > > > ++}
> > > > ++
> > > > ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > ++              struct lttng_event *event)
> > > > ++{
> > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > ++      const char *syscall_name;
> > > > ++      unsigned long *bitmap;
> > > > ++      int syscall_nr;
> > > > ++
> > > > ++      WARN_ON_ONCE(!chan->sc_table);
> > > > ++
> > > > ++      syscall_name = get_syscall_name(event);
> > > > ++
> > > > ++      switch (event->u.syscall.abi) {
> > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > ++              break;
> > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > ++              break;
> > > > ++      default:
> > > > ++              return -EINVAL;
> > > > +       }
> > > > +-      if (syscall_nr >= 0) {
> > > > +-              if (test_bit(syscall_nr, filter->sc)) {
> > > > +-                      ret = -EEXIST;
> > > > +-                      goto error;
> > > > ++      if (syscall_nr < 0)
> > > > ++              return -ENOENT;
> > > > ++
> > > > ++
> > > > ++      switch (event->u.syscall.entryexit) {
> > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > ++              switch (event->u.syscall.abi) {
> > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > ++                      bitmap = filter->sc_entry;
> > > > ++                      break;
> > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > ++                      bitmap = filter->sc_compat_entry;
> > > > ++                      break;
> > > > +               }
> > > > +-              bitmap_set(filter->sc, syscall_nr, 1);
> > > > +-      }
> > > > +-      if (compat_syscall_nr >= 0) {
> > > > +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > +-                      ret = -EEXIST;
> > > > +-                      goto error;
> > > > ++              break;
> > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > ++              switch (event->u.syscall.abi) {
> > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > ++                      bitmap = filter->sc_exit;
> > > > ++                      break;
> > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > ++                      bitmap = filter->sc_compat_exit;
> > > > ++                      break;
> > > > +               }
> > > > +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> > > > ++              break;
> > > > ++      default:
> > > > ++              return -EINVAL;
> > > > +       }
> > > > +-      if (!chan->sc_filter)
> > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > ++      if (test_bit(syscall_nr, bitmap))
> > > > ++              return -EEXIST;
> > > > ++      bitmap_set(bitmap, syscall_nr, 1);
> > > > +       return 0;
> > > > +-
> > > > +-error:
> > > > +-      if (!chan->sc_filter)
> > > > +-              kfree(filter);
> > > > +-      return ret;
> > > > + }
> > > > +
> > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > +-              const char *name)
> > > > ++              struct lttng_event *event)
> > > > + {
> > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > +-      struct lttng_syscall_filter *filter;
> > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > ++      const char *syscall_name;
> > > > ++      unsigned long *bitmap;
> > > > ++      int syscall_nr;
> > > > +
> > > > +       WARN_ON_ONCE(!chan->sc_table);
> > > > +
> > > > +-      if (!chan->sc_filter) {
> > > > +-              if (!chan->syscall_all)
> > > > +-                      return -EEXIST;
> > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > +-                              GFP_KERNEL);
> > > > +-              if (!filter)
> > > > +-                      return -ENOMEM;
> > > > +-              /* Trace all system calls, then apply disable. */
> > > > +-              bitmap_set(filter->sc, 0, NR_syscalls);
> > > > +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> > > > +-      } else {
> > > > +-              filter = chan->sc_filter;
> > > > ++      syscall_name = get_syscall_name(event);
> > > > ++
> > > > ++      switch (event->u.syscall.abi) {
> > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > ++              break;
> > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > ++              break;
> > > > ++      default:
> > > > ++              return -EINVAL;
> > > > +       }
> > > > ++      if (syscall_nr < 0)
> > > > ++              return -ENOENT;
> > > > +
> > > > +-      if (!name) {
> > > > +-              /* Fail if all syscalls are already disabled. */
> > > > +-              if (bitmap_empty(filter->sc, NR_syscalls)
> > > > +-                      && bitmap_empty(filter->sc_compat,
> > > > +-                              NR_compat_syscalls)) {
> > > > +-                      ret = -EEXIST;
> > > > +-                      goto error;
> > > > +-              }
> > > > +
> > > > +-              /* Disable all system calls */
> > > > +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> > > > +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> > > > +-              goto apply_filter;
> > > > +-      }
> > > > +-      syscall_nr = get_syscall_nr(name);
> > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > +-              ret = -ENOENT;
> > > > +-              goto error;
> > > > +-      }
> > > > +-      if (syscall_nr >= 0) {
> > > > +-              if (!test_bit(syscall_nr, filter->sc)) {
> > > > +-                      ret = -EEXIST;
> > > > +-                      goto error;
> > > > ++      switch (event->u.syscall.entryexit) {
> > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > ++              switch (event->u.syscall.abi) {
> > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > ++                      bitmap = filter->sc_entry;
> > > > ++                      break;
> > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > ++                      bitmap = filter->sc_compat_entry;
> > > > ++                      break;
> > > > +               }
> > > > +-              bitmap_clear(filter->sc, syscall_nr, 1);
> > > > +-      }
> > > > +-      if (compat_syscall_nr >= 0) {
> > > > +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > +-                      ret = -EEXIST;
> > > > +-                      goto error;
> > > > ++              break;
> > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > ++              switch (event->u.syscall.abi) {
> > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > ++                      bitmap = filter->sc_exit;
> > > > ++                      break;
> > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > ++                      bitmap = filter->sc_compat_exit;
> > > > ++                      break;
> > > > +               }
> > > > +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> > > > ++              break;
> > > > ++      default:
> > > > ++              return -EINVAL;
> > > > +       }
> > > > +-apply_filter:
> > > > +-      if (!chan->sc_filter)
> > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > +-      chan->syscall_all = 0;
> > > > +-      return 0;
> > > > ++      if (!test_bit(syscall_nr, bitmap))
> > > > ++              return -EEXIST;
> > > > ++      bitmap_clear(bitmap, syscall_nr, 1);
> > > > +
> > > > +-error:
> > > > +-      if (!chan->sc_filter)
> > > > +-              kfree(filter);
> > > > +-      return ret;
> > > > ++      return 0;
> > > > + }
> > > > +
> > > > + static
> > > > +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> > > > +       .release = seq_release,
> > > > + };
> > > > +
> > > > ++/*
> > > > ++ * A syscall is enabled if it is traced for either entry or exit.
> > > > ++ */
> > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> > > > + {
> > > > +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > +               char state;
> > > > +
> > > > +               if (channel->sc_table) {
> > > > +-                      if (filter)
> > > > +-                              state = test_bit(bit, filter->sc);
> > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > ++                              state = test_bit(bit, filter->sc_entry)
> > > > ++                                      || test_bit(bit, filter->sc_exit);
> > > > +                       else
> > > > +                               state = 1;
> > > > +               } else {
> > > > +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > +               char state;
> > > > +
> > > > +               if (channel->compat_sc_table) {
> > > > +-                      if (filter)
> > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> > > > +-                                              filter->sc_compat);
> > > > ++                                              filter->sc_compat_entry)
> > > > ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> > > > ++                                              filter->sc_compat_exit);
> > > > +                       else
> > > > +                               state = 1;
> > > > +               } else {
> > > > +--
> > > > +2.19.1
> > > > +
> > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > index 0e1a209ce8..e36b327a08 100644
> > > > --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > @@ -11,6 +11,16 @@ include lttng-platforms.inc
> > > >  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
> > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> > > > +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> > > > +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> > > > +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> > > > +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> > > > +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> > > > +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> > > > +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> > > > +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> > > > +           file://0010-Fix-system-call-filter-table.patch \
> > > >             "
> > > >
> > > >  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> > > > @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
> > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > >             "
> > > > -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> > > > +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
> > > >  PV_class-devupstream = "2.12.2+git${SRCPV}"
> > > >  S_class-devupstream = "${WORKDIR}/git"
> > > >  SRCREV_FORMAT ?= "lttng_git"
> > > > --
> > > > 2.19.1
> > > >
> > > > 
> >
> >
> >
> > --
> > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > thee at its end
> > - "Use the force Harry" - Gandalf, Star Trek II



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
       [not found]         ` <1638C0AFDA43827E.8201@lists.openembedded.org>
@ 2020-09-28 17:44           ` Bruce Ashfield
  2020-09-28 22:35             ` Steve Sakoman
  0 siblings, 1 reply; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-28 17:44 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Steve Sakoman, Richard Purdie,
	Patches and discussions about the oe-core layer

On Sun, Sep 27, 2020 at 5:18 PM Bruce Ashfield via
lists.openembedded.org
<bruce.ashfield=gmail.com@lists.openembedded.org> wrote:
>
> On Fri, Sep 25, 2020 at 3:49 PM Steve Sakoman <steve@sakoman.com> wrote:
> >
> > On Fri, Sep 25, 2020 at 6:52 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> > >
> > > On Fri, Sep 25, 2020 at 12:43 PM Steve Sakoman <steve@sakoman.com> wrote:
> > > >
> > > > Dunfell is still at 2.11.2.  Will there be a need for patches to this
> > > > version too?  Or should I take the lttng version bump along with the
> > > > 5.4 version bumps that cause the issue?
> > >
> > > I don't see a lot of options on that front. Unless we do some custom backports.
> > >
> > > I just checked the lttng 2.11 branch, and the last commit is from January, which
> > > is too old to cover these -stable kernel bump issues.
> > >
> > > I can have a go at the backports, but we should be prepared to bend the version
> > > upgrade rule if that gets too complex (and for the record, I've never
> > > had much luck
> > > with lttng fixes).
> >
> > Totally understood!  I think this is likely one of those cases where
> > we'll have to take an exception to the upgrade rule.
> >
> > If you see issues with a backport just let me know and I'll go with
> > the version upgrade approach.
>
> I'll have a go at some backports on Monday and send info by end of day.

Hmm. Despite the advertised kernel version limitations, I was able to
build lttng-modules against my dunfell branch with v5.4 bumped all the
way to v5.4.67.

So at this point, I'd suggest taking my kernel uprevs and running it
through the autobuilder. If nothing blows up on build, we are good to
go.

If it does blow up, let me know and I'll figure out how my local builds worked.

Bruce

>
> >
> > While I have your attention, what about "linux-yocto/config:
> > netfilter: Enable nat for ipv4 and ipv6" for dunfell?  I'll have to
> > prune out the changes for 5.8 in the commit, but does it make sense
> > for 5.4?
>
> It isn't a bugfix by a strict definition, but it also  won't hurt
> anything. It does
> make sense to keep 5.4 & 5.8 kernel configuration consistent whenever
> possible, so I'd say go ahead and do the port.
>
> Bruce
>
> >
> > Thanks!
> >
> > Steve
> >
> >
> >  >
> > > > On Mon, Sep 14, 2020 at 12:34 PM Bruce Ashfield
> > > > <bruce.ashfield@gmail.com> wrote:
> > > > >
> > > > > From: Jens Rehsack <sno@netbsd.org>
> > > > >
> > > > > Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> > > > > them once .3 is released, but for now, we need the fixes to build
> > > > > against the latest 5.4, 5.8 and 5.9 kernels.
> > > > >
> > > > > We also bump the devupstream SRCREV to pickup the same changes.
> > > > >
> > > > > Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> > > > > ---
> > > > >  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
> > > > >  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
> > > > >  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
> > > > >  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
> > > > >  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
> > > > >  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
> > > > >  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
> > > > >  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
> > > > >  ...es-for-ext4_discard_preallocations-a.patch |  52 +
> > > > >  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
> > > > >  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
> > > > >  11 files changed, 1829 insertions(+), 1 deletion(-)
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > >
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > new file mode 100644
> > > > > index 0000000000..ae8bec45de
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > @@ -0,0 +1,54 @@
> > > > > +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> > > > > +From: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > > +Date: Thu, 13 Aug 2020 16:24:39 +0300
> > > > > +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> > > > > + without CONFIG_FTRACE
> > > > > +
> > > > > +When building in-tree, one could disable CONFIG_FTRACE from kernel
> > > > > +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> > > > > +but generate a lot of linker errors like below because it leaves out
> > > > > +other stuff, e.g.:
> > > > > +
> > > > > +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> > > > > +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> > > > > +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> > > > > +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> > > > > +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> > > > > +
> > > > > +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> > > > > +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> > > > > +enabled.
> > > > > +
> > > > > +Steps to reproduce:
> > > > > +
> > > > > +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> > > > > +
> > > > > +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> > > > > +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> > > > > +
> > > > > +- Build will fail at linking stage
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +---
> > > > > + Kconfig | 2 +-
> > > > > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > +
> > > > > +diff --git a/Kconfig b/Kconfig
> > > > > +index acdab73..10eccff 100644
> > > > > +--- a/Kconfig
> > > > > ++++ b/Kconfig
> > > > > +@@ -2,7 +2,7 @@
> > > > > +
> > > > > + config LTTNG
> > > > > +       tristate "LTTng support"
> > > > > +-      select TRACEPOINTS
> > > > > ++      select TRACING
> > > > > +       help
> > > > > +         LTTng is an open source tracing framework for Linux.
> > > > > +
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > new file mode 100644
> > > > > index 0000000000..fab673b854
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > @@ -0,0 +1,41 @@
> > > > > +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Date: Mon, 10 Aug 2020 11:22:05 -0400
> > > > > +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> > > > > +
> > > > > +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> > > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > +  Date:   Mon Jun 22 13:20:29 2020 -0700
> > > > > +
> > > > > +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> > > > > +
> > > > > +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +---
> > > > > + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> > > > > + 1 file changed, 4 insertions(+)
> > > > > +
> > > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > +index 37384a2..5a7ef1e 100644
> > > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > +@@ -24,7 +24,11 @@
> > > > > +  */
> > > > > + #include <wrapper/tracepoint.h>
> > > > > +
> > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > > ++#else
> > > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > > ++#endif
> > > > > +
> > > > > + #undef TRACE_INCLUDE_PATH
> > > > > + #undef TRACE_INCLUDE_FILE
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > new file mode 100644
> > > > > index 0000000000..524631cc72
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > @@ -0,0 +1,39 @@
> > > > > +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Date: Mon, 10 Aug 2020 11:36:03 -0400
> > > > > +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> > > > > + accessor internal-only (v5.9)
> > > > > +
> > > > > +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> > > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > +  Date:   Mon Jun 22 13:20:32 2020 -0700
> > > > > +
> > > > > +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> > > > > +
> > > > > +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> > > > > +    be poking into the gory details of shadow pages.
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +---
> > > > > + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> > > > > + 1 file changed, 1 insertion(+)
> > > > > +
> > > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > +index 5a7ef1e..8f98186 100644
> > > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > +@@ -25,6 +25,7 @@
> > > > > + #include <wrapper/tracepoint.h>
> > > > > +
> > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> > > > > + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > > + #else
> > > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > new file mode 100644
> > > > > index 0000000000..e29c07252c
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > @@ -0,0 +1,84 @@
> > > > > +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Date: Mon, 24 Aug 2020 15:26:04 -0400
> > > > > +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> > > > > + (v5.9)
> > > > > +MIME-Version: 1.0
> > > > > +Content-Type: text/plain; charset=UTF-8
> > > > > +Content-Transfer-Encoding: 8bit
> > > > > +
> > > > > +See upstream commit:
> > > > > +
> > > > > +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> > > > > +  Author: brookxu <brookxu.cn@gmail.com>
> > > > > +  Date:   Mon Aug 17 15:36:15 2020 +0800
> > > > > +
> > > > > +    ext4: limit the length of per-inode prealloc list
> > > > > +
> > > > > +    In the scenario of writing sparse files, the per-inode prealloc list may
> > > > > +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> > > > > +    To circumvent this problem, we limit the maximum length of per-inode
> > > > > +    prealloc list to 512 and allow users to modify it.
> > > > > +
> > > > > +    After patching, we observed that the sys ratio of cpu has dropped, and
> > > > > +    the system throughput has increased significantly. We created a process
> > > > > +    to write the sparse file, and the running time of the process on the
> > > > > +    fixed kernel was significantly reduced, as follows:
> > > > > +
> > > > > +    Running time on unfixed kernel:
> > > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > > +    real    0m2.051s
> > > > > +    user    0m0.008s
> > > > > +    sys     0m2.026s
> > > > > +
> > > > > +    Running time on fixed kernel:
> > > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > > +    real    0m0.471s
> > > > > +    user    0m0.004s
> > > > > +    sys     0m0.395s
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> > > > > +---
> > > > > + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> > > > > + 1 file changed, 15 insertions(+)
> > > > > +
> > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > +index 5f7ab28..72ad4c9 100644
> > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > > + )
> > > > > + #endif
> > > > > +
> > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > > ++
> > > > > ++      TP_ARGS(inode, len, needed),
> > > > > ++
> > > > > ++      TP_FIELDS(
> > > > > ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> > > > > ++              ctf_integer(ino_t, ino, inode->i_ino)
> > > > > ++              ctf_integer(unsigned int, len, len)
> > > > > ++              ctf_integer(unsigned int, needed, needed)
> > > > > ++      )
> > > > > ++)
> > > > > ++#else
> > > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > +       TP_PROTO(struct inode *inode),
> > > > > +
> > > > > +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > +               ctf_integer(ino_t, ino, inode->i_ino)
> > > > > +       )
> > > > > + )
> > > > > ++#endif
> > > > > +
> > > > > + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> > > > > +       TP_PROTO(struct super_block *sb, int needed),
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > new file mode 100644
> > > > > index 0000000000..f76e9698c8
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > @@ -0,0 +1,63 @@
> > > > > +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Date: Mon, 24 Aug 2020 15:37:50 -0400
> > > > > +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> > > > > + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> > > > > +MIME-Version: 1.0
> > > > > +Content-Type: text/plain; charset=UTF-8
> > > > > +Content-Transfer-Encoding: 8bit
> > > > > +
> > > > > +See upstream commit:
> > > > > +
> > > > > +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> > > > > +  Author: Theodore Ts'o <tytso@mit.edu>
> > > > > +  Date:   Wed Jul 15 11:48:55 2020 -0400
> > > > > +
> > > > > +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> > > > > +
> > > > > +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> > > > > +    whether a block bitmap is being prefetched.
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> > > > > +---
> > > > > + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> > > > > + 1 file changed, 14 insertions(+)
> > > > > +
> > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > +index 72ad4c9..4476abb 100644
> > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> > > > > +       TP_ARGS(sb, group)
> > > > > + )
> > > > > +
> > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> > > > > ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> > > > > ++
> > > > > ++      TP_ARGS(sb, group, prefetch),
> > > > > ++
> > > > > ++      TP_FIELDS(
> > > > > ++              ctf_integer(dev_t, dev, sb->s_dev)
> > > > > ++              ctf_integer(__u32, group, group)
> > > > > ++              ctf_integer(bool, prefetch, prefetch)
> > > > > ++      )
> > > > > ++)
> > > > > ++#else
> > > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> > > > > +
> > > > > +       TP_PROTO(struct super_block *sb, unsigned long group),
> > > > > +
> > > > > +       TP_ARGS(sb, group)
> > > > > + )
> > > > > ++#endif
> > > > > +
> > > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> > > > > +
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > new file mode 100644
> > > > > index 0000000000..0970dd30aa
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > @@ -0,0 +1,391 @@
> > > > > +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Date: Tue, 25 Aug 2020 10:56:29 -0400
> > > > > +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> > > > > +
> > > > > +See upstream commits:
> > > > > +
> > > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > > +  Author: Will Deacon <will@kernel.org>
> > > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > > +
> > > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > > +
> > > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > > +    used to head dependency chains on all architectures.
> > > > > +
> > > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > > +  Author: Will Deacon <will.deacon@arm.com>
> > > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > > +
> > > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > > +
> > > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > > +    used to head dependency chains on all architectures.
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +---
> > > > > + instrumentation/events/lttng-module/i2c.h |  4 ++--
> > > > > + lib/ringbuffer/backend.h                  |  2 +-
> > > > > + lib/ringbuffer/backend_internal.h         |  2 +-
> > > > > + lib/ringbuffer/frontend.h                 |  4 ++--
> > > > > + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> > > > > + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> > > > > + lttng-events.c                            |  8 ++++----
> > > > > + probes/lttng-kprobes.c                    |  6 +++---
> > > > > + probes/lttng-kretprobes.c                 |  6 +++---
> > > > > + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> > > > > + probes/lttng-uprobes.c                    |  6 +++---
> > > > > + wrapper/compiler.h                        | 18 ++++++++++++++++++
> > > > > + wrapper/trace-clock.h                     | 15 +++++----------
> > > > > + 13 files changed, 51 insertions(+), 38 deletions(-)
> > > > > +
> > > > > +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> > > > > +index dcbabf6..131d134 100644
> > > > > +--- a/instrumentation/events/lttng-module/i2c.h
> > > > > ++++ b/instrumentation/events/lttng-module/i2c.h
> > > > > +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> > > > > +
> > > > > +       TP_code_pre(
> > > > > +               tp_locvar->extract_sensitive_payload =
> > > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > > +       ),
> > > > > +
> > > > > +       TP_FIELDS(
> > > > > +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> > > > > +
> > > > > +       TP_code_pre(
> > > > > +               tp_locvar->extract_sensitive_payload =
> > > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > > +       ),
> > > > > +
> > > > > +       TP_FIELDS(
> > > > > +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> > > > > +index da937f2..43e1d47 100644
> > > > > +--- a/lib/ringbuffer/backend.h
> > > > > ++++ b/lib/ringbuffer/backend.h
> > > > > +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> > > > > +                * Only read source character once, in case it is
> > > > > +                * modified concurrently.
> > > > > +                */
> > > > > +-              c = READ_ONCE(src[count]);
> > > > > ++              c = LTTNG_READ_ONCE(src[count]);
> > > > > +               if (!c)
> > > > > +                       break;
> > > > > +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> > > > > +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> > > > > +index 2d6a345..1226fd8 100644
> > > > > +--- a/lib/ringbuffer/backend_internal.h
> > > > > ++++ b/lib/ringbuffer/backend_internal.h
> > > > > +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> > > > > +        * Performing a volatile access to read the sb_pages, because we want to
> > > > > +        * read a coherent version of the pointer and the associated noref flag.
> > > > > +        */
> > > > > +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> > > > > ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> > > > > +       for (;;) {
> > > > > +               /* This check is called on the fast path for each record. */
> > > > > +               if (likely(!subbuffer_id_is_noref(config, id))) {
> > > > > +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> > > > > +index 6f516d9..41382fe 100644
> > > > > +--- a/lib/ringbuffer/frontend.h
> > > > > ++++ b/lib/ringbuffer/frontend.h
> > > > > +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> > > > > + #define for_each_channel_cpu(cpu, chan)                                       \
> > > > > +       for ((cpu) = -1;                                                \
> > > > > +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> > > > > +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> > > > > ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> > > > > +
> > > > > + extern struct lib_ring_buffer *channel_get_ring_buffer(
> > > > > +                               const struct lib_ring_buffer_config *config,
> > > > > +@@ -155,7 +155,7 @@ static inline
> > > > > + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> > > > > +                                struct lib_ring_buffer *buf)
> > > > > + {
> > > > > +-      int finalized = READ_ONCE(buf->finalized);
> > > > > ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > +       /*
> > > > > +        * Read finalized before counters.
> > > > > +        */
> > > > > +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> > > > > +index 3cab365..4980d20 100644
> > > > > +--- a/lib/ringbuffer/ring_buffer_frontend.c
> > > > > ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> > > > > +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> > > > > +       int finalized;
> > > > > +
> > > > > + retry:
> > > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > +       /*
> > > > > +        * Read finalized before counters.
> > > > > +        */
> > > > > +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> > > > > +               return -EBUSY;
> > > > > +       }
> > > > > + retry:
> > > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > +       /*
> > > > > +        * Read finalized before counters.
> > > > > +        */
> > > > > +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> > > > > +index d25db72..7b4f20a 100644
> > > > > +--- a/lib/ringbuffer/ring_buffer_iterator.c
> > > > > ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> > > > > +@@ -46,7 +46,7 @@ restart:
> > > > > +       switch (iter->state) {
> > > > > +       case ITER_GET_SUBBUF:
> > > > > +               ret = lib_ring_buffer_get_next_subbuf(buf);
> > > > > +-              if (ret && !READ_ONCE(buf->finalized)
> > > > > ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> > > > > +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> > > > > +                       /*
> > > > > +                        * Use "pull" scheme for global buffers. The reader
> > > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > > +index be7e389..d719294 100644
> > > > > +--- a/lttng-events.c
> > > > > ++++ b/lttng-events.c
> > > > > +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> > > > > +       size_t len;
> > > > > +       va_list ap;
> > > > > +
> > > > > +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> > > > > ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> > > > > +
> > > > > +       va_start(ap, fmt);
> > > > > +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> > > > > +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> > > > > + {
> > > > > +       int ret = 0;
> > > > > +
> > > > > +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> > > > > ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > > +               return 0;
> > > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > > +               return 0;
> > > > > +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> > > > > + {
> > > > > +       int ret = 0;
> > > > > +
> > > > > +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> > > > > ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > > +               return 0;
> > > > > +
> > > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > > +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> > > > > +       struct lttng_event *event;
> > > > > +       int ret = 0;
> > > > > +
> > > > > +-      if (!READ_ONCE(session->active))
> > > > > ++      if (!LTTNG_READ_ONCE(session->active))
> > > > > +               return 0;
> > > > > +
> > > > > +       lttng_metadata_begin(session);
> > > > > +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> > > > > +index a44eaa1..38fb72e 100644
> > > > > +--- a/probes/lttng-kprobes.c
> > > > > ++++ b/probes/lttng-kprobes.c
> > > > > +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> > > > > +       int ret;
> > > > > +       unsigned long data = (unsigned long) p->addr;
> > > > > +
> > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > +               return 0;
> > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > +               return 0;
> > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > +               return 0;
> > > > > +
> > > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> > > > > +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> > > > > +index ab98ff2..a6bcd21 100644
> > > > > +--- a/probes/lttng-kretprobes.c
> > > > > ++++ b/probes/lttng-kretprobes.c
> > > > > +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> > > > > +               unsigned long parent_ip;
> > > > > +       } payload;
> > > > > +
> > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > +               return 0;
> > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > +               return 0;
> > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > +               return 0;
> > > > > +
> > > > > +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> > > > > +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> > > > > +index 77b8638..72a669e 100644
> > > > > +--- a/probes/lttng-tracepoint-event-impl.h
> > > > > ++++ b/probes/lttng-tracepoint-event-impl.h
> > > > > +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> > > > > +                                                                             \
> > > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > > +               return;                                                       \
> > > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > > +               return;                                                       \
> > > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > > +               return;                                                       \
> > > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > > +               return;                                                       \
> > > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > > +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> > > > > +                                                                             \
> > > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > > +               return;                                                       \
> > > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > > +               return;                                                       \
> > > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > > +               return;                                                       \
> > > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > > +               return;                                                       \
> > > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > > +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> > > > > +index bc10128..bda1d9b 100644
> > > > > +--- a/probes/lttng-uprobes.c
> > > > > ++++ b/probes/lttng-uprobes.c
> > > > > +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> > > > > +               unsigned long ip;
> > > > > +       } payload;
> > > > > +
> > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > +               return 0;
> > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > +               return 0;
> > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > +               return 0;
> > > > > +
> > > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> > > > > +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> > > > > +index 1496f33..b9f8c51 100644
> > > > > +--- a/wrapper/compiler.h
> > > > > ++++ b/wrapper/compiler.h
> > > > > +@@ -9,6 +9,7 @@
> > > > > + #define _LTTNG_WRAPPER_COMPILER_H
> > > > > +
> > > > > + #include <linux/compiler.h>
> > > > > ++#include <linux/version.h>
> > > > > +
> > > > > + /*
> > > > > +  * Don't allow compiling with buggy compiler.
> > > > > +@@ -39,4 +40,21 @@
> > > > > + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> > > > > + #endif
> > > > > +
> > > > > ++/*
> > > > > ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> > > > > ++ * lockless_dereference(), replicate this behavior on prior kernels
> > > > > ++ * and remove calls to smp_read_barrier_depends which was dropped
> > > > > ++ * in v5.9.
> > > > > ++ */
> > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> > > > > ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> > > > > ++#else
> > > > > ++#define LTTNG_READ_ONCE(x)                    \
> > > > > ++({                                            \
> > > > > ++      typeof(x) __val = READ_ONCE(x);         \
> > > > > ++      smp_read_barrier_depends();             \
> > > > > ++      __val;                                  \
> > > > > ++})
> > > > > ++#endif
> > > > > ++
> > > > > + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> > > > > +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> > > > > +index 9f4e366..187fc82 100644
> > > > > +--- a/wrapper/trace-clock.h
> > > > > ++++ b/wrapper/trace-clock.h
> > > > > +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> > > > > +
> > > > > + static inline u64 trace_clock_read64(void)
> > > > > + {
> > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > +
> > > > > +       if (likely(!ltc)) {
> > > > > +               return trace_clock_read64_monotonic();
> > > > > +       } else {
> > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > +               return ltc->read64();
> > > > > +       }
> > > > > + }
> > > > > +
> > > > > + static inline u64 trace_clock_freq(void)
> > > > > + {
> > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > +
> > > > > +       if (!ltc) {
> > > > > +               return trace_clock_freq_monotonic();
> > > > > +       } else {
> > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > +               return ltc->freq();
> > > > > +       }
> > > > > + }
> > > > > +
> > > > > + static inline int trace_clock_uuid(char *uuid)
> > > > > + {
> > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > +
> > > > > +-      read_barrier_depends(); /* load ltc before content */
> > > > > +       /* Use default UUID cb when NULL */
> > > > > +       if (!ltc || !ltc->uuid) {
> > > > > +               return trace_clock_uuid_monotonic(uuid);
> > > > > +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> > > > > +
> > > > > + static inline const char *trace_clock_name(void)
> > > > > + {
> > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > +
> > > > > +       if (!ltc) {
> > > > > +               return trace_clock_name_monotonic();
> > > > > +       } else {
> > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > +               return ltc->name();
> > > > > +       }
> > > > > + }
> > > > > +
> > > > > + static inline const char *trace_clock_description(void)
> > > > > + {
> > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > +
> > > > > +       if (!ltc) {
> > > > > +               return trace_clock_description_monotonic();
> > > > > +       } else {
> > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > +               return ltc->description();
> > > > > +       }
> > > > > + }
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > new file mode 100644
> > > > > index 0000000000..2843c9cb62
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > @@ -0,0 +1,59 @@
> > > > > +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Date: Mon, 31 Aug 2020 11:41:38 -0400
> > > > > +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> > > > > +
> > > > > +See upstream commit:
> > > > > +
> > > > > +  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.
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> > > > > +---
> > > > > + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> > > > > + 1 file changed, 15 insertions(+), 1 deletion(-)
> > > > > +
> > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > +index affb4eb..ece67ad 100644
> > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> > > > > +
> > > > > + #endif
> > > > > +
> > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > ++#define show_inode_state(state)                                       \
> > > > > ++      __print_flags(state, "|",                               \
> > > > > ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > > ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> > > > > ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> > > > > ++              {I_NEW,                 "I_NEW"},               \
> > > > > ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> > > > > ++              {I_FREEING,             "I_FREEING"},           \
> > > > > ++              {I_CLEAR,               "I_CLEAR"},             \
> > > > > ++              {I_SYNC,                "I_SYNC"},              \
> > > > > ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> > > > > ++              {I_REFERENCED,          "I_REFERENCED"}         \
> > > > > ++      )
> > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > > + #define show_inode_state(state)                                       \
> > > > > +       __print_flags(state, "|",                               \
> > > > > +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > new file mode 100644
> > > > > index 0000000000..7a0d9a38b8
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > @@ -0,0 +1,117 @@
> > > > > +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Date: Mon, 31 Aug 2020 14:16:01 -0400
> > > > > +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> > > > > + processing (v5.9)
> > > > > +
> > > > > +See upstream commit:
> > > > > +
> > > > > +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> > > > > +  Author: Jan Kara <jack@suse.cz>
> > > > > +  Date:   Fri May 29 16:08:58 2020 +0200
> > > > > +
> > > > > +    writeback: Fix sync livelock due to b_dirty_time processing
> > > > > +
> > > > > +    When we are processing writeback for sync(2), move_expired_inodes()
> > > > > +    didn't set any inode expiry value (older_than_this). This can result in
> > > > > +    writeback never completing if there's steady stream of inodes added to
> > > > > +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> > > > > +    round whether there's more work to be done. Fix the problem by using
> > > > > +    sync(2) start time is inode expiry value when processing b_dirty_time
> > > > > +    list similarly as for ordinarily dirtied inodes. This requires some
> > > > > +    refactoring of older_than_this handling which simplifies the code
> > > > > +    noticeably as a bonus.
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +---
> > > > > + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> > > > > + 1 file changed, 26 insertions(+), 13 deletions(-)
> > > > > +
> > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > +index ece67ad..e9018dd 100644
> > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > > + #endif
> > > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > > +
> > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > > ++               struct wb_writeback_work *work,
> > > > > ++               unsigned long dirtied_before,
> > > > > ++               int moved),
> > > > > ++      TP_ARGS(wb, work, dirtied_before, moved),
> > > > > ++      TP_FIELDS(
> > > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > ++              ctf_integer(unsigned long, older, dirtied_before)
> > > > > ++              ctf_integer(int, moved, moved)
> > > > > ++      )
> > > > > ++)
> > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > +                struct wb_writeback_work *work,
> > > > > +-#else
> > > > > +-               unsigned long *older_than_this,
> > > > > +-#endif
> > > > > +                int moved),
> > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > +       TP_ARGS(wb, work, moved),
> > > > > +-#else
> > > > > ++      TP_FIELDS(
> > > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > ++              ctf_integer(int, moved, moved)
> > > > > ++      )
> > > > > ++)
> > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > > ++               unsigned long *older_than_this,
> > > > > ++               int moved),
> > > > > +       TP_ARGS(wb, older_than_this, moved),
> > > > > +-#endif
> > > > > +       TP_FIELDS(
> > > > > +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > +-#else
> > > > > +               ctf_integer(unsigned long, older,
> > > > > +                       older_than_this ? *older_than_this : 0)
> > > > > +               ctf_integer(long, age,
> > > > > +                       older_than_this ?
> > > > > +                               (jiffies - *older_than_this) * 1000 / HZ
> > > > > +                               : -1)
> > > > > +-#endif
> > > > > +               ctf_integer(int, moved, moved)
> > > > > +       )
> > > > > + )
> > > > > ++#endif
> > > > > +
> > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> > > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> > > > > +       )
> > > > > + )
> > > > > +-#else
> > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > +
> > > > > +       writeback_global_dirty_state,
> > > > > +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > +       )
> > > > > + )
> > > > > + #endif
> > > > > +-#endif
> > > > > +
> > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > +
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > new file mode 100644
> > > > > index 0000000000..346e1d63ad
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > @@ -0,0 +1,52 @@
> > > > > +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Date: Fri, 4 Sep 2020 11:52:51 -0400
> > > > > +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> > > > > + writeback_queue_io
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> > > > > +---
> > > > > + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> > > > > + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> > > > > + 2 files changed, 9 insertions(+), 2 deletions(-)
> > > > > +
> > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > +index 4476abb..b172c8d 100644
> > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > > + )
> > > > > + #endif
> > > > > +
> > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> > > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > > +
> > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > +index e9018dd..09637d7 100644
> > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > > + #endif
> > > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > > +
> > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> > > > > ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> > > > > ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> > > > > ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> > > > > ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> > > > > ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> > > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > > +                struct wb_writeback_work *work,
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > new file mode 100644
> > > > > index 0000000000..a16750ddb3
> > > > > --- /dev/null
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > @@ -0,0 +1,918 @@
> > > > > +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> > > > > +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +Date: Tue, 28 Jan 2020 16:02:44 -0500
> > > > > +Subject: [PATCH 10/10] Fix: system call filter table
> > > > > +
> > > > > +The system call filter table has effectively been unused for a long
> > > > > +time due to system call name prefix mismatch. This means the overhead of
> > > > > +selective system call tracing was larger than it should have been because
> > > > > +the event payload preparation would be done for all system calls as soon
> > > > > +as a single system call is traced.
> > > > > +
> > > > > +However, fixing this underlying issue unearths several issues that crept
> > > > > +unnoticed when the "enabler" concept was introduced (after the original
> > > > > +implementation of the system call filter table).
> > > > > +
> > > > > +Here is a list of the issues which are resolved here:
> > > > > +
> > > > > +- Split lttng_syscalls_unregister into an unregister and destroy
> > > > > +  function, thus awaiting for a grace period (and therefore quiescence
> > > > > +  of the users) after unregistering the system call tracepoints before
> > > > > +  freeing the system call filter data structures. This effectively fixes
> > > > > +  a use-after-free.
> > > > > +
> > > > > +- The state for enabling "all" system calls vs enabling specific system
> > > > > +  calls (and sequences of enable-disable) was incorrect with respect to
> > > > > +  the "enablers" semantic. This is solved by always tracking the
> > > > > +  bitmap of enabled system calls, and keeping this bitmap even when
> > > > > +  enabling all system calls. The sc_filter is now always allocated
> > > > > +  before system call tracing is registered to tracepoints, which means
> > > > > +  it does not need to be RCU dereferenced anymore.
> > > > > +
> > > > > +Padding fields in the ABI are reserved to select whether to:
> > > > > +
> > > > > +- Trace either native or compat system call (or both, which is the
> > > > > +  behavior currently implemented),
> > > > > +- Trace either system call entry or exit (or both, which is the
> > > > > +  behavior currently implemented),
> > > > > +- Select the system call to trace by name (behavior currently
> > > > > +  implemented) or by system call number,
> > > > > +
> > > > > +Upstream-Status: Backport
> > > > > +
> > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > +---
> > > > > + lttng-abi.c      |  43 ++++++
> > > > > + lttng-abi.h      |  26 ++++
> > > > > + lttng-events.c   | 112 +++++++++++++--
> > > > > + lttng-events.h   |  31 ++++-
> > > > > + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> > > > > + 5 files changed, 380 insertions(+), 180 deletions(-)
> > > > > +
> > > > > +diff --git a/lttng-abi.c b/lttng-abi.c
> > > > > +index 64ea99d..b33879d 100644
> > > > > +--- a/lttng-abi.c
> > > > > ++++ b/lttng-abi.c
> > > > > +@@ -1264,6 +1264,46 @@ nomem:
> > > > > +       return ret;
> > > > > + }
> > > > > +
> > > > > ++static
> > > > > ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> > > > > ++{
> > > > > ++      /* Limit ABI to implemented features. */
> > > > > ++      switch (event_param->instrumentation) {
> > > > > ++      case LTTNG_KERNEL_SYSCALL:
> > > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > ++                      break;
> > > > > ++              default:
> > > > > ++                      return -EINVAL;
> > > > > ++              }
> > > > > ++              switch (event_param->u.syscall.abi) {
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > ++                      break;
> > > > > ++              default:
> > > > > ++                      return -EINVAL;
> > > > > ++              }
> > > > > ++              switch (event_param->u.syscall.match) {
> > > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > > ++                      break;
> > > > > ++              default:
> > > > > ++                      return -EINVAL;
> > > > > ++              }
> > > > > ++              break;
> > > > > ++
> > > > > ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> > > > > ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> > > > > ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> > > > > ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> > > > > ++      case LTTNG_KERNEL_UPROBE:
> > > > > ++              break;
> > > > > ++
> > > > > ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> > > > > ++      default:
> > > > > ++              return -EINVAL;
> > > > > ++      }
> > > > > ++      return 0;
> > > > > ++}
> > > > > ++
> > > > > + static
> > > > > + int lttng_abi_create_event(struct file *channel_file,
> > > > > +                          struct lttng_kernel_event *event_param)
> > > > > +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> > > > > +               ret = -EOVERFLOW;
> > > > > +               goto refcount_error;
> > > > > +       }
> > > > > ++      ret = lttng_abi_validate_event_param(event_param);
> > > > > ++      if (ret)
> > > > > ++              goto event_error;
> > > > > +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> > > > > +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> > > > > +               struct lttng_enabler *enabler;
> > > > > +diff --git a/lttng-abi.h b/lttng-abi.h
> > > > > +index 1d356ab..51d60e5 100644
> > > > > +--- a/lttng-abi.h
> > > > > ++++ b/lttng-abi.h
> > > > > +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> > > > > +       } u;
> > > > > + } __attribute__((packed));
> > > > > +
> > > > > ++enum lttng_kernel_syscall_entryexit {
> > > > > ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> > > > > ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> > > > > ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> > > > > ++};
> > > > > ++
> > > > > ++enum lttng_kernel_syscall_abi {
> > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> > > > > ++};
> > > > > ++
> > > > > ++enum lttng_kernel_syscall_match {
> > > > > ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> > > > > ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> > > > > ++};
> > > > > ++
> > > > > ++struct lttng_kernel_syscall {
> > > > > ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> > > > > ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> > > > > ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> > > > > ++      uint8_t padding;
> > > > > ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> > > > > ++} __attribute__((packed));
> > > > > ++
> > > > > + /*
> > > > > +  * For syscall tracing, name = "*" means "enable all".
> > > > > +  */
> > > > > +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> > > > > +               struct lttng_kernel_kprobe kprobe;
> > > > > +               struct lttng_kernel_function_tracer ftrace;
> > > > > +               struct lttng_kernel_uprobe uprobe;
> > > > > ++              struct lttng_kernel_syscall syscall;
> > > > > +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> > > > > +       } u;
> > > > > + } __attribute__((packed));
> > > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > > +index d719294..4c0b04a 100644
> > > > > +--- a/lttng-events.c
> > > > > ++++ b/lttng-events.c
> > > > > +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> > > > > +               WARN_ON(ret);
> > > > > +       }
> > > > > +       synchronize_trace();    /* Wait for in-flight events to complete */
> > > > > ++      list_for_each_entry(chan, &session->chan, list) {
> > > > > ++              ret = lttng_syscalls_destroy(chan);
> > > > > ++              WARN_ON(ret);
> > > > > ++      }
> > > > > +       list_for_each_entry_safe(enabler, tmpenabler,
> > > > > +                       &session->enablers_head, node)
> > > > > +               lttng_enabler_destroy(enabler);
> > > > > +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> > > > > +               event->enabled = 0;
> > > > > +               event->registered = 0;
> > > > > +               event->desc = event_desc;
> > > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > ++                      ret = -EINVAL;
> > > > > ++                      goto register_error;
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> > > > > ++                      break;
> > > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> > > > > ++                      break;
> > > > > ++              }
> > > > > ++              switch (event_param->u.syscall.abi) {
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > ++                      ret = -EINVAL;
> > > > > ++                      goto register_error;
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> > > > > ++                      break;
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> > > > > ++                      break;
> > > > > ++              }
> > > > > +               if (!event->desc) {
> > > > > +                       ret = -EINVAL;
> > > > > +                       goto register_error;
> > > > > +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> > > > > +                                                 event);
> > > > > +               break;
> > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > +-              ret = lttng_syscall_filter_enable(event->chan,
> > > > > +-                      desc->name);
> > > > > ++              ret = lttng_syscall_filter_enable(event->chan, event);
> > > > > +               break;
> > > > > +       case LTTNG_KERNEL_KPROBE:
> > > > > +       case LTTNG_KERNEL_UPROBE:
> > > > > +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> > > > > +               ret = 0;
> > > > > +               break;
> > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > +-              ret = lttng_syscall_filter_disable(event->chan,
> > > > > +-                      desc->name);
> > > > > ++              ret = lttng_syscall_filter_disable(event->chan, event);
> > > > > +               break;
> > > > > +       case LTTNG_KERNEL_NOOP:
> > > > > +               ret = 0;
> > > > > +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> > > > > +               struct lttng_enabler *enabler)
> > > > > + {
> > > > > +       const char *desc_name, *enabler_name;
> > > > > ++      bool compat = false, entry = false;
> > > > > +
> > > > > +       enabler_name = enabler->event_param.name;
> > > > > +       switch (enabler->event_param.instrumentation) {
> > > > > +       case LTTNG_KERNEL_TRACEPOINT:
> > > > > +               desc_name = desc->name;
> > > > > ++              switch (enabler->type) {
> > > > > ++              case LTTNG_ENABLER_STAR_GLOB:
> > > > > ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > ++              case LTTNG_ENABLER_NAME:
> > > > > ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > ++              default:
> > > > > ++                      return -EINVAL;
> > > > > ++              }
> > > > > +               break;
> > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > +               desc_name = desc->name;
> > > > > +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> > > > > ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> > > > > +                       desc_name += strlen("compat_");
> > > > > ++                      compat = true;
> > > > > ++              }
> > > > > +               if (!strncmp(desc_name, "syscall_exit_",
> > > > > +                               strlen("syscall_exit_"))) {
> > > > > +                       desc_name += strlen("syscall_exit_");
> > > > > +               } else if (!strncmp(desc_name, "syscall_entry_",
> > > > > +                               strlen("syscall_entry_"))) {
> > > > > +                       desc_name += strlen("syscall_entry_");
> > > > > ++                      entry = true;
> > > > > +               } else {
> > > > > +                       WARN_ON_ONCE(1);
> > > > > +                       return -EINVAL;
> > > > > +               }
> > > > > ++              switch (enabler->event_param.u.syscall.entryexit) {
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > ++                      break;
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > > ++                      if (!entry)
> > > > > ++                              return 0;
> > > > > ++                      break;
> > > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > > ++                      if (entry)
> > > > > ++                              return 0;
> > > > > ++                      break;
> > > > > ++              default:
> > > > > ++                      return -EINVAL;
> > > > > ++              }
> > > > > ++              switch (enabler->event_param.u.syscall.abi) {
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > ++                      break;
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > > ++                      if (compat)
> > > > > ++                              return 0;
> > > > > ++                      break;
> > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > > ++                      if (!compat)
> > > > > ++                              return 0;
> > > > > ++                      break;
> > > > > ++              default:
> > > > > ++                      return -EINVAL;
> > > > > ++              }
> > > > > ++              switch (enabler->event_param.u.syscall.match) {
> > > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > > ++                      switch (enabler->type) {
> > > > > ++                      case LTTNG_ENABLER_STAR_GLOB:
> > > > > ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > ++                      case LTTNG_ENABLER_NAME:
> > > > > ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > ++                      default:
> > > > > ++                              return -EINVAL;
> > > > > ++                      }
> > > > > ++                      break;
> > > > > ++              case LTTNG_SYSCALL_MATCH_NR:
> > > > > ++                      return -EINVAL; /* Not implemented. */
> > > > > ++              default:
> > > > > ++                      return -EINVAL;
> > > > > ++              }
> > > > > +               break;
> > > > > +       default:
> > > > > +               WARN_ON_ONCE(1);
> > > > > +               return -EINVAL;
> > > > > +       }
> > > > > +-      switch (enabler->type) {
> > > > > +-      case LTTNG_ENABLER_STAR_GLOB:
> > > > > +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > +-      case LTTNG_ENABLER_NAME:
> > > > > +-              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > +-      default:
> > > > > +-              return -EINVAL;
> > > > > +-      }
> > > > > + }
> > > > > +
> > > > > + static
> > > > > +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> > > > > + static
> > > > > + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> > > > > + {
> > > > > +-      struct lttng_session *session = enabler->chan->session;
> > > > > ++      struct lttng_channel *chan = enabler->chan;
> > > > > ++      struct lttng_session *session = chan->session;
> > > > > +       struct lttng_event *event;
> > > > > +
> > > > > ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> > > > > ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> > > > > ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> > > > > ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> > > > > ++                      !strcmp(enabler->event_param.name, "*")) {
> > > > > ++              if (enabler->enabled)
> > > > > ++                      WRITE_ONCE(chan->syscall_all, 1);
> > > > > ++              else
> > > > > ++                      WRITE_ONCE(chan->syscall_all, 0);
> > > > > ++      }
> > > > > ++
> > > > > +       /* First ensure that probe events are created for this enabler. */
> > > > > +       lttng_create_event_if_missing(enabler);
> > > > > +
> > > > > +diff --git a/lttng-events.h b/lttng-events.h
> > > > > +index a36a312..d4d9976 100644
> > > > > +--- a/lttng-events.h
> > > > > ++++ b/lttng-events.h
> > > > > +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> > > > > +       struct list_head node;
> > > > > + };
> > > > > +
> > > > > ++enum lttng_syscall_entryexit {
> > > > > ++      LTTNG_SYSCALL_ENTRY,
> > > > > ++      LTTNG_SYSCALL_EXIT,
> > > > > ++};
> > > > > ++
> > > > > ++enum lttng_syscall_abi {
> > > > > ++      LTTNG_SYSCALL_ABI_NATIVE,
> > > > > ++      LTTNG_SYSCALL_ABI_COMPAT,
> > > > > ++};
> > > > > ++
> > > > > + /*
> > > > > +  * lttng_event structure is referred to by the tracing fast path. It must be
> > > > > +  * kept small.
> > > > > +@@ -318,6 +328,11 @@ struct lttng_event {
> > > > > +                       struct inode *inode;
> > > > > +                       struct list_head head;
> > > > > +               } uprobe;
> > > > > ++              struct {
> > > > > ++                      char *syscall_name;
> > > > > ++                      enum lttng_syscall_entryexit entryexit;
> > > > > ++                      enum lttng_syscall_abi abi;
> > > > > ++              } syscall;
> > > > > +       } u;
> > > > > +       struct list_head list;          /* Event list in session */
> > > > > +       unsigned int metadata_dumped:1;
> > > > > +@@ -457,10 +472,10 @@ struct lttng_channel {
> > > > > +       struct lttng_syscall_filter *sc_filter;
> > > > > +       int header_type;                /* 0: unset, 1: compact, 2: large */
> > > > > +       enum channel_type channel_type;
> > > > > ++      int syscall_all;
> > > > > +       unsigned int metadata_dumped:1,
> > > > > +               sys_enter_registered:1,
> > > > > +               sys_exit_registered:1,
> > > > > +-              syscall_all:1,
> > > > > +               tstate:1;               /* Transient enable state */
> > > > > + };
> > > > > +
> > > > > +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> > > > > + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> > > > > + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> > > > > + int lttng_syscalls_unregister(struct lttng_channel *chan);
> > > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> > > > > + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > +-              const char *name);
> > > > > ++              struct lttng_event *event);
> > > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > +-              const char *name);
> > > > > ++              struct lttng_event *event);
> > > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> > > > > + #else
> > > > > +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > > +       return 0;
> > > > > + }
> > > > > +
> > > > > ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > > ++{
> > > > > ++      return 0;
> > > > > ++}
> > > > > ++
> > > > > + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > +-              const char *name)
> > > > > ++              struct lttng_event *event);
> > > > > + {
> > > > > +       return -ENOSYS;
> > > > > + }
> > > > > +
> > > > > + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > +-              const char *name)
> > > > > ++              struct lttng_event *event);
> > > > > + {
> > > > > +       return -ENOSYS;
> > > > > + }
> > > > > +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> > > > > +index 97f1ba9..26cead6 100644
> > > > > +--- a/lttng-syscalls.c
> > > > > ++++ b/lttng-syscalls.c
> > > > > +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> > > > > + #undef CREATE_SYSCALL_TABLE
> > > > > +
> > > > > + struct lttng_syscall_filter {
> > > > > +-      DECLARE_BITMAP(sc, NR_syscalls);
> > > > > +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> > > > > ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> > > > > ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> > > > > ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> > > > > ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> > > > > + };
> > > > > +
> > > > > + static void syscall_entry_unknown(struct lttng_event *event,
> > > > > +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> > > > > +       size_t table_len;
> > > > > +
> > > > > +       if (unlikely(in_compat_syscall())) {
> > > > > +-              struct lttng_syscall_filter *filter;
> > > > > +-
> > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > +-              if (filter) {
> > > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > > +-                              /* System call filtered out. */
> > > > > +-                              return;
> > > > > +-                      }
> > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > ++
> > > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> > > > > ++                      /* System call filtered out. */
> > > > > ++                      return;
> > > > > +               }
> > > > > +               table = compat_sc_table;
> > > > > +               table_len = ARRAY_SIZE(compat_sc_table);
> > > > > +               unknown_event = chan->sc_compat_unknown;
> > > > > +       } else {
> > > > > +-              struct lttng_syscall_filter *filter;
> > > > > +-
> > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > +-              if (filter) {
> > > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > > +-                              || !test_bit(id, filter->sc)) {
> > > > > +-                              /* System call filtered out. */
> > > > > +-                              return;
> > > > > +-                      }
> > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > ++
> > > > > ++              if (id < 0 || id >= NR_syscalls
> > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> > > > > ++                      /* System call filtered out. */
> > > > > ++                      return;
> > > > > +               }
> > > > > +               table = sc_table;
> > > > > +               table_len = ARRAY_SIZE(sc_table);
> > > > > +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> > > > > +
> > > > > +       id = syscall_get_nr(current, regs);
> > > > > +       if (unlikely(in_compat_syscall())) {
> > > > > +-              struct lttng_syscall_filter *filter;
> > > > > +-
> > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > +-              if (filter) {
> > > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > > +-                              /* System call filtered out. */
> > > > > +-                              return;
> > > > > +-                      }
> > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > ++
> > > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> > > > > ++                      /* System call filtered out. */
> > > > > ++                      return;
> > > > > +               }
> > > > > +               table = compat_sc_exit_table;
> > > > > +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> > > > > +               unknown_event = chan->compat_sc_exit_unknown;
> > > > > +       } else {
> > > > > +-              struct lttng_syscall_filter *filter;
> > > > > +-
> > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > +-              if (filter) {
> > > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > > +-                              || !test_bit(id, filter->sc)) {
> > > > > +-                              /* System call filtered out. */
> > > > > +-                              return;
> > > > > +-                      }
> > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > ++
> > > > > ++              if (id < 0 || id >= NR_syscalls
> > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> > > > > ++                      /* System call filtered out. */
> > > > > ++                      return;
> > > > > +               }
> > > > > +               table = sc_exit_table;
> > > > > +               table_len = ARRAY_SIZE(sc_exit_table);
> > > > > +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> > > > > +               memset(&ev, 0, sizeof(ev));
> > > > > +               switch (type) {
> > > > > +               case SC_TYPE_ENTRY:
> > > > > +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > +                       break;
> > > > > +               case SC_TYPE_EXIT:
> > > > > +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > +                       break;
> > > > > +               case SC_TYPE_COMPAT_ENTRY:
> > > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > +                       break;
> > > > > +               case SC_TYPE_COMPAT_EXIT:
> > > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > +-                      break;
> > > > > +-              default:
> > > > > +-                      BUG_ON(1);
> > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > +                       break;
> > > > > +               }
> > > > > +-              strncat(ev.name, desc->name,
> > > > > +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> > > > > ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> > > > > +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > +                                               desc,
> > > > > +                                               ev.instrumentation);
> > > > > +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > +                                               desc,
> > > > > +                                               ev.instrumentation);
> > > > > +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> > > > > +                                               filter, desc,
> > > > > +                                               ev.instrumentation);
> > > > > +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > +                                               desc, ev.instrumentation);
> > > > > +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> > > > > +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > +       if (ret)
> > > > > +               return ret;
> > > > > + #endif
> > > > > ++
> > > > > ++      if (!chan->sc_filter) {
> > > > > ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > ++                              GFP_KERNEL);
> > > > > ++              if (!chan->sc_filter)
> > > > > ++                      return -ENOMEM;
> > > > > ++      }
> > > > > ++
> > > > > +       if (!chan->sys_enter_registered) {
> > > > > +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> > > > > +                               (void *) syscall_entry_probe, chan);
> > > > > +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > > +                       return ret;
> > > > > +               chan->sys_exit_registered = 0;
> > > > > +       }
> > > > > +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> > > > > ++      return 0;
> > > > > ++}
> > > > > ++
> > > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > > ++{
> > > > > +       kfree(chan->sc_table);
> > > > > +       kfree(chan->sc_exit_table);
> > > > > + #ifdef CONFIG_COMPAT
> > > > > +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> > > > > +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> > > > > + }
> > > > > +
> > > > > +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > +-              const char *name)
> > > > > ++static
> > > > > ++const char *get_syscall_name(struct lttng_event *event)
> > > > > + {
> > > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > > +-      struct lttng_syscall_filter *filter;
> > > > > ++      size_t prefix_len = 0;
> > > > > +
> > > > > +-      WARN_ON_ONCE(!chan->sc_table);
> > > > > ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> > > > > +
> > > > > +-      if (!name) {
> > > > > +-              /* Enable all system calls by removing filter */
> > > > > +-              if (chan->sc_filter) {
> > > > > +-                      filter = chan->sc_filter;
> > > > > +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> > > > > +-                      synchronize_trace();
> > > > > +-                      kfree(filter);
> > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > ++              switch (event->u.syscall.abi) {
> > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> > > > > ++                      break;
> > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> > > > > ++                      break;
> > > > > +               }
> > > > > +-              chan->syscall_all = 1;
> > > > > +-              return 0;
> > > > > +-      }
> > > > > +-
> > > > > +-      if (!chan->sc_filter) {
> > > > > +-              if (chan->syscall_all) {
> > > > > +-                      /*
> > > > > +-                       * All syscalls are already enabled.
> > > > > +-                       */
> > > > > +-                      return -EEXIST;
> > > > > ++              break;
> > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > ++              switch (event->u.syscall.abi) {
> > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> > > > > ++                      break;
> > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> > > > > ++                      break;
> > > > > +               }
> > > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > +-                              GFP_KERNEL);
> > > > > +-              if (!filter)
> > > > > +-                      return -ENOMEM;
> > > > > +-      } else {
> > > > > +-              filter = chan->sc_filter;
> > > > > ++              break;
> > > > > +       }
> > > > > +-      syscall_nr = get_syscall_nr(name);
> > > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > > +-              ret = -ENOENT;
> > > > > +-              goto error;
> > > > > ++      WARN_ON_ONCE(prefix_len == 0);
> > > > > ++      return event->desc->name + prefix_len;
> > > > > ++}
> > > > > ++
> > > > > ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > ++              struct lttng_event *event)
> > > > > ++{
> > > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > ++      const char *syscall_name;
> > > > > ++      unsigned long *bitmap;
> > > > > ++      int syscall_nr;
> > > > > ++
> > > > > ++      WARN_ON_ONCE(!chan->sc_table);
> > > > > ++
> > > > > ++      syscall_name = get_syscall_name(event);
> > > > > ++
> > > > > ++      switch (event->u.syscall.abi) {
> > > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > > ++              break;
> > > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > > ++              break;
> > > > > ++      default:
> > > > > ++              return -EINVAL;
> > > > > +       }
> > > > > +-      if (syscall_nr >= 0) {
> > > > > +-              if (test_bit(syscall_nr, filter->sc)) {
> > > > > +-                      ret = -EEXIST;
> > > > > +-                      goto error;
> > > > > ++      if (syscall_nr < 0)
> > > > > ++              return -ENOENT;
> > > > > ++
> > > > > ++
> > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > ++              switch (event->u.syscall.abi) {
> > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > ++                      bitmap = filter->sc_entry;
> > > > > ++                      break;
> > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > ++                      bitmap = filter->sc_compat_entry;
> > > > > ++                      break;
> > > > > +               }
> > > > > +-              bitmap_set(filter->sc, syscall_nr, 1);
> > > > > +-      }
> > > > > +-      if (compat_syscall_nr >= 0) {
> > > > > +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > > +-                      ret = -EEXIST;
> > > > > +-                      goto error;
> > > > > ++              break;
> > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > ++              switch (event->u.syscall.abi) {
> > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > ++                      bitmap = filter->sc_exit;
> > > > > ++                      break;
> > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > ++                      bitmap = filter->sc_compat_exit;
> > > > > ++                      break;
> > > > > +               }
> > > > > +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> > > > > ++              break;
> > > > > ++      default:
> > > > > ++              return -EINVAL;
> > > > > +       }
> > > > > +-      if (!chan->sc_filter)
> > > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > > ++      if (test_bit(syscall_nr, bitmap))
> > > > > ++              return -EEXIST;
> > > > > ++      bitmap_set(bitmap, syscall_nr, 1);
> > > > > +       return 0;
> > > > > +-
> > > > > +-error:
> > > > > +-      if (!chan->sc_filter)
> > > > > +-              kfree(filter);
> > > > > +-      return ret;
> > > > > + }
> > > > > +
> > > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > +-              const char *name)
> > > > > ++              struct lttng_event *event)
> > > > > + {
> > > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > > +-      struct lttng_syscall_filter *filter;
> > > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > ++      const char *syscall_name;
> > > > > ++      unsigned long *bitmap;
> > > > > ++      int syscall_nr;
> > > > > +
> > > > > +       WARN_ON_ONCE(!chan->sc_table);
> > > > > +
> > > > > +-      if (!chan->sc_filter) {
> > > > > +-              if (!chan->syscall_all)
> > > > > +-                      return -EEXIST;
> > > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > +-                              GFP_KERNEL);
> > > > > +-              if (!filter)
> > > > > +-                      return -ENOMEM;
> > > > > +-              /* Trace all system calls, then apply disable. */
> > > > > +-              bitmap_set(filter->sc, 0, NR_syscalls);
> > > > > +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> > > > > +-      } else {
> > > > > +-              filter = chan->sc_filter;
> > > > > ++      syscall_name = get_syscall_name(event);
> > > > > ++
> > > > > ++      switch (event->u.syscall.abi) {
> > > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > > ++              break;
> > > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > > ++              break;
> > > > > ++      default:
> > > > > ++              return -EINVAL;
> > > > > +       }
> > > > > ++      if (syscall_nr < 0)
> > > > > ++              return -ENOENT;
> > > > > +
> > > > > +-      if (!name) {
> > > > > +-              /* Fail if all syscalls are already disabled. */
> > > > > +-              if (bitmap_empty(filter->sc, NR_syscalls)
> > > > > +-                      && bitmap_empty(filter->sc_compat,
> > > > > +-                              NR_compat_syscalls)) {
> > > > > +-                      ret = -EEXIST;
> > > > > +-                      goto error;
> > > > > +-              }
> > > > > +
> > > > > +-              /* Disable all system calls */
> > > > > +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> > > > > +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> > > > > +-              goto apply_filter;
> > > > > +-      }
> > > > > +-      syscall_nr = get_syscall_nr(name);
> > > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > > +-              ret = -ENOENT;
> > > > > +-              goto error;
> > > > > +-      }
> > > > > +-      if (syscall_nr >= 0) {
> > > > > +-              if (!test_bit(syscall_nr, filter->sc)) {
> > > > > +-                      ret = -EEXIST;
> > > > > +-                      goto error;
> > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > ++              switch (event->u.syscall.abi) {
> > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > ++                      bitmap = filter->sc_entry;
> > > > > ++                      break;
> > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > ++                      bitmap = filter->sc_compat_entry;
> > > > > ++                      break;
> > > > > +               }
> > > > > +-              bitmap_clear(filter->sc, syscall_nr, 1);
> > > > > +-      }
> > > > > +-      if (compat_syscall_nr >= 0) {
> > > > > +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > > +-                      ret = -EEXIST;
> > > > > +-                      goto error;
> > > > > ++              break;
> > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > ++              switch (event->u.syscall.abi) {
> > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > ++                      bitmap = filter->sc_exit;
> > > > > ++                      break;
> > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > ++                      bitmap = filter->sc_compat_exit;
> > > > > ++                      break;
> > > > > +               }
> > > > > +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> > > > > ++              break;
> > > > > ++      default:
> > > > > ++              return -EINVAL;
> > > > > +       }
> > > > > +-apply_filter:
> > > > > +-      if (!chan->sc_filter)
> > > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > > +-      chan->syscall_all = 0;
> > > > > +-      return 0;
> > > > > ++      if (!test_bit(syscall_nr, bitmap))
> > > > > ++              return -EEXIST;
> > > > > ++      bitmap_clear(bitmap, syscall_nr, 1);
> > > > > +
> > > > > +-error:
> > > > > +-      if (!chan->sc_filter)
> > > > > +-              kfree(filter);
> > > > > +-      return ret;
> > > > > ++      return 0;
> > > > > + }
> > > > > +
> > > > > + static
> > > > > +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> > > > > +       .release = seq_release,
> > > > > + };
> > > > > +
> > > > > ++/*
> > > > > ++ * A syscall is enabled if it is traced for either entry or exit.
> > > > > ++ */
> > > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> > > > > + {
> > > > > +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > +               char state;
> > > > > +
> > > > > +               if (channel->sc_table) {
> > > > > +-                      if (filter)
> > > > > +-                              state = test_bit(bit, filter->sc);
> > > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > > ++                              state = test_bit(bit, filter->sc_entry)
> > > > > ++                                      || test_bit(bit, filter->sc_exit);
> > > > > +                       else
> > > > > +                               state = 1;
> > > > > +               } else {
> > > > > +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > +               char state;
> > > > > +
> > > > > +               if (channel->compat_sc_table) {
> > > > > +-                      if (filter)
> > > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > > +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> > > > > +-                                              filter->sc_compat);
> > > > > ++                                              filter->sc_compat_entry)
> > > > > ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> > > > > ++                                              filter->sc_compat_exit);
> > > > > +                       else
> > > > > +                               state = 1;
> > > > > +               } else {
> > > > > +--
> > > > > +2.19.1
> > > > > +
> > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > index 0e1a209ce8..e36b327a08 100644
> > > > > --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > @@ -11,6 +11,16 @@ include lttng-platforms.inc
> > > > >  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
> > > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > > +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> > > > > +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> > > > > +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> > > > > +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> > > > > +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> > > > > +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> > > > > +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> > > > > +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> > > > > +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> > > > > +           file://0010-Fix-system-call-filter-table.patch \
> > > > >             "
> > > > >
> > > > >  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> > > > > @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
> > > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > >             "
> > > > > -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> > > > > +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
> > > > >  PV_class-devupstream = "2.12.2+git${SRCPV}"
> > > > >  S_class-devupstream = "${WORKDIR}/git"
> > > > >  SRCREV_FORMAT ?= "lttng_git"
> > > > > --
> > > > > 2.19.1
> > > > >
> > > > >
> > >
> > >
> > >
> > > --
> > > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > > thee at its end
> > > - "Use the force Harry" - Gandalf, Star Trek II
>
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>
> 
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-28 17:44           ` Bruce Ashfield
@ 2020-09-28 22:35             ` Steve Sakoman
  2020-09-28 22:53               ` Bruce Ashfield
       [not found]               ` <16391475BC3C80C8.17908@lists.openembedded.org>
  0 siblings, 2 replies; 23+ messages in thread
From: Steve Sakoman @ 2020-09-28 22:35 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

On Mon, Sep 28, 2020 at 7:44 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
>
> On Sun, Sep 27, 2020 at 5:18 PM Bruce Ashfield via
> lists.openembedded.org
> <bruce.ashfield=gmail.com@lists.openembedded.org> wrote:
> >
> > On Fri, Sep 25, 2020 at 3:49 PM Steve Sakoman <steve@sakoman.com> wrote:
> > >
> > > On Fri, Sep 25, 2020 at 6:52 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> > > >
> > > > On Fri, Sep 25, 2020 at 12:43 PM Steve Sakoman <steve@sakoman.com> wrote:
> > > > >
> > > > > Dunfell is still at 2.11.2.  Will there be a need for patches to this
> > > > > version too?  Or should I take the lttng version bump along with the
> > > > > 5.4 version bumps that cause the issue?
> > > >
> > > > I don't see a lot of options on that front. Unless we do some custom backports.
> > > >
> > > > I just checked the lttng 2.11 branch, and the last commit is from January, which
> > > > is too old to cover these -stable kernel bump issues.
> > > >
> > > > I can have a go at the backports, but we should be prepared to bend the version
> > > > upgrade rule if that gets too complex (and for the record, I've never
> > > > had much luck
> > > > with lttng fixes).
> > >
> > > Totally understood!  I think this is likely one of those cases where
> > > we'll have to take an exception to the upgrade rule.
> > >
> > > If you see issues with a backport just let me know and I'll go with
> > > the version upgrade approach.
> >
> > I'll have a go at some backports on Monday and send info by end of day.
>
> Hmm. Despite the advertised kernel version limitations, I was able to
> build lttng-modules against my dunfell branch with v5.4 bumped all the
> way to v5.4.67.
>
> So at this point, I'd suggest taking my kernel uprevs and running it
> through the autobuilder. If nothing blows up on build, we are good to
> go.
>
> If it does blow up, let me know and I'll figure out how my local builds worked.

Sadly I am starting to errors on the autobuilder:

https://autobuilder.yoctoproject.org/typhoon/#/builders/102/builds/975
https://autobuilder.yoctoproject.org/typhoon/#/builders/63/builds/2498
https://autobuilder.yoctoproject.org/typhoon/#/builders/107/builds/962

Steve

> > > While I have your attention, what about "linux-yocto/config:
> > > netfilter: Enable nat for ipv4 and ipv6" for dunfell?  I'll have to
> > > prune out the changes for 5.8 in the commit, but does it make sense
> > > for 5.4?
> >
> > It isn't a bugfix by a strict definition, but it also  won't hurt
> > anything. It does
> > make sense to keep 5.4 & 5.8 kernel configuration consistent whenever
> > possible, so I'd say go ahead and do the port.
> >
> > Bruce
> >
> > >
> > > Thanks!
> > >
> > > Steve
> > >
> > >
> > >  >
> > > > > On Mon, Sep 14, 2020 at 12:34 PM Bruce Ashfield
> > > > > <bruce.ashfield@gmail.com> wrote:
> > > > > >
> > > > > > From: Jens Rehsack <sno@netbsd.org>
> > > > > >
> > > > > > Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> > > > > > them once .3 is released, but for now, we need the fixes to build
> > > > > > against the latest 5.4, 5.8 and 5.9 kernels.
> > > > > >
> > > > > > We also bump the devupstream SRCREV to pickup the same changes.
> > > > > >
> > > > > > Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> > > > > > ---
> > > > > >  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
> > > > > >  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
> > > > > >  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
> > > > > >  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
> > > > > >  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
> > > > > >  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
> > > > > >  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
> > > > > >  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
> > > > > >  ...es-for-ext4_discard_preallocations-a.patch |  52 +
> > > > > >  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
> > > > > >  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
> > > > > >  11 files changed, 1829 insertions(+), 1 deletion(-)
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > >
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..ae8bec45de
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > > @@ -0,0 +1,54 @@
> > > > > > +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> > > > > > +From: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > > > +Date: Thu, 13 Aug 2020 16:24:39 +0300
> > > > > > +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> > > > > > + without CONFIG_FTRACE
> > > > > > +
> > > > > > +When building in-tree, one could disable CONFIG_FTRACE from kernel
> > > > > > +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> > > > > > +but generate a lot of linker errors like below because it leaves out
> > > > > > +other stuff, e.g.:
> > > > > > +
> > > > > > +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> > > > > > +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> > > > > > +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> > > > > > +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> > > > > > +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> > > > > > +
> > > > > > +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> > > > > > +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> > > > > > +enabled.
> > > > > > +
> > > > > > +Steps to reproduce:
> > > > > > +
> > > > > > +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> > > > > > +
> > > > > > +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> > > > > > +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> > > > > > +
> > > > > > +- Build will fail at linking stage
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +---
> > > > > > + Kconfig | 2 +-
> > > > > > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > +
> > > > > > +diff --git a/Kconfig b/Kconfig
> > > > > > +index acdab73..10eccff 100644
> > > > > > +--- a/Kconfig
> > > > > > ++++ b/Kconfig
> > > > > > +@@ -2,7 +2,7 @@
> > > > > > +
> > > > > > + config LTTNG
> > > > > > +       tristate "LTTng support"
> > > > > > +-      select TRACEPOINTS
> > > > > > ++      select TRACING
> > > > > > +       help
> > > > > > +         LTTng is an open source tracing framework for Linux.
> > > > > > +
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..fab673b854
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > > @@ -0,0 +1,41 @@
> > > > > > +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Date: Mon, 10 Aug 2020 11:22:05 -0400
> > > > > > +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> > > > > > +
> > > > > > +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> > > > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > > +  Date:   Mon Jun 22 13:20:29 2020 -0700
> > > > > > +
> > > > > > +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> > > > > > +
> > > > > > +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +---
> > > > > > + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> > > > > > + 1 file changed, 4 insertions(+)
> > > > > > +
> > > > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > +index 37384a2..5a7ef1e 100644
> > > > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > +@@ -24,7 +24,11 @@
> > > > > > +  */
> > > > > > + #include <wrapper/tracepoint.h>
> > > > > > +
> > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > > > ++#else
> > > > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > > > ++#endif
> > > > > > +
> > > > > > + #undef TRACE_INCLUDE_PATH
> > > > > > + #undef TRACE_INCLUDE_FILE
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..524631cc72
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > > @@ -0,0 +1,39 @@
> > > > > > +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Date: Mon, 10 Aug 2020 11:36:03 -0400
> > > > > > +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> > > > > > + accessor internal-only (v5.9)
> > > > > > +
> > > > > > +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> > > > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > > +  Date:   Mon Jun 22 13:20:32 2020 -0700
> > > > > > +
> > > > > > +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> > > > > > +
> > > > > > +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> > > > > > +    be poking into the gory details of shadow pages.
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +---
> > > > > > + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> > > > > > + 1 file changed, 1 insertion(+)
> > > > > > +
> > > > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > +index 5a7ef1e..8f98186 100644
> > > > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > +@@ -25,6 +25,7 @@
> > > > > > + #include <wrapper/tracepoint.h>
> > > > > > +
> > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> > > > > > + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > > > + #else
> > > > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..e29c07252c
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > > @@ -0,0 +1,84 @@
> > > > > > +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Date: Mon, 24 Aug 2020 15:26:04 -0400
> > > > > > +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> > > > > > + (v5.9)
> > > > > > +MIME-Version: 1.0
> > > > > > +Content-Type: text/plain; charset=UTF-8
> > > > > > +Content-Transfer-Encoding: 8bit
> > > > > > +
> > > > > > +See upstream commit:
> > > > > > +
> > > > > > +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> > > > > > +  Author: brookxu <brookxu.cn@gmail.com>
> > > > > > +  Date:   Mon Aug 17 15:36:15 2020 +0800
> > > > > > +
> > > > > > +    ext4: limit the length of per-inode prealloc list
> > > > > > +
> > > > > > +    In the scenario of writing sparse files, the per-inode prealloc list may
> > > > > > +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> > > > > > +    To circumvent this problem, we limit the maximum length of per-inode
> > > > > > +    prealloc list to 512 and allow users to modify it.
> > > > > > +
> > > > > > +    After patching, we observed that the sys ratio of cpu has dropped, and
> > > > > > +    the system throughput has increased significantly. We created a process
> > > > > > +    to write the sparse file, and the running time of the process on the
> > > > > > +    fixed kernel was significantly reduced, as follows:
> > > > > > +
> > > > > > +    Running time on unfixed kernel:
> > > > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > > > +    real    0m2.051s
> > > > > > +    user    0m0.008s
> > > > > > +    sys     0m2.026s
> > > > > > +
> > > > > > +    Running time on fixed kernel:
> > > > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > > > +    real    0m0.471s
> > > > > > +    user    0m0.004s
> > > > > > +    sys     0m0.395s
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> > > > > > +---
> > > > > > + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> > > > > > + 1 file changed, 15 insertions(+)
> > > > > > +
> > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > +index 5f7ab28..72ad4c9 100644
> > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > > > + )
> > > > > > + #endif
> > > > > > +
> > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > > > ++
> > > > > > ++      TP_ARGS(inode, len, needed),
> > > > > > ++
> > > > > > ++      TP_FIELDS(
> > > > > > ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> > > > > > ++              ctf_integer(ino_t, ino, inode->i_ino)
> > > > > > ++              ctf_integer(unsigned int, len, len)
> > > > > > ++              ctf_integer(unsigned int, needed, needed)
> > > > > > ++      )
> > > > > > ++)
> > > > > > ++#else
> > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > +       TP_PROTO(struct inode *inode),
> > > > > > +
> > > > > > +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > +               ctf_integer(ino_t, ino, inode->i_ino)
> > > > > > +       )
> > > > > > + )
> > > > > > ++#endif
> > > > > > +
> > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> > > > > > +       TP_PROTO(struct super_block *sb, int needed),
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..f76e9698c8
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > > @@ -0,0 +1,63 @@
> > > > > > +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Date: Mon, 24 Aug 2020 15:37:50 -0400
> > > > > > +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> > > > > > + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> > > > > > +MIME-Version: 1.0
> > > > > > +Content-Type: text/plain; charset=UTF-8
> > > > > > +Content-Transfer-Encoding: 8bit
> > > > > > +
> > > > > > +See upstream commit:
> > > > > > +
> > > > > > +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> > > > > > +  Author: Theodore Ts'o <tytso@mit.edu>
> > > > > > +  Date:   Wed Jul 15 11:48:55 2020 -0400
> > > > > > +
> > > > > > +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> > > > > > +
> > > > > > +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> > > > > > +    whether a block bitmap is being prefetched.
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> > > > > > +---
> > > > > > + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> > > > > > + 1 file changed, 14 insertions(+)
> > > > > > +
> > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > +index 72ad4c9..4476abb 100644
> > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> > > > > > +       TP_ARGS(sb, group)
> > > > > > + )
> > > > > > +
> > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> > > > > > ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> > > > > > ++
> > > > > > ++      TP_ARGS(sb, group, prefetch),
> > > > > > ++
> > > > > > ++      TP_FIELDS(
> > > > > > ++              ctf_integer(dev_t, dev, sb->s_dev)
> > > > > > ++              ctf_integer(__u32, group, group)
> > > > > > ++              ctf_integer(bool, prefetch, prefetch)
> > > > > > ++      )
> > > > > > ++)
> > > > > > ++#else
> > > > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> > > > > > +
> > > > > > +       TP_PROTO(struct super_block *sb, unsigned long group),
> > > > > > +
> > > > > > +       TP_ARGS(sb, group)
> > > > > > + )
> > > > > > ++#endif
> > > > > > +
> > > > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> > > > > > +
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..0970dd30aa
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > > @@ -0,0 +1,391 @@
> > > > > > +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Date: Tue, 25 Aug 2020 10:56:29 -0400
> > > > > > +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> > > > > > +
> > > > > > +See upstream commits:
> > > > > > +
> > > > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > > > +  Author: Will Deacon <will@kernel.org>
> > > > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > > > +
> > > > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > > > +
> > > > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > > > +    used to head dependency chains on all architectures.
> > > > > > +
> > > > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > > > +  Author: Will Deacon <will.deacon@arm.com>
> > > > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > > > +
> > > > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > > > +
> > > > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > > > +    used to head dependency chains on all architectures.
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +---
> > > > > > + instrumentation/events/lttng-module/i2c.h |  4 ++--
> > > > > > + lib/ringbuffer/backend.h                  |  2 +-
> > > > > > + lib/ringbuffer/backend_internal.h         |  2 +-
> > > > > > + lib/ringbuffer/frontend.h                 |  4 ++--
> > > > > > + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> > > > > > + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> > > > > > + lttng-events.c                            |  8 ++++----
> > > > > > + probes/lttng-kprobes.c                    |  6 +++---
> > > > > > + probes/lttng-kretprobes.c                 |  6 +++---
> > > > > > + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> > > > > > + probes/lttng-uprobes.c                    |  6 +++---
> > > > > > + wrapper/compiler.h                        | 18 ++++++++++++++++++
> > > > > > + wrapper/trace-clock.h                     | 15 +++++----------
> > > > > > + 13 files changed, 51 insertions(+), 38 deletions(-)
> > > > > > +
> > > > > > +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> > > > > > +index dcbabf6..131d134 100644
> > > > > > +--- a/instrumentation/events/lttng-module/i2c.h
> > > > > > ++++ b/instrumentation/events/lttng-module/i2c.h
> > > > > > +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> > > > > > +
> > > > > > +       TP_code_pre(
> > > > > > +               tp_locvar->extract_sensitive_payload =
> > > > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > > > +       ),
> > > > > > +
> > > > > > +       TP_FIELDS(
> > > > > > +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> > > > > > +
> > > > > > +       TP_code_pre(
> > > > > > +               tp_locvar->extract_sensitive_payload =
> > > > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > > > +       ),
> > > > > > +
> > > > > > +       TP_FIELDS(
> > > > > > +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> > > > > > +index da937f2..43e1d47 100644
> > > > > > +--- a/lib/ringbuffer/backend.h
> > > > > > ++++ b/lib/ringbuffer/backend.h
> > > > > > +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> > > > > > +                * Only read source character once, in case it is
> > > > > > +                * modified concurrently.
> > > > > > +                */
> > > > > > +-              c = READ_ONCE(src[count]);
> > > > > > ++              c = LTTNG_READ_ONCE(src[count]);
> > > > > > +               if (!c)
> > > > > > +                       break;
> > > > > > +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> > > > > > +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> > > > > > +index 2d6a345..1226fd8 100644
> > > > > > +--- a/lib/ringbuffer/backend_internal.h
> > > > > > ++++ b/lib/ringbuffer/backend_internal.h
> > > > > > +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> > > > > > +        * Performing a volatile access to read the sb_pages, because we want to
> > > > > > +        * read a coherent version of the pointer and the associated noref flag.
> > > > > > +        */
> > > > > > +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> > > > > > ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> > > > > > +       for (;;) {
> > > > > > +               /* This check is called on the fast path for each record. */
> > > > > > +               if (likely(!subbuffer_id_is_noref(config, id))) {
> > > > > > +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> > > > > > +index 6f516d9..41382fe 100644
> > > > > > +--- a/lib/ringbuffer/frontend.h
> > > > > > ++++ b/lib/ringbuffer/frontend.h
> > > > > > +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> > > > > > + #define for_each_channel_cpu(cpu, chan)                                       \
> > > > > > +       for ((cpu) = -1;                                                \
> > > > > > +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> > > > > > +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> > > > > > ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> > > > > > +
> > > > > > + extern struct lib_ring_buffer *channel_get_ring_buffer(
> > > > > > +                               const struct lib_ring_buffer_config *config,
> > > > > > +@@ -155,7 +155,7 @@ static inline
> > > > > > + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> > > > > > +                                struct lib_ring_buffer *buf)
> > > > > > + {
> > > > > > +-      int finalized = READ_ONCE(buf->finalized);
> > > > > > ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > +       /*
> > > > > > +        * Read finalized before counters.
> > > > > > +        */
> > > > > > +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > +index 3cab365..4980d20 100644
> > > > > > +--- a/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> > > > > > +       int finalized;
> > > > > > +
> > > > > > + retry:
> > > > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > +       /*
> > > > > > +        * Read finalized before counters.
> > > > > > +        */
> > > > > > +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> > > > > > +               return -EBUSY;
> > > > > > +       }
> > > > > > + retry:
> > > > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > +       /*
> > > > > > +        * Read finalized before counters.
> > > > > > +        */
> > > > > > +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > +index d25db72..7b4f20a 100644
> > > > > > +--- a/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > +@@ -46,7 +46,7 @@ restart:
> > > > > > +       switch (iter->state) {
> > > > > > +       case ITER_GET_SUBBUF:
> > > > > > +               ret = lib_ring_buffer_get_next_subbuf(buf);
> > > > > > +-              if (ret && !READ_ONCE(buf->finalized)
> > > > > > ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> > > > > > +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> > > > > > +                       /*
> > > > > > +                        * Use "pull" scheme for global buffers. The reader
> > > > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > > > +index be7e389..d719294 100644
> > > > > > +--- a/lttng-events.c
> > > > > > ++++ b/lttng-events.c
> > > > > > +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> > > > > > +       size_t len;
> > > > > > +       va_list ap;
> > > > > > +
> > > > > > +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> > > > > > ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> > > > > > +
> > > > > > +       va_start(ap, fmt);
> > > > > > +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> > > > > > +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> > > > > > + {
> > > > > > +       int ret = 0;
> > > > > > +
> > > > > > +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> > > > > > ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > > > +               return 0;
> > > > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > > > +               return 0;
> > > > > > +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> > > > > > + {
> > > > > > +       int ret = 0;
> > > > > > +
> > > > > > +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> > > > > > ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > > > +               return 0;
> > > > > > +
> > > > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > > > +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> > > > > > +       struct lttng_event *event;
> > > > > > +       int ret = 0;
> > > > > > +
> > > > > > +-      if (!READ_ONCE(session->active))
> > > > > > ++      if (!LTTNG_READ_ONCE(session->active))
> > > > > > +               return 0;
> > > > > > +
> > > > > > +       lttng_metadata_begin(session);
> > > > > > +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> > > > > > +index a44eaa1..38fb72e 100644
> > > > > > +--- a/probes/lttng-kprobes.c
> > > > > > ++++ b/probes/lttng-kprobes.c
> > > > > > +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> > > > > > +       int ret;
> > > > > > +       unsigned long data = (unsigned long) p->addr;
> > > > > > +
> > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > +               return 0;
> > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > +               return 0;
> > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > +               return 0;
> > > > > > +
> > > > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> > > > > > +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> > > > > > +index ab98ff2..a6bcd21 100644
> > > > > > +--- a/probes/lttng-kretprobes.c
> > > > > > ++++ b/probes/lttng-kretprobes.c
> > > > > > +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> > > > > > +               unsigned long parent_ip;
> > > > > > +       } payload;
> > > > > > +
> > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > +               return 0;
> > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > +               return 0;
> > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > +               return 0;
> > > > > > +
> > > > > > +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> > > > > > +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> > > > > > +index 77b8638..72a669e 100644
> > > > > > +--- a/probes/lttng-tracepoint-event-impl.h
> > > > > > ++++ b/probes/lttng-tracepoint-event-impl.h
> > > > > > +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> > > > > > +                                                                             \
> > > > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > > > +               return;                                                       \
> > > > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > > > +               return;                                                       \
> > > > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > > > +               return;                                                       \
> > > > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > > > +               return;                                                       \
> > > > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > > > +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> > > > > > +                                                                             \
> > > > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > > > +               return;                                                       \
> > > > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > > > +               return;                                                       \
> > > > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > > > +               return;                                                       \
> > > > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > > > +               return;                                                       \
> > > > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > > > +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> > > > > > +index bc10128..bda1d9b 100644
> > > > > > +--- a/probes/lttng-uprobes.c
> > > > > > ++++ b/probes/lttng-uprobes.c
> > > > > > +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> > > > > > +               unsigned long ip;
> > > > > > +       } payload;
> > > > > > +
> > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > +               return 0;
> > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > +               return 0;
> > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > +               return 0;
> > > > > > +
> > > > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> > > > > > +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> > > > > > +index 1496f33..b9f8c51 100644
> > > > > > +--- a/wrapper/compiler.h
> > > > > > ++++ b/wrapper/compiler.h
> > > > > > +@@ -9,6 +9,7 @@
> > > > > > + #define _LTTNG_WRAPPER_COMPILER_H
> > > > > > +
> > > > > > + #include <linux/compiler.h>
> > > > > > ++#include <linux/version.h>
> > > > > > +
> > > > > > + /*
> > > > > > +  * Don't allow compiling with buggy compiler.
> > > > > > +@@ -39,4 +40,21 @@
> > > > > > + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> > > > > > + #endif
> > > > > > +
> > > > > > ++/*
> > > > > > ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> > > > > > ++ * lockless_dereference(), replicate this behavior on prior kernels
> > > > > > ++ * and remove calls to smp_read_barrier_depends which was dropped
> > > > > > ++ * in v5.9.
> > > > > > ++ */
> > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> > > > > > ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> > > > > > ++#else
> > > > > > ++#define LTTNG_READ_ONCE(x)                    \
> > > > > > ++({                                            \
> > > > > > ++      typeof(x) __val = READ_ONCE(x);         \
> > > > > > ++      smp_read_barrier_depends();             \
> > > > > > ++      __val;                                  \
> > > > > > ++})
> > > > > > ++#endif
> > > > > > ++
> > > > > > + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> > > > > > +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> > > > > > +index 9f4e366..187fc82 100644
> > > > > > +--- a/wrapper/trace-clock.h
> > > > > > ++++ b/wrapper/trace-clock.h
> > > > > > +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> > > > > > +
> > > > > > + static inline u64 trace_clock_read64(void)
> > > > > > + {
> > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > +
> > > > > > +       if (likely(!ltc)) {
> > > > > > +               return trace_clock_read64_monotonic();
> > > > > > +       } else {
> > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > +               return ltc->read64();
> > > > > > +       }
> > > > > > + }
> > > > > > +
> > > > > > + static inline u64 trace_clock_freq(void)
> > > > > > + {
> > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > +
> > > > > > +       if (!ltc) {
> > > > > > +               return trace_clock_freq_monotonic();
> > > > > > +       } else {
> > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > +               return ltc->freq();
> > > > > > +       }
> > > > > > + }
> > > > > > +
> > > > > > + static inline int trace_clock_uuid(char *uuid)
> > > > > > + {
> > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > +
> > > > > > +-      read_barrier_depends(); /* load ltc before content */
> > > > > > +       /* Use default UUID cb when NULL */
> > > > > > +       if (!ltc || !ltc->uuid) {
> > > > > > +               return trace_clock_uuid_monotonic(uuid);
> > > > > > +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> > > > > > +
> > > > > > + static inline const char *trace_clock_name(void)
> > > > > > + {
> > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > +
> > > > > > +       if (!ltc) {
> > > > > > +               return trace_clock_name_monotonic();
> > > > > > +       } else {
> > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > +               return ltc->name();
> > > > > > +       }
> > > > > > + }
> > > > > > +
> > > > > > + static inline const char *trace_clock_description(void)
> > > > > > + {
> > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > +
> > > > > > +       if (!ltc) {
> > > > > > +               return trace_clock_description_monotonic();
> > > > > > +       } else {
> > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > +               return ltc->description();
> > > > > > +       }
> > > > > > + }
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..2843c9cb62
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > > @@ -0,0 +1,59 @@
> > > > > > +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Date: Mon, 31 Aug 2020 11:41:38 -0400
> > > > > > +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> > > > > > +
> > > > > > +See upstream commit:
> > > > > > +
> > > > > > +  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.
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> > > > > > +---
> > > > > > + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> > > > > > + 1 file changed, 15 insertions(+), 1 deletion(-)
> > > > > > +
> > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > +index affb4eb..ece67ad 100644
> > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> > > > > > +
> > > > > > + #endif
> > > > > > +
> > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > ++#define show_inode_state(state)                                       \
> > > > > > ++      __print_flags(state, "|",                               \
> > > > > > ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > > > ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> > > > > > ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> > > > > > ++              {I_NEW,                 "I_NEW"},               \
> > > > > > ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> > > > > > ++              {I_FREEING,             "I_FREEING"},           \
> > > > > > ++              {I_CLEAR,               "I_CLEAR"},             \
> > > > > > ++              {I_SYNC,                "I_SYNC"},              \
> > > > > > ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> > > > > > ++              {I_REFERENCED,          "I_REFERENCED"}         \
> > > > > > ++      )
> > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > > > + #define show_inode_state(state)                                       \
> > > > > > +       __print_flags(state, "|",                               \
> > > > > > +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..7a0d9a38b8
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > > @@ -0,0 +1,117 @@
> > > > > > +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Date: Mon, 31 Aug 2020 14:16:01 -0400
> > > > > > +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> > > > > > + processing (v5.9)
> > > > > > +
> > > > > > +See upstream commit:
> > > > > > +
> > > > > > +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> > > > > > +  Author: Jan Kara <jack@suse.cz>
> > > > > > +  Date:   Fri May 29 16:08:58 2020 +0200
> > > > > > +
> > > > > > +    writeback: Fix sync livelock due to b_dirty_time processing
> > > > > > +
> > > > > > +    When we are processing writeback for sync(2), move_expired_inodes()
> > > > > > +    didn't set any inode expiry value (older_than_this). This can result in
> > > > > > +    writeback never completing if there's steady stream of inodes added to
> > > > > > +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> > > > > > +    round whether there's more work to be done. Fix the problem by using
> > > > > > +    sync(2) start time is inode expiry value when processing b_dirty_time
> > > > > > +    list similarly as for ordinarily dirtied inodes. This requires some
> > > > > > +    refactoring of older_than_this handling which simplifies the code
> > > > > > +    noticeably as a bonus.
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +---
> > > > > > + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> > > > > > + 1 file changed, 26 insertions(+), 13 deletions(-)
> > > > > > +
> > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > +index ece67ad..e9018dd 100644
> > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > > > + #endif
> > > > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > > > +
> > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > > > ++               struct wb_writeback_work *work,
> > > > > > ++               unsigned long dirtied_before,
> > > > > > ++               int moved),
> > > > > > ++      TP_ARGS(wb, work, dirtied_before, moved),
> > > > > > ++      TP_FIELDS(
> > > > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > ++              ctf_integer(unsigned long, older, dirtied_before)
> > > > > > ++              ctf_integer(int, moved, moved)
> > > > > > ++      )
> > > > > > ++)
> > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > +                struct wb_writeback_work *work,
> > > > > > +-#else
> > > > > > +-               unsigned long *older_than_this,
> > > > > > +-#endif
> > > > > > +                int moved),
> > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > +       TP_ARGS(wb, work, moved),
> > > > > > +-#else
> > > > > > ++      TP_FIELDS(
> > > > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > ++              ctf_integer(int, moved, moved)
> > > > > > ++      )
> > > > > > ++)
> > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > > > ++               unsigned long *older_than_this,
> > > > > > ++               int moved),
> > > > > > +       TP_ARGS(wb, older_than_this, moved),
> > > > > > +-#endif
> > > > > > +       TP_FIELDS(
> > > > > > +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > +-#else
> > > > > > +               ctf_integer(unsigned long, older,
> > > > > > +                       older_than_this ? *older_than_this : 0)
> > > > > > +               ctf_integer(long, age,
> > > > > > +                       older_than_this ?
> > > > > > +                               (jiffies - *older_than_this) * 1000 / HZ
> > > > > > +                               : -1)
> > > > > > +-#endif
> > > > > > +               ctf_integer(int, moved, moved)
> > > > > > +       )
> > > > > > + )
> > > > > > ++#endif
> > > > > > +
> > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> > > > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> > > > > > +       )
> > > > > > + )
> > > > > > +-#else
> > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > +
> > > > > > +       writeback_global_dirty_state,
> > > > > > +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > +       )
> > > > > > + )
> > > > > > + #endif
> > > > > > +-#endif
> > > > > > +
> > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > +
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..346e1d63ad
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > > @@ -0,0 +1,52 @@
> > > > > > +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Date: Fri, 4 Sep 2020 11:52:51 -0400
> > > > > > +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> > > > > > + writeback_queue_io
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> > > > > > +---
> > > > > > + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> > > > > > + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> > > > > > + 2 files changed, 9 insertions(+), 2 deletions(-)
> > > > > > +
> > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > +index 4476abb..b172c8d 100644
> > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > > > + )
> > > > > > + #endif
> > > > > > +
> > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > > > +
> > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > +index e9018dd..09637d7 100644
> > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > > > + #endif
> > > > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > > > +
> > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> > > > > > ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> > > > > > ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> > > > > > ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> > > > > > ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> > > > > > ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> > > > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > > > +                struct wb_writeback_work *work,
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > > new file mode 100644
> > > > > > index 0000000000..a16750ddb3
> > > > > > --- /dev/null
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > > @@ -0,0 +1,918 @@
> > > > > > +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> > > > > > +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +Date: Tue, 28 Jan 2020 16:02:44 -0500
> > > > > > +Subject: [PATCH 10/10] Fix: system call filter table
> > > > > > +
> > > > > > +The system call filter table has effectively been unused for a long
> > > > > > +time due to system call name prefix mismatch. This means the overhead of
> > > > > > +selective system call tracing was larger than it should have been because
> > > > > > +the event payload preparation would be done for all system calls as soon
> > > > > > +as a single system call is traced.
> > > > > > +
> > > > > > +However, fixing this underlying issue unearths several issues that crept
> > > > > > +unnoticed when the "enabler" concept was introduced (after the original
> > > > > > +implementation of the system call filter table).
> > > > > > +
> > > > > > +Here is a list of the issues which are resolved here:
> > > > > > +
> > > > > > +- Split lttng_syscalls_unregister into an unregister and destroy
> > > > > > +  function, thus awaiting for a grace period (and therefore quiescence
> > > > > > +  of the users) after unregistering the system call tracepoints before
> > > > > > +  freeing the system call filter data structures. This effectively fixes
> > > > > > +  a use-after-free.
> > > > > > +
> > > > > > +- The state for enabling "all" system calls vs enabling specific system
> > > > > > +  calls (and sequences of enable-disable) was incorrect with respect to
> > > > > > +  the "enablers" semantic. This is solved by always tracking the
> > > > > > +  bitmap of enabled system calls, and keeping this bitmap even when
> > > > > > +  enabling all system calls. The sc_filter is now always allocated
> > > > > > +  before system call tracing is registered to tracepoints, which means
> > > > > > +  it does not need to be RCU dereferenced anymore.
> > > > > > +
> > > > > > +Padding fields in the ABI are reserved to select whether to:
> > > > > > +
> > > > > > +- Trace either native or compat system call (or both, which is the
> > > > > > +  behavior currently implemented),
> > > > > > +- Trace either system call entry or exit (or both, which is the
> > > > > > +  behavior currently implemented),
> > > > > > +- Select the system call to trace by name (behavior currently
> > > > > > +  implemented) or by system call number,
> > > > > > +
> > > > > > +Upstream-Status: Backport
> > > > > > +
> > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > +---
> > > > > > + lttng-abi.c      |  43 ++++++
> > > > > > + lttng-abi.h      |  26 ++++
> > > > > > + lttng-events.c   | 112 +++++++++++++--
> > > > > > + lttng-events.h   |  31 ++++-
> > > > > > + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> > > > > > + 5 files changed, 380 insertions(+), 180 deletions(-)
> > > > > > +
> > > > > > +diff --git a/lttng-abi.c b/lttng-abi.c
> > > > > > +index 64ea99d..b33879d 100644
> > > > > > +--- a/lttng-abi.c
> > > > > > ++++ b/lttng-abi.c
> > > > > > +@@ -1264,6 +1264,46 @@ nomem:
> > > > > > +       return ret;
> > > > > > + }
> > > > > > +
> > > > > > ++static
> > > > > > ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> > > > > > ++{
> > > > > > ++      /* Limit ABI to implemented features. */
> > > > > > ++      switch (event_param->instrumentation) {
> > > > > > ++      case LTTNG_KERNEL_SYSCALL:
> > > > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > ++                      break;
> > > > > > ++              default:
> > > > > > ++                      return -EINVAL;
> > > > > > ++              }
> > > > > > ++              switch (event_param->u.syscall.abi) {
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > ++                      break;
> > > > > > ++              default:
> > > > > > ++                      return -EINVAL;
> > > > > > ++              }
> > > > > > ++              switch (event_param->u.syscall.match) {
> > > > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > > > ++                      break;
> > > > > > ++              default:
> > > > > > ++                      return -EINVAL;
> > > > > > ++              }
> > > > > > ++              break;
> > > > > > ++
> > > > > > ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> > > > > > ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> > > > > > ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> > > > > > ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> > > > > > ++      case LTTNG_KERNEL_UPROBE:
> > > > > > ++              break;
> > > > > > ++
> > > > > > ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> > > > > > ++      default:
> > > > > > ++              return -EINVAL;
> > > > > > ++      }
> > > > > > ++      return 0;
> > > > > > ++}
> > > > > > ++
> > > > > > + static
> > > > > > + int lttng_abi_create_event(struct file *channel_file,
> > > > > > +                          struct lttng_kernel_event *event_param)
> > > > > > +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> > > > > > +               ret = -EOVERFLOW;
> > > > > > +               goto refcount_error;
> > > > > > +       }
> > > > > > ++      ret = lttng_abi_validate_event_param(event_param);
> > > > > > ++      if (ret)
> > > > > > ++              goto event_error;
> > > > > > +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> > > > > > +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> > > > > > +               struct lttng_enabler *enabler;
> > > > > > +diff --git a/lttng-abi.h b/lttng-abi.h
> > > > > > +index 1d356ab..51d60e5 100644
> > > > > > +--- a/lttng-abi.h
> > > > > > ++++ b/lttng-abi.h
> > > > > > +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> > > > > > +       } u;
> > > > > > + } __attribute__((packed));
> > > > > > +
> > > > > > ++enum lttng_kernel_syscall_entryexit {
> > > > > > ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> > > > > > ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> > > > > > ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> > > > > > ++};
> > > > > > ++
> > > > > > ++enum lttng_kernel_syscall_abi {
> > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> > > > > > ++};
> > > > > > ++
> > > > > > ++enum lttng_kernel_syscall_match {
> > > > > > ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> > > > > > ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> > > > > > ++};
> > > > > > ++
> > > > > > ++struct lttng_kernel_syscall {
> > > > > > ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> > > > > > ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> > > > > > ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> > > > > > ++      uint8_t padding;
> > > > > > ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> > > > > > ++} __attribute__((packed));
> > > > > > ++
> > > > > > + /*
> > > > > > +  * For syscall tracing, name = "*" means "enable all".
> > > > > > +  */
> > > > > > +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> > > > > > +               struct lttng_kernel_kprobe kprobe;
> > > > > > +               struct lttng_kernel_function_tracer ftrace;
> > > > > > +               struct lttng_kernel_uprobe uprobe;
> > > > > > ++              struct lttng_kernel_syscall syscall;
> > > > > > +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> > > > > > +       } u;
> > > > > > + } __attribute__((packed));
> > > > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > > > +index d719294..4c0b04a 100644
> > > > > > +--- a/lttng-events.c
> > > > > > ++++ b/lttng-events.c
> > > > > > +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> > > > > > +               WARN_ON(ret);
> > > > > > +       }
> > > > > > +       synchronize_trace();    /* Wait for in-flight events to complete */
> > > > > > ++      list_for_each_entry(chan, &session->chan, list) {
> > > > > > ++              ret = lttng_syscalls_destroy(chan);
> > > > > > ++              WARN_ON(ret);
> > > > > > ++      }
> > > > > > +       list_for_each_entry_safe(enabler, tmpenabler,
> > > > > > +                       &session->enablers_head, node)
> > > > > > +               lttng_enabler_destroy(enabler);
> > > > > > +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> > > > > > +               event->enabled = 0;
> > > > > > +               event->registered = 0;
> > > > > > +               event->desc = event_desc;
> > > > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > ++                      ret = -EINVAL;
> > > > > > ++                      goto register_error;
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> > > > > > ++                      break;
> > > > > > ++              }
> > > > > > ++              switch (event_param->u.syscall.abi) {
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > ++                      ret = -EINVAL;
> > > > > > ++                      goto register_error;
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> > > > > > ++                      break;
> > > > > > ++              }
> > > > > > +               if (!event->desc) {
> > > > > > +                       ret = -EINVAL;
> > > > > > +                       goto register_error;
> > > > > > +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> > > > > > +                                                 event);
> > > > > > +               break;
> > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > +-              ret = lttng_syscall_filter_enable(event->chan,
> > > > > > +-                      desc->name);
> > > > > > ++              ret = lttng_syscall_filter_enable(event->chan, event);
> > > > > > +               break;
> > > > > > +       case LTTNG_KERNEL_KPROBE:
> > > > > > +       case LTTNG_KERNEL_UPROBE:
> > > > > > +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> > > > > > +               ret = 0;
> > > > > > +               break;
> > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > +-              ret = lttng_syscall_filter_disable(event->chan,
> > > > > > +-                      desc->name);
> > > > > > ++              ret = lttng_syscall_filter_disable(event->chan, event);
> > > > > > +               break;
> > > > > > +       case LTTNG_KERNEL_NOOP:
> > > > > > +               ret = 0;
> > > > > > +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> > > > > > +               struct lttng_enabler *enabler)
> > > > > > + {
> > > > > > +       const char *desc_name, *enabler_name;
> > > > > > ++      bool compat = false, entry = false;
> > > > > > +
> > > > > > +       enabler_name = enabler->event_param.name;
> > > > > > +       switch (enabler->event_param.instrumentation) {
> > > > > > +       case LTTNG_KERNEL_TRACEPOINT:
> > > > > > +               desc_name = desc->name;
> > > > > > ++              switch (enabler->type) {
> > > > > > ++              case LTTNG_ENABLER_STAR_GLOB:
> > > > > > ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > ++              case LTTNG_ENABLER_NAME:
> > > > > > ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > ++              default:
> > > > > > ++                      return -EINVAL;
> > > > > > ++              }
> > > > > > +               break;
> > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > +               desc_name = desc->name;
> > > > > > +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> > > > > > ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> > > > > > +                       desc_name += strlen("compat_");
> > > > > > ++                      compat = true;
> > > > > > ++              }
> > > > > > +               if (!strncmp(desc_name, "syscall_exit_",
> > > > > > +                               strlen("syscall_exit_"))) {
> > > > > > +                       desc_name += strlen("syscall_exit_");
> > > > > > +               } else if (!strncmp(desc_name, "syscall_entry_",
> > > > > > +                               strlen("syscall_entry_"))) {
> > > > > > +                       desc_name += strlen("syscall_entry_");
> > > > > > ++                      entry = true;
> > > > > > +               } else {
> > > > > > +                       WARN_ON_ONCE(1);
> > > > > > +                       return -EINVAL;
> > > > > > +               }
> > > > > > ++              switch (enabler->event_param.u.syscall.entryexit) {
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > > > ++                      if (!entry)
> > > > > > ++                              return 0;
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > > > ++                      if (entry)
> > > > > > ++                              return 0;
> > > > > > ++                      break;
> > > > > > ++              default:
> > > > > > ++                      return -EINVAL;
> > > > > > ++              }
> > > > > > ++              switch (enabler->event_param.u.syscall.abi) {
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > > > ++                      if (compat)
> > > > > > ++                              return 0;
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > > > ++                      if (!compat)
> > > > > > ++                              return 0;
> > > > > > ++                      break;
> > > > > > ++              default:
> > > > > > ++                      return -EINVAL;
> > > > > > ++              }
> > > > > > ++              switch (enabler->event_param.u.syscall.match) {
> > > > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > > > ++                      switch (enabler->type) {
> > > > > > ++                      case LTTNG_ENABLER_STAR_GLOB:
> > > > > > ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > ++                      case LTTNG_ENABLER_NAME:
> > > > > > ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > ++                      default:
> > > > > > ++                              return -EINVAL;
> > > > > > ++                      }
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_SYSCALL_MATCH_NR:
> > > > > > ++                      return -EINVAL; /* Not implemented. */
> > > > > > ++              default:
> > > > > > ++                      return -EINVAL;
> > > > > > ++              }
> > > > > > +               break;
> > > > > > +       default:
> > > > > > +               WARN_ON_ONCE(1);
> > > > > > +               return -EINVAL;
> > > > > > +       }
> > > > > > +-      switch (enabler->type) {
> > > > > > +-      case LTTNG_ENABLER_STAR_GLOB:
> > > > > > +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > +-      case LTTNG_ENABLER_NAME:
> > > > > > +-              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > +-      default:
> > > > > > +-              return -EINVAL;
> > > > > > +-      }
> > > > > > + }
> > > > > > +
> > > > > > + static
> > > > > > +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> > > > > > + static
> > > > > > + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> > > > > > + {
> > > > > > +-      struct lttng_session *session = enabler->chan->session;
> > > > > > ++      struct lttng_channel *chan = enabler->chan;
> > > > > > ++      struct lttng_session *session = chan->session;
> > > > > > +       struct lttng_event *event;
> > > > > > +
> > > > > > ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> > > > > > ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> > > > > > ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> > > > > > ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> > > > > > ++                      !strcmp(enabler->event_param.name, "*")) {
> > > > > > ++              if (enabler->enabled)
> > > > > > ++                      WRITE_ONCE(chan->syscall_all, 1);
> > > > > > ++              else
> > > > > > ++                      WRITE_ONCE(chan->syscall_all, 0);
> > > > > > ++      }
> > > > > > ++
> > > > > > +       /* First ensure that probe events are created for this enabler. */
> > > > > > +       lttng_create_event_if_missing(enabler);
> > > > > > +
> > > > > > +diff --git a/lttng-events.h b/lttng-events.h
> > > > > > +index a36a312..d4d9976 100644
> > > > > > +--- a/lttng-events.h
> > > > > > ++++ b/lttng-events.h
> > > > > > +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> > > > > > +       struct list_head node;
> > > > > > + };
> > > > > > +
> > > > > > ++enum lttng_syscall_entryexit {
> > > > > > ++      LTTNG_SYSCALL_ENTRY,
> > > > > > ++      LTTNG_SYSCALL_EXIT,
> > > > > > ++};
> > > > > > ++
> > > > > > ++enum lttng_syscall_abi {
> > > > > > ++      LTTNG_SYSCALL_ABI_NATIVE,
> > > > > > ++      LTTNG_SYSCALL_ABI_COMPAT,
> > > > > > ++};
> > > > > > ++
> > > > > > + /*
> > > > > > +  * lttng_event structure is referred to by the tracing fast path. It must be
> > > > > > +  * kept small.
> > > > > > +@@ -318,6 +328,11 @@ struct lttng_event {
> > > > > > +                       struct inode *inode;
> > > > > > +                       struct list_head head;
> > > > > > +               } uprobe;
> > > > > > ++              struct {
> > > > > > ++                      char *syscall_name;
> > > > > > ++                      enum lttng_syscall_entryexit entryexit;
> > > > > > ++                      enum lttng_syscall_abi abi;
> > > > > > ++              } syscall;
> > > > > > +       } u;
> > > > > > +       struct list_head list;          /* Event list in session */
> > > > > > +       unsigned int metadata_dumped:1;
> > > > > > +@@ -457,10 +472,10 @@ struct lttng_channel {
> > > > > > +       struct lttng_syscall_filter *sc_filter;
> > > > > > +       int header_type;                /* 0: unset, 1: compact, 2: large */
> > > > > > +       enum channel_type channel_type;
> > > > > > ++      int syscall_all;
> > > > > > +       unsigned int metadata_dumped:1,
> > > > > > +               sys_enter_registered:1,
> > > > > > +               sys_exit_registered:1,
> > > > > > +-              syscall_all:1,
> > > > > > +               tstate:1;               /* Transient enable state */
> > > > > > + };
> > > > > > +
> > > > > > +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> > > > > > + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> > > > > > + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> > > > > > + int lttng_syscalls_unregister(struct lttng_channel *chan);
> > > > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> > > > > > + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > +-              const char *name);
> > > > > > ++              struct lttng_event *event);
> > > > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > +-              const char *name);
> > > > > > ++              struct lttng_event *event);
> > > > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> > > > > > + #else
> > > > > > +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > > > +       return 0;
> > > > > > + }
> > > > > > +
> > > > > > ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > > > ++{
> > > > > > ++      return 0;
> > > > > > ++}
> > > > > > ++
> > > > > > + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > +-              const char *name)
> > > > > > ++              struct lttng_event *event);
> > > > > > + {
> > > > > > +       return -ENOSYS;
> > > > > > + }
> > > > > > +
> > > > > > + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > +-              const char *name)
> > > > > > ++              struct lttng_event *event);
> > > > > > + {
> > > > > > +       return -ENOSYS;
> > > > > > + }
> > > > > > +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> > > > > > +index 97f1ba9..26cead6 100644
> > > > > > +--- a/lttng-syscalls.c
> > > > > > ++++ b/lttng-syscalls.c
> > > > > > +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> > > > > > + #undef CREATE_SYSCALL_TABLE
> > > > > > +
> > > > > > + struct lttng_syscall_filter {
> > > > > > +-      DECLARE_BITMAP(sc, NR_syscalls);
> > > > > > +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> > > > > > ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> > > > > > ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> > > > > > ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> > > > > > ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> > > > > > + };
> > > > > > +
> > > > > > + static void syscall_entry_unknown(struct lttng_event *event,
> > > > > > +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> > > > > > +       size_t table_len;
> > > > > > +
> > > > > > +       if (unlikely(in_compat_syscall())) {
> > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > +-
> > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > +-              if (filter) {
> > > > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > > > +-                              /* System call filtered out. */
> > > > > > +-                              return;
> > > > > > +-                      }
> > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > ++
> > > > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> > > > > > ++                      /* System call filtered out. */
> > > > > > ++                      return;
> > > > > > +               }
> > > > > > +               table = compat_sc_table;
> > > > > > +               table_len = ARRAY_SIZE(compat_sc_table);
> > > > > > +               unknown_event = chan->sc_compat_unknown;
> > > > > > +       } else {
> > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > +-
> > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > +-              if (filter) {
> > > > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > > > +-                              || !test_bit(id, filter->sc)) {
> > > > > > +-                              /* System call filtered out. */
> > > > > > +-                              return;
> > > > > > +-                      }
> > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > ++
> > > > > > ++              if (id < 0 || id >= NR_syscalls
> > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> > > > > > ++                      /* System call filtered out. */
> > > > > > ++                      return;
> > > > > > +               }
> > > > > > +               table = sc_table;
> > > > > > +               table_len = ARRAY_SIZE(sc_table);
> > > > > > +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> > > > > > +
> > > > > > +       id = syscall_get_nr(current, regs);
> > > > > > +       if (unlikely(in_compat_syscall())) {
> > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > +-
> > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > +-              if (filter) {
> > > > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > > > +-                              /* System call filtered out. */
> > > > > > +-                              return;
> > > > > > +-                      }
> > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > ++
> > > > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> > > > > > ++                      /* System call filtered out. */
> > > > > > ++                      return;
> > > > > > +               }
> > > > > > +               table = compat_sc_exit_table;
> > > > > > +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> > > > > > +               unknown_event = chan->compat_sc_exit_unknown;
> > > > > > +       } else {
> > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > +-
> > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > +-              if (filter) {
> > > > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > > > +-                              || !test_bit(id, filter->sc)) {
> > > > > > +-                              /* System call filtered out. */
> > > > > > +-                              return;
> > > > > > +-                      }
> > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > ++
> > > > > > ++              if (id < 0 || id >= NR_syscalls
> > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> > > > > > ++                      /* System call filtered out. */
> > > > > > ++                      return;
> > > > > > +               }
> > > > > > +               table = sc_exit_table;
> > > > > > +               table_len = ARRAY_SIZE(sc_exit_table);
> > > > > > +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> > > > > > +               memset(&ev, 0, sizeof(ev));
> > > > > > +               switch (type) {
> > > > > > +               case SC_TYPE_ENTRY:
> > > > > > +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > +                       break;
> > > > > > +               case SC_TYPE_EXIT:
> > > > > > +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > +                       break;
> > > > > > +               case SC_TYPE_COMPAT_ENTRY:
> > > > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > +                       break;
> > > > > > +               case SC_TYPE_COMPAT_EXIT:
> > > > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > +-                      break;
> > > > > > +-              default:
> > > > > > +-                      BUG_ON(1);
> > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > +                       break;
> > > > > > +               }
> > > > > > +-              strncat(ev.name, desc->name,
> > > > > > +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> > > > > > ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> > > > > > +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > +                                               desc,
> > > > > > +                                               ev.instrumentation);
> > > > > > +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > +                                               desc,
> > > > > > +                                               ev.instrumentation);
> > > > > > +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> > > > > > +                                               filter, desc,
> > > > > > +                                               ev.instrumentation);
> > > > > > +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > +                                               desc, ev.instrumentation);
> > > > > > +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> > > > > > +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > +       if (ret)
> > > > > > +               return ret;
> > > > > > + #endif
> > > > > > ++
> > > > > > ++      if (!chan->sc_filter) {
> > > > > > ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > ++                              GFP_KERNEL);
> > > > > > ++              if (!chan->sc_filter)
> > > > > > ++                      return -ENOMEM;
> > > > > > ++      }
> > > > > > ++
> > > > > > +       if (!chan->sys_enter_registered) {
> > > > > > +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> > > > > > +                               (void *) syscall_entry_probe, chan);
> > > > > > +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > > > +                       return ret;
> > > > > > +               chan->sys_exit_registered = 0;
> > > > > > +       }
> > > > > > +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> > > > > > ++      return 0;
> > > > > > ++}
> > > > > > ++
> > > > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > > > ++{
> > > > > > +       kfree(chan->sc_table);
> > > > > > +       kfree(chan->sc_exit_table);
> > > > > > + #ifdef CONFIG_COMPAT
> > > > > > +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> > > > > > +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> > > > > > + }
> > > > > > +
> > > > > > +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > +-              const char *name)
> > > > > > ++static
> > > > > > ++const char *get_syscall_name(struct lttng_event *event)
> > > > > > + {
> > > > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > > > +-      struct lttng_syscall_filter *filter;
> > > > > > ++      size_t prefix_len = 0;
> > > > > > +
> > > > > > +-      WARN_ON_ONCE(!chan->sc_table);
> > > > > > ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> > > > > > +
> > > > > > +-      if (!name) {
> > > > > > +-              /* Enable all system calls by removing filter */
> > > > > > +-              if (chan->sc_filter) {
> > > > > > +-                      filter = chan->sc_filter;
> > > > > > +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> > > > > > +-                      synchronize_trace();
> > > > > > +-                      kfree(filter);
> > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> > > > > > ++                      break;
> > > > > > +               }
> > > > > > +-              chan->syscall_all = 1;
> > > > > > +-              return 0;
> > > > > > +-      }
> > > > > > +-
> > > > > > +-      if (!chan->sc_filter) {
> > > > > > +-              if (chan->syscall_all) {
> > > > > > +-                      /*
> > > > > > +-                       * All syscalls are already enabled.
> > > > > > +-                       */
> > > > > > +-                      return -EEXIST;
> > > > > > ++              break;
> > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> > > > > > ++                      break;
> > > > > > +               }
> > > > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > +-                              GFP_KERNEL);
> > > > > > +-              if (!filter)
> > > > > > +-                      return -ENOMEM;
> > > > > > +-      } else {
> > > > > > +-              filter = chan->sc_filter;
> > > > > > ++              break;
> > > > > > +       }
> > > > > > +-      syscall_nr = get_syscall_nr(name);
> > > > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > > > +-              ret = -ENOENT;
> > > > > > +-              goto error;
> > > > > > ++      WARN_ON_ONCE(prefix_len == 0);
> > > > > > ++      return event->desc->name + prefix_len;
> > > > > > ++}
> > > > > > ++
> > > > > > ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > ++              struct lttng_event *event)
> > > > > > ++{
> > > > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > ++      const char *syscall_name;
> > > > > > ++      unsigned long *bitmap;
> > > > > > ++      int syscall_nr;
> > > > > > ++
> > > > > > ++      WARN_ON_ONCE(!chan->sc_table);
> > > > > > ++
> > > > > > ++      syscall_name = get_syscall_name(event);
> > > > > > ++
> > > > > > ++      switch (event->u.syscall.abi) {
> > > > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > > > ++              break;
> > > > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > > > ++              break;
> > > > > > ++      default:
> > > > > > ++              return -EINVAL;
> > > > > > +       }
> > > > > > +-      if (syscall_nr >= 0) {
> > > > > > +-              if (test_bit(syscall_nr, filter->sc)) {
> > > > > > +-                      ret = -EEXIST;
> > > > > > +-                      goto error;
> > > > > > ++      if (syscall_nr < 0)
> > > > > > ++              return -ENOENT;
> > > > > > ++
> > > > > > ++
> > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > ++                      bitmap = filter->sc_entry;
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > ++                      bitmap = filter->sc_compat_entry;
> > > > > > ++                      break;
> > > > > > +               }
> > > > > > +-              bitmap_set(filter->sc, syscall_nr, 1);
> > > > > > +-      }
> > > > > > +-      if (compat_syscall_nr >= 0) {
> > > > > > +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > > > +-                      ret = -EEXIST;
> > > > > > +-                      goto error;
> > > > > > ++              break;
> > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > ++                      bitmap = filter->sc_exit;
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > ++                      bitmap = filter->sc_compat_exit;
> > > > > > ++                      break;
> > > > > > +               }
> > > > > > +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> > > > > > ++              break;
> > > > > > ++      default:
> > > > > > ++              return -EINVAL;
> > > > > > +       }
> > > > > > +-      if (!chan->sc_filter)
> > > > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > > > ++      if (test_bit(syscall_nr, bitmap))
> > > > > > ++              return -EEXIST;
> > > > > > ++      bitmap_set(bitmap, syscall_nr, 1);
> > > > > > +       return 0;
> > > > > > +-
> > > > > > +-error:
> > > > > > +-      if (!chan->sc_filter)
> > > > > > +-              kfree(filter);
> > > > > > +-      return ret;
> > > > > > + }
> > > > > > +
> > > > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > +-              const char *name)
> > > > > > ++              struct lttng_event *event)
> > > > > > + {
> > > > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > > > +-      struct lttng_syscall_filter *filter;
> > > > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > ++      const char *syscall_name;
> > > > > > ++      unsigned long *bitmap;
> > > > > > ++      int syscall_nr;
> > > > > > +
> > > > > > +       WARN_ON_ONCE(!chan->sc_table);
> > > > > > +
> > > > > > +-      if (!chan->sc_filter) {
> > > > > > +-              if (!chan->syscall_all)
> > > > > > +-                      return -EEXIST;
> > > > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > +-                              GFP_KERNEL);
> > > > > > +-              if (!filter)
> > > > > > +-                      return -ENOMEM;
> > > > > > +-              /* Trace all system calls, then apply disable. */
> > > > > > +-              bitmap_set(filter->sc, 0, NR_syscalls);
> > > > > > +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> > > > > > +-      } else {
> > > > > > +-              filter = chan->sc_filter;
> > > > > > ++      syscall_name = get_syscall_name(event);
> > > > > > ++
> > > > > > ++      switch (event->u.syscall.abi) {
> > > > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > > > ++              break;
> > > > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > > > ++              break;
> > > > > > ++      default:
> > > > > > ++              return -EINVAL;
> > > > > > +       }
> > > > > > ++      if (syscall_nr < 0)
> > > > > > ++              return -ENOENT;
> > > > > > +
> > > > > > +-      if (!name) {
> > > > > > +-              /* Fail if all syscalls are already disabled. */
> > > > > > +-              if (bitmap_empty(filter->sc, NR_syscalls)
> > > > > > +-                      && bitmap_empty(filter->sc_compat,
> > > > > > +-                              NR_compat_syscalls)) {
> > > > > > +-                      ret = -EEXIST;
> > > > > > +-                      goto error;
> > > > > > +-              }
> > > > > > +
> > > > > > +-              /* Disable all system calls */
> > > > > > +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> > > > > > +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> > > > > > +-              goto apply_filter;
> > > > > > +-      }
> > > > > > +-      syscall_nr = get_syscall_nr(name);
> > > > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > > > +-              ret = -ENOENT;
> > > > > > +-              goto error;
> > > > > > +-      }
> > > > > > +-      if (syscall_nr >= 0) {
> > > > > > +-              if (!test_bit(syscall_nr, filter->sc)) {
> > > > > > +-                      ret = -EEXIST;
> > > > > > +-                      goto error;
> > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > ++                      bitmap = filter->sc_entry;
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > ++                      bitmap = filter->sc_compat_entry;
> > > > > > ++                      break;
> > > > > > +               }
> > > > > > +-              bitmap_clear(filter->sc, syscall_nr, 1);
> > > > > > +-      }
> > > > > > +-      if (compat_syscall_nr >= 0) {
> > > > > > +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > > > +-                      ret = -EEXIST;
> > > > > > +-                      goto error;
> > > > > > ++              break;
> > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > ++                      bitmap = filter->sc_exit;
> > > > > > ++                      break;
> > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > ++                      bitmap = filter->sc_compat_exit;
> > > > > > ++                      break;
> > > > > > +               }
> > > > > > +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> > > > > > ++              break;
> > > > > > ++      default:
> > > > > > ++              return -EINVAL;
> > > > > > +       }
> > > > > > +-apply_filter:
> > > > > > +-      if (!chan->sc_filter)
> > > > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > > > +-      chan->syscall_all = 0;
> > > > > > +-      return 0;
> > > > > > ++      if (!test_bit(syscall_nr, bitmap))
> > > > > > ++              return -EEXIST;
> > > > > > ++      bitmap_clear(bitmap, syscall_nr, 1);
> > > > > > +
> > > > > > +-error:
> > > > > > +-      if (!chan->sc_filter)
> > > > > > +-              kfree(filter);
> > > > > > +-      return ret;
> > > > > > ++      return 0;
> > > > > > + }
> > > > > > +
> > > > > > + static
> > > > > > +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> > > > > > +       .release = seq_release,
> > > > > > + };
> > > > > > +
> > > > > > ++/*
> > > > > > ++ * A syscall is enabled if it is traced for either entry or exit.
> > > > > > ++ */
> > > > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> > > > > > + {
> > > > > > +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > +               char state;
> > > > > > +
> > > > > > +               if (channel->sc_table) {
> > > > > > +-                      if (filter)
> > > > > > +-                              state = test_bit(bit, filter->sc);
> > > > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > > > ++                              state = test_bit(bit, filter->sc_entry)
> > > > > > ++                                      || test_bit(bit, filter->sc_exit);
> > > > > > +                       else
> > > > > > +                               state = 1;
> > > > > > +               } else {
> > > > > > +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > +               char state;
> > > > > > +
> > > > > > +               if (channel->compat_sc_table) {
> > > > > > +-                      if (filter)
> > > > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > > > +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> > > > > > +-                                              filter->sc_compat);
> > > > > > ++                                              filter->sc_compat_entry)
> > > > > > ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> > > > > > ++                                              filter->sc_compat_exit);
> > > > > > +                       else
> > > > > > +                               state = 1;
> > > > > > +               } else {
> > > > > > +--
> > > > > > +2.19.1
> > > > > > +
> > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > index 0e1a209ce8..e36b327a08 100644
> > > > > > --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > @@ -11,6 +11,16 @@ include lttng-platforms.inc
> > > > > >  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
> > > > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > > > +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> > > > > > +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> > > > > > +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> > > > > > +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> > > > > > +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> > > > > > +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> > > > > > +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> > > > > > +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> > > > > > +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> > > > > > +           file://0010-Fix-system-call-filter-table.patch \
> > > > > >             "
> > > > > >
> > > > > >  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> > > > > > @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
> > > > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > > >             "
> > > > > > -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> > > > > > +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
> > > > > >  PV_class-devupstream = "2.12.2+git${SRCPV}"
> > > > > >  S_class-devupstream = "${WORKDIR}/git"
> > > > > >  SRCREV_FORMAT ?= "lttng_git"
> > > > > > --
> > > > > > 2.19.1
> > > > > >
> > > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > > > thee at its end
> > > > - "Use the force Harry" - Gandalf, Star Trek II
> >
> >
> >
> > --
> > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > thee at its end
> > - "Use the force Harry" - Gandalf, Star Trek II
> >
> > 
> >
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-28 22:35             ` Steve Sakoman
@ 2020-09-28 22:53               ` Bruce Ashfield
       [not found]               ` <16391475BC3C80C8.17908@lists.openembedded.org>
  1 sibling, 0 replies; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-28 22:53 UTC (permalink / raw)
  To: Steve Sakoman
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

On Mon, Sep 28, 2020 at 6:35 PM Steve Sakoman <steve@sakoman.com> wrote:
>
> On Mon, Sep 28, 2020 at 7:44 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> >
> > On Sun, Sep 27, 2020 at 5:18 PM Bruce Ashfield via
> > lists.openembedded.org
> > <bruce.ashfield=gmail.com@lists.openembedded.org> wrote:
> > >
> > > On Fri, Sep 25, 2020 at 3:49 PM Steve Sakoman <steve@sakoman.com> wrote:
> > > >
> > > > On Fri, Sep 25, 2020 at 6:52 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> > > > >
> > > > > On Fri, Sep 25, 2020 at 12:43 PM Steve Sakoman <steve@sakoman.com> wrote:
> > > > > >
> > > > > > Dunfell is still at 2.11.2.  Will there be a need for patches to this
> > > > > > version too?  Or should I take the lttng version bump along with the
> > > > > > 5.4 version bumps that cause the issue?
> > > > >
> > > > > I don't see a lot of options on that front. Unless we do some custom backports.
> > > > >
> > > > > I just checked the lttng 2.11 branch, and the last commit is from January, which
> > > > > is too old to cover these -stable kernel bump issues.
> > > > >
> > > > > I can have a go at the backports, but we should be prepared to bend the version
> > > > > upgrade rule if that gets too complex (and for the record, I've never
> > > > > had much luck
> > > > > with lttng fixes).
> > > >
> > > > Totally understood!  I think this is likely one of those cases where
> > > > we'll have to take an exception to the upgrade rule.
> > > >
> > > > If you see issues with a backport just let me know and I'll go with
> > > > the version upgrade approach.
> > >
> > > I'll have a go at some backports on Monday and send info by end of day.
> >
> > Hmm. Despite the advertised kernel version limitations, I was able to
> > build lttng-modules against my dunfell branch with v5.4 bumped all the
> > way to v5.4.67.
> >
> > So at this point, I'd suggest taking my kernel uprevs and running it
> > through the autobuilder. If nothing blows up on build, we are good to
> > go.
> >
> > If it does blow up, let me know and I'll figure out how my local builds worked.
>
> Sadly I am starting to errors on the autobuilder:
>
> https://autobuilder.yoctoproject.org/typhoon/#/builders/102/builds/975
> https://autobuilder.yoctoproject.org/typhoon/#/builders/63/builds/2498
> https://autobuilder.yoctoproject.org/typhoon/#/builders/107/builds/962
>

Not surprising!

Leave it with me, and I'll send a dunfell series later today or early tomorrow.

Bruce


> Steve
>
> > > > While I have your attention, what about "linux-yocto/config:
> > > > netfilter: Enable nat for ipv4 and ipv6" for dunfell?  I'll have to
> > > > prune out the changes for 5.8 in the commit, but does it make sense
> > > > for 5.4?
> > >
> > > It isn't a bugfix by a strict definition, but it also  won't hurt
> > > anything. It does
> > > make sense to keep 5.4 & 5.8 kernel configuration consistent whenever
> > > possible, so I'd say go ahead and do the port.
> > >
> > > Bruce
> > >
> > > >
> > > > Thanks!
> > > >
> > > > Steve
> > > >
> > > >
> > > >  >
> > > > > > On Mon, Sep 14, 2020 at 12:34 PM Bruce Ashfield
> > > > > > <bruce.ashfield@gmail.com> wrote:
> > > > > > >
> > > > > > > From: Jens Rehsack <sno@netbsd.org>
> > > > > > >
> > > > > > > Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> > > > > > > them once .3 is released, but for now, we need the fixes to build
> > > > > > > against the latest 5.4, 5.8 and 5.9 kernels.
> > > > > > >
> > > > > > > We also bump the devupstream SRCREV to pickup the same changes.
> > > > > > >
> > > > > > > Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> > > > > > > ---
> > > > > > >  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
> > > > > > >  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
> > > > > > >  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
> > > > > > >  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
> > > > > > >  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
> > > > > > >  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
> > > > > > >  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
> > > > > > >  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
> > > > > > >  ...es-for-ext4_discard_preallocations-a.patch |  52 +
> > > > > > >  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
> > > > > > >  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
> > > > > > >  11 files changed, 1829 insertions(+), 1 deletion(-)
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > > >
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..ae8bec45de
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > > > @@ -0,0 +1,54 @@
> > > > > > > +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> > > > > > > +From: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > > > > +Date: Thu, 13 Aug 2020 16:24:39 +0300
> > > > > > > +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> > > > > > > + without CONFIG_FTRACE
> > > > > > > +
> > > > > > > +When building in-tree, one could disable CONFIG_FTRACE from kernel
> > > > > > > +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> > > > > > > +but generate a lot of linker errors like below because it leaves out
> > > > > > > +other stuff, e.g.:
> > > > > > > +
> > > > > > > +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> > > > > > > +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> > > > > > > +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> > > > > > > +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> > > > > > > +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> > > > > > > +
> > > > > > > +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> > > > > > > +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> > > > > > > +enabled.
> > > > > > > +
> > > > > > > +Steps to reproduce:
> > > > > > > +
> > > > > > > +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> > > > > > > +
> > > > > > > +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> > > > > > > +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> > > > > > > +
> > > > > > > +- Build will fail at linking stage
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +---
> > > > > > > + Kconfig | 2 +-
> > > > > > > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > > +
> > > > > > > +diff --git a/Kconfig b/Kconfig
> > > > > > > +index acdab73..10eccff 100644
> > > > > > > +--- a/Kconfig
> > > > > > > ++++ b/Kconfig
> > > > > > > +@@ -2,7 +2,7 @@
> > > > > > > +
> > > > > > > + config LTTNG
> > > > > > > +       tristate "LTTng support"
> > > > > > > +-      select TRACEPOINTS
> > > > > > > ++      select TRACING
> > > > > > > +       help
> > > > > > > +         LTTng is an open source tracing framework for Linux.
> > > > > > > +
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..fab673b854
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > > > @@ -0,0 +1,41 @@
> > > > > > > +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Date: Mon, 10 Aug 2020 11:22:05 -0400
> > > > > > > +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> > > > > > > +
> > > > > > > +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> > > > > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > > > +  Date:   Mon Jun 22 13:20:29 2020 -0700
> > > > > > > +
> > > > > > > +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> > > > > > > +
> > > > > > > +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +---
> > > > > > > + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> > > > > > > + 1 file changed, 4 insertions(+)
> > > > > > > +
> > > > > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > +index 37384a2..5a7ef1e 100644
> > > > > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > +@@ -24,7 +24,11 @@
> > > > > > > +  */
> > > > > > > + #include <wrapper/tracepoint.h>
> > > > > > > +
> > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > > > > ++#else
> > > > > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > > > > ++#endif
> > > > > > > +
> > > > > > > + #undef TRACE_INCLUDE_PATH
> > > > > > > + #undef TRACE_INCLUDE_FILE
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..524631cc72
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > > > @@ -0,0 +1,39 @@
> > > > > > > +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Date: Mon, 10 Aug 2020 11:36:03 -0400
> > > > > > > +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> > > > > > > + accessor internal-only (v5.9)
> > > > > > > +
> > > > > > > +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> > > > > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > > > +  Date:   Mon Jun 22 13:20:32 2020 -0700
> > > > > > > +
> > > > > > > +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> > > > > > > +
> > > > > > > +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> > > > > > > +    be poking into the gory details of shadow pages.
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +---
> > > > > > > + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> > > > > > > + 1 file changed, 1 insertion(+)
> > > > > > > +
> > > > > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > +index 5a7ef1e..8f98186 100644
> > > > > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > +@@ -25,6 +25,7 @@
> > > > > > > + #include <wrapper/tracepoint.h>
> > > > > > > +
> > > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> > > > > > > + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > > > > + #else
> > > > > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..e29c07252c
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > > > @@ -0,0 +1,84 @@
> > > > > > > +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Date: Mon, 24 Aug 2020 15:26:04 -0400
> > > > > > > +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> > > > > > > + (v5.9)
> > > > > > > +MIME-Version: 1.0
> > > > > > > +Content-Type: text/plain; charset=UTF-8
> > > > > > > +Content-Transfer-Encoding: 8bit
> > > > > > > +
> > > > > > > +See upstream commit:
> > > > > > > +
> > > > > > > +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> > > > > > > +  Author: brookxu <brookxu.cn@gmail.com>
> > > > > > > +  Date:   Mon Aug 17 15:36:15 2020 +0800
> > > > > > > +
> > > > > > > +    ext4: limit the length of per-inode prealloc list
> > > > > > > +
> > > > > > > +    In the scenario of writing sparse files, the per-inode prealloc list may
> > > > > > > +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> > > > > > > +    To circumvent this problem, we limit the maximum length of per-inode
> > > > > > > +    prealloc list to 512 and allow users to modify it.
> > > > > > > +
> > > > > > > +    After patching, we observed that the sys ratio of cpu has dropped, and
> > > > > > > +    the system throughput has increased significantly. We created a process
> > > > > > > +    to write the sparse file, and the running time of the process on the
> > > > > > > +    fixed kernel was significantly reduced, as follows:
> > > > > > > +
> > > > > > > +    Running time on unfixed kernel:
> > > > > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > > > > +    real    0m2.051s
> > > > > > > +    user    0m0.008s
> > > > > > > +    sys     0m2.026s
> > > > > > > +
> > > > > > > +    Running time on fixed kernel:
> > > > > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > > > > +    real    0m0.471s
> > > > > > > +    user    0m0.004s
> > > > > > > +    sys     0m0.395s
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> > > > > > > +---
> > > > > > > + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> > > > > > > + 1 file changed, 15 insertions(+)
> > > > > > > +
> > > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > > +index 5f7ab28..72ad4c9 100644
> > > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > > +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > > > > + )
> > > > > > > + #endif
> > > > > > > +
> > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > > ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > > > > ++
> > > > > > > ++      TP_ARGS(inode, len, needed),
> > > > > > > ++
> > > > > > > ++      TP_FIELDS(
> > > > > > > ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> > > > > > > ++              ctf_integer(ino_t, ino, inode->i_ino)
> > > > > > > ++              ctf_integer(unsigned int, len, len)
> > > > > > > ++              ctf_integer(unsigned int, needed, needed)
> > > > > > > ++      )
> > > > > > > ++)
> > > > > > > ++#else
> > > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > > +       TP_PROTO(struct inode *inode),
> > > > > > > +
> > > > > > > +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > > +               ctf_integer(ino_t, ino, inode->i_ino)
> > > > > > > +       )
> > > > > > > + )
> > > > > > > ++#endif
> > > > > > > +
> > > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> > > > > > > +       TP_PROTO(struct super_block *sb, int needed),
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..f76e9698c8
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > > > @@ -0,0 +1,63 @@
> > > > > > > +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Date: Mon, 24 Aug 2020 15:37:50 -0400
> > > > > > > +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> > > > > > > + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> > > > > > > +MIME-Version: 1.0
> > > > > > > +Content-Type: text/plain; charset=UTF-8
> > > > > > > +Content-Transfer-Encoding: 8bit
> > > > > > > +
> > > > > > > +See upstream commit:
> > > > > > > +
> > > > > > > +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> > > > > > > +  Author: Theodore Ts'o <tytso@mit.edu>
> > > > > > > +  Date:   Wed Jul 15 11:48:55 2020 -0400
> > > > > > > +
> > > > > > > +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> > > > > > > +
> > > > > > > +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> > > > > > > +    whether a block bitmap is being prefetched.
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> > > > > > > +---
> > > > > > > + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> > > > > > > + 1 file changed, 14 insertions(+)
> > > > > > > +
> > > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > > +index 72ad4c9..4476abb 100644
> > > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > > +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> > > > > > > +       TP_ARGS(sb, group)
> > > > > > > + )
> > > > > > > +
> > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> > > > > > > ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> > > > > > > ++
> > > > > > > ++      TP_ARGS(sb, group, prefetch),
> > > > > > > ++
> > > > > > > ++      TP_FIELDS(
> > > > > > > ++              ctf_integer(dev_t, dev, sb->s_dev)
> > > > > > > ++              ctf_integer(__u32, group, group)
> > > > > > > ++              ctf_integer(bool, prefetch, prefetch)
> > > > > > > ++      )
> > > > > > > ++)
> > > > > > > ++#else
> > > > > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> > > > > > > +
> > > > > > > +       TP_PROTO(struct super_block *sb, unsigned long group),
> > > > > > > +
> > > > > > > +       TP_ARGS(sb, group)
> > > > > > > + )
> > > > > > > ++#endif
> > > > > > > +
> > > > > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> > > > > > > +
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..0970dd30aa
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > > > @@ -0,0 +1,391 @@
> > > > > > > +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Date: Tue, 25 Aug 2020 10:56:29 -0400
> > > > > > > +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> > > > > > > +
> > > > > > > +See upstream commits:
> > > > > > > +
> > > > > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > > > > +  Author: Will Deacon <will@kernel.org>
> > > > > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > > > > +
> > > > > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > > > > +
> > > > > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > > > > +    used to head dependency chains on all architectures.
> > > > > > > +
> > > > > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > > > > +  Author: Will Deacon <will.deacon@arm.com>
> > > > > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > > > > +
> > > > > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > > > > +
> > > > > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > > > > +    used to head dependency chains on all architectures.
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +---
> > > > > > > + instrumentation/events/lttng-module/i2c.h |  4 ++--
> > > > > > > + lib/ringbuffer/backend.h                  |  2 +-
> > > > > > > + lib/ringbuffer/backend_internal.h         |  2 +-
> > > > > > > + lib/ringbuffer/frontend.h                 |  4 ++--
> > > > > > > + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> > > > > > > + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> > > > > > > + lttng-events.c                            |  8 ++++----
> > > > > > > + probes/lttng-kprobes.c                    |  6 +++---
> > > > > > > + probes/lttng-kretprobes.c                 |  6 +++---
> > > > > > > + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> > > > > > > + probes/lttng-uprobes.c                    |  6 +++---
> > > > > > > + wrapper/compiler.h                        | 18 ++++++++++++++++++
> > > > > > > + wrapper/trace-clock.h                     | 15 +++++----------
> > > > > > > + 13 files changed, 51 insertions(+), 38 deletions(-)
> > > > > > > +
> > > > > > > +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> > > > > > > +index dcbabf6..131d134 100644
> > > > > > > +--- a/instrumentation/events/lttng-module/i2c.h
> > > > > > > ++++ b/instrumentation/events/lttng-module/i2c.h
> > > > > > > +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> > > > > > > +
> > > > > > > +       TP_code_pre(
> > > > > > > +               tp_locvar->extract_sensitive_payload =
> > > > > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > > > > +       ),
> > > > > > > +
> > > > > > > +       TP_FIELDS(
> > > > > > > +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> > > > > > > +
> > > > > > > +       TP_code_pre(
> > > > > > > +               tp_locvar->extract_sensitive_payload =
> > > > > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > > > > +       ),
> > > > > > > +
> > > > > > > +       TP_FIELDS(
> > > > > > > +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> > > > > > > +index da937f2..43e1d47 100644
> > > > > > > +--- a/lib/ringbuffer/backend.h
> > > > > > > ++++ b/lib/ringbuffer/backend.h
> > > > > > > +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> > > > > > > +                * Only read source character once, in case it is
> > > > > > > +                * modified concurrently.
> > > > > > > +                */
> > > > > > > +-              c = READ_ONCE(src[count]);
> > > > > > > ++              c = LTTNG_READ_ONCE(src[count]);
> > > > > > > +               if (!c)
> > > > > > > +                       break;
> > > > > > > +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> > > > > > > +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> > > > > > > +index 2d6a345..1226fd8 100644
> > > > > > > +--- a/lib/ringbuffer/backend_internal.h
> > > > > > > ++++ b/lib/ringbuffer/backend_internal.h
> > > > > > > +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> > > > > > > +        * Performing a volatile access to read the sb_pages, because we want to
> > > > > > > +        * read a coherent version of the pointer and the associated noref flag.
> > > > > > > +        */
> > > > > > > +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> > > > > > > ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> > > > > > > +       for (;;) {
> > > > > > > +               /* This check is called on the fast path for each record. */
> > > > > > > +               if (likely(!subbuffer_id_is_noref(config, id))) {
> > > > > > > +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> > > > > > > +index 6f516d9..41382fe 100644
> > > > > > > +--- a/lib/ringbuffer/frontend.h
> > > > > > > ++++ b/lib/ringbuffer/frontend.h
> > > > > > > +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> > > > > > > + #define for_each_channel_cpu(cpu, chan)                                       \
> > > > > > > +       for ((cpu) = -1;                                                \
> > > > > > > +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> > > > > > > +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> > > > > > > ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> > > > > > > +
> > > > > > > + extern struct lib_ring_buffer *channel_get_ring_buffer(
> > > > > > > +                               const struct lib_ring_buffer_config *config,
> > > > > > > +@@ -155,7 +155,7 @@ static inline
> > > > > > > + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> > > > > > > +                                struct lib_ring_buffer *buf)
> > > > > > > + {
> > > > > > > +-      int finalized = READ_ONCE(buf->finalized);
> > > > > > > ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > > +       /*
> > > > > > > +        * Read finalized before counters.
> > > > > > > +        */
> > > > > > > +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > > +index 3cab365..4980d20 100644
> > > > > > > +--- a/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > > ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > > +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> > > > > > > +       int finalized;
> > > > > > > +
> > > > > > > + retry:
> > > > > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > > +       /*
> > > > > > > +        * Read finalized before counters.
> > > > > > > +        */
> > > > > > > +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> > > > > > > +               return -EBUSY;
> > > > > > > +       }
> > > > > > > + retry:
> > > > > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > > +       /*
> > > > > > > +        * Read finalized before counters.
> > > > > > > +        */
> > > > > > > +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > > +index d25db72..7b4f20a 100644
> > > > > > > +--- a/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > > ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > > +@@ -46,7 +46,7 @@ restart:
> > > > > > > +       switch (iter->state) {
> > > > > > > +       case ITER_GET_SUBBUF:
> > > > > > > +               ret = lib_ring_buffer_get_next_subbuf(buf);
> > > > > > > +-              if (ret && !READ_ONCE(buf->finalized)
> > > > > > > ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> > > > > > > +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> > > > > > > +                       /*
> > > > > > > +                        * Use "pull" scheme for global buffers. The reader
> > > > > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > > > > +index be7e389..d719294 100644
> > > > > > > +--- a/lttng-events.c
> > > > > > > ++++ b/lttng-events.c
> > > > > > > +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> > > > > > > +       size_t len;
> > > > > > > +       va_list ap;
> > > > > > > +
> > > > > > > +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> > > > > > > ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> > > > > > > +
> > > > > > > +       va_start(ap, fmt);
> > > > > > > +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> > > > > > > +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> > > > > > > + {
> > > > > > > +       int ret = 0;
> > > > > > > +
> > > > > > > +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> > > > > > > ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > > > > +               return 0;
> > > > > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > > > > +               return 0;
> > > > > > > +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> > > > > > > + {
> > > > > > > +       int ret = 0;
> > > > > > > +
> > > > > > > +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> > > > > > > ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > > > > +               return 0;
> > > > > > > +
> > > > > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > > > > +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> > > > > > > +       struct lttng_event *event;
> > > > > > > +       int ret = 0;
> > > > > > > +
> > > > > > > +-      if (!READ_ONCE(session->active))
> > > > > > > ++      if (!LTTNG_READ_ONCE(session->active))
> > > > > > > +               return 0;
> > > > > > > +
> > > > > > > +       lttng_metadata_begin(session);
> > > > > > > +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> > > > > > > +index a44eaa1..38fb72e 100644
> > > > > > > +--- a/probes/lttng-kprobes.c
> > > > > > > ++++ b/probes/lttng-kprobes.c
> > > > > > > +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> > > > > > > +       int ret;
> > > > > > > +       unsigned long data = (unsigned long) p->addr;
> > > > > > > +
> > > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > > +               return 0;
> > > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > > +               return 0;
> > > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > > +               return 0;
> > > > > > > +
> > > > > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> > > > > > > +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> > > > > > > +index ab98ff2..a6bcd21 100644
> > > > > > > +--- a/probes/lttng-kretprobes.c
> > > > > > > ++++ b/probes/lttng-kretprobes.c
> > > > > > > +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> > > > > > > +               unsigned long parent_ip;
> > > > > > > +       } payload;
> > > > > > > +
> > > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > > +               return 0;
> > > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > > +               return 0;
> > > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > > +               return 0;
> > > > > > > +
> > > > > > > +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> > > > > > > +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> > > > > > > +index 77b8638..72a669e 100644
> > > > > > > +--- a/probes/lttng-tracepoint-event-impl.h
> > > > > > > ++++ b/probes/lttng-tracepoint-event-impl.h
> > > > > > > +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> > > > > > > +                                                                             \
> > > > > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > > > > +               return;                                                       \
> > > > > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > > > > +               return;                                                       \
> > > > > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > > > > +               return;                                                       \
> > > > > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > > > > +               return;                                                       \
> > > > > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > > > > +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> > > > > > > +                                                                             \
> > > > > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > > > > +               return;                                                       \
> > > > > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > > > > +               return;                                                       \
> > > > > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > > > > +               return;                                                       \
> > > > > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > > > > +               return;                                                       \
> > > > > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > > > > +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> > > > > > > +index bc10128..bda1d9b 100644
> > > > > > > +--- a/probes/lttng-uprobes.c
> > > > > > > ++++ b/probes/lttng-uprobes.c
> > > > > > > +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> > > > > > > +               unsigned long ip;
> > > > > > > +       } payload;
> > > > > > > +
> > > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > > +               return 0;
> > > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > > +               return 0;
> > > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > > +               return 0;
> > > > > > > +
> > > > > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> > > > > > > +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> > > > > > > +index 1496f33..b9f8c51 100644
> > > > > > > +--- a/wrapper/compiler.h
> > > > > > > ++++ b/wrapper/compiler.h
> > > > > > > +@@ -9,6 +9,7 @@
> > > > > > > + #define _LTTNG_WRAPPER_COMPILER_H
> > > > > > > +
> > > > > > > + #include <linux/compiler.h>
> > > > > > > ++#include <linux/version.h>
> > > > > > > +
> > > > > > > + /*
> > > > > > > +  * Don't allow compiling with buggy compiler.
> > > > > > > +@@ -39,4 +40,21 @@
> > > > > > > + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> > > > > > > + #endif
> > > > > > > +
> > > > > > > ++/*
> > > > > > > ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> > > > > > > ++ * lockless_dereference(), replicate this behavior on prior kernels
> > > > > > > ++ * and remove calls to smp_read_barrier_depends which was dropped
> > > > > > > ++ * in v5.9.
> > > > > > > ++ */
> > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> > > > > > > ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> > > > > > > ++#else
> > > > > > > ++#define LTTNG_READ_ONCE(x)                    \
> > > > > > > ++({                                            \
> > > > > > > ++      typeof(x) __val = READ_ONCE(x);         \
> > > > > > > ++      smp_read_barrier_depends();             \
> > > > > > > ++      __val;                                  \
> > > > > > > ++})
> > > > > > > ++#endif
> > > > > > > ++
> > > > > > > + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> > > > > > > +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> > > > > > > +index 9f4e366..187fc82 100644
> > > > > > > +--- a/wrapper/trace-clock.h
> > > > > > > ++++ b/wrapper/trace-clock.h
> > > > > > > +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> > > > > > > +
> > > > > > > + static inline u64 trace_clock_read64(void)
> > > > > > > + {
> > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > +
> > > > > > > +       if (likely(!ltc)) {
> > > > > > > +               return trace_clock_read64_monotonic();
> > > > > > > +       } else {
> > > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > > +               return ltc->read64();
> > > > > > > +       }
> > > > > > > + }
> > > > > > > +
> > > > > > > + static inline u64 trace_clock_freq(void)
> > > > > > > + {
> > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > +
> > > > > > > +       if (!ltc) {
> > > > > > > +               return trace_clock_freq_monotonic();
> > > > > > > +       } else {
> > > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > > +               return ltc->freq();
> > > > > > > +       }
> > > > > > > + }
> > > > > > > +
> > > > > > > + static inline int trace_clock_uuid(char *uuid)
> > > > > > > + {
> > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > +
> > > > > > > +-      read_barrier_depends(); /* load ltc before content */
> > > > > > > +       /* Use default UUID cb when NULL */
> > > > > > > +       if (!ltc || !ltc->uuid) {
> > > > > > > +               return trace_clock_uuid_monotonic(uuid);
> > > > > > > +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> > > > > > > +
> > > > > > > + static inline const char *trace_clock_name(void)
> > > > > > > + {
> > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > +
> > > > > > > +       if (!ltc) {
> > > > > > > +               return trace_clock_name_monotonic();
> > > > > > > +       } else {
> > > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > > +               return ltc->name();
> > > > > > > +       }
> > > > > > > + }
> > > > > > > +
> > > > > > > + static inline const char *trace_clock_description(void)
> > > > > > > + {
> > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > +
> > > > > > > +       if (!ltc) {
> > > > > > > +               return trace_clock_description_monotonic();
> > > > > > > +       } else {
> > > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > > +               return ltc->description();
> > > > > > > +       }
> > > > > > > + }
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..2843c9cb62
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > > > @@ -0,0 +1,59 @@
> > > > > > > +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Date: Mon, 31 Aug 2020 11:41:38 -0400
> > > > > > > +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> > > > > > > +
> > > > > > > +See upstream commit:
> > > > > > > +
> > > > > > > +  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.
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> > > > > > > +---
> > > > > > > + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> > > > > > > + 1 file changed, 15 insertions(+), 1 deletion(-)
> > > > > > > +
> > > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > > +index affb4eb..ece67ad 100644
> > > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > > +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> > > > > > > +
> > > > > > > + #endif
> > > > > > > +
> > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > ++#define show_inode_state(state)                                       \
> > > > > > > ++      __print_flags(state, "|",                               \
> > > > > > > ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > > > > ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> > > > > > > ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> > > > > > > ++              {I_NEW,                 "I_NEW"},               \
> > > > > > > ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> > > > > > > ++              {I_FREEING,             "I_FREEING"},           \
> > > > > > > ++              {I_CLEAR,               "I_CLEAR"},             \
> > > > > > > ++              {I_SYNC,                "I_SYNC"},              \
> > > > > > > ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> > > > > > > ++              {I_REFERENCED,          "I_REFERENCED"}         \
> > > > > > > ++      )
> > > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > > > > + #define show_inode_state(state)                                       \
> > > > > > > +       __print_flags(state, "|",                               \
> > > > > > > +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..7a0d9a38b8
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > > > @@ -0,0 +1,117 @@
> > > > > > > +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Date: Mon, 31 Aug 2020 14:16:01 -0400
> > > > > > > +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> > > > > > > + processing (v5.9)
> > > > > > > +
> > > > > > > +See upstream commit:
> > > > > > > +
> > > > > > > +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> > > > > > > +  Author: Jan Kara <jack@suse.cz>
> > > > > > > +  Date:   Fri May 29 16:08:58 2020 +0200
> > > > > > > +
> > > > > > > +    writeback: Fix sync livelock due to b_dirty_time processing
> > > > > > > +
> > > > > > > +    When we are processing writeback for sync(2), move_expired_inodes()
> > > > > > > +    didn't set any inode expiry value (older_than_this). This can result in
> > > > > > > +    writeback never completing if there's steady stream of inodes added to
> > > > > > > +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> > > > > > > +    round whether there's more work to be done. Fix the problem by using
> > > > > > > +    sync(2) start time is inode expiry value when processing b_dirty_time
> > > > > > > +    list similarly as for ordinarily dirtied inodes. This requires some
> > > > > > > +    refactoring of older_than_this handling which simplifies the code
> > > > > > > +    noticeably as a bonus.
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +---
> > > > > > > + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> > > > > > > + 1 file changed, 26 insertions(+), 13 deletions(-)
> > > > > > > +
> > > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > > +index ece67ad..e9018dd 100644
> > > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > > +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > > > > + #endif
> > > > > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > > > > +
> > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > > > > ++               struct wb_writeback_work *work,
> > > > > > > ++               unsigned long dirtied_before,
> > > > > > > ++               int moved),
> > > > > > > ++      TP_ARGS(wb, work, dirtied_before, moved),
> > > > > > > ++      TP_FIELDS(
> > > > > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > > ++              ctf_integer(unsigned long, older, dirtied_before)
> > > > > > > ++              ctf_integer(int, moved, moved)
> > > > > > > ++      )
> > > > > > > ++)
> > > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > +                struct wb_writeback_work *work,
> > > > > > > +-#else
> > > > > > > +-               unsigned long *older_than_this,
> > > > > > > +-#endif
> > > > > > > +                int moved),
> > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > +       TP_ARGS(wb, work, moved),
> > > > > > > +-#else
> > > > > > > ++      TP_FIELDS(
> > > > > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > > ++              ctf_integer(int, moved, moved)
> > > > > > > ++      )
> > > > > > > ++)
> > > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > > > > ++               unsigned long *older_than_this,
> > > > > > > ++               int moved),
> > > > > > > +       TP_ARGS(wb, older_than_this, moved),
> > > > > > > +-#endif
> > > > > > > +       TP_FIELDS(
> > > > > > > +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > +-#else
> > > > > > > +               ctf_integer(unsigned long, older,
> > > > > > > +                       older_than_this ? *older_than_this : 0)
> > > > > > > +               ctf_integer(long, age,
> > > > > > > +                       older_than_this ?
> > > > > > > +                               (jiffies - *older_than_this) * 1000 / HZ
> > > > > > > +                               : -1)
> > > > > > > +-#endif
> > > > > > > +               ctf_integer(int, moved, moved)
> > > > > > > +       )
> > > > > > > + )
> > > > > > > ++#endif
> > > > > > > +
> > > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> > > > > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > > +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > > +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> > > > > > > +       )
> > > > > > > + )
> > > > > > > +-#else
> > > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > > +
> > > > > > > +       writeback_global_dirty_state,
> > > > > > > +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > > +       )
> > > > > > > + )
> > > > > > > + #endif
> > > > > > > +-#endif
> > > > > > > +
> > > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > +
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..346e1d63ad
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > > > @@ -0,0 +1,52 @@
> > > > > > > +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Date: Fri, 4 Sep 2020 11:52:51 -0400
> > > > > > > +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> > > > > > > + writeback_queue_io
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> > > > > > > +---
> > > > > > > + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> > > > > > > + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> > > > > > > + 2 files changed, 9 insertions(+), 2 deletions(-)
> > > > > > > +
> > > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > > +index 4476abb..b172c8d 100644
> > > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > > +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > > > > + )
> > > > > > > + #endif
> > > > > > > +
> > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> > > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > > +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > > > > +
> > > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > > +index e9018dd..09637d7 100644
> > > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > > +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > > > > + #endif
> > > > > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > > > > +
> > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> > > > > > > ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> > > > > > > ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> > > > > > > ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> > > > > > > ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> > > > > > > ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> > > > > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > > > > +                struct wb_writeback_work *work,
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > > > new file mode 100644
> > > > > > > index 0000000000..a16750ddb3
> > > > > > > --- /dev/null
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > > > @@ -0,0 +1,918 @@
> > > > > > > +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> > > > > > > +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +Date: Tue, 28 Jan 2020 16:02:44 -0500
> > > > > > > +Subject: [PATCH 10/10] Fix: system call filter table
> > > > > > > +
> > > > > > > +The system call filter table has effectively been unused for a long
> > > > > > > +time due to system call name prefix mismatch. This means the overhead of
> > > > > > > +selective system call tracing was larger than it should have been because
> > > > > > > +the event payload preparation would be done for all system calls as soon
> > > > > > > +as a single system call is traced.
> > > > > > > +
> > > > > > > +However, fixing this underlying issue unearths several issues that crept
> > > > > > > +unnoticed when the "enabler" concept was introduced (after the original
> > > > > > > +implementation of the system call filter table).
> > > > > > > +
> > > > > > > +Here is a list of the issues which are resolved here:
> > > > > > > +
> > > > > > > +- Split lttng_syscalls_unregister into an unregister and destroy
> > > > > > > +  function, thus awaiting for a grace period (and therefore quiescence
> > > > > > > +  of the users) after unregistering the system call tracepoints before
> > > > > > > +  freeing the system call filter data structures. This effectively fixes
> > > > > > > +  a use-after-free.
> > > > > > > +
> > > > > > > +- The state for enabling "all" system calls vs enabling specific system
> > > > > > > +  calls (and sequences of enable-disable) was incorrect with respect to
> > > > > > > +  the "enablers" semantic. This is solved by always tracking the
> > > > > > > +  bitmap of enabled system calls, and keeping this bitmap even when
> > > > > > > +  enabling all system calls. The sc_filter is now always allocated
> > > > > > > +  before system call tracing is registered to tracepoints, which means
> > > > > > > +  it does not need to be RCU dereferenced anymore.
> > > > > > > +
> > > > > > > +Padding fields in the ABI are reserved to select whether to:
> > > > > > > +
> > > > > > > +- Trace either native or compat system call (or both, which is the
> > > > > > > +  behavior currently implemented),
> > > > > > > +- Trace either system call entry or exit (or both, which is the
> > > > > > > +  behavior currently implemented),
> > > > > > > +- Select the system call to trace by name (behavior currently
> > > > > > > +  implemented) or by system call number,
> > > > > > > +
> > > > > > > +Upstream-Status: Backport
> > > > > > > +
> > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > +---
> > > > > > > + lttng-abi.c      |  43 ++++++
> > > > > > > + lttng-abi.h      |  26 ++++
> > > > > > > + lttng-events.c   | 112 +++++++++++++--
> > > > > > > + lttng-events.h   |  31 ++++-
> > > > > > > + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> > > > > > > + 5 files changed, 380 insertions(+), 180 deletions(-)
> > > > > > > +
> > > > > > > +diff --git a/lttng-abi.c b/lttng-abi.c
> > > > > > > +index 64ea99d..b33879d 100644
> > > > > > > +--- a/lttng-abi.c
> > > > > > > ++++ b/lttng-abi.c
> > > > > > > +@@ -1264,6 +1264,46 @@ nomem:
> > > > > > > +       return ret;
> > > > > > > + }
> > > > > > > +
> > > > > > > ++static
> > > > > > > ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> > > > > > > ++{
> > > > > > > ++      /* Limit ABI to implemented features. */
> > > > > > > ++      switch (event_param->instrumentation) {
> > > > > > > ++      case LTTNG_KERNEL_SYSCALL:
> > > > > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > > ++                      break;
> > > > > > > ++              default:
> > > > > > > ++                      return -EINVAL;
> > > > > > > ++              }
> > > > > > > ++              switch (event_param->u.syscall.abi) {
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > > ++                      break;
> > > > > > > ++              default:
> > > > > > > ++                      return -EINVAL;
> > > > > > > ++              }
> > > > > > > ++              switch (event_param->u.syscall.match) {
> > > > > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > > > > ++                      break;
> > > > > > > ++              default:
> > > > > > > ++                      return -EINVAL;
> > > > > > > ++              }
> > > > > > > ++              break;
> > > > > > > ++
> > > > > > > ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> > > > > > > ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> > > > > > > ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> > > > > > > ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> > > > > > > ++      case LTTNG_KERNEL_UPROBE:
> > > > > > > ++              break;
> > > > > > > ++
> > > > > > > ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> > > > > > > ++      default:
> > > > > > > ++              return -EINVAL;
> > > > > > > ++      }
> > > > > > > ++      return 0;
> > > > > > > ++}
> > > > > > > ++
> > > > > > > + static
> > > > > > > + int lttng_abi_create_event(struct file *channel_file,
> > > > > > > +                          struct lttng_kernel_event *event_param)
> > > > > > > +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> > > > > > > +               ret = -EOVERFLOW;
> > > > > > > +               goto refcount_error;
> > > > > > > +       }
> > > > > > > ++      ret = lttng_abi_validate_event_param(event_param);
> > > > > > > ++      if (ret)
> > > > > > > ++              goto event_error;
> > > > > > > +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> > > > > > > +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> > > > > > > +               struct lttng_enabler *enabler;
> > > > > > > +diff --git a/lttng-abi.h b/lttng-abi.h
> > > > > > > +index 1d356ab..51d60e5 100644
> > > > > > > +--- a/lttng-abi.h
> > > > > > > ++++ b/lttng-abi.h
> > > > > > > +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> > > > > > > +       } u;
> > > > > > > + } __attribute__((packed));
> > > > > > > +
> > > > > > > ++enum lttng_kernel_syscall_entryexit {
> > > > > > > ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> > > > > > > ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> > > > > > > ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> > > > > > > ++};
> > > > > > > ++
> > > > > > > ++enum lttng_kernel_syscall_abi {
> > > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> > > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> > > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> > > > > > > ++};
> > > > > > > ++
> > > > > > > ++enum lttng_kernel_syscall_match {
> > > > > > > ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> > > > > > > ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> > > > > > > ++};
> > > > > > > ++
> > > > > > > ++struct lttng_kernel_syscall {
> > > > > > > ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> > > > > > > ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> > > > > > > ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> > > > > > > ++      uint8_t padding;
> > > > > > > ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> > > > > > > ++} __attribute__((packed));
> > > > > > > ++
> > > > > > > + /*
> > > > > > > +  * For syscall tracing, name = "*" means "enable all".
> > > > > > > +  */
> > > > > > > +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> > > > > > > +               struct lttng_kernel_kprobe kprobe;
> > > > > > > +               struct lttng_kernel_function_tracer ftrace;
> > > > > > > +               struct lttng_kernel_uprobe uprobe;
> > > > > > > ++              struct lttng_kernel_syscall syscall;
> > > > > > > +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> > > > > > > +       } u;
> > > > > > > + } __attribute__((packed));
> > > > > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > > > > +index d719294..4c0b04a 100644
> > > > > > > +--- a/lttng-events.c
> > > > > > > ++++ b/lttng-events.c
> > > > > > > +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> > > > > > > +               WARN_ON(ret);
> > > > > > > +       }
> > > > > > > +       synchronize_trace();    /* Wait for in-flight events to complete */
> > > > > > > ++      list_for_each_entry(chan, &session->chan, list) {
> > > > > > > ++              ret = lttng_syscalls_destroy(chan);
> > > > > > > ++              WARN_ON(ret);
> > > > > > > ++      }
> > > > > > > +       list_for_each_entry_safe(enabler, tmpenabler,
> > > > > > > +                       &session->enablers_head, node)
> > > > > > > +               lttng_enabler_destroy(enabler);
> > > > > > > +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> > > > > > > +               event->enabled = 0;
> > > > > > > +               event->registered = 0;
> > > > > > > +               event->desc = event_desc;
> > > > > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > > ++                      ret = -EINVAL;
> > > > > > > ++                      goto register_error;
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> > > > > > > ++                      break;
> > > > > > > ++              }
> > > > > > > ++              switch (event_param->u.syscall.abi) {
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > > ++                      ret = -EINVAL;
> > > > > > > ++                      goto register_error;
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> > > > > > > ++                      break;
> > > > > > > ++              }
> > > > > > > +               if (!event->desc) {
> > > > > > > +                       ret = -EINVAL;
> > > > > > > +                       goto register_error;
> > > > > > > +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> > > > > > > +                                                 event);
> > > > > > > +               break;
> > > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > > +-              ret = lttng_syscall_filter_enable(event->chan,
> > > > > > > +-                      desc->name);
> > > > > > > ++              ret = lttng_syscall_filter_enable(event->chan, event);
> > > > > > > +               break;
> > > > > > > +       case LTTNG_KERNEL_KPROBE:
> > > > > > > +       case LTTNG_KERNEL_UPROBE:
> > > > > > > +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> > > > > > > +               ret = 0;
> > > > > > > +               break;
> > > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > > +-              ret = lttng_syscall_filter_disable(event->chan,
> > > > > > > +-                      desc->name);
> > > > > > > ++              ret = lttng_syscall_filter_disable(event->chan, event);
> > > > > > > +               break;
> > > > > > > +       case LTTNG_KERNEL_NOOP:
> > > > > > > +               ret = 0;
> > > > > > > +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> > > > > > > +               struct lttng_enabler *enabler)
> > > > > > > + {
> > > > > > > +       const char *desc_name, *enabler_name;
> > > > > > > ++      bool compat = false, entry = false;
> > > > > > > +
> > > > > > > +       enabler_name = enabler->event_param.name;
> > > > > > > +       switch (enabler->event_param.instrumentation) {
> > > > > > > +       case LTTNG_KERNEL_TRACEPOINT:
> > > > > > > +               desc_name = desc->name;
> > > > > > > ++              switch (enabler->type) {
> > > > > > > ++              case LTTNG_ENABLER_STAR_GLOB:
> > > > > > > ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > > ++              case LTTNG_ENABLER_NAME:
> > > > > > > ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > > ++              default:
> > > > > > > ++                      return -EINVAL;
> > > > > > > ++              }
> > > > > > > +               break;
> > > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > > +               desc_name = desc->name;
> > > > > > > +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> > > > > > > ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> > > > > > > +                       desc_name += strlen("compat_");
> > > > > > > ++                      compat = true;
> > > > > > > ++              }
> > > > > > > +               if (!strncmp(desc_name, "syscall_exit_",
> > > > > > > +                               strlen("syscall_exit_"))) {
> > > > > > > +                       desc_name += strlen("syscall_exit_");
> > > > > > > +               } else if (!strncmp(desc_name, "syscall_entry_",
> > > > > > > +                               strlen("syscall_entry_"))) {
> > > > > > > +                       desc_name += strlen("syscall_entry_");
> > > > > > > ++                      entry = true;
> > > > > > > +               } else {
> > > > > > > +                       WARN_ON_ONCE(1);
> > > > > > > +                       return -EINVAL;
> > > > > > > +               }
> > > > > > > ++              switch (enabler->event_param.u.syscall.entryexit) {
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > > > > ++                      if (!entry)
> > > > > > > ++                              return 0;
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > > > > ++                      if (entry)
> > > > > > > ++                              return 0;
> > > > > > > ++                      break;
> > > > > > > ++              default:
> > > > > > > ++                      return -EINVAL;
> > > > > > > ++              }
> > > > > > > ++              switch (enabler->event_param.u.syscall.abi) {
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > > > > ++                      if (compat)
> > > > > > > ++                              return 0;
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > > > > ++                      if (!compat)
> > > > > > > ++                              return 0;
> > > > > > > ++                      break;
> > > > > > > ++              default:
> > > > > > > ++                      return -EINVAL;
> > > > > > > ++              }
> > > > > > > ++              switch (enabler->event_param.u.syscall.match) {
> > > > > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > > > > ++                      switch (enabler->type) {
> > > > > > > ++                      case LTTNG_ENABLER_STAR_GLOB:
> > > > > > > ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > > ++                      case LTTNG_ENABLER_NAME:
> > > > > > > ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > > ++                      default:
> > > > > > > ++                              return -EINVAL;
> > > > > > > ++                      }
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_SYSCALL_MATCH_NR:
> > > > > > > ++                      return -EINVAL; /* Not implemented. */
> > > > > > > ++              default:
> > > > > > > ++                      return -EINVAL;
> > > > > > > ++              }
> > > > > > > +               break;
> > > > > > > +       default:
> > > > > > > +               WARN_ON_ONCE(1);
> > > > > > > +               return -EINVAL;
> > > > > > > +       }
> > > > > > > +-      switch (enabler->type) {
> > > > > > > +-      case LTTNG_ENABLER_STAR_GLOB:
> > > > > > > +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > > +-      case LTTNG_ENABLER_NAME:
> > > > > > > +-              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > > +-      default:
> > > > > > > +-              return -EINVAL;
> > > > > > > +-      }
> > > > > > > + }
> > > > > > > +
> > > > > > > + static
> > > > > > > +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> > > > > > > + static
> > > > > > > + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> > > > > > > + {
> > > > > > > +-      struct lttng_session *session = enabler->chan->session;
> > > > > > > ++      struct lttng_channel *chan = enabler->chan;
> > > > > > > ++      struct lttng_session *session = chan->session;
> > > > > > > +       struct lttng_event *event;
> > > > > > > +
> > > > > > > ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> > > > > > > ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> > > > > > > ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> > > > > > > ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> > > > > > > ++                      !strcmp(enabler->event_param.name, "*")) {
> > > > > > > ++              if (enabler->enabled)
> > > > > > > ++                      WRITE_ONCE(chan->syscall_all, 1);
> > > > > > > ++              else
> > > > > > > ++                      WRITE_ONCE(chan->syscall_all, 0);
> > > > > > > ++      }
> > > > > > > ++
> > > > > > > +       /* First ensure that probe events are created for this enabler. */
> > > > > > > +       lttng_create_event_if_missing(enabler);
> > > > > > > +
> > > > > > > +diff --git a/lttng-events.h b/lttng-events.h
> > > > > > > +index a36a312..d4d9976 100644
> > > > > > > +--- a/lttng-events.h
> > > > > > > ++++ b/lttng-events.h
> > > > > > > +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> > > > > > > +       struct list_head node;
> > > > > > > + };
> > > > > > > +
> > > > > > > ++enum lttng_syscall_entryexit {
> > > > > > > ++      LTTNG_SYSCALL_ENTRY,
> > > > > > > ++      LTTNG_SYSCALL_EXIT,
> > > > > > > ++};
> > > > > > > ++
> > > > > > > ++enum lttng_syscall_abi {
> > > > > > > ++      LTTNG_SYSCALL_ABI_NATIVE,
> > > > > > > ++      LTTNG_SYSCALL_ABI_COMPAT,
> > > > > > > ++};
> > > > > > > ++
> > > > > > > + /*
> > > > > > > +  * lttng_event structure is referred to by the tracing fast path. It must be
> > > > > > > +  * kept small.
> > > > > > > +@@ -318,6 +328,11 @@ struct lttng_event {
> > > > > > > +                       struct inode *inode;
> > > > > > > +                       struct list_head head;
> > > > > > > +               } uprobe;
> > > > > > > ++              struct {
> > > > > > > ++                      char *syscall_name;
> > > > > > > ++                      enum lttng_syscall_entryexit entryexit;
> > > > > > > ++                      enum lttng_syscall_abi abi;
> > > > > > > ++              } syscall;
> > > > > > > +       } u;
> > > > > > > +       struct list_head list;          /* Event list in session */
> > > > > > > +       unsigned int metadata_dumped:1;
> > > > > > > +@@ -457,10 +472,10 @@ struct lttng_channel {
> > > > > > > +       struct lttng_syscall_filter *sc_filter;
> > > > > > > +       int header_type;                /* 0: unset, 1: compact, 2: large */
> > > > > > > +       enum channel_type channel_type;
> > > > > > > ++      int syscall_all;
> > > > > > > +       unsigned int metadata_dumped:1,
> > > > > > > +               sys_enter_registered:1,
> > > > > > > +               sys_exit_registered:1,
> > > > > > > +-              syscall_all:1,
> > > > > > > +               tstate:1;               /* Transient enable state */
> > > > > > > + };
> > > > > > > +
> > > > > > > +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> > > > > > > + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> > > > > > > + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> > > > > > > + int lttng_syscalls_unregister(struct lttng_channel *chan);
> > > > > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> > > > > > > + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > > +-              const char *name);
> > > > > > > ++              struct lttng_event *event);
> > > > > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > > +-              const char *name);
> > > > > > > ++              struct lttng_event *event);
> > > > > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> > > > > > > + #else
> > > > > > > +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > > > > +       return 0;
> > > > > > > + }
> > > > > > > +
> > > > > > > ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > > > > ++{
> > > > > > > ++      return 0;
> > > > > > > ++}
> > > > > > > ++
> > > > > > > + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > > +-              const char *name)
> > > > > > > ++              struct lttng_event *event);
> > > > > > > + {
> > > > > > > +       return -ENOSYS;
> > > > > > > + }
> > > > > > > +
> > > > > > > + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > > +-              const char *name)
> > > > > > > ++              struct lttng_event *event);
> > > > > > > + {
> > > > > > > +       return -ENOSYS;
> > > > > > > + }
> > > > > > > +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> > > > > > > +index 97f1ba9..26cead6 100644
> > > > > > > +--- a/lttng-syscalls.c
> > > > > > > ++++ b/lttng-syscalls.c
> > > > > > > +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> > > > > > > + #undef CREATE_SYSCALL_TABLE
> > > > > > > +
> > > > > > > + struct lttng_syscall_filter {
> > > > > > > +-      DECLARE_BITMAP(sc, NR_syscalls);
> > > > > > > +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> > > > > > > ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> > > > > > > ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> > > > > > > ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> > > > > > > ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> > > > > > > + };
> > > > > > > +
> > > > > > > + static void syscall_entry_unknown(struct lttng_event *event,
> > > > > > > +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> > > > > > > +       size_t table_len;
> > > > > > > +
> > > > > > > +       if (unlikely(in_compat_syscall())) {
> > > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > > +-
> > > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > > +-              if (filter) {
> > > > > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > > > > +-                              /* System call filtered out. */
> > > > > > > +-                              return;
> > > > > > > +-                      }
> > > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > ++
> > > > > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> > > > > > > ++                      /* System call filtered out. */
> > > > > > > ++                      return;
> > > > > > > +               }
> > > > > > > +               table = compat_sc_table;
> > > > > > > +               table_len = ARRAY_SIZE(compat_sc_table);
> > > > > > > +               unknown_event = chan->sc_compat_unknown;
> > > > > > > +       } else {
> > > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > > +-
> > > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > > +-              if (filter) {
> > > > > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > > > > +-                              || !test_bit(id, filter->sc)) {
> > > > > > > +-                              /* System call filtered out. */
> > > > > > > +-                              return;
> > > > > > > +-                      }
> > > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > ++
> > > > > > > ++              if (id < 0 || id >= NR_syscalls
> > > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> > > > > > > ++                      /* System call filtered out. */
> > > > > > > ++                      return;
> > > > > > > +               }
> > > > > > > +               table = sc_table;
> > > > > > > +               table_len = ARRAY_SIZE(sc_table);
> > > > > > > +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> > > > > > > +
> > > > > > > +       id = syscall_get_nr(current, regs);
> > > > > > > +       if (unlikely(in_compat_syscall())) {
> > > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > > +-
> > > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > > +-              if (filter) {
> > > > > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > > > > +-                              /* System call filtered out. */
> > > > > > > +-                              return;
> > > > > > > +-                      }
> > > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > ++
> > > > > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> > > > > > > ++                      /* System call filtered out. */
> > > > > > > ++                      return;
> > > > > > > +               }
> > > > > > > +               table = compat_sc_exit_table;
> > > > > > > +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> > > > > > > +               unknown_event = chan->compat_sc_exit_unknown;
> > > > > > > +       } else {
> > > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > > +-
> > > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > > +-              if (filter) {
> > > > > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > > > > +-                              || !test_bit(id, filter->sc)) {
> > > > > > > +-                              /* System call filtered out. */
> > > > > > > +-                              return;
> > > > > > > +-                      }
> > > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > ++
> > > > > > > ++              if (id < 0 || id >= NR_syscalls
> > > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> > > > > > > ++                      /* System call filtered out. */
> > > > > > > ++                      return;
> > > > > > > +               }
> > > > > > > +               table = sc_exit_table;
> > > > > > > +               table_len = ARRAY_SIZE(sc_exit_table);
> > > > > > > +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> > > > > > > +               memset(&ev, 0, sizeof(ev));
> > > > > > > +               switch (type) {
> > > > > > > +               case SC_TYPE_ENTRY:
> > > > > > > +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> > > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > > +                       break;
> > > > > > > +               case SC_TYPE_EXIT:
> > > > > > > +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> > > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > > +                       break;
> > > > > > > +               case SC_TYPE_COMPAT_ENTRY:
> > > > > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> > > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > > +                       break;
> > > > > > > +               case SC_TYPE_COMPAT_EXIT:
> > > > > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> > > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > +-                      break;
> > > > > > > +-              default:
> > > > > > > +-                      BUG_ON(1);
> > > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > > +                       break;
> > > > > > > +               }
> > > > > > > +-              strncat(ev.name, desc->name,
> > > > > > > +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> > > > > > > ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> > > > > > > +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > > +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > > +                                               desc,
> > > > > > > +                                               ev.instrumentation);
> > > > > > > +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > > +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > > +                                               desc,
> > > > > > > +                                               ev.instrumentation);
> > > > > > > +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > > +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> > > > > > > +                                               filter, desc,
> > > > > > > +                                               ev.instrumentation);
> > > > > > > +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > > +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > > +                                               desc, ev.instrumentation);
> > > > > > > +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> > > > > > > +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > +       if (ret)
> > > > > > > +               return ret;
> > > > > > > + #endif
> > > > > > > ++
> > > > > > > ++      if (!chan->sc_filter) {
> > > > > > > ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > > ++                              GFP_KERNEL);
> > > > > > > ++              if (!chan->sc_filter)
> > > > > > > ++                      return -ENOMEM;
> > > > > > > ++      }
> > > > > > > ++
> > > > > > > +       if (!chan->sys_enter_registered) {
> > > > > > > +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> > > > > > > +                               (void *) syscall_entry_probe, chan);
> > > > > > > +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > > > > +                       return ret;
> > > > > > > +               chan->sys_exit_registered = 0;
> > > > > > > +       }
> > > > > > > +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> > > > > > > ++      return 0;
> > > > > > > ++}
> > > > > > > ++
> > > > > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > > > > ++{
> > > > > > > +       kfree(chan->sc_table);
> > > > > > > +       kfree(chan->sc_exit_table);
> > > > > > > + #ifdef CONFIG_COMPAT
> > > > > > > +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> > > > > > > +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> > > > > > > + }
> > > > > > > +
> > > > > > > +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > > +-              const char *name)
> > > > > > > ++static
> > > > > > > ++const char *get_syscall_name(struct lttng_event *event)
> > > > > > > + {
> > > > > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > > > > +-      struct lttng_syscall_filter *filter;
> > > > > > > ++      size_t prefix_len = 0;
> > > > > > > +
> > > > > > > +-      WARN_ON_ONCE(!chan->sc_table);
> > > > > > > ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> > > > > > > +
> > > > > > > +-      if (!name) {
> > > > > > > +-              /* Enable all system calls by removing filter */
> > > > > > > +-              if (chan->sc_filter) {
> > > > > > > +-                      filter = chan->sc_filter;
> > > > > > > +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> > > > > > > +-                      synchronize_trace();
> > > > > > > +-                      kfree(filter);
> > > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> > > > > > > ++                      break;
> > > > > > > +               }
> > > > > > > +-              chan->syscall_all = 1;
> > > > > > > +-              return 0;
> > > > > > > +-      }
> > > > > > > +-
> > > > > > > +-      if (!chan->sc_filter) {
> > > > > > > +-              if (chan->syscall_all) {
> > > > > > > +-                      /*
> > > > > > > +-                       * All syscalls are already enabled.
> > > > > > > +-                       */
> > > > > > > +-                      return -EEXIST;
> > > > > > > ++              break;
> > > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> > > > > > > ++                      break;
> > > > > > > +               }
> > > > > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > > +-                              GFP_KERNEL);
> > > > > > > +-              if (!filter)
> > > > > > > +-                      return -ENOMEM;
> > > > > > > +-      } else {
> > > > > > > +-              filter = chan->sc_filter;
> > > > > > > ++              break;
> > > > > > > +       }
> > > > > > > +-      syscall_nr = get_syscall_nr(name);
> > > > > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > > > > +-              ret = -ENOENT;
> > > > > > > +-              goto error;
> > > > > > > ++      WARN_ON_ONCE(prefix_len == 0);
> > > > > > > ++      return event->desc->name + prefix_len;
> > > > > > > ++}
> > > > > > > ++
> > > > > > > ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > > ++              struct lttng_event *event)
> > > > > > > ++{
> > > > > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > ++      const char *syscall_name;
> > > > > > > ++      unsigned long *bitmap;
> > > > > > > ++      int syscall_nr;
> > > > > > > ++
> > > > > > > ++      WARN_ON_ONCE(!chan->sc_table);
> > > > > > > ++
> > > > > > > ++      syscall_name = get_syscall_name(event);
> > > > > > > ++
> > > > > > > ++      switch (event->u.syscall.abi) {
> > > > > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > > > > ++              break;
> > > > > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > > > > ++              break;
> > > > > > > ++      default:
> > > > > > > ++              return -EINVAL;
> > > > > > > +       }
> > > > > > > +-      if (syscall_nr >= 0) {
> > > > > > > +-              if (test_bit(syscall_nr, filter->sc)) {
> > > > > > > +-                      ret = -EEXIST;
> > > > > > > +-                      goto error;
> > > > > > > ++      if (syscall_nr < 0)
> > > > > > > ++              return -ENOENT;
> > > > > > > ++
> > > > > > > ++
> > > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > ++                      bitmap = filter->sc_entry;
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > ++                      bitmap = filter->sc_compat_entry;
> > > > > > > ++                      break;
> > > > > > > +               }
> > > > > > > +-              bitmap_set(filter->sc, syscall_nr, 1);
> > > > > > > +-      }
> > > > > > > +-      if (compat_syscall_nr >= 0) {
> > > > > > > +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > > > > +-                      ret = -EEXIST;
> > > > > > > +-                      goto error;
> > > > > > > ++              break;
> > > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > ++                      bitmap = filter->sc_exit;
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > ++                      bitmap = filter->sc_compat_exit;
> > > > > > > ++                      break;
> > > > > > > +               }
> > > > > > > +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> > > > > > > ++              break;
> > > > > > > ++      default:
> > > > > > > ++              return -EINVAL;
> > > > > > > +       }
> > > > > > > +-      if (!chan->sc_filter)
> > > > > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > > > > ++      if (test_bit(syscall_nr, bitmap))
> > > > > > > ++              return -EEXIST;
> > > > > > > ++      bitmap_set(bitmap, syscall_nr, 1);
> > > > > > > +       return 0;
> > > > > > > +-
> > > > > > > +-error:
> > > > > > > +-      if (!chan->sc_filter)
> > > > > > > +-              kfree(filter);
> > > > > > > +-      return ret;
> > > > > > > + }
> > > > > > > +
> > > > > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > > +-              const char *name)
> > > > > > > ++              struct lttng_event *event)
> > > > > > > + {
> > > > > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > > > > +-      struct lttng_syscall_filter *filter;
> > > > > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > ++      const char *syscall_name;
> > > > > > > ++      unsigned long *bitmap;
> > > > > > > ++      int syscall_nr;
> > > > > > > +
> > > > > > > +       WARN_ON_ONCE(!chan->sc_table);
> > > > > > > +
> > > > > > > +-      if (!chan->sc_filter) {
> > > > > > > +-              if (!chan->syscall_all)
> > > > > > > +-                      return -EEXIST;
> > > > > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > > +-                              GFP_KERNEL);
> > > > > > > +-              if (!filter)
> > > > > > > +-                      return -ENOMEM;
> > > > > > > +-              /* Trace all system calls, then apply disable. */
> > > > > > > +-              bitmap_set(filter->sc, 0, NR_syscalls);
> > > > > > > +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> > > > > > > +-      } else {
> > > > > > > +-              filter = chan->sc_filter;
> > > > > > > ++      syscall_name = get_syscall_name(event);
> > > > > > > ++
> > > > > > > ++      switch (event->u.syscall.abi) {
> > > > > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > > > > ++              break;
> > > > > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > > > > ++              break;
> > > > > > > ++      default:
> > > > > > > ++              return -EINVAL;
> > > > > > > +       }
> > > > > > > ++      if (syscall_nr < 0)
> > > > > > > ++              return -ENOENT;
> > > > > > > +
> > > > > > > +-      if (!name) {
> > > > > > > +-              /* Fail if all syscalls are already disabled. */
> > > > > > > +-              if (bitmap_empty(filter->sc, NR_syscalls)
> > > > > > > +-                      && bitmap_empty(filter->sc_compat,
> > > > > > > +-                              NR_compat_syscalls)) {
> > > > > > > +-                      ret = -EEXIST;
> > > > > > > +-                      goto error;
> > > > > > > +-              }
> > > > > > > +
> > > > > > > +-              /* Disable all system calls */
> > > > > > > +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> > > > > > > +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> > > > > > > +-              goto apply_filter;
> > > > > > > +-      }
> > > > > > > +-      syscall_nr = get_syscall_nr(name);
> > > > > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > > > > +-              ret = -ENOENT;
> > > > > > > +-              goto error;
> > > > > > > +-      }
> > > > > > > +-      if (syscall_nr >= 0) {
> > > > > > > +-              if (!test_bit(syscall_nr, filter->sc)) {
> > > > > > > +-                      ret = -EEXIST;
> > > > > > > +-                      goto error;
> > > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > ++                      bitmap = filter->sc_entry;
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > ++                      bitmap = filter->sc_compat_entry;
> > > > > > > ++                      break;
> > > > > > > +               }
> > > > > > > +-              bitmap_clear(filter->sc, syscall_nr, 1);
> > > > > > > +-      }
> > > > > > > +-      if (compat_syscall_nr >= 0) {
> > > > > > > +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > > > > +-                      ret = -EEXIST;
> > > > > > > +-                      goto error;
> > > > > > > ++              break;
> > > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > ++                      bitmap = filter->sc_exit;
> > > > > > > ++                      break;
> > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > ++                      bitmap = filter->sc_compat_exit;
> > > > > > > ++                      break;
> > > > > > > +               }
> > > > > > > +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> > > > > > > ++              break;
> > > > > > > ++      default:
> > > > > > > ++              return -EINVAL;
> > > > > > > +       }
> > > > > > > +-apply_filter:
> > > > > > > +-      if (!chan->sc_filter)
> > > > > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > > > > +-      chan->syscall_all = 0;
> > > > > > > +-      return 0;
> > > > > > > ++      if (!test_bit(syscall_nr, bitmap))
> > > > > > > ++              return -EEXIST;
> > > > > > > ++      bitmap_clear(bitmap, syscall_nr, 1);
> > > > > > > +
> > > > > > > +-error:
> > > > > > > +-      if (!chan->sc_filter)
> > > > > > > +-              kfree(filter);
> > > > > > > +-      return ret;
> > > > > > > ++      return 0;
> > > > > > > + }
> > > > > > > +
> > > > > > > + static
> > > > > > > +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> > > > > > > +       .release = seq_release,
> > > > > > > + };
> > > > > > > +
> > > > > > > ++/*
> > > > > > > ++ * A syscall is enabled if it is traced for either entry or exit.
> > > > > > > ++ */
> > > > > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> > > > > > > + {
> > > > > > > +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > > +               char state;
> > > > > > > +
> > > > > > > +               if (channel->sc_table) {
> > > > > > > +-                      if (filter)
> > > > > > > +-                              state = test_bit(bit, filter->sc);
> > > > > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > > > > ++                              state = test_bit(bit, filter->sc_entry)
> > > > > > > ++                                      || test_bit(bit, filter->sc_exit);
> > > > > > > +                       else
> > > > > > > +                               state = 1;
> > > > > > > +               } else {
> > > > > > > +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > > +               char state;
> > > > > > > +
> > > > > > > +               if (channel->compat_sc_table) {
> > > > > > > +-                      if (filter)
> > > > > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > > > > +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> > > > > > > +-                                              filter->sc_compat);
> > > > > > > ++                                              filter->sc_compat_entry)
> > > > > > > ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> > > > > > > ++                                              filter->sc_compat_exit);
> > > > > > > +                       else
> > > > > > > +                               state = 1;
> > > > > > > +               } else {
> > > > > > > +--
> > > > > > > +2.19.1
> > > > > > > +
> > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > > index 0e1a209ce8..e36b327a08 100644
> > > > > > > --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > > @@ -11,6 +11,16 @@ include lttng-platforms.inc
> > > > > > >  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
> > > > > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > > > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > > > > +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> > > > > > > +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> > > > > > > +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> > > > > > > +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> > > > > > > +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> > > > > > > +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> > > > > > > +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> > > > > > > +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> > > > > > > +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> > > > > > > +           file://0010-Fix-system-call-filter-table.patch \
> > > > > > >             "
> > > > > > >
> > > > > > >  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> > > > > > > @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
> > > > > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > > > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > > > >             "
> > > > > > > -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> > > > > > > +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
> > > > > > >  PV_class-devupstream = "2.12.2+git${SRCPV}"
> > > > > > >  S_class-devupstream = "${WORKDIR}/git"
> > > > > > >  SRCREV_FORMAT ?= "lttng_git"
> > > > > > > --
> > > > > > > 2.19.1
> > > > > > >
> > > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > > > > thee at its end
> > > > > - "Use the force Harry" - Gandalf, Star Trek II
> > >
> > >
> > >
> > > --
> > > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > > thee at its end
> > > - "Use the force Harry" - Gandalf, Star Trek II
> > >
> > > 
> > >
> >
> >
> > --
> > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > thee at its end
> > - "Use the force Harry" - Gandalf, Star Trek II



-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
       [not found]               ` <16391475BC3C80C8.17908@lists.openembedded.org>
@ 2020-09-29 14:54                 ` Bruce Ashfield
  2020-09-29 17:23                   ` Steve Sakoman
  0 siblings, 1 reply; 23+ messages in thread
From: Bruce Ashfield @ 2020-09-29 14:54 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Steve Sakoman, Richard Purdie,
	Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 119620 bytes --]

Steve,

Attached is the minimal backport that I was able to pull together.
Chuck that in the queue and you can take the latest 5.4.x -stable
updates.

So it looks like we can get away without a version bump for now.

It passed all my local testing, but let me know if it causes you issues.

Bruce

On Mon, Sep 28, 2020 at 6:53 PM Bruce Ashfield via
lists.openembedded.org
<bruce.ashfield=gmail.com@lists.openembedded.org> wrote:
>
> On Mon, Sep 28, 2020 at 6:35 PM Steve Sakoman <steve@sakoman.com> wrote:
> >
> > On Mon, Sep 28, 2020 at 7:44 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> > >
> > > On Sun, Sep 27, 2020 at 5:18 PM Bruce Ashfield via
> > > lists.openembedded.org
> > > <bruce.ashfield=gmail.com@lists.openembedded.org> wrote:
> > > >
> > > > On Fri, Sep 25, 2020 at 3:49 PM Steve Sakoman <steve@sakoman.com> wrote:
> > > > >
> > > > > On Fri, Sep 25, 2020 at 6:52 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
> > > > > >
> > > > > > On Fri, Sep 25, 2020 at 12:43 PM Steve Sakoman <steve@sakoman.com> wrote:
> > > > > > >
> > > > > > > Dunfell is still at 2.11.2.  Will there be a need for patches to this
> > > > > > > version too?  Or should I take the lttng version bump along with the
> > > > > > > 5.4 version bumps that cause the issue?
> > > > > >
> > > > > > I don't see a lot of options on that front. Unless we do some custom backports.
> > > > > >
> > > > > > I just checked the lttng 2.11 branch, and the last commit is from January, which
> > > > > > is too old to cover these -stable kernel bump issues.
> > > > > >
> > > > > > I can have a go at the backports, but we should be prepared to bend the version
> > > > > > upgrade rule if that gets too complex (and for the record, I've never
> > > > > > had much luck
> > > > > > with lttng fixes).
> > > > >
> > > > > Totally understood!  I think this is likely one of those cases where
> > > > > we'll have to take an exception to the upgrade rule.
> > > > >
> > > > > If you see issues with a backport just let me know and I'll go with
> > > > > the version upgrade approach.
> > > >
> > > > I'll have a go at some backports on Monday and send info by end of day.
> > >
> > > Hmm. Despite the advertised kernel version limitations, I was able to
> > > build lttng-modules against my dunfell branch with v5.4 bumped all the
> > > way to v5.4.67.
> > >
> > > So at this point, I'd suggest taking my kernel uprevs and running it
> > > through the autobuilder. If nothing blows up on build, we are good to
> > > go.
> > >
> > > If it does blow up, let me know and I'll figure out how my local builds worked.
> >
> > Sadly I am starting to errors on the autobuilder:
> >
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/102/builds/975
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/63/builds/2498
> > https://autobuilder.yoctoproject.org/typhoon/#/builders/107/builds/962
> >
>
> Not surprising!
>
> Leave it with me, and I'll send a dunfell series later today or early tomorrow.
>
> Bruce
>
>
> > Steve
> >
> > > > > While I have your attention, what about "linux-yocto/config:
> > > > > netfilter: Enable nat for ipv4 and ipv6" for dunfell?  I'll have to
> > > > > prune out the changes for 5.8 in the commit, but does it make sense
> > > > > for 5.4?
> > > >
> > > > It isn't a bugfix by a strict definition, but it also  won't hurt
> > > > anything. It does
> > > > make sense to keep 5.4 & 5.8 kernel configuration consistent whenever
> > > > possible, so I'd say go ahead and do the port.
> > > >
> > > > Bruce
> > > >
> > > > >
> > > > > Thanks!
> > > > >
> > > > > Steve
> > > > >
> > > > >
> > > > >  >
> > > > > > > On Mon, Sep 14, 2020 at 12:34 PM Bruce Ashfield
> > > > > > > <bruce.ashfield@gmail.com> wrote:
> > > > > > > >
> > > > > > > > From: Jens Rehsack <sno@netbsd.org>
> > > > > > > >
> > > > > > > > Backporting the 10 patches since the lttng 2.12.2 release. We'll drop
> > > > > > > > them once .3 is released, but for now, we need the fixes to build
> > > > > > > > against the latest 5.4, 5.8 and 5.9 kernels.
> > > > > > > >
> > > > > > > > We also bump the devupstream SRCREV to pickup the same changes.
> > > > > > > >
> > > > > > > > Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
> > > > > > > > ---
> > > > > > > >  ...ndency-issue-when-building-in-tree-w.patch |  54 ++
> > > > > > > >  ...ce.h-into-the-mmu-sub-directory-v5.9.patch |  41 +
> > > > > > > >  ...Make-kvm_mmu_page-definition-and-acc.patch |  39 +
> > > > > > > >  ...he-length-of-per-inode-prealloc-list.patch |  84 ++
> > > > > > > >  ...e-via-a-block-bitmap-read-is-prefetc.patch |  63 ++
> > > > > > > >  ...al-of-smp_-read_barrier_depends-v5.9.patch | 391 ++++++++
> > > > > > > >  ...teback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch |  59 ++
> > > > > > > >  ...x-sync-livelock-due-to-b_dirty_time-.patch | 117 +++
> > > > > > > >  ...es-for-ext4_discard_preallocations-a.patch |  52 +
> > > > > > > >  .../0010-Fix-system-call-filter-table.patch   | 918 ++++++++++++++++++
> > > > > > > >  .../lttng/lttng-modules_2.12.2.bb             |  12 +-
> > > > > > > >  11 files changed, 1829 insertions(+), 1 deletion(-)
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > > > >  create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > > > >
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..ae8bec45de
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch
> > > > > > > > @@ -0,0 +1,54 @@
> > > > > > > > +From ff4d1d7e85be94ef43709cd698f0ec9a12f247d1 Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > > > > > +Date: Thu, 13 Aug 2020 16:24:39 +0300
> > > > > > > > +Subject: [PATCH 01/10] Kconfig: fix dependency issue when building in-tree
> > > > > > > > + without CONFIG_FTRACE
> > > > > > > > +
> > > > > > > > +When building in-tree, one could disable CONFIG_FTRACE from kernel
> > > > > > > > +config which will leave CONFIG_TRACEPOINTS selected by LTTNG modules,
> > > > > > > > +but generate a lot of linker errors like below because it leaves out
> > > > > > > > +other stuff, e.g.:
> > > > > > > > +
> > > > > > > > +trace.c:(.text+0xd86b): undefined reference to `trace_event_buffer_reserve'
> > > > > > > > +ld: trace.c:(.text+0xd8de): undefined reference to `trace_event_buffer_commit'
> > > > > > > > +ld: trace.c:(.text+0xd926): undefined reference to `event_triggers_call'
> > > > > > > > +ld: trace.c:(.text+0xd942): undefined reference to `trace_event_ignore_this_pid'
> > > > > > > > +ld: net/mac80211/trace.o: in function `trace_event_raw_event_drv_tdls_cancel_channel_switch':
> > > > > > > > +
> > > > > > > > +It appears to be caused by the fact that TRACE_EVENT macros in the Linux
> > > > > > > > +kernel depend on the Ftrace ring buffer as soon as CONFIG_TRACEPOINTS is
> > > > > > > > +enabled.
> > > > > > > > +
> > > > > > > > +Steps to reproduce:
> > > > > > > > +
> > > > > > > > +- Get a clone of an upstream stable kernel and use scripts/built-in.sh on it
> > > > > > > > +
> > > > > > > > +- Configure a standard x86-64 build, enable built-in LTTNG but disable
> > > > > > > > +  CONFIG_FTRACE from Kernel Hacking-->Tracers using menuconfig
> > > > > > > > +
> > > > > > > > +- Build will fail at linking stage
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +---
> > > > > > > > + Kconfig | 2 +-
> > > > > > > > + 1 file changed, 1 insertion(+), 1 deletion(-)
> > > > > > > > +
> > > > > > > > +diff --git a/Kconfig b/Kconfig
> > > > > > > > +index acdab73..10eccff 100644
> > > > > > > > +--- a/Kconfig
> > > > > > > > ++++ b/Kconfig
> > > > > > > > +@@ -2,7 +2,7 @@
> > > > > > > > +
> > > > > > > > + config LTTNG
> > > > > > > > +       tristate "LTTng support"
> > > > > > > > +-      select TRACEPOINTS
> > > > > > > > ++      select TRACING
> > > > > > > > +       help
> > > > > > > > +         LTTng is an open source tracing framework for Linux.
> > > > > > > > +
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..fab673b854
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch
> > > > > > > > @@ -0,0 +1,41 @@
> > > > > > > > +From e10ab43dd0e425df5bc0ac763447664ed075ba05 Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Date: Mon, 10 Aug 2020 11:22:05 -0400
> > > > > > > > +Subject: [PATCH 02/10] fix: Move mmutrace.h into the mmu/ sub-directory (v5.9)
> > > > > > > > +
> > > > > > > > +  commit 33e3042dac6bcc33b80835f7d7b502b1d74c457c
> > > > > > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > > > > +  Date:   Mon Jun 22 13:20:29 2020 -0700
> > > > > > > > +
> > > > > > > > +    KVM: x86/mmu: Move mmu_audit.c and mmutrace.h into the mmu/ sub-directory
> > > > > > > > +
> > > > > > > > +    Move mmu_audit.c and mmutrace.h under mmu/ where they belong.
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Change-Id: I582525ccca34e1e3bd62870364108a7d3e9df2e4
> > > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +---
> > > > > > > > + probes/lttng-probe-kvm-x86-mmu.c | 4 ++++
> > > > > > > > + 1 file changed, 4 insertions(+)
> > > > > > > > +
> > > > > > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > > +index 37384a2..5a7ef1e 100644
> > > > > > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > > +@@ -24,7 +24,11 @@
> > > > > > > > +  */
> > > > > > > > + #include <wrapper/tracepoint.h>
> > > > > > > > +
> > > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > > ++#include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > > > > > ++#else
> > > > > > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > > > > > ++#endif
> > > > > > > > +
> > > > > > > > + #undef TRACE_INCLUDE_PATH
> > > > > > > > + #undef TRACE_INCLUDE_FILE
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..524631cc72
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch
> > > > > > > > @@ -0,0 +1,39 @@
> > > > > > > > +From f16315cc45c4c6b880de541bb092ca18a13952b7 Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Date: Mon, 10 Aug 2020 11:36:03 -0400
> > > > > > > > +Subject: [PATCH 03/10] fix: KVM: x86/mmu: Make kvm_mmu_page definition and
> > > > > > > > + accessor internal-only (v5.9)
> > > > > > > > +
> > > > > > > > +  commit 985ab2780164698ec6e7d73fad523d50449261dd
> > > > > > > > +  Author: Sean Christopherson <sean.j.christopherson@intel.com>
> > > > > > > > +  Date:   Mon Jun 22 13:20:32 2020 -0700
> > > > > > > > +
> > > > > > > > +    KVM: x86/mmu: Make kvm_mmu_page definition and accessor internal-only
> > > > > > > > +
> > > > > > > > +    Make 'struct kvm_mmu_page' MMU-only, nothing outside of the MMU should
> > > > > > > > +    be poking into the gory details of shadow pages.
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Change-Id: Ia5c1b9c49c2b00dad1d5b17c50c3dc730dafda20
> > > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +---
> > > > > > > > + probes/lttng-probe-kvm-x86-mmu.c | 1 +
> > > > > > > > + 1 file changed, 1 insertion(+)
> > > > > > > > +
> > > > > > > > +diff --git a/probes/lttng-probe-kvm-x86-mmu.c b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > > +index 5a7ef1e..8f98186 100644
> > > > > > > > +--- a/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > > ++++ b/probes/lttng-probe-kvm-x86-mmu.c
> > > > > > > > +@@ -25,6 +25,7 @@
> > > > > > > > + #include <wrapper/tracepoint.h>
> > > > > > > > +
> > > > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > > ++#include <../../arch/x86/kvm/mmu/mmu_internal.h>
> > > > > > > > + #include <../../arch/x86/kvm/mmu/mmutrace.h>
> > > > > > > > + #else
> > > > > > > > + #include <../../arch/x86/kvm/mmutrace.h>
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..e29c07252c
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch
> > > > > > > > @@ -0,0 +1,84 @@
> > > > > > > > +From 8fe742807e65af29dac3fea568ff93cbc5dd9a56 Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Date: Mon, 24 Aug 2020 15:26:04 -0400
> > > > > > > > +Subject: [PATCH 04/10] fix: ext4: limit the length of per-inode prealloc list
> > > > > > > > + (v5.9)
> > > > > > > > +MIME-Version: 1.0
> > > > > > > > +Content-Type: text/plain; charset=UTF-8
> > > > > > > > +Content-Transfer-Encoding: 8bit
> > > > > > > > +
> > > > > > > > +See upstream commit:
> > > > > > > > +
> > > > > > > > +  commit 27bc446e2def38db3244a6eb4bb1d6312936610a
> > > > > > > > +  Author: brookxu <brookxu.cn@gmail.com>
> > > > > > > > +  Date:   Mon Aug 17 15:36:15 2020 +0800
> > > > > > > > +
> > > > > > > > +    ext4: limit the length of per-inode prealloc list
> > > > > > > > +
> > > > > > > > +    In the scenario of writing sparse files, the per-inode prealloc list may
> > > > > > > > +    be very long, resulting in high overhead for ext4_mb_use_preallocated().
> > > > > > > > +    To circumvent this problem, we limit the maximum length of per-inode
> > > > > > > > +    prealloc list to 512 and allow users to modify it.
> > > > > > > > +
> > > > > > > > +    After patching, we observed that the sys ratio of cpu has dropped, and
> > > > > > > > +    the system throughput has increased significantly. We created a process
> > > > > > > > +    to write the sparse file, and the running time of the process on the
> > > > > > > > +    fixed kernel was significantly reduced, as follows:
> > > > > > > > +
> > > > > > > > +    Running time on unfixed kernel:
> > > > > > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > > > > > +    real    0m2.051s
> > > > > > > > +    user    0m0.008s
> > > > > > > > +    sys     0m2.026s
> > > > > > > > +
> > > > > > > > +    Running time on fixed kernel:
> > > > > > > > +    [root@TENCENT64 ~]# time taskset 0x01 ./sparse /data1/sparce.dat
> > > > > > > > +    real    0m0.471s
> > > > > > > > +    user    0m0.004s
> > > > > > > > +    sys     0m0.395s
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +Change-Id: I5169cb24853d4da32e2862a6626f1f058689b053
> > > > > > > > +---
> > > > > > > > + instrumentation/events/lttng-module/ext4.h | 15 +++++++++++++++
> > > > > > > > + 1 file changed, 15 insertions(+)
> > > > > > > > +
> > > > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > > > +index 5f7ab28..72ad4c9 100644
> > > > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > > > +@@ -460,6 +460,20 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > > > > > + )
> > > > > > > > + #endif
> > > > > > > > +
> > > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > > ++LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > > > ++      TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > > > > > ++
> > > > > > > > ++      TP_ARGS(inode, len, needed),
> > > > > > > > ++
> > > > > > > > ++      TP_FIELDS(
> > > > > > > > ++              ctf_integer(dev_t, dev, inode->i_sb->s_dev)
> > > > > > > > ++              ctf_integer(ino_t, ino, inode->i_ino)
> > > > > > > > ++              ctf_integer(unsigned int, len, len)
> > > > > > > > ++              ctf_integer(unsigned int, needed, needed)
> > > > > > > > ++      )
> > > > > > > > ++)
> > > > > > > > ++#else
> > > > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > > > +       TP_PROTO(struct inode *inode),
> > > > > > > > +
> > > > > > > > +@@ -470,6 +484,7 @@ LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > > > +               ctf_integer(ino_t, ino, inode->i_ino)
> > > > > > > > +       )
> > > > > > > > + )
> > > > > > > > ++#endif
> > > > > > > > +
> > > > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_mb_discard_preallocations,
> > > > > > > > +       TP_PROTO(struct super_block *sb, int needed),
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..f76e9698c8
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch
> > > > > > > > @@ -0,0 +1,63 @@
> > > > > > > > +From 52563d02a9234215b62c5f519aa1b5d8589ccd0a Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Date: Mon, 24 Aug 2020 15:37:50 -0400
> > > > > > > > +Subject: [PATCH 05/10] =?UTF-8?q?fix:=20ext4:=20indicate=20via=20a=20block?=
> > > > > > > > + =?UTF-8?q?=20bitmap=20read=20is=20prefetched=E2=80=A6=20(v5.9)?=
> > > > > > > > +MIME-Version: 1.0
> > > > > > > > +Content-Type: text/plain; charset=UTF-8
> > > > > > > > +Content-Transfer-Encoding: 8bit
> > > > > > > > +
> > > > > > > > +See upstream commit:
> > > > > > > > +
> > > > > > > > +  commit ab74c7b23f3770935016e3eb3ecdf1e42b73efaa
> > > > > > > > +  Author: Theodore Ts'o <tytso@mit.edu>
> > > > > > > > +  Date:   Wed Jul 15 11:48:55 2020 -0400
> > > > > > > > +
> > > > > > > > +    ext4: indicate via a block bitmap read is prefetched via a tracepoint
> > > > > > > > +
> > > > > > > > +    Modify the ext4_read_block_bitmap_load tracepoint so that it tells us
> > > > > > > > +    whether a block bitmap is being prefetched.
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +Change-Id: I0e5e2c5b8004223d0928235c092449ee16a940e1
> > > > > > > > +---
> > > > > > > > + instrumentation/events/lttng-module/ext4.h | 14 ++++++++++++++
> > > > > > > > + 1 file changed, 14 insertions(+)
> > > > > > > > +
> > > > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > > > +index 72ad4c9..4476abb 100644
> > > > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > > > +@@ -893,12 +893,26 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_mb_buddy_bitmap_load,
> > > > > > > > +       TP_ARGS(sb, group)
> > > > > > > > + )
> > > > > > > > +
> > > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > > ++LTTNG_TRACEPOINT_EVENT(ext4_read_block_bitmap_load,
> > > > > > > > ++      TP_PROTO(struct super_block *sb, unsigned long group, bool prefetch),
> > > > > > > > ++
> > > > > > > > ++      TP_ARGS(sb, group, prefetch),
> > > > > > > > ++
> > > > > > > > ++      TP_FIELDS(
> > > > > > > > ++              ctf_integer(dev_t, dev, sb->s_dev)
> > > > > > > > ++              ctf_integer(__u32, group, group)
> > > > > > > > ++              ctf_integer(bool, prefetch, prefetch)
> > > > > > > > ++      )
> > > > > > > > ++)
> > > > > > > > ++#else
> > > > > > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_read_block_bitmap_load,
> > > > > > > > +
> > > > > > > > +       TP_PROTO(struct super_block *sb, unsigned long group),
> > > > > > > > +
> > > > > > > > +       TP_ARGS(sb, group)
> > > > > > > > + )
> > > > > > > > ++#endif
> > > > > > > > +
> > > > > > > > + LTTNG_TRACEPOINT_EVENT_INSTANCE(ext4__bitmap_load, ext4_load_inode_bitmap,
> > > > > > > > +
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..0970dd30aa
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch
> > > > > > > > @@ -0,0 +1,391 @@
> > > > > > > > +From 57ccbfa6a8a79c7b84394c2097efaf7935607aa5 Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Date: Tue, 25 Aug 2020 10:56:29 -0400
> > > > > > > > +Subject: [PATCH 06/10] fix: removal of [smp_]read_barrier_depends (v5.9)
> > > > > > > > +
> > > > > > > > +See upstream commits:
> > > > > > > > +
> > > > > > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > > > > > +  Author: Will Deacon <will@kernel.org>
> > > > > > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > > > > > +
> > > > > > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > > > > > +
> > > > > > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > > > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > > > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > > > > > +    used to head dependency chains on all architectures.
> > > > > > > > +
> > > > > > > > +  commit 76ebbe78f7390aee075a7f3768af197ded1bdfbb
> > > > > > > > +  Author: Will Deacon <will.deacon@arm.com>
> > > > > > > > +  Date:   Tue Oct 24 11:22:47 2017 +0100
> > > > > > > > +
> > > > > > > > +    locking/barriers: Add implicit smp_read_barrier_depends() to READ_ONCE()
> > > > > > > > +
> > > > > > > > +    In preparation for the removal of lockless_dereference(), which is the
> > > > > > > > +    same as READ_ONCE() on all architectures other than Alpha, add an
> > > > > > > > +    implicit smp_read_barrier_depends() to READ_ONCE() so that it can be
> > > > > > > > +    used to head dependency chains on all architectures.
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Change-Id: Ife8880bd9378dca2972da8838f40fc35ccdfaaac
> > > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +---
> > > > > > > > + instrumentation/events/lttng-module/i2c.h |  4 ++--
> > > > > > > > + lib/ringbuffer/backend.h                  |  2 +-
> > > > > > > > + lib/ringbuffer/backend_internal.h         |  2 +-
> > > > > > > > + lib/ringbuffer/frontend.h                 |  4 ++--
> > > > > > > > + lib/ringbuffer/ring_buffer_frontend.c     |  4 ++--
> > > > > > > > + lib/ringbuffer/ring_buffer_iterator.c     |  2 +-
> > > > > > > > + lttng-events.c                            |  8 ++++----
> > > > > > > > + probes/lttng-kprobes.c                    |  6 +++---
> > > > > > > > + probes/lttng-kretprobes.c                 |  6 +++---
> > > > > > > > + probes/lttng-tracepoint-event-impl.h      | 12 ++++++------
> > > > > > > > + probes/lttng-uprobes.c                    |  6 +++---
> > > > > > > > + wrapper/compiler.h                        | 18 ++++++++++++++++++
> > > > > > > > + wrapper/trace-clock.h                     | 15 +++++----------
> > > > > > > > + 13 files changed, 51 insertions(+), 38 deletions(-)
> > > > > > > > +
> > > > > > > > +diff --git a/instrumentation/events/lttng-module/i2c.h b/instrumentation/events/lttng-module/i2c.h
> > > > > > > > +index dcbabf6..131d134 100644
> > > > > > > > +--- a/instrumentation/events/lttng-module/i2c.h
> > > > > > > > ++++ b/instrumentation/events/lttng-module/i2c.h
> > > > > > > > +@@ -23,7 +23,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_write,
> > > > > > > > +
> > > > > > > > +       TP_code_pre(
> > > > > > > > +               tp_locvar->extract_sensitive_payload =
> > > > > > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > > > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > > > > > +       ),
> > > > > > > > +
> > > > > > > > +       TP_FIELDS(
> > > > > > > > +@@ -78,7 +78,7 @@ LTTNG_TRACEPOINT_EVENT_CODE(i2c_reply,
> > > > > > > > +
> > > > > > > > +       TP_code_pre(
> > > > > > > > +               tp_locvar->extract_sensitive_payload =
> > > > > > > > +-                      READ_ONCE(extract_sensitive_payload);
> > > > > > > > ++                      LTTNG_READ_ONCE(extract_sensitive_payload);
> > > > > > > > +       ),
> > > > > > > > +
> > > > > > > > +       TP_FIELDS(
> > > > > > > > +diff --git a/lib/ringbuffer/backend.h b/lib/ringbuffer/backend.h
> > > > > > > > +index da937f2..43e1d47 100644
> > > > > > > > +--- a/lib/ringbuffer/backend.h
> > > > > > > > ++++ b/lib/ringbuffer/backend.h
> > > > > > > > +@@ -156,7 +156,7 @@ size_t lib_ring_buffer_do_strcpy(const struct lib_ring_buffer_config *config,
> > > > > > > > +                * Only read source character once, in case it is
> > > > > > > > +                * modified concurrently.
> > > > > > > > +                */
> > > > > > > > +-              c = READ_ONCE(src[count]);
> > > > > > > > ++              c = LTTNG_READ_ONCE(src[count]);
> > > > > > > > +               if (!c)
> > > > > > > > +                       break;
> > > > > > > > +               lib_ring_buffer_do_copy(config, &dest[count], &c, 1);
> > > > > > > > +diff --git a/lib/ringbuffer/backend_internal.h b/lib/ringbuffer/backend_internal.h
> > > > > > > > +index 2d6a345..1226fd8 100644
> > > > > > > > +--- a/lib/ringbuffer/backend_internal.h
> > > > > > > > ++++ b/lib/ringbuffer/backend_internal.h
> > > > > > > > +@@ -367,7 +367,7 @@ void lib_ring_buffer_clear_noref(const struct lib_ring_buffer_config *config,
> > > > > > > > +        * Performing a volatile access to read the sb_pages, because we want to
> > > > > > > > +        * read a coherent version of the pointer and the associated noref flag.
> > > > > > > > +        */
> > > > > > > > +-      id = READ_ONCE(bufb->buf_wsb[idx].id);
> > > > > > > > ++      id = LTTNG_READ_ONCE(bufb->buf_wsb[idx].id);
> > > > > > > > +       for (;;) {
> > > > > > > > +               /* This check is called on the fast path for each record. */
> > > > > > > > +               if (likely(!subbuffer_id_is_noref(config, id))) {
> > > > > > > > +diff --git a/lib/ringbuffer/frontend.h b/lib/ringbuffer/frontend.h
> > > > > > > > +index 6f516d9..41382fe 100644
> > > > > > > > +--- a/lib/ringbuffer/frontend.h
> > > > > > > > ++++ b/lib/ringbuffer/frontend.h
> > > > > > > > +@@ -79,7 +79,7 @@ void *channel_destroy(struct channel *chan);
> > > > > > > > + #define for_each_channel_cpu(cpu, chan)                                       \
> > > > > > > > +       for ((cpu) = -1;                                                \
> > > > > > > > +               ({ (cpu) = cpumask_next(cpu, (chan)->backend.cpumask);  \
> > > > > > > > +-                 smp_read_barrier_depends(); (cpu) < nr_cpu_ids; });)
> > > > > > > > ++                 smp_rmb(); (cpu) < nr_cpu_ids; });)
> > > > > > > > +
> > > > > > > > + extern struct lib_ring_buffer *channel_get_ring_buffer(
> > > > > > > > +                               const struct lib_ring_buffer_config *config,
> > > > > > > > +@@ -155,7 +155,7 @@ static inline
> > > > > > > > + int lib_ring_buffer_is_finalized(const struct lib_ring_buffer_config *config,
> > > > > > > > +                                struct lib_ring_buffer *buf)
> > > > > > > > + {
> > > > > > > > +-      int finalized = READ_ONCE(buf->finalized);
> > > > > > > > ++      int finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > > > +       /*
> > > > > > > > +        * Read finalized before counters.
> > > > > > > > +        */
> > > > > > > > +diff --git a/lib/ringbuffer/ring_buffer_frontend.c b/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > > > +index 3cab365..4980d20 100644
> > > > > > > > +--- a/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > > > ++++ b/lib/ringbuffer/ring_buffer_frontend.c
> > > > > > > > +@@ -1074,7 +1074,7 @@ int lib_ring_buffer_snapshot(struct lib_ring_buffer *buf,
> > > > > > > > +       int finalized;
> > > > > > > > +
> > > > > > > > + retry:
> > > > > > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > > > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > > > +       /*
> > > > > > > > +        * Read finalized before counters.
> > > > > > > > +        */
> > > > > > > > +@@ -1245,7 +1245,7 @@ int lib_ring_buffer_get_subbuf(struct lib_ring_buffer *buf,
> > > > > > > > +               return -EBUSY;
> > > > > > > > +       }
> > > > > > > > + retry:
> > > > > > > > +-      finalized = READ_ONCE(buf->finalized);
> > > > > > > > ++      finalized = LTTNG_READ_ONCE(buf->finalized);
> > > > > > > > +       /*
> > > > > > > > +        * Read finalized before counters.
> > > > > > > > +        */
> > > > > > > > +diff --git a/lib/ringbuffer/ring_buffer_iterator.c b/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > > > +index d25db72..7b4f20a 100644
> > > > > > > > +--- a/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > > > ++++ b/lib/ringbuffer/ring_buffer_iterator.c
> > > > > > > > +@@ -46,7 +46,7 @@ restart:
> > > > > > > > +       switch (iter->state) {
> > > > > > > > +       case ITER_GET_SUBBUF:
> > > > > > > > +               ret = lib_ring_buffer_get_next_subbuf(buf);
> > > > > > > > +-              if (ret && !READ_ONCE(buf->finalized)
> > > > > > > > ++              if (ret && !LTTNG_READ_ONCE(buf->finalized)
> > > > > > > > +                   && config->alloc == RING_BUFFER_ALLOC_GLOBAL) {
> > > > > > > > +                       /*
> > > > > > > > +                        * Use "pull" scheme for global buffers. The reader
> > > > > > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > > > > > +index be7e389..d719294 100644
> > > > > > > > +--- a/lttng-events.c
> > > > > > > > ++++ b/lttng-events.c
> > > > > > > > +@@ -1719,7 +1719,7 @@ int lttng_metadata_printf(struct lttng_session *session,
> > > > > > > > +       size_t len;
> > > > > > > > +       va_list ap;
> > > > > > > > +
> > > > > > > > +-      WARN_ON_ONCE(!READ_ONCE(session->active));
> > > > > > > > ++      WARN_ON_ONCE(!LTTNG_READ_ONCE(session->active));
> > > > > > > > +
> > > > > > > > +       va_start(ap, fmt);
> > > > > > > > +       str = kvasprintf(GFP_KERNEL, fmt, ap);
> > > > > > > > +@@ -2305,7 +2305,7 @@ int _lttng_event_metadata_statedump(struct lttng_session *session,
> > > > > > > > + {
> > > > > > > > +       int ret = 0;
> > > > > > > > +
> > > > > > > > +-      if (event->metadata_dumped || !READ_ONCE(session->active))
> > > > > > > > ++      if (event->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > > > > > +               return 0;
> > > > > > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > > > > > +               return 0;
> > > > > > > > +@@ -2377,7 +2377,7 @@ int _lttng_channel_metadata_statedump(struct lttng_session *session,
> > > > > > > > + {
> > > > > > > > +       int ret = 0;
> > > > > > > > +
> > > > > > > > +-      if (chan->metadata_dumped || !READ_ONCE(session->active))
> > > > > > > > ++      if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
> > > > > > > > +               return 0;
> > > > > > > > +
> > > > > > > > +       if (chan->channel_type == METADATA_CHANNEL)
> > > > > > > > +@@ -2604,7 +2604,7 @@ int _lttng_session_metadata_statedump(struct lttng_session *session)
> > > > > > > > +       struct lttng_event *event;
> > > > > > > > +       int ret = 0;
> > > > > > > > +
> > > > > > > > +-      if (!READ_ONCE(session->active))
> > > > > > > > ++      if (!LTTNG_READ_ONCE(session->active))
> > > > > > > > +               return 0;
> > > > > > > > +
> > > > > > > > +       lttng_metadata_begin(session);
> > > > > > > > +diff --git a/probes/lttng-kprobes.c b/probes/lttng-kprobes.c
> > > > > > > > +index a44eaa1..38fb72e 100644
> > > > > > > > +--- a/probes/lttng-kprobes.c
> > > > > > > > ++++ b/probes/lttng-kprobes.c
> > > > > > > > +@@ -31,11 +31,11 @@ int lttng_kprobes_handler_pre(struct kprobe *p, struct pt_regs *regs)
> > > > > > > > +       int ret;
> > > > > > > > +       unsigned long data = (unsigned long) p->addr;
> > > > > > > > +
> > > > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > > > +               return 0;
> > > > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > > > +               return 0;
> > > > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > > > +               return 0;
> > > > > > > > +
> > > > > > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx, sizeof(data),
> > > > > > > > +diff --git a/probes/lttng-kretprobes.c b/probes/lttng-kretprobes.c
> > > > > > > > +index ab98ff2..a6bcd21 100644
> > > > > > > > +--- a/probes/lttng-kretprobes.c
> > > > > > > > ++++ b/probes/lttng-kretprobes.c
> > > > > > > > +@@ -51,11 +51,11 @@ int _lttng_kretprobes_handler(struct kretprobe_instance *krpi,
> > > > > > > > +               unsigned long parent_ip;
> > > > > > > > +       } payload;
> > > > > > > > +
> > > > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > > > +               return 0;
> > > > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > > > +               return 0;
> > > > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > > > +               return 0;
> > > > > > > > +
> > > > > > > > +       payload.ip = (unsigned long) krpi->rp->kp.addr;
> > > > > > > > +diff --git a/probes/lttng-tracepoint-event-impl.h b/probes/lttng-tracepoint-event-impl.h
> > > > > > > > +index 77b8638..72a669e 100644
> > > > > > > > +--- a/probes/lttng-tracepoint-event-impl.h
> > > > > > > > ++++ b/probes/lttng-tracepoint-event-impl.h
> > > > > > > > +@@ -1132,11 +1132,11 @@ static void __event_probe__##_name(void *__data, _proto)                     \
> > > > > > > > +                                                                             \
> > > > > > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > > > > > +               return;                                                       \
> > > > > > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > > > > > +               return;                                                       \
> > > > > > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > > > > > +               return;                                                       \
> > > > > > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > > > > > +               return;                                                       \
> > > > > > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > > > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > > > > > +@@ -1225,11 +1225,11 @@ static void __event_probe__##_name(void *__data)                             \
> > > > > > > > +                                                                             \
> > > > > > > > +       if (!_TP_SESSION_CHECK(session, __session))                           \
> > > > > > > > +               return;                                                       \
> > > > > > > > +-      if (unlikely(!READ_ONCE(__session->active)))                          \
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__session->active)))                    \
> > > > > > > > +               return;                                                       \
> > > > > > > > +-      if (unlikely(!READ_ONCE(__chan->enabled)))                            \
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__chan->enabled)))                      \
> > > > > > > > +               return;                                                       \
> > > > > > > > +-      if (unlikely(!READ_ONCE(__event->enabled)))                           \
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(__event->enabled)))                     \
> > > > > > > > +               return;                                                       \
> > > > > > > > +       __lf = lttng_rcu_dereference(__session->pid_tracker.p);               \
> > > > > > > > +       if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid)))    \
> > > > > > > > +diff --git a/probes/lttng-uprobes.c b/probes/lttng-uprobes.c
> > > > > > > > +index bc10128..bda1d9b 100644
> > > > > > > > +--- a/probes/lttng-uprobes.c
> > > > > > > > ++++ b/probes/lttng-uprobes.c
> > > > > > > > +@@ -40,11 +40,11 @@ int lttng_uprobes_handler_pre(struct uprobe_consumer *uc, struct pt_regs *regs)
> > > > > > > > +               unsigned long ip;
> > > > > > > > +       } payload;
> > > > > > > > +
> > > > > > > > +-      if (unlikely(!READ_ONCE(chan->session->active)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
> > > > > > > > +               return 0;
> > > > > > > > +-      if (unlikely(!READ_ONCE(chan->enabled)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
> > > > > > > > +               return 0;
> > > > > > > > +-      if (unlikely(!READ_ONCE(event->enabled)))
> > > > > > > > ++      if (unlikely(!LTTNG_READ_ONCE(event->enabled)))
> > > > > > > > +               return 0;
> > > > > > > > +
> > > > > > > > +       lib_ring_buffer_ctx_init(&ctx, chan->chan, &lttng_probe_ctx,
> > > > > > > > +diff --git a/wrapper/compiler.h b/wrapper/compiler.h
> > > > > > > > +index 1496f33..b9f8c51 100644
> > > > > > > > +--- a/wrapper/compiler.h
> > > > > > > > ++++ b/wrapper/compiler.h
> > > > > > > > +@@ -9,6 +9,7 @@
> > > > > > > > + #define _LTTNG_WRAPPER_COMPILER_H
> > > > > > > > +
> > > > > > > > + #include <linux/compiler.h>
> > > > > > > > ++#include <linux/version.h>
> > > > > > > > +
> > > > > > > > + /*
> > > > > > > > +  * Don't allow compiling with buggy compiler.
> > > > > > > > +@@ -39,4 +40,21 @@
> > > > > > > > + # define WRITE_ONCE(x, val)   ({ ACCESS_ONCE(x) = val; })
> > > > > > > > + #endif
> > > > > > > > +
> > > > > > > > ++/*
> > > > > > > > ++ * In v4.15 a smp read barrier was added to READ_ONCE to replace
> > > > > > > > ++ * lockless_dereference(), replicate this behavior on prior kernels
> > > > > > > > ++ * and remove calls to smp_read_barrier_depends which was dropped
> > > > > > > > ++ * in v5.9.
> > > > > > > > ++ */
> > > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0))
> > > > > > > > ++#define LTTNG_READ_ONCE(x)    READ_ONCE(x)
> > > > > > > > ++#else
> > > > > > > > ++#define LTTNG_READ_ONCE(x)                    \
> > > > > > > > ++({                                            \
> > > > > > > > ++      typeof(x) __val = READ_ONCE(x);         \
> > > > > > > > ++      smp_read_barrier_depends();             \
> > > > > > > > ++      __val;                                  \
> > > > > > > > ++})
> > > > > > > > ++#endif
> > > > > > > > ++
> > > > > > > > + #endif /* _LTTNG_WRAPPER_COMPILER_H */
> > > > > > > > +diff --git a/wrapper/trace-clock.h b/wrapper/trace-clock.h
> > > > > > > > +index 9f4e366..187fc82 100644
> > > > > > > > +--- a/wrapper/trace-clock.h
> > > > > > > > ++++ b/wrapper/trace-clock.h
> > > > > > > > +@@ -160,33 +160,30 @@ static inline void put_trace_clock(void)
> > > > > > > > +
> > > > > > > > + static inline u64 trace_clock_read64(void)
> > > > > > > > + {
> > > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > > +
> > > > > > > > +       if (likely(!ltc)) {
> > > > > > > > +               return trace_clock_read64_monotonic();
> > > > > > > > +       } else {
> > > > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > > > +               return ltc->read64();
> > > > > > > > +       }
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > + static inline u64 trace_clock_freq(void)
> > > > > > > > + {
> > > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > > +
> > > > > > > > +       if (!ltc) {
> > > > > > > > +               return trace_clock_freq_monotonic();
> > > > > > > > +       } else {
> > > > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > > > +               return ltc->freq();
> > > > > > > > +       }
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > + static inline int trace_clock_uuid(char *uuid)
> > > > > > > > + {
> > > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > > +
> > > > > > > > +-      read_barrier_depends(); /* load ltc before content */
> > > > > > > > +       /* Use default UUID cb when NULL */
> > > > > > > > +       if (!ltc || !ltc->uuid) {
> > > > > > > > +               return trace_clock_uuid_monotonic(uuid);
> > > > > > > > +@@ -197,24 +194,22 @@ static inline int trace_clock_uuid(char *uuid)
> > > > > > > > +
> > > > > > > > + static inline const char *trace_clock_name(void)
> > > > > > > > + {
> > > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > > +
> > > > > > > > +       if (!ltc) {
> > > > > > > > +               return trace_clock_name_monotonic();
> > > > > > > > +       } else {
> > > > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > > > +               return ltc->name();
> > > > > > > > +       }
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > + static inline const char *trace_clock_description(void)
> > > > > > > > + {
> > > > > > > > +-      struct lttng_trace_clock *ltc = READ_ONCE(lttng_trace_clock);
> > > > > > > > ++      struct lttng_trace_clock *ltc = LTTNG_READ_ONCE(lttng_trace_clock);
> > > > > > > > +
> > > > > > > > +       if (!ltc) {
> > > > > > > > +               return trace_clock_description_monotonic();
> > > > > > > > +       } else {
> > > > > > > > +-              read_barrier_depends(); /* load ltc before content */
> > > > > > > > +               return ltc->description();
> > > > > > > > +       }
> > > > > > > > + }
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..2843c9cb62
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch
> > > > > > > > @@ -0,0 +1,59 @@
> > > > > > > > +From eae02feb58064eee5ce15a9f6bdffd107c47da05 Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Date: Mon, 31 Aug 2020 11:41:38 -0400
> > > > > > > > +Subject: [PATCH 07/10] fix: writeback: Drop I_DIRTY_TIME_EXPIRE (v5.9)
> > > > > > > > +
> > > > > > > > +See upstream commit:
> > > > > > > > +
> > > > > > > > +  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.
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +Change-Id: I92e37c2ff3ec36d431e8f9de5c8e37c5a2da55ea
> > > > > > > > +---
> > > > > > > > + instrumentation/events/lttng-module/writeback.h | 16 +++++++++++++++-
> > > > > > > > + 1 file changed, 15 insertions(+), 1 deletion(-)
> > > > > > > > +
> > > > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > > > +index affb4eb..ece67ad 100644
> > > > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > > > +@@ -46,7 +46,21 @@ static inline struct backing_dev_info *lttng_inode_to_bdi(struct inode *inode)
> > > > > > > > +
> > > > > > > > + #endif
> > > > > > > > +
> > > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > > ++#define show_inode_state(state)                                       \
> > > > > > > > ++      __print_flags(state, "|",                               \
> > > > > > > > ++              {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > > > > > ++              {I_DIRTY_DATASYNC,      "I_DIRTY_DATASYNC"},    \
> > > > > > > > ++              {I_DIRTY_PAGES,         "I_DIRTY_PAGES"},       \
> > > > > > > > ++              {I_NEW,                 "I_NEW"},               \
> > > > > > > > ++              {I_WILL_FREE,           "I_WILL_FREE"},         \
> > > > > > > > ++              {I_FREEING,             "I_FREEING"},           \
> > > > > > > > ++              {I_CLEAR,               "I_CLEAR"},             \
> > > > > > > > ++              {I_SYNC,                "I_SYNC"},              \
> > > > > > > > ++              {I_DIRTY_TIME,          "I_DIRTY_TIME"},        \
> > > > > > > > ++              {I_REFERENCED,          "I_REFERENCED"}         \
> > > > > > > > ++      )
> > > > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(4,0,0))
> > > > > > > > + #define show_inode_state(state)                                       \
> > > > > > > > +       __print_flags(state, "|",                               \
> > > > > > > > +               {I_DIRTY_SYNC,          "I_DIRTY_SYNC"},        \
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..7a0d9a38b8
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch
> > > > > > > > @@ -0,0 +1,117 @@
> > > > > > > > +From 87b2affc3eb06f3fb2d0923f18af37713eb6814b Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Date: Mon, 31 Aug 2020 14:16:01 -0400
> > > > > > > > +Subject: [PATCH 08/10] fix: writeback: Fix sync livelock due to b_dirty_time
> > > > > > > > + processing (v5.9)
> > > > > > > > +
> > > > > > > > +See upstream commit:
> > > > > > > > +
> > > > > > > > +  commit f9cae926f35e8230330f28c7b743ad088611a8de
> > > > > > > > +  Author: Jan Kara <jack@suse.cz>
> > > > > > > > +  Date:   Fri May 29 16:08:58 2020 +0200
> > > > > > > > +
> > > > > > > > +    writeback: Fix sync livelock due to b_dirty_time processing
> > > > > > > > +
> > > > > > > > +    When we are processing writeback for sync(2), move_expired_inodes()
> > > > > > > > +    didn't set any inode expiry value (older_than_this). This can result in
> > > > > > > > +    writeback never completing if there's steady stream of inodes added to
> > > > > > > > +    b_dirty_time list as writeback rechecks dirty lists after each writeback
> > > > > > > > +    round whether there's more work to be done. Fix the problem by using
> > > > > > > > +    sync(2) start time is inode expiry value when processing b_dirty_time
> > > > > > > > +    list similarly as for ordinarily dirtied inodes. This requires some
> > > > > > > > +    refactoring of older_than_this handling which simplifies the code
> > > > > > > > +    noticeably as a bonus.
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Change-Id: I8b894b13ccc14d9b8983ee4c2810a927c319560b
> > > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +---
> > > > > > > > + .../events/lttng-module/writeback.h           | 39 ++++++++++++-------
> > > > > > > > + 1 file changed, 26 insertions(+), 13 deletions(-)
> > > > > > > > +
> > > > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > > > +index ece67ad..e9018dd 100644
> > > > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > > > +@@ -384,34 +384,48 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > > > > > + #endif
> > > > > > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > > > > > +
> > > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > > > > > ++               struct wb_writeback_work *work,
> > > > > > > > ++               unsigned long dirtied_before,
> > > > > > > > ++               int moved),
> > > > > > > > ++      TP_ARGS(wb, work, dirtied_before, moved),
> > > > > > > > ++      TP_FIELDS(
> > > > > > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > > > ++              ctf_integer(unsigned long, older, dirtied_before)
> > > > > > > > ++              ctf_integer(int, moved, moved)
> > > > > > > > ++      )
> > > > > > > > ++)
> > > > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > > +                struct wb_writeback_work *work,
> > > > > > > > +-#else
> > > > > > > > +-               unsigned long *older_than_this,
> > > > > > > > +-#endif
> > > > > > > > +                int moved),
> > > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > > +       TP_ARGS(wb, work, moved),
> > > > > > > > +-#else
> > > > > > > > ++      TP_FIELDS(
> > > > > > > > ++              ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > > > ++              ctf_integer(int, moved, moved)
> > > > > > > > ++      )
> > > > > > > > ++)
> > > > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > > > ++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > > > ++      TP_PROTO(struct bdi_writeback *wb,
> > > > > > > > ++               unsigned long *older_than_this,
> > > > > > > > ++               int moved),
> > > > > > > > +       TP_ARGS(wb, older_than_this, moved),
> > > > > > > > +-#endif
> > > > > > > > +       TP_FIELDS(
> > > > > > > > +               ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
> > > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > > +-#else
> > > > > > > > +               ctf_integer(unsigned long, older,
> > > > > > > > +                       older_than_this ? *older_than_this : 0)
> > > > > > > > +               ctf_integer(long, age,
> > > > > > > > +                       older_than_this ?
> > > > > > > > +                               (jiffies - *older_than_this) * 1000 / HZ
> > > > > > > > +                               : -1)
> > > > > > > > +-#endif
> > > > > > > > +               ctf_integer(int, moved, moved)
> > > > > > > > +       )
> > > > > > > > + )
> > > > > > > > ++#endif
> > > > > > > > +
> > > > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0))
> > > > > > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > > > +@@ -460,7 +474,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > > > +               ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
> > > > > > > > +       )
> > > > > > > > + )
> > > > > > > > +-#else
> > > > > > > > ++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
> > > > > > > > + LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > > > +
> > > > > > > > +       writeback_global_dirty_state,
> > > > > > > > +@@ -485,7 +499,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
> > > > > > > > +       )
> > > > > > > > + )
> > > > > > > > + #endif
> > > > > > > > +-#endif
> > > > > > > > +
> > > > > > > > + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
> > > > > > > > +
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..346e1d63ad
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch
> > > > > > > > @@ -0,0 +1,52 @@
> > > > > > > > +From b74b25f349e92d7b5bdc8684e406d6a889f13773 Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Date: Fri, 4 Sep 2020 11:52:51 -0400
> > > > > > > > +Subject: [PATCH 09/10] fix: version ranges for ext4_discard_preallocations and
> > > > > > > > + writeback_queue_io
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +Change-Id: Id4fa53cb2e713cbda651e1a75deed91013115592
> > > > > > > > +---
> > > > > > > > + instrumentation/events/lttng-module/ext4.h      | 3 ++-
> > > > > > > > + instrumentation/events/lttng-module/writeback.h | 8 +++++++-
> > > > > > > > + 2 files changed, 9 insertions(+), 2 deletions(-)
> > > > > > > > +
> > > > > > > > +diff --git a/instrumentation/events/lttng-module/ext4.h b/instrumentation/events/lttng-module/ext4.h
> > > > > > > > +index 4476abb..b172c8d 100644
> > > > > > > > +--- a/instrumentation/events/lttng-module/ext4.h
> > > > > > > > ++++ b/instrumentation/events/lttng-module/ext4.h
> > > > > > > > +@@ -460,7 +460,8 @@ LTTNG_TRACEPOINT_EVENT(ext4_mb_release_group_pa,
> > > > > > > > + )
> > > > > > > > + #endif
> > > > > > > > +
> > > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > > > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0))
> > > > > > > > + LTTNG_TRACEPOINT_EVENT(ext4_discard_preallocations,
> > > > > > > > +       TP_PROTO(struct inode *inode, unsigned int len, unsigned int needed),
> > > > > > > > +
> > > > > > > > +diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
> > > > > > > > +index e9018dd..09637d7 100644
> > > > > > > > +--- a/instrumentation/events/lttng-module/writeback.h
> > > > > > > > ++++ b/instrumentation/events/lttng-module/writeback.h
> > > > > > > > +@@ -384,7 +384,13 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
> > > > > > > > + #endif
> > > > > > > > + LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
> > > > > > > > +
> > > > > > > > +-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0))
> > > > > > > > ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
> > > > > > > > ++      LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
> > > > > > > > ++      LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
> > > > > > > > ++      LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
> > > > > > > > ++      LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
> > > > > > > > ++      LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
> > > > > > > > ++      LTTNG_KERNEL_RANGE(4,4,235, 4,5,0))
> > > > > > > > + LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
> > > > > > > > +       TP_PROTO(struct bdi_writeback *wb,
> > > > > > > > +                struct wb_writeback_work *work,
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > > > > new file mode 100644
> > > > > > > > index 0000000000..a16750ddb3
> > > > > > > > --- /dev/null
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules/0010-Fix-system-call-filter-table.patch
> > > > > > > > @@ -0,0 +1,918 @@
> > > > > > > > +From ad594e3a953db1b0c3c059fde45b5a5494f6be78 Mon Sep 17 00:00:00 2001
> > > > > > > > +From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +Date: Tue, 28 Jan 2020 16:02:44 -0500
> > > > > > > > +Subject: [PATCH 10/10] Fix: system call filter table
> > > > > > > > +
> > > > > > > > +The system call filter table has effectively been unused for a long
> > > > > > > > +time due to system call name prefix mismatch. This means the overhead of
> > > > > > > > +selective system call tracing was larger than it should have been because
> > > > > > > > +the event payload preparation would be done for all system calls as soon
> > > > > > > > +as a single system call is traced.
> > > > > > > > +
> > > > > > > > +However, fixing this underlying issue unearths several issues that crept
> > > > > > > > +unnoticed when the "enabler" concept was introduced (after the original
> > > > > > > > +implementation of the system call filter table).
> > > > > > > > +
> > > > > > > > +Here is a list of the issues which are resolved here:
> > > > > > > > +
> > > > > > > > +- Split lttng_syscalls_unregister into an unregister and destroy
> > > > > > > > +  function, thus awaiting for a grace period (and therefore quiescence
> > > > > > > > +  of the users) after unregistering the system call tracepoints before
> > > > > > > > +  freeing the system call filter data structures. This effectively fixes
> > > > > > > > +  a use-after-free.
> > > > > > > > +
> > > > > > > > +- The state for enabling "all" system calls vs enabling specific system
> > > > > > > > +  calls (and sequences of enable-disable) was incorrect with respect to
> > > > > > > > +  the "enablers" semantic. This is solved by always tracking the
> > > > > > > > +  bitmap of enabled system calls, and keeping this bitmap even when
> > > > > > > > +  enabling all system calls. The sc_filter is now always allocated
> > > > > > > > +  before system call tracing is registered to tracepoints, which means
> > > > > > > > +  it does not need to be RCU dereferenced anymore.
> > > > > > > > +
> > > > > > > > +Padding fields in the ABI are reserved to select whether to:
> > > > > > > > +
> > > > > > > > +- Trace either native or compat system call (or both, which is the
> > > > > > > > +  behavior currently implemented),
> > > > > > > > +- Trace either system call entry or exit (or both, which is the
> > > > > > > > +  behavior currently implemented),
> > > > > > > > +- Select the system call to trace by name (behavior currently
> > > > > > > > +  implemented) or by system call number,
> > > > > > > > +
> > > > > > > > +Upstream-Status: Backport
> > > > > > > > +
> > > > > > > > +Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> > > > > > > > +---
> > > > > > > > + lttng-abi.c      |  43 ++++++
> > > > > > > > + lttng-abi.h      |  26 ++++
> > > > > > > > + lttng-events.c   | 112 +++++++++++++--
> > > > > > > > + lttng-events.h   |  31 ++++-
> > > > > > > > + lttng-syscalls.c | 348 +++++++++++++++++++++++++----------------------
> > > > > > > > + 5 files changed, 380 insertions(+), 180 deletions(-)
> > > > > > > > +
> > > > > > > > +diff --git a/lttng-abi.c b/lttng-abi.c
> > > > > > > > +index 64ea99d..b33879d 100644
> > > > > > > > +--- a/lttng-abi.c
> > > > > > > > ++++ b/lttng-abi.c
> > > > > > > > +@@ -1264,6 +1264,46 @@ nomem:
> > > > > > > > +       return ret;
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > ++static
> > > > > > > > ++int lttng_abi_validate_event_param(struct lttng_kernel_event *event_param)
> > > > > > > > ++{
> > > > > > > > ++      /* Limit ABI to implemented features. */
> > > > > > > > ++      switch (event_param->instrumentation) {
> > > > > > > > ++      case LTTNG_KERNEL_SYSCALL:
> > > > > > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > > > ++                      break;
> > > > > > > > ++              default:
> > > > > > > > ++                      return -EINVAL;
> > > > > > > > ++              }
> > > > > > > > ++              switch (event_param->u.syscall.abi) {
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > > > ++                      break;
> > > > > > > > ++              default:
> > > > > > > > ++                      return -EINVAL;
> > > > > > > > ++              }
> > > > > > > > ++              switch (event_param->u.syscall.match) {
> > > > > > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > > > > > ++                      break;
> > > > > > > > ++              default:
> > > > > > > > ++                      return -EINVAL;
> > > > > > > > ++              }
> > > > > > > > ++              break;
> > > > > > > > ++
> > > > > > > > ++      case LTTNG_KERNEL_TRACEPOINT:   /* Fallthrough */
> > > > > > > > ++      case LTTNG_KERNEL_KPROBE:       /* Fallthrough */
> > > > > > > > ++      case LTTNG_KERNEL_KRETPROBE:    /* Fallthrough */
> > > > > > > > ++      case LTTNG_KERNEL_NOOP:         /* Fallthrough */
> > > > > > > > ++      case LTTNG_KERNEL_UPROBE:
> > > > > > > > ++              break;
> > > > > > > > ++
> > > > > > > > ++      case LTTNG_KERNEL_FUNCTION:     /* Fallthrough */
> > > > > > > > ++      default:
> > > > > > > > ++              return -EINVAL;
> > > > > > > > ++      }
> > > > > > > > ++      return 0;
> > > > > > > > ++}
> > > > > > > > ++
> > > > > > > > + static
> > > > > > > > + int lttng_abi_create_event(struct file *channel_file,
> > > > > > > > +                          struct lttng_kernel_event *event_param)
> > > > > > > > +@@ -1305,6 +1345,9 @@ int lttng_abi_create_event(struct file *channel_file,
> > > > > > > > +               ret = -EOVERFLOW;
> > > > > > > > +               goto refcount_error;
> > > > > > > > +       }
> > > > > > > > ++      ret = lttng_abi_validate_event_param(event_param);
> > > > > > > > ++      if (ret)
> > > > > > > > ++              goto event_error;
> > > > > > > > +       if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
> > > > > > > > +                       || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
> > > > > > > > +               struct lttng_enabler *enabler;
> > > > > > > > +diff --git a/lttng-abi.h b/lttng-abi.h
> > > > > > > > +index 1d356ab..51d60e5 100644
> > > > > > > > +--- a/lttng-abi.h
> > > > > > > > ++++ b/lttng-abi.h
> > > > > > > > +@@ -90,6 +90,31 @@ struct lttng_kernel_event_callsite {
> > > > > > > > +       } u;
> > > > > > > > + } __attribute__((packed));
> > > > > > > > +
> > > > > > > > ++enum lttng_kernel_syscall_entryexit {
> > > > > > > > ++      LTTNG_KERNEL_SYSCALL_ENTRYEXIT = 0,
> > > > > > > > ++      LTTNG_KERNEL_SYSCALL_ENTRY = 1,         /* Not implemented. */
> > > > > > > > ++      LTTNG_KERNEL_SYSCALL_EXIT = 2,          /* Not implemented. */
> > > > > > > > ++};
> > > > > > > > ++
> > > > > > > > ++enum lttng_kernel_syscall_abi {
> > > > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_ALL = 0,
> > > > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_NATIVE = 1,    /* Not implemented. */
> > > > > > > > ++      LTTNG_KERNEL_SYSCALL_ABI_COMPAT = 2,    /* Not implemented. */
> > > > > > > > ++};
> > > > > > > > ++
> > > > > > > > ++enum lttng_kernel_syscall_match {
> > > > > > > > ++      LTTNG_SYSCALL_MATCH_NAME = 0,
> > > > > > > > ++      LTTNG_SYSCALL_MATCH_NR = 1,             /* Not implemented. */
> > > > > > > > ++};
> > > > > > > > ++
> > > > > > > > ++struct lttng_kernel_syscall {
> > > > > > > > ++      uint8_t entryexit;      /* enum lttng_kernel_syscall_entryexit */
> > > > > > > > ++      uint8_t abi;            /* enum lttng_kernel_syscall_abi */
> > > > > > > > ++      uint8_t match;          /* enum lttng_kernel_syscall_match */
> > > > > > > > ++      uint8_t padding;
> > > > > > > > ++      uint32_t nr;            /* For LTTNG_SYSCALL_MATCH_NR */
> > > > > > > > ++} __attribute__((packed));
> > > > > > > > ++
> > > > > > > > + /*
> > > > > > > > +  * For syscall tracing, name = "*" means "enable all".
> > > > > > > > +  */
> > > > > > > > +@@ -106,6 +131,7 @@ struct lttng_kernel_event {
> > > > > > > > +               struct lttng_kernel_kprobe kprobe;
> > > > > > > > +               struct lttng_kernel_function_tracer ftrace;
> > > > > > > > +               struct lttng_kernel_uprobe uprobe;
> > > > > > > > ++              struct lttng_kernel_syscall syscall;
> > > > > > > > +               char padding[LTTNG_KERNEL_EVENT_PADDING2];
> > > > > > > > +       } u;
> > > > > > > > + } __attribute__((packed));
> > > > > > > > +diff --git a/lttng-events.c b/lttng-events.c
> > > > > > > > +index d719294..4c0b04a 100644
> > > > > > > > +--- a/lttng-events.c
> > > > > > > > ++++ b/lttng-events.c
> > > > > > > > +@@ -201,6 +201,10 @@ void lttng_session_destroy(struct lttng_session *session)
> > > > > > > > +               WARN_ON(ret);
> > > > > > > > +       }
> > > > > > > > +       synchronize_trace();    /* Wait for in-flight events to complete */
> > > > > > > > ++      list_for_each_entry(chan, &session->chan, list) {
> > > > > > > > ++              ret = lttng_syscalls_destroy(chan);
> > > > > > > > ++              WARN_ON(ret);
> > > > > > > > ++      }
> > > > > > > > +       list_for_each_entry_safe(enabler, tmpenabler,
> > > > > > > > +                       &session->enablers_head, node)
> > > > > > > > +               lttng_enabler_destroy(enabler);
> > > > > > > > +@@ -740,6 +744,28 @@ struct lttng_event *_lttng_event_create(struct lttng_channel *chan,
> > > > > > > > +               event->enabled = 0;
> > > > > > > > +               event->registered = 0;
> > > > > > > > +               event->desc = event_desc;
> > > > > > > > ++              switch (event_param->u.syscall.entryexit) {
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > > > ++                      ret = -EINVAL;
> > > > > > > > ++                      goto register_error;
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > > > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_ENTRY;
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > > > > > ++                      event->u.syscall.entryexit = LTTNG_SYSCALL_EXIT;
> > > > > > > > ++                      break;
> > > > > > > > ++              }
> > > > > > > > ++              switch (event_param->u.syscall.abi) {
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > > > ++                      ret = -EINVAL;
> > > > > > > > ++                      goto register_error;
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > > > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_NATIVE;
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > > > > > ++                      event->u.syscall.abi = LTTNG_SYSCALL_ABI_COMPAT;
> > > > > > > > ++                      break;
> > > > > > > > ++              }
> > > > > > > > +               if (!event->desc) {
> > > > > > > > +                       ret = -EINVAL;
> > > > > > > > +                       goto register_error;
> > > > > > > > +@@ -826,8 +852,7 @@ void register_event(struct lttng_event *event)
> > > > > > > > +                                                 event);
> > > > > > > > +               break;
> > > > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > > > +-              ret = lttng_syscall_filter_enable(event->chan,
> > > > > > > > +-                      desc->name);
> > > > > > > > ++              ret = lttng_syscall_filter_enable(event->chan, event);
> > > > > > > > +               break;
> > > > > > > > +       case LTTNG_KERNEL_KPROBE:
> > > > > > > > +       case LTTNG_KERNEL_UPROBE:
> > > > > > > > +@@ -870,8 +895,7 @@ int _lttng_event_unregister(struct lttng_event *event)
> > > > > > > > +               ret = 0;
> > > > > > > > +               break;
> > > > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > > > +-              ret = lttng_syscall_filter_disable(event->chan,
> > > > > > > > +-                      desc->name);
> > > > > > > > ++              ret = lttng_syscall_filter_disable(event->chan, event);
> > > > > > > > +               break;
> > > > > > > > +       case LTTNG_KERNEL_NOOP:
> > > > > > > > +               ret = 0;
> > > > > > > > +@@ -1203,39 +1227,87 @@ int lttng_desc_match_enabler(const struct lttng_event_desc *desc,
> > > > > > > > +               struct lttng_enabler *enabler)
> > > > > > > > + {
> > > > > > > > +       const char *desc_name, *enabler_name;
> > > > > > > > ++      bool compat = false, entry = false;
> > > > > > > > +
> > > > > > > > +       enabler_name = enabler->event_param.name;
> > > > > > > > +       switch (enabler->event_param.instrumentation) {
> > > > > > > > +       case LTTNG_KERNEL_TRACEPOINT:
> > > > > > > > +               desc_name = desc->name;
> > > > > > > > ++              switch (enabler->type) {
> > > > > > > > ++              case LTTNG_ENABLER_STAR_GLOB:
> > > > > > > > ++                      return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > > > ++              case LTTNG_ENABLER_NAME:
> > > > > > > > ++                      return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > > > ++              default:
> > > > > > > > ++                      return -EINVAL;
> > > > > > > > ++              }
> > > > > > > > +               break;
> > > > > > > > +       case LTTNG_KERNEL_SYSCALL:
> > > > > > > > +               desc_name = desc->name;
> > > > > > > > +-              if (!strncmp(desc_name, "compat_", strlen("compat_")))
> > > > > > > > ++              if (!strncmp(desc_name, "compat_", strlen("compat_"))) {
> > > > > > > > +                       desc_name += strlen("compat_");
> > > > > > > > ++                      compat = true;
> > > > > > > > ++              }
> > > > > > > > +               if (!strncmp(desc_name, "syscall_exit_",
> > > > > > > > +                               strlen("syscall_exit_"))) {
> > > > > > > > +                       desc_name += strlen("syscall_exit_");
> > > > > > > > +               } else if (!strncmp(desc_name, "syscall_entry_",
> > > > > > > > +                               strlen("syscall_entry_"))) {
> > > > > > > > +                       desc_name += strlen("syscall_entry_");
> > > > > > > > ++                      entry = true;
> > > > > > > > +               } else {
> > > > > > > > +                       WARN_ON_ONCE(1);
> > > > > > > > +                       return -EINVAL;
> > > > > > > > +               }
> > > > > > > > ++              switch (enabler->event_param.u.syscall.entryexit) {
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRYEXIT:
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ENTRY:
> > > > > > > > ++                      if (!entry)
> > > > > > > > ++                              return 0;
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_EXIT:
> > > > > > > > ++                      if (entry)
> > > > > > > > ++                              return 0;
> > > > > > > > ++                      break;
> > > > > > > > ++              default:
> > > > > > > > ++                      return -EINVAL;
> > > > > > > > ++              }
> > > > > > > > ++              switch (enabler->event_param.u.syscall.abi) {
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_ALL:
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_NATIVE:
> > > > > > > > ++                      if (compat)
> > > > > > > > ++                              return 0;
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_KERNEL_SYSCALL_ABI_COMPAT:
> > > > > > > > ++                      if (!compat)
> > > > > > > > ++                              return 0;
> > > > > > > > ++                      break;
> > > > > > > > ++              default:
> > > > > > > > ++                      return -EINVAL;
> > > > > > > > ++              }
> > > > > > > > ++              switch (enabler->event_param.u.syscall.match) {
> > > > > > > > ++              case LTTNG_SYSCALL_MATCH_NAME:
> > > > > > > > ++                      switch (enabler->type) {
> > > > > > > > ++                      case LTTNG_ENABLER_STAR_GLOB:
> > > > > > > > ++                              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > > > ++                      case LTTNG_ENABLER_NAME:
> > > > > > > > ++                              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > > > ++                      default:
> > > > > > > > ++                              return -EINVAL;
> > > > > > > > ++                      }
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_SYSCALL_MATCH_NR:
> > > > > > > > ++                      return -EINVAL; /* Not implemented. */
> > > > > > > > ++              default:
> > > > > > > > ++                      return -EINVAL;
> > > > > > > > ++              }
> > > > > > > > +               break;
> > > > > > > > +       default:
> > > > > > > > +               WARN_ON_ONCE(1);
> > > > > > > > +               return -EINVAL;
> > > > > > > > +       }
> > > > > > > > +-      switch (enabler->type) {
> > > > > > > > +-      case LTTNG_ENABLER_STAR_GLOB:
> > > > > > > > +-              return lttng_match_enabler_star_glob(desc_name, enabler_name);
> > > > > > > > +-      case LTTNG_ENABLER_NAME:
> > > > > > > > +-              return lttng_match_enabler_name(desc_name, enabler_name);
> > > > > > > > +-      default:
> > > > > > > > +-              return -EINVAL;
> > > > > > > > +-      }
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > + static
> > > > > > > > +@@ -1361,9 +1433,21 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
> > > > > > > > + static
> > > > > > > > + int lttng_enabler_ref_events(struct lttng_enabler *enabler)
> > > > > > > > + {
> > > > > > > > +-      struct lttng_session *session = enabler->chan->session;
> > > > > > > > ++      struct lttng_channel *chan = enabler->chan;
> > > > > > > > ++      struct lttng_session *session = chan->session;
> > > > > > > > +       struct lttng_event *event;
> > > > > > > > +
> > > > > > > > ++      if (enabler->event_param.instrumentation == LTTNG_KERNEL_SYSCALL &&
> > > > > > > > ++                      enabler->event_param.u.syscall.entryexit == LTTNG_KERNEL_SYSCALL_ENTRYEXIT &&
> > > > > > > > ++                      enabler->event_param.u.syscall.abi == LTTNG_KERNEL_SYSCALL_ABI_ALL &&
> > > > > > > > ++                      enabler->event_param.u.syscall.match == LTTNG_SYSCALL_MATCH_NAME &&
> > > > > > > > ++                      !strcmp(enabler->event_param.name, "*")) {
> > > > > > > > ++              if (enabler->enabled)
> > > > > > > > ++                      WRITE_ONCE(chan->syscall_all, 1);
> > > > > > > > ++              else
> > > > > > > > ++                      WRITE_ONCE(chan->syscall_all, 0);
> > > > > > > > ++      }
> > > > > > > > ++
> > > > > > > > +       /* First ensure that probe events are created for this enabler. */
> > > > > > > > +       lttng_create_event_if_missing(enabler);
> > > > > > > > +
> > > > > > > > +diff --git a/lttng-events.h b/lttng-events.h
> > > > > > > > +index a36a312..d4d9976 100644
> > > > > > > > +--- a/lttng-events.h
> > > > > > > > ++++ b/lttng-events.h
> > > > > > > > +@@ -292,6 +292,16 @@ struct lttng_uprobe_handler {
> > > > > > > > +       struct list_head node;
> > > > > > > > + };
> > > > > > > > +
> > > > > > > > ++enum lttng_syscall_entryexit {
> > > > > > > > ++      LTTNG_SYSCALL_ENTRY,
> > > > > > > > ++      LTTNG_SYSCALL_EXIT,
> > > > > > > > ++};
> > > > > > > > ++
> > > > > > > > ++enum lttng_syscall_abi {
> > > > > > > > ++      LTTNG_SYSCALL_ABI_NATIVE,
> > > > > > > > ++      LTTNG_SYSCALL_ABI_COMPAT,
> > > > > > > > ++};
> > > > > > > > ++
> > > > > > > > + /*
> > > > > > > > +  * lttng_event structure is referred to by the tracing fast path. It must be
> > > > > > > > +  * kept small.
> > > > > > > > +@@ -318,6 +328,11 @@ struct lttng_event {
> > > > > > > > +                       struct inode *inode;
> > > > > > > > +                       struct list_head head;
> > > > > > > > +               } uprobe;
> > > > > > > > ++              struct {
> > > > > > > > ++                      char *syscall_name;
> > > > > > > > ++                      enum lttng_syscall_entryexit entryexit;
> > > > > > > > ++                      enum lttng_syscall_abi abi;
> > > > > > > > ++              } syscall;
> > > > > > > > +       } u;
> > > > > > > > +       struct list_head list;          /* Event list in session */
> > > > > > > > +       unsigned int metadata_dumped:1;
> > > > > > > > +@@ -457,10 +472,10 @@ struct lttng_channel {
> > > > > > > > +       struct lttng_syscall_filter *sc_filter;
> > > > > > > > +       int header_type;                /* 0: unset, 1: compact, 2: large */
> > > > > > > > +       enum channel_type channel_type;
> > > > > > > > ++      int syscall_all;
> > > > > > > > +       unsigned int metadata_dumped:1,
> > > > > > > > +               sys_enter_registered:1,
> > > > > > > > +               sys_exit_registered:1,
> > > > > > > > +-              syscall_all:1,
> > > > > > > > +               tstate:1;               /* Transient enable state */
> > > > > > > > + };
> > > > > > > > +
> > > > > > > > +@@ -653,10 +668,11 @@ void lttng_clock_unref(void);
> > > > > > > > + #if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
> > > > > > > > + int lttng_syscalls_register(struct lttng_channel *chan, void *filter);
> > > > > > > > + int lttng_syscalls_unregister(struct lttng_channel *chan);
> > > > > > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan);
> > > > > > > > + int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > > > +-              const char *name);
> > > > > > > > ++              struct lttng_event *event);
> > > > > > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > > > +-              const char *name);
> > > > > > > > ++              struct lttng_event *event);
> > > > > > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask);
> > > > > > > > + #else
> > > > > > > > +@@ -670,14 +686,19 @@ static inline int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > > > > > +       return 0;
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > ++static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > > > > > ++{
> > > > > > > > ++      return 0;
> > > > > > > > ++}
> > > > > > > > ++
> > > > > > > > + static inline int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > > > +-              const char *name)
> > > > > > > > ++              struct lttng_event *event);
> > > > > > > > + {
> > > > > > > > +       return -ENOSYS;
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > + static inline int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > > > +-              const char *name)
> > > > > > > > ++              struct lttng_event *event);
> > > > > > > > + {
> > > > > > > > +       return -ENOSYS;
> > > > > > > > + }
> > > > > > > > +diff --git a/lttng-syscalls.c b/lttng-syscalls.c
> > > > > > > > +index 97f1ba9..26cead6 100644
> > > > > > > > +--- a/lttng-syscalls.c
> > > > > > > > ++++ b/lttng-syscalls.c
> > > > > > > > +@@ -367,8 +367,10 @@ const struct trace_syscall_entry compat_sc_exit_table[] = {
> > > > > > > > + #undef CREATE_SYSCALL_TABLE
> > > > > > > > +
> > > > > > > > + struct lttng_syscall_filter {
> > > > > > > > +-      DECLARE_BITMAP(sc, NR_syscalls);
> > > > > > > > +-      DECLARE_BITMAP(sc_compat, NR_compat_syscalls);
> > > > > > > > ++      DECLARE_BITMAP(sc_entry, NR_syscalls);
> > > > > > > > ++      DECLARE_BITMAP(sc_exit, NR_syscalls);
> > > > > > > > ++      DECLARE_BITMAP(sc_compat_entry, NR_compat_syscalls);
> > > > > > > > ++      DECLARE_BITMAP(sc_compat_exit, NR_compat_syscalls);
> > > > > > > > + };
> > > > > > > > +
> > > > > > > > + static void syscall_entry_unknown(struct lttng_event *event,
> > > > > > > > +@@ -391,29 +393,23 @@ void syscall_entry_probe(void *__data, struct pt_regs *regs, long id)
> > > > > > > > +       size_t table_len;
> > > > > > > > +
> > > > > > > > +       if (unlikely(in_compat_syscall())) {
> > > > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > > > +-
> > > > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > > > +-              if (filter) {
> > > > > > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > > > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > > > > > +-                              /* System call filtered out. */
> > > > > > > > +-                              return;
> > > > > > > > +-                      }
> > > > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > > ++
> > > > > > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_entry))) {
> > > > > > > > ++                      /* System call filtered out. */
> > > > > > > > ++                      return;
> > > > > > > > +               }
> > > > > > > > +               table = compat_sc_table;
> > > > > > > > +               table_len = ARRAY_SIZE(compat_sc_table);
> > > > > > > > +               unknown_event = chan->sc_compat_unknown;
> > > > > > > > +       } else {
> > > > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > > > +-
> > > > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > > > +-              if (filter) {
> > > > > > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > > > > > +-                              || !test_bit(id, filter->sc)) {
> > > > > > > > +-                              /* System call filtered out. */
> > > > > > > > +-                              return;
> > > > > > > > +-                      }
> > > > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > > ++
> > > > > > > > ++              if (id < 0 || id >= NR_syscalls
> > > > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_entry))) {
> > > > > > > > ++                      /* System call filtered out. */
> > > > > > > > ++                      return;
> > > > > > > > +               }
> > > > > > > > +               table = sc_table;
> > > > > > > > +               table_len = ARRAY_SIZE(sc_table);
> > > > > > > > +@@ -545,29 +541,23 @@ void syscall_exit_probe(void *__data, struct pt_regs *regs, long ret)
> > > > > > > > +
> > > > > > > > +       id = syscall_get_nr(current, regs);
> > > > > > > > +       if (unlikely(in_compat_syscall())) {
> > > > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > > > +-
> > > > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > > > +-              if (filter) {
> > > > > > > > +-                      if (id < 0 || id >= NR_compat_syscalls
> > > > > > > > +-                              || !test_bit(id, filter->sc_compat)) {
> > > > > > > > +-                              /* System call filtered out. */
> > > > > > > > +-                              return;
> > > > > > > > +-                      }
> > > > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > > ++
> > > > > > > > ++              if (id < 0 || id >= NR_compat_syscalls
> > > > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_compat_exit))) {
> > > > > > > > ++                      /* System call filtered out. */
> > > > > > > > ++                      return;
> > > > > > > > +               }
> > > > > > > > +               table = compat_sc_exit_table;
> > > > > > > > +               table_len = ARRAY_SIZE(compat_sc_exit_table);
> > > > > > > > +               unknown_event = chan->compat_sc_exit_unknown;
> > > > > > > > +       } else {
> > > > > > > > +-              struct lttng_syscall_filter *filter;
> > > > > > > > +-
> > > > > > > > +-              filter = lttng_rcu_dereference(chan->sc_filter);
> > > > > > > > +-              if (filter) {
> > > > > > > > +-                      if (id < 0 || id >= NR_syscalls
> > > > > > > > +-                              || !test_bit(id, filter->sc)) {
> > > > > > > > +-                              /* System call filtered out. */
> > > > > > > > +-                              return;
> > > > > > > > +-                      }
> > > > > > > > ++              struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > > ++
> > > > > > > > ++              if (id < 0 || id >= NR_syscalls
> > > > > > > > ++                      || (!READ_ONCE(chan->syscall_all) && !test_bit(id, filter->sc_exit))) {
> > > > > > > > ++                      /* System call filtered out. */
> > > > > > > > ++                      return;
> > > > > > > > +               }
> > > > > > > > +               table = sc_exit_table;
> > > > > > > > +               table_len = ARRAY_SIZE(sc_exit_table);
> > > > > > > > +@@ -713,27 +703,23 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
> > > > > > > > +               memset(&ev, 0, sizeof(ev));
> > > > > > > > +               switch (type) {
> > > > > > > > +               case SC_TYPE_ENTRY:
> > > > > > > > +-                      strncpy(ev.name, SYSCALL_ENTRY_STR,
> > > > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > > > +                       break;
> > > > > > > > +               case SC_TYPE_EXIT:
> > > > > > > > +-                      strncpy(ev.name, SYSCALL_EXIT_STR,
> > > > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > > > +                       break;
> > > > > > > > +               case SC_TYPE_COMPAT_ENTRY:
> > > > > > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_ENTRY_STR,
> > > > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > > > +                       break;
> > > > > > > > +               case SC_TYPE_COMPAT_EXIT:
> > > > > > > > +-                      strncpy(ev.name, COMPAT_SYSCALL_EXIT_STR,
> > > > > > > > +-                              LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > +-                      break;
> > > > > > > > +-              default:
> > > > > > > > +-                      BUG_ON(1);
> > > > > > > > ++                      ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > > > ++                      ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > > > +                       break;
> > > > > > > > +               }
> > > > > > > > +-              strncat(ev.name, desc->name,
> > > > > > > > +-                      LTTNG_KERNEL_SYM_NAME_LEN - strlen(ev.name) - 1);
> > > > > > > > ++              strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > > +               chan_table[i] = _lttng_event_create(chan, &ev, filter,
> > > > > > > > +@@ -803,6 +789,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > > > +               chan->sc_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > > > +                                               desc,
> > > > > > > > +                                               ev.instrumentation);
> > > > > > > > +@@ -820,6 +808,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_ENTRY;
> > > > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > > > +               chan->sc_compat_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > > > +                                               desc,
> > > > > > > > +                                               ev.instrumentation);
> > > > > > > > +@@ -837,6 +827,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
> > > > > > > > +               chan->compat_sc_exit_unknown = _lttng_event_create(chan, &ev,
> > > > > > > > +                                               filter, desc,
> > > > > > > > +                                               ev.instrumentation);
> > > > > > > > +@@ -854,6 +846,8 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > > +               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
> > > > > > > > +               ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
> > > > > > > > +               ev.instrumentation = LTTNG_KERNEL_SYSCALL;
> > > > > > > > ++              ev.u.syscall.entryexit = LTTNG_KERNEL_SYSCALL_EXIT;
> > > > > > > > ++              ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_NATIVE;
> > > > > > > > +               chan->sc_exit_unknown = _lttng_event_create(chan, &ev, filter,
> > > > > > > > +                                               desc, ev.instrumentation);
> > > > > > > > +               WARN_ON_ONCE(!chan->sc_exit_unknown);
> > > > > > > > +@@ -883,6 +877,14 @@ int lttng_syscalls_register(struct lttng_channel *chan, void *filter)
> > > > > > > > +       if (ret)
> > > > > > > > +               return ret;
> > > > > > > > + #endif
> > > > > > > > ++
> > > > > > > > ++      if (!chan->sc_filter) {
> > > > > > > > ++              chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > > > ++                              GFP_KERNEL);
> > > > > > > > ++              if (!chan->sc_filter)
> > > > > > > > ++                      return -ENOMEM;
> > > > > > > > ++      }
> > > > > > > > ++
> > > > > > > > +       if (!chan->sys_enter_registered) {
> > > > > > > > +               ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
> > > > > > > > +                               (void *) syscall_entry_probe, chan);
> > > > > > > > +@@ -930,7 +932,11 @@ int lttng_syscalls_unregister(struct lttng_channel *chan)
> > > > > > > > +                       return ret;
> > > > > > > > +               chan->sys_exit_registered = 0;
> > > > > > > > +       }
> > > > > > > > +-      /* lttng_event destroy will be performed by lttng_session_destroy() */
> > > > > > > > ++      return 0;
> > > > > > > > ++}
> > > > > > > > ++
> > > > > > > > ++int lttng_syscalls_destroy(struct lttng_channel *chan)
> > > > > > > > ++{
> > > > > > > > +       kfree(chan->sc_table);
> > > > > > > > +       kfree(chan->sc_exit_table);
> > > > > > > > + #ifdef CONFIG_COMPAT
> > > > > > > > +@@ -993,136 +999,150 @@ uint32_t get_sc_tables_len(void)
> > > > > > > > +       return ARRAY_SIZE(sc_table) + ARRAY_SIZE(compat_sc_table);
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > +-int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > > > +-              const char *name)
> > > > > > > > ++static
> > > > > > > > ++const char *get_syscall_name(struct lttng_event *event)
> > > > > > > > + {
> > > > > > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > > > > > +-      struct lttng_syscall_filter *filter;
> > > > > > > > ++      size_t prefix_len = 0;
> > > > > > > > +
> > > > > > > > +-      WARN_ON_ONCE(!chan->sc_table);
> > > > > > > > ++      WARN_ON_ONCE(event->instrumentation != LTTNG_KERNEL_SYSCALL);
> > > > > > > > +
> > > > > > > > +-      if (!name) {
> > > > > > > > +-              /* Enable all system calls by removing filter */
> > > > > > > > +-              if (chan->sc_filter) {
> > > > > > > > +-                      filter = chan->sc_filter;
> > > > > > > > +-                      rcu_assign_pointer(chan->sc_filter, NULL);
> > > > > > > > +-                      synchronize_trace();
> > > > > > > > +-                      kfree(filter);
> > > > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > > ++                      prefix_len = strlen(SYSCALL_ENTRY_STR);
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_ENTRY_STR);
> > > > > > > > ++                      break;
> > > > > > > > +               }
> > > > > > > > +-              chan->syscall_all = 1;
> > > > > > > > +-              return 0;
> > > > > > > > +-      }
> > > > > > > > +-
> > > > > > > > +-      if (!chan->sc_filter) {
> > > > > > > > +-              if (chan->syscall_all) {
> > > > > > > > +-                      /*
> > > > > > > > +-                       * All syscalls are already enabled.
> > > > > > > > +-                       */
> > > > > > > > +-                      return -EEXIST;
> > > > > > > > ++              break;
> > > > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > > ++                      prefix_len = strlen(SYSCALL_EXIT_STR);
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > > ++                      prefix_len = strlen(COMPAT_SYSCALL_EXIT_STR);
> > > > > > > > ++                      break;
> > > > > > > > +               }
> > > > > > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > > > +-                              GFP_KERNEL);
> > > > > > > > +-              if (!filter)
> > > > > > > > +-                      return -ENOMEM;
> > > > > > > > +-      } else {
> > > > > > > > +-              filter = chan->sc_filter;
> > > > > > > > ++              break;
> > > > > > > > +       }
> > > > > > > > +-      syscall_nr = get_syscall_nr(name);
> > > > > > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > > > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > > > > > +-              ret = -ENOENT;
> > > > > > > > +-              goto error;
> > > > > > > > ++      WARN_ON_ONCE(prefix_len == 0);
> > > > > > > > ++      return event->desc->name + prefix_len;
> > > > > > > > ++}
> > > > > > > > ++
> > > > > > > > ++int lttng_syscall_filter_enable(struct lttng_channel *chan,
> > > > > > > > ++              struct lttng_event *event)
> > > > > > > > ++{
> > > > > > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > > ++      const char *syscall_name;
> > > > > > > > ++      unsigned long *bitmap;
> > > > > > > > ++      int syscall_nr;
> > > > > > > > ++
> > > > > > > > ++      WARN_ON_ONCE(!chan->sc_table);
> > > > > > > > ++
> > > > > > > > ++      syscall_name = get_syscall_name(event);
> > > > > > > > ++
> > > > > > > > ++      switch (event->u.syscall.abi) {
> > > > > > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > > > > > ++              break;
> > > > > > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > > > > > ++              break;
> > > > > > > > ++      default:
> > > > > > > > ++              return -EINVAL;
> > > > > > > > +       }
> > > > > > > > +-      if (syscall_nr >= 0) {
> > > > > > > > +-              if (test_bit(syscall_nr, filter->sc)) {
> > > > > > > > +-                      ret = -EEXIST;
> > > > > > > > +-                      goto error;
> > > > > > > > ++      if (syscall_nr < 0)
> > > > > > > > ++              return -ENOENT;
> > > > > > > > ++
> > > > > > > > ++
> > > > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > > ++                      bitmap = filter->sc_entry;
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > > ++                      bitmap = filter->sc_compat_entry;
> > > > > > > > ++                      break;
> > > > > > > > +               }
> > > > > > > > +-              bitmap_set(filter->sc, syscall_nr, 1);
> > > > > > > > +-      }
> > > > > > > > +-      if (compat_syscall_nr >= 0) {
> > > > > > > > +-              if (test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > > > > > +-                      ret = -EEXIST;
> > > > > > > > +-                      goto error;
> > > > > > > > ++              break;
> > > > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > > ++                      bitmap = filter->sc_exit;
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > > ++                      bitmap = filter->sc_compat_exit;
> > > > > > > > ++                      break;
> > > > > > > > +               }
> > > > > > > > +-              bitmap_set(filter->sc_compat, compat_syscall_nr, 1);
> > > > > > > > ++              break;
> > > > > > > > ++      default:
> > > > > > > > ++              return -EINVAL;
> > > > > > > > +       }
> > > > > > > > +-      if (!chan->sc_filter)
> > > > > > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > > > > > ++      if (test_bit(syscall_nr, bitmap))
> > > > > > > > ++              return -EEXIST;
> > > > > > > > ++      bitmap_set(bitmap, syscall_nr, 1);
> > > > > > > > +       return 0;
> > > > > > > > +-
> > > > > > > > +-error:
> > > > > > > > +-      if (!chan->sc_filter)
> > > > > > > > +-              kfree(filter);
> > > > > > > > +-      return ret;
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > + int lttng_syscall_filter_disable(struct lttng_channel *chan,
> > > > > > > > +-              const char *name)
> > > > > > > > ++              struct lttng_event *event)
> > > > > > > > + {
> > > > > > > > +-      int syscall_nr, compat_syscall_nr, ret;
> > > > > > > > +-      struct lttng_syscall_filter *filter;
> > > > > > > > ++      struct lttng_syscall_filter *filter = chan->sc_filter;
> > > > > > > > ++      const char *syscall_name;
> > > > > > > > ++      unsigned long *bitmap;
> > > > > > > > ++      int syscall_nr;
> > > > > > > > +
> > > > > > > > +       WARN_ON_ONCE(!chan->sc_table);
> > > > > > > > +
> > > > > > > > +-      if (!chan->sc_filter) {
> > > > > > > > +-              if (!chan->syscall_all)
> > > > > > > > +-                      return -EEXIST;
> > > > > > > > +-              filter = kzalloc(sizeof(struct lttng_syscall_filter),
> > > > > > > > +-                              GFP_KERNEL);
> > > > > > > > +-              if (!filter)
> > > > > > > > +-                      return -ENOMEM;
> > > > > > > > +-              /* Trace all system calls, then apply disable. */
> > > > > > > > +-              bitmap_set(filter->sc, 0, NR_syscalls);
> > > > > > > > +-              bitmap_set(filter->sc_compat, 0, NR_compat_syscalls);
> > > > > > > > +-      } else {
> > > > > > > > +-              filter = chan->sc_filter;
> > > > > > > > ++      syscall_name = get_syscall_name(event);
> > > > > > > > ++
> > > > > > > > ++      switch (event->u.syscall.abi) {
> > > > > > > > ++      case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > > ++              syscall_nr = get_syscall_nr(syscall_name);
> > > > > > > > ++              break;
> > > > > > > > ++      case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > > ++              syscall_nr = get_compat_syscall_nr(syscall_name);
> > > > > > > > ++              break;
> > > > > > > > ++      default:
> > > > > > > > ++              return -EINVAL;
> > > > > > > > +       }
> > > > > > > > ++      if (syscall_nr < 0)
> > > > > > > > ++              return -ENOENT;
> > > > > > > > +
> > > > > > > > +-      if (!name) {
> > > > > > > > +-              /* Fail if all syscalls are already disabled. */
> > > > > > > > +-              if (bitmap_empty(filter->sc, NR_syscalls)
> > > > > > > > +-                      && bitmap_empty(filter->sc_compat,
> > > > > > > > +-                              NR_compat_syscalls)) {
> > > > > > > > +-                      ret = -EEXIST;
> > > > > > > > +-                      goto error;
> > > > > > > > +-              }
> > > > > > > > +
> > > > > > > > +-              /* Disable all system calls */
> > > > > > > > +-              bitmap_clear(filter->sc, 0, NR_syscalls);
> > > > > > > > +-              bitmap_clear(filter->sc_compat, 0, NR_compat_syscalls);
> > > > > > > > +-              goto apply_filter;
> > > > > > > > +-      }
> > > > > > > > +-      syscall_nr = get_syscall_nr(name);
> > > > > > > > +-      compat_syscall_nr = get_compat_syscall_nr(name);
> > > > > > > > +-      if (syscall_nr < 0 && compat_syscall_nr < 0) {
> > > > > > > > +-              ret = -ENOENT;
> > > > > > > > +-              goto error;
> > > > > > > > +-      }
> > > > > > > > +-      if (syscall_nr >= 0) {
> > > > > > > > +-              if (!test_bit(syscall_nr, filter->sc)) {
> > > > > > > > +-                      ret = -EEXIST;
> > > > > > > > +-                      goto error;
> > > > > > > > ++      switch (event->u.syscall.entryexit) {
> > > > > > > > ++      case LTTNG_SYSCALL_ENTRY:
> > > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > > ++                      bitmap = filter->sc_entry;
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > > ++                      bitmap = filter->sc_compat_entry;
> > > > > > > > ++                      break;
> > > > > > > > +               }
> > > > > > > > +-              bitmap_clear(filter->sc, syscall_nr, 1);
> > > > > > > > +-      }
> > > > > > > > +-      if (compat_syscall_nr >= 0) {
> > > > > > > > +-              if (!test_bit(compat_syscall_nr, filter->sc_compat)) {
> > > > > > > > +-                      ret = -EEXIST;
> > > > > > > > +-                      goto error;
> > > > > > > > ++              break;
> > > > > > > > ++      case LTTNG_SYSCALL_EXIT:
> > > > > > > > ++              switch (event->u.syscall.abi) {
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_NATIVE:
> > > > > > > > ++                      bitmap = filter->sc_exit;
> > > > > > > > ++                      break;
> > > > > > > > ++              case LTTNG_SYSCALL_ABI_COMPAT:
> > > > > > > > ++                      bitmap = filter->sc_compat_exit;
> > > > > > > > ++                      break;
> > > > > > > > +               }
> > > > > > > > +-              bitmap_clear(filter->sc_compat, compat_syscall_nr, 1);
> > > > > > > > ++              break;
> > > > > > > > ++      default:
> > > > > > > > ++              return -EINVAL;
> > > > > > > > +       }
> > > > > > > > +-apply_filter:
> > > > > > > > +-      if (!chan->sc_filter)
> > > > > > > > +-              rcu_assign_pointer(chan->sc_filter, filter);
> > > > > > > > +-      chan->syscall_all = 0;
> > > > > > > > +-      return 0;
> > > > > > > > ++      if (!test_bit(syscall_nr, bitmap))
> > > > > > > > ++              return -EEXIST;
> > > > > > > > ++      bitmap_clear(bitmap, syscall_nr, 1);
> > > > > > > > +
> > > > > > > > +-error:
> > > > > > > > +-      if (!chan->sc_filter)
> > > > > > > > +-              kfree(filter);
> > > > > > > > +-      return ret;
> > > > > > > > ++      return 0;
> > > > > > > > + }
> > > > > > > > +
> > > > > > > > + static
> > > > > > > > +@@ -1236,6 +1256,9 @@ const struct file_operations lttng_syscall_list_fops = {
> > > > > > > > +       .release = seq_release,
> > > > > > > > + };
> > > > > > > > +
> > > > > > > > ++/*
> > > > > > > > ++ * A syscall is enabled if it is traced for either entry or exit.
> > > > > > > > ++ */
> > > > > > > > + long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > > > +               struct lttng_kernel_syscall_mask __user *usyscall_mask)
> > > > > > > > + {
> > > > > > > > +@@ -1262,8 +1285,9 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > > > +               char state;
> > > > > > > > +
> > > > > > > > +               if (channel->sc_table) {
> > > > > > > > +-                      if (filter)
> > > > > > > > +-                              state = test_bit(bit, filter->sc);
> > > > > > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > > > > > ++                              state = test_bit(bit, filter->sc_entry)
> > > > > > > > ++                                      || test_bit(bit, filter->sc_exit);
> > > > > > > > +                       else
> > > > > > > > +                               state = 1;
> > > > > > > > +               } else {
> > > > > > > > +@@ -1275,9 +1299,11 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel,
> > > > > > > > +               char state;
> > > > > > > > +
> > > > > > > > +               if (channel->compat_sc_table) {
> > > > > > > > +-                      if (filter)
> > > > > > > > ++                      if (!READ_ONCE(channel->syscall_all) && filter)
> > > > > > > > +                               state = test_bit(bit - ARRAY_SIZE(sc_table),
> > > > > > > > +-                                              filter->sc_compat);
> > > > > > > > ++                                              filter->sc_compat_entry)
> > > > > > > > ++                                      || test_bit(bit - ARRAY_SIZE(sc_table),
> > > > > > > > ++                                              filter->sc_compat_exit);
> > > > > > > > +                       else
> > > > > > > > +                               state = 1;
> > > > > > > > +               } else {
> > > > > > > > +--
> > > > > > > > +2.19.1
> > > > > > > > +
> > > > > > > > diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > > > index 0e1a209ce8..e36b327a08 100644
> > > > > > > > --- a/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > > > +++ b/meta/recipes-kernel/lttng/lttng-modules_2.12.2.bb
> > > > > > > > @@ -11,6 +11,16 @@ include lttng-platforms.inc
> > > > > > > >  SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
> > > > > > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > > > > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > > > > > +           file://0001-Kconfig-fix-dependency-issue-when-building-in-tree-w.patch \
> > > > > > > > +           file://0002-fix-Move-mmutrace.h-into-the-mmu-sub-directory-v5.9.patch \
> > > > > > > > +           file://0003-fix-KVM-x86-mmu-Make-kvm_mmu_page-definition-and-acc.patch \
> > > > > > > > +           file://0004-fix-ext4-limit-the-length-of-per-inode-prealloc-list.patch \
> > > > > > > > +           file://0005-fix-ext4-indicate-via-a-block-bitmap-read-is-prefetc.patch \
> > > > > > > > +           file://0006-fix-removal-of-smp_-read_barrier_depends-v5.9.patch \
> > > > > > > > +           file://0007-fix-writeback-Drop-I_DIRTY_TIME_EXPIRE-v5.9.patch \
> > > > > > > > +           file://0008-fix-writeback-Fix-sync-livelock-due-to-b_dirty_time-.patch \
> > > > > > > > +           file://0009-fix-version-ranges-for-ext4_discard_preallocations-a.patch \
> > > > > > > > +           file://0010-Fix-system-call-filter-table.patch \
> > > > > > > >             "
> > > > > > > >
> > > > > > > >  SRC_URI[sha256sum] = "df50bc3bd58679705714f17721acf619a8b0cedc694f8a97052aa5099626feca"
> > > > > > > > @@ -36,7 +46,7 @@ SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.1
> > > > > > > >             file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
> > > > > > > >             file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
> > > > > > > >             "
> > > > > > > > -SRCREV_class-devupstream = "57ccbfa6a8a79c7b84394c2097efaf7935607aa5"
> > > > > > > > +SRCREV_class-devupstream = "ad594e3a953db1b0c3c059fde45b5a5494f6be78"
> > > > > > > >  PV_class-devupstream = "2.12.2+git${SRCPV}"
> > > > > > > >  S_class-devupstream = "${WORKDIR}/git"
> > > > > > > >  SRCREV_FORMAT ?= "lttng_git"
> > > > > > > > --
> > > > > > > > 2.19.1
> > > > > > > >
> > > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > > > > > thee at its end
> > > > > > - "Use the force Harry" - Gandalf, Star Trek II
> > > >
> > > >
> > > >
> > > > --
> > > > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > > > thee at its end
> > > > - "Use the force Harry" - Gandalf, Star Trek II
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > - Thou shalt not follow the NULL pointer, for chaos and madness await
> > > thee at its end
> > > - "Use the force Harry" - Gandalf, Star Trek II
>
>
>
> --
> - Thou shalt not follow the NULL pointer, for chaos and madness await
> thee at its end
> - "Use the force Harry" - Gandalf, Star Trek II
>
> 
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

[-- Attachment #2: 0001-lttng-modules-backport-writeback.h-changes-from-2.12.patch --]
[-- Type: application/octet-stream, Size: 7280 bytes --]

From 9e80a982237c0f831ceb5a194420dd9a81619ebe Mon Sep 17 00:00:00 2001
From: Bruce Ashfield <bruce.ashfield@gmail.com>
Date: Tue, 29 Sep 2020 10:51:28 -0400
Subject: [PATCH] lttng-modules: backport writeback.h changes from 2.12.x to
 fix kernel 5.4.62+

Backporting the kernel version changes for writeback.h to fix
compilation against kernel stable versions 5.4.62+

This is a combination of upstream commits:

 87b2aff [fix: writeback: Fix sync livelock due to b_dirty_time processing (v5.9)]
 b74b25f [fix: version ranges for ext4_discard_preallocations and writeback_queue_io

Upstream-status: Backport

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
---
 ...ckport-writeback.h-changes-from-2.12.patch | 128 ++++++++++++++++++
 .../lttng/lttng-modules_2.11.2.bb             |   7 +-
 2 files changed, 132 insertions(+), 3 deletions(-)
 create mode 100644 meta/recipes-kernel/lttng/lttng-modules/0001-lttng-modules-backport-writeback.h-changes-from-2.12.patch

diff --git a/meta/recipes-kernel/lttng/lttng-modules/0001-lttng-modules-backport-writeback.h-changes-from-2.12.patch b/meta/recipes-kernel/lttng/lttng-modules/0001-lttng-modules-backport-writeback.h-changes-from-2.12.patch
new file mode 100644
index 0000000000..25b0a57bc6
--- /dev/null
+++ b/meta/recipes-kernel/lttng/lttng-modules/0001-lttng-modules-backport-writeback.h-changes-from-2.12.patch
@@ -0,0 +1,128 @@
+From 66d0869cf54ed79a33345f537dce2f7840e279f0 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@gmail.com>
+Date: Tue, 29 Sep 2020 10:28:20 -0400
+Subject: [PATCH] lttng-modules: backport writeback.h changes from 2.12.x to
+ fix kernel 5.4.62+
+
+Backporting the kernel version changes for writeback.h to fix
+compilation against kernel stable versions 5.4.62+
+
+This is a combination of upstream commits:
+
+ 87b2aff [fix: writeback: Fix sync livelock due to b_dirty_time processing (v5.9)]
+ b74b25f [fix: version ranges for ext4_discard_preallocations and writeback_queue_io
+
+Upstream-status: Backport
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+---
+ .../events/lttng-module/writeback.h           | 48 +++++++++++++------
+ 1 file changed, 33 insertions(+), 15 deletions(-)
+
+diff --git a/instrumentation/events/lttng-module/writeback.h b/instrumentation/events/lttng-module/writeback.h
+index 3327a0f..8d2250e 100644
+--- a/instrumentation/events/lttng-module/writeback.h
++++ b/instrumentation/events/lttng-module/writeback.h
+@@ -372,34 +372,55 @@ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_balance_dirty_wait, writeback_wbc_balanc
+ #endif
+ LTTNG_TRACEPOINT_EVENT_WBC_INSTANCE(wbc_writepage, writeback_wbc_writepage)
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,9,0) || \
++	LTTNG_KERNEL_RANGE(5,8,6, 5,9,0) || \
++	LTTNG_KERNEL_RANGE(5,4,62, 5,5,0) || \
++	LTTNG_KERNEL_RANGE(4,19,143, 4,20,0) || \
++	LTTNG_KERNEL_RANGE(4,14,196, 4,15,0) || \
++	LTTNG_KERNEL_RANGE(4,9,235, 4,10,0) || \
++	LTTNG_KERNEL_RANGE(4,4,235, 4,5,0) || \
++	LTTNG_UBUNTU_KERNEL_RANGE(4,15,18,119, 4,16,0,0))
++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
++	TP_PROTO(struct bdi_writeback *wb,
++		 struct wb_writeback_work *work,
++		 unsigned long dirtied_before,
++		 int moved),
++	TP_ARGS(wb, work, dirtied_before, moved),
++	TP_FIELDS(
++		ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
++		ctf_integer(unsigned long, older, dirtied_before)
++		ctf_integer(int, moved, moved)
++	)
++)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
+ 	TP_PROTO(struct bdi_writeback *wb,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ 		 struct wb_writeback_work *work,
+-#else
+-		 unsigned long *older_than_this,
+-#endif
+ 		 int moved),
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ 	TP_ARGS(wb, work, moved),
+-#else
++	TP_FIELDS(
++		ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
++		ctf_integer(int, moved, moved)
++	)
++)
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
++LTTNG_TRACEPOINT_EVENT(writeback_queue_io,
++	TP_PROTO(struct bdi_writeback *wb,
++		 unsigned long *older_than_this,
++		 int moved),
+ 	TP_ARGS(wb, older_than_this, moved),
+-#endif
+ 	TP_FIELDS(
+ 		ctf_array_text(char, name, dev_name(wb->bdi->dev), 32)
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+-#else
+ 		ctf_integer(unsigned long, older,
+ 			older_than_this ? *older_than_this : 0)
+ 		ctf_integer(long, age,
+ 			older_than_this ?
+ 				(jiffies - *older_than_this) * 1000 / HZ
+ 				: -1)
+-#endif
+ 		ctf_integer(int, moved, moved)
+ 	)
+ )
++#endif
+ 
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0))
+ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+@@ -425,7 +446,7 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+ 		ctf_integer(unsigned long, dirty_limit, global_dirty_limit)
+ 	)
+ )
+-#else
++#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+ 
+ 	writeback_global_dirty_state,
+@@ -450,7 +471,6 @@ LTTNG_TRACEPOINT_EVENT_MAP(global_dirty_state,
+ 	)
+ )
+ #endif
+-#endif
+ 
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+ 
+@@ -661,7 +681,6 @@ LTTNG_TRACEPOINT_EVENT(writeback_sb_inodes_requeue,
+ )
+ #endif
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
+ LTTNG_TRACEPOINT_EVENT_CLASS(writeback_congest_waited_template,
+ 
+ 	TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
+@@ -687,7 +706,6 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE(writeback_congest_waited_template, writeback_wai
+ 
+ 	TP_ARGS(usec_timeout, usec_delayed)
+ )
+-#endif
+ 
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
+ LTTNG_TRACEPOINT_EVENT_CLASS(writeback_single_inode_template,
+-- 
+2.25.1
+
diff --git a/meta/recipes-kernel/lttng/lttng-modules_2.11.2.bb b/meta/recipes-kernel/lttng/lttng-modules_2.11.2.bb
index 6fff096a37..8e56a3c10a 100644
--- a/meta/recipes-kernel/lttng/lttng-modules_2.11.2.bb
+++ b/meta/recipes-kernel/lttng/lttng-modules_2.11.2.bb
@@ -11,6 +11,7 @@ COMPATIBLE_HOST = '(x86_64|i.86|powerpc|aarch64|mips|nios2|arm|riscv).*-linux'
 SRC_URI = "https://lttng.org/files/${BPN}/${BPN}-${PV}.tar.bz2 \
            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
            file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
+           file://0001-lttng-modules-backport-writeback.h-changes-from-2.12.patch \
            "
 
 SRC_URI[md5sum] = "2e3bc8cfb264fa13f374618b46f170e7"
@@ -33,11 +34,11 @@ python do_package_prepend() {
 BBCLASSEXTEND = "devupstream:target"
 LIC_FILES_CHKSUM_class-devupstream = "file://LICENSE;md5=3f882d431dc0f32f1f44c0707aa41128"
 DEFAULT_PREFERENCE_class-devupstream = "-1"
-SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.11 \
+SRC_URI_class-devupstream = "git://git.lttng.org/lttng-modules;branch=stable-2.12 \
            file://Makefile-Do-not-fail-if-CONFIG_TRACEPOINTS-is-not-en.patch \
            file://BUILD_RUNTIME_BUG_ON-vs-gcc7.patch \
            "
-SRCREV_class-devupstream = "17c413953603f063f2a9d6c3788bec914ce6f955"
-PV_class-devupstream = "2.11.2+git${SRCPV}"
+SRCREV_class-devupstream = "01a12501e0b0395b60c7e392cb7dded51ae572ca"
+PV_class-devupstream = "2.12.2+git${SRCPV}"
 S_class-devupstream = "${WORKDIR}/git"
 SRCREV_FORMAT ?= "lttng_git"
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [OE-core] [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds
  2020-09-29 14:54                 ` Bruce Ashfield
@ 2020-09-29 17:23                   ` Steve Sakoman
  0 siblings, 0 replies; 23+ messages in thread
From: Steve Sakoman @ 2020-09-29 17:23 UTC (permalink / raw)
  To: Bruce Ashfield
  Cc: Richard Purdie, Patches and discussions about the oe-core layer

On Tue, Sep 29, 2020 at 4:55 AM Bruce Ashfield <bruce.ashfield@gmail.com> wrote:
>
> Steve,
>
> Attached is the minimal backport that I was able to pull together.
> Chuck that in the queue and you can take the latest 5.4.x -stable
> updates.
>
> So it looks like we can get away without a version bump for now.
>
> It passed all my local testing, but let me know if it causes you issues.

Autobuilder test is in process, but preliminary results look good -
one of the five builds that failed before has passed with your patch.

Fingers crossed . . .

Thanks!

Steve

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2020-09-29 17:23 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14 22:34 [PATCH 0/6] linux-yocto: consolidated pull request Bruce Ashfield
2020-09-14 22:34 ` [PATCH 1/6] linux-yocto/5.8: update to v5.8.8 Bruce Ashfield
2020-09-14 22:34 ` [PATCH 2/6] linux-yocto/5.4: update to v5.4.64 Bruce Ashfield
2020-09-14 22:34 ` [PATCH 3/6] linux-yocto/config: configuration warning cleanup Bruce Ashfield
2020-09-14 22:34 ` [PATCH 4/6] linux-yocto/5.8: update to v5.8.9 Bruce Ashfield
2020-09-14 22:34 ` [PATCH 5/6] linux-yocto/5.4: update to v5.4.65 Bruce Ashfield
2020-09-14 22:34 ` [PATCH 6/6] lttng-modules: backport patches from 2.12.x to fix 5.4.64+ and 5.8.9+ builds Bruce Ashfield
2020-09-14 22:35   ` Bruce Ashfield
2020-09-15  5:03     ` [OE-core] " Jens Rehsack
2020-09-15 11:37       ` Bruce Ashfield
2020-09-15  5:44   ` Jens Rehsack
2020-09-15 11:33     ` Bruce Ashfield
2020-09-15 11:45       ` Richard Purdie
2020-09-15 11:53         ` Bruce Ashfield
2020-09-25 16:43   ` Steve Sakoman
2020-09-25 16:52     ` Bruce Ashfield
2020-09-25 19:48       ` Steve Sakoman
2020-09-27 21:18         ` Bruce Ashfield
     [not found]         ` <1638C0AFDA43827E.8201@lists.openembedded.org>
2020-09-28 17:44           ` Bruce Ashfield
2020-09-28 22:35             ` Steve Sakoman
2020-09-28 22:53               ` Bruce Ashfield
     [not found]               ` <16391475BC3C80C8.17908@lists.openembedded.org>
2020-09-29 14:54                 ` Bruce Ashfield
2020-09-29 17:23                   ` Steve Sakoman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.