public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [for-linus][PATCH 00/15] tracing: Updates for 6.4
@ 2023-06-15 13:05 Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 01/15] tracing/rv/rtla: Update MAINTAINERS file to point to proper mailing list Steven Rostedt
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton

Tracing fixes for 6.4:

 - Fix MAINTAINERS file to point to proper mailing list for rtla and rv
    The mailing list pointed to linux-trace-devel instead of
    linux-trace-kernel. The former is for the tracing libraries
    and the latter is for anything in the Linux kernel tree.
    The wrong mailing list was used because linux-trace-kernel did not
    exist when rtla and rv were created.

 - User events:
   . Fix matching of dynamic events to their user events
     When user writes to dynamic_events file, a lookup of the
     registered dynamic events are made, but there were some cases
     that a match could be incorrectly made.

   . Add auto cleanup of user events
     Have the user events automatically get removed when the last
     reference (file descriptor) is closed. This was asked for to
     prevent leaks of user events hanging around needing admins
     to clean them up.

   . Add persistent logic (but not let user space use it yet)
     In some cases, having a persistent user event (one that does not
     get cleaned up automatically) is useful. But there's still
     debates about how to expose this to user space. The infrastructure
     is added, but the API is not.

   . Update the selftests
     Update the user event selftests to reflect the above changes.

  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/urgent

Head SHA1: 0113d4615dbf053ae9a7a1e0acbc6652713af01f


Beau Belgrave (7):
      tracing/user_events: Remove user_ns walk for groups
      tracing/user_events: Store register flags on events
      tracing/user_events: Track refcount consistently via put/get
      tracing/user_events: Add auto cleanup and future persist flag
      selftests/user_events: Ensure auto cleanup works as expected
      selftests/user_events: Adapt dyn_test to non-persist events
      tracing/user_events: Document auto-cleanup and remove dyn_event refs

Steven Rostedt (Google) (1):
      tracing/rv/rtla: Update MAINTAINERS file to point to proper mailing list

sunliming (7):
      tracing/user_events: Prevent same name but different args event
      tracing/user_events: Handle matching arguments that is null from dyn_events
      tracing: Modify print_fields() for fields output order
      tracing/user_events: Fix the incorrect trace record for empty arguments events
      selftests/user_events: Add ftrace self-test for empty arguments events
      selftests/user_events: Clear the events after perf self-test
      selftests/user_events: Add perf self-test for empty arguments events

----
 Documentation/admin-guide/cifs/changes.rst         |   4 +-
 Documentation/admin-guide/cifs/usage.rst           |   8 +-
 .../bindings/fpga/lattice,sysconfig.yaml           |   2 +-
 .../bindings/fpga/microchip,mpf-spi-fpga-mgr.yaml  |   2 +-
 .../bindings/iio/adc/nxp,imx8qxp-adc.yaml          |   7 -
 .../bindings/iio/adc/renesas,rcar-gyroadc.yaml     |   2 +-
 .../bindings/interrupt-controller/arm,gic-v3.yaml  |   6 -
 .../devicetree/bindings/serial/8250_omap.yaml      |   1 -
 .../devicetree/bindings/sound/tlv320aic32x4.txt    |   2 +-
 .../devicetree/bindings/usb/cdns,usb3.yaml         |   2 +-
 .../devicetree/bindings/usb/snps,dwc3.yaml         |   2 +-
 .../filesystems/{smb => cifs}/cifsroot.rst         |   2 +-
 Documentation/filesystems/{smb => cifs}/index.rst  |   0
 Documentation/filesystems/{smb => cifs}/ksmbd.rst  |   0
 Documentation/filesystems/index.rst                |   2 +-
 Documentation/mm/page_table_check.rst              |  19 -
 Documentation/netlink/specs/ethtool.yaml           |  32 +-
 Documentation/netlink/specs/handshake.yaml         |   4 -
 .../ethernet/mellanox/mlx5/devlink.rst             |  60 ++--
 Documentation/networking/tls-handshake.rst         |   5 -
 Documentation/process/maintainer-netdev.rst        |  33 +-
 Documentation/trace/user_events.rst                |   7 +-
 Documentation/userspace-api/ioctl/ioctl-number.rst |   2 +-
 MAINTAINERS                                        |  48 +--
 Makefile                                           |   2 +-
 arch/arm/boot/dts/imx6qdl-mba6.dtsi                |   1 -
 arch/arm/boot/dts/imx6ull-dhcor-som.dtsi           |   7 -
 arch/arm/boot/dts/vexpress-v2p-ca5s.dts            |   1 -
 arch/arm64/boot/dts/arm/foundation-v8.dtsi         |   1 -
 arch/arm64/boot/dts/arm/rtsm_ve-aemv8a.dts         |   1 -
 .../boot/dts/arm/vexpress-v2f-1xv7-ca53x2.dts      |   1 -
 arch/arm64/boot/dts/freescale/imx8-ss-conn.dtsi    |   1 -
 arch/arm64/boot/dts/freescale/imx8mn-var-som.dtsi  |   8 +-
 arch/arm64/boot/dts/freescale/imx8mn.dtsi          |  28 +-
 arch/arm64/boot/dts/freescale/imx8mp.dtsi          |  25 +-
 .../boot/dts/freescale/imx8x-colibri-eval-v3.dtsi  |   6 -
 .../boot/dts/freescale/imx8x-colibri-iris.dtsi     |   3 +-
 arch/arm64/boot/dts/freescale/imx8x-colibri.dtsi   |  14 +-
 arch/arm64/include/asm/kvm_pgtable.h               |   6 +-
 arch/arm64/include/asm/sysreg.h                    |   6 -
 arch/arm64/kvm/hyp/include/hyp/switch.h            |   8 +-
 arch/arm64/kvm/hyp/nvhe/mem_protect.c              |  14 +-
 arch/arm64/kvm/hyp/nvhe/switch.c                   |   2 -
 arch/arm64/kvm/hyp/pgtable.c                       |  17 +-
 arch/arm64/kvm/hyp/vhe/switch.c                    |   1 -
 arch/arm64/kvm/pmu-emul.c                          |  58 +--
 arch/arm64/kvm/sys_regs.c                          |  19 -
 arch/arm64/kvm/vgic/vgic-init.c                    |  27 +-
 arch/arm64/kvm/vgic/vgic-its.c                     |  14 +-
 arch/arm64/kvm/vgic/vgic-kvm-device.c              |  10 +-
 arch/arm64/kvm/vgic/vgic-mmio-v3.c                 |  31 +-
 arch/arm64/kvm/vgic/vgic-mmio.c                    |   9 +-
 arch/arm64/kvm/vgic/vgic-v2.c                      |   6 +
 arch/arm64/kvm/vgic/vgic-v3.c                      |   7 +
 arch/arm64/kvm/vgic/vgic-v4.c                      |   3 +-
 arch/m68k/kernel/signal.c                          |  14 +-
 arch/mips/Kconfig                                  |   1 -
 arch/mips/alchemy/common/dbdma.c                   |  27 +-
 arch/mips/kernel/cpu-probe.c                       |   5 -
 arch/mips/kernel/setup.c                           |   9 +-
 arch/parisc/Kconfig                                |   4 -
 arch/parisc/Kconfig.debug                          |  11 -
 arch/parisc/include/asm/cacheflush.h               |   4 -
 arch/parisc/include/asm/spinlock.h                 |  39 +--
 arch/parisc/include/asm/spinlock_types.h           |   8 +-
 arch/parisc/kernel/alternative.c                   |   2 +-
 arch/parisc/kernel/cache.c                         |   5 +-
 arch/parisc/kernel/pci-dma.c                       |  18 +-
 arch/parisc/kernel/process.c                       |  11 +-
 arch/parisc/kernel/traps.c                         |  18 +-
 arch/powerpc/Kconfig                               |   6 -
 arch/powerpc/crypto/Makefile                       |  10 +-
 arch/powerpc/crypto/aes-gcm-p10-glue.c             |  18 +-
 .../powerpc/crypto/{aesp10-ppc.pl => aesp8-ppc.pl} |   2 +-
 .../crypto/{ghashp10-ppc.pl => ghashp8-ppc.pl}     |  12 +-
 arch/powerpc/platforms/pseries/iommu.c             |  13 +-
 arch/powerpc/xmon/xmon.c                           |   2 +-
 arch/riscv/Kconfig                                 |   5 +-
 arch/riscv/errata/Makefile                         |   4 -
 arch/riscv/include/asm/hugetlb.h                   |   3 -
 arch/riscv/include/asm/perf_event.h                |   7 -
 arch/riscv/kernel/Makefile                         |   4 -
 arch/riscv/mm/hugetlbpage.c                        |  30 +-
 arch/riscv/mm/init.c                               |   2 +-
 arch/x86/crypto/aria-aesni-avx-asm_64.S            |   2 +
 arch/x86/events/intel/core.c                       |   2 +-
 arch/x86/events/intel/uncore_snbep.c               |  11 -
 arch/x86/include/asm/fpu/sched.h                   |   2 +-
 arch/x86/kernel/cpu/topology.c                     |   5 +-
 arch/x86/kernel/dumpstack.c                        |   7 +-
 arch/x86/kernel/fpu/context.h                      |   2 +-
 arch/x86/kernel/fpu/core.c                         |   2 +-
 arch/x86/kvm/lapic.c                               |  20 +-
 arch/x86/kvm/mmu/mmu.c                             |   5 +-
 arch/x86/kvm/svm/svm.c                             |   2 +-
 arch/x86/kvm/x86.c                                 |   3 -
 arch/x86/lib/copy_user_64.S                        |  10 +-
 arch/x86/mm/init.c                                 |  25 --
 arch/x86/pci/xen.c                                 |   8 +-
 arch/xtensa/kernel/signal.c                        |  35 +-
 arch/xtensa/kernel/xtensa_ksyms.c                  |   4 -
 arch/xtensa/lib/Makefile                           |   2 +-
 arch/xtensa/lib/bswapdi2.S                         |  21 --
 arch/xtensa/lib/bswapsi2.S                         |  16 -
 block/blk-core.c                                   |   2 +-
 block/blk-map.c                                    |   2 +-
 block/blk-mq-tag.c                                 |  12 +-
 block/blk-settings.c                               |   3 +-
 block/blk-wbt.c                                    |  12 +-
 drivers/accel/qaic/qaic_control.c                  |  41 +--
 drivers/accel/qaic/qaic_data.c                     |  93 ++---
 drivers/accel/qaic/qaic_drv.c                      |   2 +-
 drivers/acpi/apei/apei-internal.h                  |   6 +
 drivers/acpi/apei/bert.c                           |   1 -
 drivers/android/binder.c                           |  28 +-
 drivers/android/binder_alloc.c                     |  64 ++--
 drivers/android/binder_alloc.h                     |   4 +-
 drivers/android/binder_alloc_selftest.c            |   2 +-
 drivers/ata/libata-scsi.c                          |  34 +-
 drivers/base/cacheinfo.c                           |  26 --
 drivers/base/firmware_loader/main.c                |   2 +-
 drivers/base/regmap/Kconfig                        |  13 +-
 drivers/base/regmap/regcache-maple.c               |   5 +-
 drivers/base/regmap/regmap-sdw.c                   |   4 -
 drivers/base/regmap/regmap.c                       |   6 +-
 drivers/block/xen-blkfront.c                       |   3 +-
 drivers/bluetooth/btnxpuart.c                      |   6 +-
 drivers/char/agp/parisc-agp.c                      |  15 +-
 drivers/char/tpm/tpm_tis.c                         |   7 -
 drivers/char/tpm/tpm_tis_core.h                    |   8 +-
 drivers/cpufreq/amd-pstate.c                       |  46 +--
 drivers/cxl/core/mbox.c                            |  12 +-
 drivers/cxl/core/pci.c                             | 112 +-----
 drivers/cxl/core/port.c                            |   7 +-
 drivers/cxl/cxl.h                                  |   1 -
 drivers/cxl/cxlmem.h                               |   2 -
 drivers/cxl/cxlpci.h                               |   2 -
 drivers/cxl/mem.c                                  |   3 -
 drivers/cxl/pci.c                                  |   6 -
 drivers/cxl/port.c                                 |  20 +-
 drivers/dma/at_hdmac.c                             |  17 +-
 drivers/dma/at_xdmac.c                             |   7 +-
 drivers/dma/idxd/cdev.c                            |   1 +
 drivers/dma/pl330.c                                |   8 +-
 drivers/dma/ti/k3-udma.c                           |   4 +-
 drivers/firmware/arm_ffa/bus.c                     |  19 +-
 drivers/firmware/arm_ffa/driver.c                  |   9 +-
 drivers/firmware/arm_scmi/raw_mode.c               |   2 +-
 drivers/firmware/efi/libstub/Makefile.zboot        |   3 +-
 drivers/firmware/efi/libstub/efistub.h             |   3 -
 drivers/gpio/Kconfig                               |   2 +-
 drivers/gpio/gpio-f7188x.c                         |  28 +-
 drivers/gpio/gpio-mockup.c                         |   2 +-
 drivers/gpio/gpiolib.c                             |   2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c            |   3 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c           |  27 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.h           |   3 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c            |  27 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h            |   3 -
 drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c             |   4 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c              |   4 +-
 drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c             |  28 +-
 drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c             |  28 +-
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c             |   8 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c              |  25 +-
 drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c              |  36 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  25 +-
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c |  16 +-
 drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c |   9 +
 drivers/gpu/drm/amd/display/dc/dcn30/dcn30_hwseq.c |  25 +-
 drivers/gpu/drm/amd/pm/amdgpu_pm.c                 |  12 +-
 drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c         |  29 ++
 drivers/gpu/drm/amd/pm/swsmu/smu11/vangogh_ppt.c   |  10 +-
 drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c    |   5 +-
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_4_ppt.c   |   5 +-
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_5_ppt.c   |   5 +-
 .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c   |   1 -
 .../gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c   |   5 +-
 drivers/gpu/drm/drm_managed.c                      |  22 +-
 drivers/gpu/drm/drm_panel_orientation_quirks.c     |   2 +-
 drivers/gpu/drm/i915/display/intel_display.c       |  12 +-
 drivers/gpu/drm/i915/i915_perf.c                   |  17 +-
 drivers/gpu/drm/mgag200/mgag200_mode.c             |   5 -
 drivers/gpu/drm/pl111/pl111_display.c              |   2 +-
 drivers/gpu/drm/pl111/pl111_drm.h                  |   4 +-
 drivers/gpu/drm/pl111/pl111_drv.c                  |   8 +-
 drivers/gpu/drm/pl111/pl111_versatile.c            |  10 +-
 drivers/gpu/drm/radeon/radeon_irq_kms.c            |  10 -
 drivers/gpu/drm/scheduler/sched_main.c             |   3 +
 drivers/hid/hid-google-hammer.c                    |   2 -
 drivers/hid/hid-ids.h                              |   1 -
 drivers/hid/hid-logitech-hidpp.c                   |   1 -
 drivers/hid/wacom_sys.c                            |  21 +-
 drivers/hid/wacom_wac.c                            |   2 +-
 drivers/hwtracing/coresight/coresight-etm-perf.c   |   1 -
 drivers/hwtracing/coresight/coresight-tmc-etr.c    |   2 +-
 drivers/iio/accel/kionix-kx022a.c                  |   2 +-
 drivers/iio/accel/st_accel_core.c                  |   4 +-
 drivers/iio/adc/ad4130.c                           |  12 +-
 drivers/iio/adc/ad7192.c                           |   8 +-
 drivers/iio/adc/ad_sigma_delta.c                   |   4 -
 drivers/iio/adc/imx93_adc.c                        |   7 +-
 drivers/iio/adc/mt6370-adc.c                       |  53 +--
 drivers/iio/adc/mxs-lradc-adc.c                    |  10 +-
 drivers/iio/adc/palmas_gpadc.c                     |  10 +-
 drivers/iio/adc/stm32-adc.c                        |  61 ++--
 drivers/iio/addac/ad74413r.c                       |   2 +-
 drivers/iio/dac/Makefile                           |   2 +-
 drivers/iio/dac/mcp4725.c                          |  16 +-
 drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c |  10 +-
 drivers/iio/industrialio-gts-helper.c              |  42 +--
 drivers/iio/light/rohm-bu27034.c                   |  26 +-
 drivers/iio/light/vcnl4035.c                       |   3 -
 drivers/iio/magnetometer/tmag5273.c                |   5 +-
 drivers/infiniband/hw/bnxt_re/ib_verbs.c           |   4 +-
 drivers/infiniband/hw/bnxt_re/main.c               |   4 -
 drivers/infiniband/hw/bnxt_re/qplib_fp.c           |  11 +-
 drivers/infiniband/hw/bnxt_re/qplib_res.c          |  12 +-
 drivers/infiniband/hw/bnxt_re/qplib_sp.c           |   7 +-
 drivers/infiniband/hw/efa/efa_verbs.c              |   2 +-
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c         |  25 +-
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h         |   2 -
 drivers/infiniband/hw/hns/hns_roce_mr.c            |  43 ---
 drivers/infiniband/hw/irdma/verbs.c                |  12 +-
 drivers/infiniband/sw/rxe/rxe_comp.c               |  26 +-
 drivers/infiniband/sw/rxe/rxe_net.c                |   7 +-
 drivers/infiniband/sw/rxe/rxe_qp.c                 |  37 +-
 drivers/infiniband/sw/rxe/rxe_recv.c               |   9 +-
 drivers/infiniband/sw/rxe/rxe_req.c                |  30 +-
 drivers/infiniband/sw/rxe/rxe_resp.c               |  14 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c              |  25 +-
 drivers/iommu/Kconfig                              |   1 -
 drivers/iommu/amd/amd_iommu.h                      |   4 +-
 drivers/iommu/amd/init.c                           |  24 --
 drivers/iommu/amd/iommu.c                          |  31 +-
 drivers/iommu/mtk_iommu.c                          |   3 +-
 drivers/iommu/rockchip-iommu.c                     |  14 +-
 drivers/irqchip/irq-gic-common.c                   |  10 +-
 drivers/irqchip/irq-gic-common.h                   |   1 -
 drivers/irqchip/irq-gic-v3.c                       |  20 --
 drivers/irqchip/irq-mbigen.c                       |  31 +-
 drivers/irqchip/irq-meson-gpio.c                   |   2 +-
 drivers/irqchip/irq-mips-gic.c                     |  32 +-
 drivers/leds/rgb/leds-qcom-lpg.c                   |   8 +-
 drivers/mailbox/mailbox-test.c                     |  10 +-
 drivers/md/raid5.c                                 |   2 +-
 drivers/media/cec/core/cec-adap.c                  |   8 +-
 drivers/media/cec/core/cec-core.c                  |   2 -
 drivers/media/cec/core/cec-priv.h                  |   1 -
 .../mediatek/vcodec/mtk_vcodec_dec_stateful.c      |   3 -
 drivers/media/platform/qcom/camss/camss-video.c    |   1 +
 drivers/media/platform/verisilicon/hantro_v4l2.c   |   6 +-
 drivers/media/usb/uvc/uvc_driver.c                 |  16 +-
 drivers/media/v4l2-core/v4l2-mc.c                  |   3 +-
 drivers/misc/fastrpc.c                             |  31 +-
 drivers/mmc/core/block.c                           |   5 -
 drivers/mmc/core/pwrseq_sd8787.c                   |  34 +-
 drivers/mmc/host/sdhci-cadence.c                   |   8 +-
 drivers/mmc/host/sdhci-esdhc-imx.c                 |  18 +-
 drivers/mmc/host/vub300.c                          |   3 -
 drivers/mtd/mtdchar.c                              |   8 +-
 drivers/mtd/nand/raw/ingenic/ingenic_ecc.h         |   8 +-
 drivers/mtd/nand/raw/marvell_nand.c                |  10 +-
 drivers/mtd/spi-nor/core.c                         |   5 +-
 drivers/mtd/spi-nor/spansion.c                     |   4 +-
 drivers/net/bonding/bond_main.c                    |   8 +-
 drivers/net/dsa/mv88e6xxx/chip.c                   |   2 +-
 drivers/net/ethernet/3com/3c589_cs.c               |  11 +-
 drivers/net/ethernet/amd/xgbe/xgbe-mdio.c          |  12 +-
 drivers/net/ethernet/freescale/fec_main.c          |  17 +-
 drivers/net/ethernet/intel/ice/ice_txrx.c          |   2 +-
 .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c |   4 +-
 drivers/net/ethernet/mediatek/mtk_eth_soc.c        |   8 +-
 drivers/net/ethernet/mellanox/mlx5/core/cmd.c      |   3 +-
 .../ethernet/mellanox/mlx5/core/diag/fw_tracer.c   |   2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en.h       |   1 -
 .../ethernet/mellanox/mlx5/core/en/port_buffer.c   |  46 +--
 .../ethernet/mellanox/mlx5/core/en/port_buffer.h   |   8 +-
 drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c   |   2 -
 .../ethernet/mellanox/mlx5/core/en/tc/act/act.c    |   7 +-
 .../ethernet/mellanox/mlx5/core/en/tc/act/act.h    |   2 +-
 .../ethernet/mellanox/mlx5/core/en/tc_tun_encap.c  | 124 +------
 .../ethernet/mellanox/mlx5/core/en/tc_tun_encap.h  |   9 -
 drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h  |   2 -
 .../net/ethernet/mellanox/mlx5/core/en_common.c    |  11 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c |   7 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c  |  69 ++--
 drivers/net/ethernet/mellanox/mlx5/core/en_rep.c   |   6 -
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c    | 152 +++++---
 drivers/net/ethernet/mellanox/mlx5/core/en_tx.c    |  19 +-
 drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c  |  16 +-
 drivers/net/ethernet/mellanox/mlx5/core/eq.c       |   4 +-
 drivers/net/ethernet/mellanox/mlx5/core/eswitch.h  |   5 -
 .../ethernet/mellanox/mlx5/core/eswitch_offloads.c |  16 +-
 .../net/ethernet/mellanox/mlx5/core/lib/devcom.c   |  70 +---
 .../net/ethernet/mellanox/mlx5/core/lib/devcom.h   |   1 -
 drivers/net/ethernet/mellanox/mlx5/core/main.c     |  11 +-
 drivers/net/ethernet/mellanox/mlx5/core/mlx5_irq.h |   1 -
 drivers/net/ethernet/mellanox/mlx5/core/mr.c       |  21 --
 drivers/net/ethernet/mellanox/mlx5/core/pci_irq.c  |  53 +--
 .../ethernet/mellanox/mlx5/core/sf/dev/driver.c    |   1 -
 .../ethernet/mellanox/mlx5/core/steering/dr_cmd.c  |   4 +-
 .../ethernet/mellanox/mlx5/core/steering/dr_ptrn.c |   3 -
 .../ethernet/mellanox/mlx5/core/steering/dr_ste.c  |   3 +-
 .../ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c   |  13 +-
 .../net/ethernet/microchip/lan966x/lan966x_main.c  |  10 -
 drivers/net/ethernet/microsoft/mana/mana_en.c      |  10 +
 drivers/net/ethernet/microsoft/mana/mana_ethtool.c |   2 +
 drivers/net/ethernet/nvidia/forcedeth.c            |   1 -
 drivers/net/ethernet/realtek/r8169_main.c          |  44 +--
 drivers/net/ethernet/renesas/rswitch.c             |   2 +-
 drivers/net/ethernet/sfc/efx_devlink.c             |  95 ++---
 drivers/net/ethernet/sfc/tc.c                      |  27 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |   3 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_xdp.c   |   6 -
 drivers/net/ipa/ipa_endpoint.c                     |   2 +-
 drivers/net/phy/mscc/mscc.h                        |   2 -
 drivers/net/phy/mscc/mscc_main.c                   |  82 ++---
 drivers/net/phy/mxl-gpy.c                          |  16 +-
 drivers/net/team/team.c                            |   7 +-
 drivers/net/usb/cdc_ncm.c                          |  24 +-
 drivers/net/usb/qmi_wwan.c                         |   2 +-
 drivers/nfc/nfcsim.c                               |   4 +
 drivers/nvme/host/constants.c                      |   2 +-
 drivers/nvme/host/core.c                           |  52 +--
 drivers/nvme/host/ioctl.c                          |   2 +-
 drivers/nvme/host/nvme.h                           |   3 +-
 drivers/nvme/host/pci.c                            |   2 -
 drivers/nvme/target/passthru.c                     |   2 +-
 drivers/pci/quirks.c                               |   9 +-
 .../phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c  |   2 +-
 drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c         |  10 +-
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c          |   5 +-
 drivers/phy/qualcomm/phy-qcom-qmp-pcie-msm8996.c   |   5 +-
 drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c      |   2 +-
 drivers/platform/mellanox/mlxbf-pmc.c              |   5 +-
 drivers/platform/x86/amd/pmf/core.c                |  32 +-
 drivers/platform/x86/asus-nb-wmi.c                 |   2 -
 drivers/platform/x86/intel/ifs/load.c              |   2 +-
 .../x86/intel/speed_select_if/isst_if_common.c     |  12 +-
 drivers/power/supply/ab8500_btemp.c                |   6 +-
 drivers/power/supply/ab8500_fg.c                   |   6 +-
 drivers/power/supply/axp288_fuel_gauge.c           |   2 +-
 drivers/power/supply/bq24190_charger.c             |   1 -
 drivers/power/supply/bq25890_charger.c             |   5 +-
 drivers/power/supply/bq27xxx_battery.c             | 181 +++++-----
 drivers/power/supply/bq27xxx_battery_i2c.c         |   3 +-
 drivers/power/supply/mt6360_charger.c              |   4 +-
 drivers/power/supply/power_supply_core.c           |  15 +-
 drivers/power/supply/power_supply_leds.c           |   5 +-
 drivers/power/supply/power_supply_sysfs.c          |   3 +-
 drivers/power/supply/rt9467-charger.c              |   2 +-
 drivers/power/supply/sbs-charger.c                 |   2 +-
 drivers/power/supply/sc27xx_fuel_gauge.c           |   9 +-
 drivers/regulator/core.c                           |   4 +-
 drivers/regulator/mt6359-regulator.c               |   7 +-
 drivers/regulator/pca9450-regulator.c              |   4 +-
 drivers/scsi/qla2xxx/qla_def.h                     |   1 -
 drivers/scsi/qla2xxx/qla_init.c                    |   3 -
 drivers/scsi/qla2xxx/qla_inline.h                  |   3 -
 drivers/scsi/qla2xxx/qla_isr.c                     |   3 -
 drivers/scsi/stex.c                                |   4 -
 drivers/soc/fsl/qe/Kconfig                         |   4 +-
 drivers/spi/spi-cadence.c                          | 105 +++---
 drivers/spi/spi-dw-mmio.c                          |   8 +-
 drivers/spi/spi-geni-qcom.c                        |   2 -
 drivers/staging/media/atomisp/i2c/atomisp-ov2680.c |   4 +-
 drivers/staging/media/imx/imx8mq-mipi-csi2.c       |   2 +-
 drivers/target/iscsi/iscsi_target.c                |   2 +
 drivers/target/iscsi/iscsi_target_login.c          |  63 +++-
 drivers/target/iscsi/iscsi_target_nego.c           |  74 ++--
 drivers/target/iscsi/iscsi_target_util.c           |  51 ---
 drivers/target/iscsi/iscsi_target_util.h           |   4 -
 drivers/tee/optee/smc_abi.c                        |   4 +-
 .../intel/int340x_thermal/int3400_thermal.c        |   4 +-
 drivers/tty/serial/8250/8250_tegra.c               |   4 +-
 drivers/tty/serial/Kconfig                         |   2 +-
 drivers/tty/serial/cpm_uart/cpm_uart.h             |   2 +
 drivers/tty/serial/fsl_lpuart.c                    |  44 ++-
 drivers/usb/cdns3/cdns3-gadget.c                   |  13 -
 drivers/usb/core/buffer.c                          |  41 ---
 drivers/usb/core/devio.c                           |  20 +-
 drivers/usb/gadget/function/f_fs.c                 |   2 +-
 drivers/usb/gadget/udc/amd5536udc_pci.c            |   3 -
 drivers/usb/typec/tipd/core.c                      |   2 +-
 drivers/vfio/vfio_iommu_type1.c                    |   5 -
 drivers/vhost/vhost.c                              |  22 +-
 drivers/video/fbdev/arcfb.c                        |   5 +-
 drivers/video/fbdev/au1100fb.c                     |  11 +-
 drivers/video/fbdev/au1200fb.c                     |   6 +-
 drivers/video/fbdev/broadsheetfb.c                 |   5 +-
 drivers/video/fbdev/bw2.c                          |   6 +-
 drivers/video/fbdev/core/bitblit.c                 |   3 -
 drivers/video/fbdev/imsttfb.c                      |  12 +-
 drivers/video/fbdev/matrox/matroxfb_maven.c        |   2 +-
 drivers/video/fbdev/ssd1307fb.c                    |   2 +-
 drivers/xen/pvcalls-back.c                         |   9 +-
 fs/Kconfig                                         |   9 +-
 fs/Makefile                                        |   4 +-
 fs/btrfs/bio.c                                     |   6 +-
 fs/btrfs/block-group.c                             |  14 +-
 fs/btrfs/disk-io.c                                 |  11 +-
 fs/btrfs/file-item.c                               |   4 +-
 fs/btrfs/scrub.c                                   |  57 +--
 fs/btrfs/tree-log.c                                |   2 +-
 fs/{smb/client => cifs}/Kconfig                    |   0
 fs/{smb/client => cifs}/Makefile                   |   0
 fs/{smb/client => cifs}/asn1.c                     |   0
 fs/{smb/client => cifs}/cached_dir.c               |   0
 fs/{smb/client => cifs}/cached_dir.h               |   0
 fs/{smb/client => cifs}/cifs_debug.c               |   8 +-
 fs/{smb/client => cifs}/cifs_debug.h               |   0
 fs/{smb/client => cifs}/cifs_dfs_ref.c             |   0
 fs/{smb/client => cifs}/cifs_fs_sb.h               |   0
 fs/{smb/client => cifs}/cifs_ioctl.h               |   0
 fs/{smb/client => cifs}/cifs_spnego.c              |   0
 fs/{smb/client => cifs}/cifs_spnego.h              |   0
 .../client => cifs}/cifs_spnego_negtokeninit.asn1  |   0
 fs/{smb/client => cifs}/cifs_swn.c                 |   0
 fs/{smb/client => cifs}/cifs_swn.h                 |   0
 fs/{smb/client => cifs}/cifs_unicode.c             |   0
 fs/{smb/client => cifs}/cifs_unicode.h             |   0
 fs/{smb/client => cifs}/cifs_uniupr.h              |   0
 fs/{smb/client => cifs}/cifsacl.c                  |   0
 fs/{smb/client => cifs}/cifsacl.h                  |   0
 fs/{smb/client => cifs}/cifsencrypt.c              |   2 +-
 fs/{smb/client => cifs}/cifsfs.c                   |   0
 fs/{smb/client => cifs}/cifsfs.h                   |   0
 fs/{smb/client => cifs}/cifsglob.h                 |   2 +-
 fs/{smb/client => cifs}/cifspdu.h                  |   2 +-
 fs/{smb/client => cifs}/cifsproto.h                |   0
 fs/{smb/client => cifs}/cifsroot.c                 |   0
 fs/{smb/client => cifs}/cifssmb.c                  |   0
 fs/{smb/client => cifs}/connect.c                  |   0
 fs/{smb/client => cifs}/dfs.c                      |   2 +-
 fs/{smb/client => cifs}/dfs.h                      |   0
 fs/{smb/client => cifs}/dfs_cache.c                |   0
 fs/{smb/client => cifs}/dfs_cache.h                |   0
 fs/{smb/client => cifs}/dir.c                      |   0
 fs/{smb/client => cifs}/dns_resolve.c              |   0
 fs/{smb/client => cifs}/dns_resolve.h              |   0
 fs/{smb/client => cifs}/export.c                   |   0
 fs/{smb/client => cifs}/file.c                     |   3 +-
 fs/{smb/client => cifs}/fs_context.c               |   8 -
 fs/{smb/client => cifs}/fs_context.h               |   0
 fs/{smb/client => cifs}/fscache.c                  |   0
 fs/{smb/client => cifs}/fscache.h                  |   0
 fs/{smb/client => cifs}/inode.c                    |   0
 fs/{smb/client => cifs}/ioctl.c                    |   6 +-
 fs/{smb/client => cifs}/link.c                     |   0
 fs/{smb/client => cifs}/misc.c                     |   0
 fs/{smb/client => cifs}/netlink.c                  |   0
 fs/{smb/client => cifs}/netlink.h                  |   0
 fs/{smb/client => cifs}/netmisc.c                  |   0
 fs/{smb/client => cifs}/nterr.c                    |   0
 fs/{smb/client => cifs}/nterr.h                    |   0
 fs/{smb/client => cifs}/ntlmssp.h                  |   0
 fs/{smb/client => cifs}/readdir.c                  |   0
 fs/{smb/client => cifs}/rfc1002pdu.h               |   0
 fs/{smb/client => cifs}/sess.c                     |   0
 fs/{smb/client => cifs}/smb1ops.c                  |   0
 fs/{smb/client => cifs}/smb2file.c                 |   0
 fs/{smb/client => cifs}/smb2glob.h                 |   0
 fs/{smb/client => cifs}/smb2inode.c                |   0
 fs/{smb/client => cifs}/smb2maperror.c             |   0
 fs/{smb/client => cifs}/smb2misc.c                 |   0
 fs/{smb/client => cifs}/smb2ops.c                  |   1 +
 fs/{smb/client => cifs}/smb2pdu.c                  |   2 +-
 fs/{smb/client => cifs}/smb2pdu.h                  |   0
 fs/{smb/client => cifs}/smb2proto.h                |   0
 fs/{smb/client => cifs}/smb2status.h               |   0
 fs/{smb/client => cifs}/smb2transport.c            |   0
 fs/{smb/client => cifs}/smbdirect.c                |   0
 fs/{smb/client => cifs}/smbdirect.h                |   0
 fs/{smb/client => cifs}/smbencrypt.c               |   2 +-
 fs/{smb/client => cifs}/smberr.h                   |   0
 fs/{smb/client => cifs}/trace.c                    |   0
 fs/{smb/client => cifs}/trace.h                    |   0
 fs/{smb/client => cifs}/transport.c                |   0
 fs/{smb/client => cifs}/unc.c                      |   0
 fs/{smb/client => cifs}/winucase.c                 |   0
 fs/{smb/client => cifs}/xattr.c                    |   0
 fs/coredump.c                                      |   4 +-
 fs/erofs/Kconfig                                   |   1 -
 fs/erofs/Makefile                                  |   4 +-
 fs/erofs/internal.h                                |  13 +-
 fs/erofs/xattr.c                                   |   2 +-
 fs/erofs/zdata.c                                   |   2 +
 fs/ext4/ext4.h                                     |   5 +-
 fs/ext4/fsync.c                                    |   7 -
 fs/ext4/inode.c                                    |  34 +-
 fs/ext4/mballoc.c                                  |  16 +-
 fs/ext4/super.c                                    |  24 +-
 fs/ext4/xattr.c                                    |  41 ++-
 fs/{smb/server => ksmbd}/Kconfig                   |   0
 fs/{smb/server => ksmbd}/Makefile                  |   0
 fs/{smb/server => ksmbd}/asn1.c                    |   0
 fs/{smb/server => ksmbd}/asn1.h                    |   0
 fs/{smb/server => ksmbd}/auth.c                    |   2 +-
 fs/{smb/server => ksmbd}/auth.h                    |   0
 fs/{smb/server => ksmbd}/connection.c              |   0
 fs/{smb/server => ksmbd}/connection.h              |   0
 fs/{smb/server => ksmbd}/crypto_ctx.c              |   0
 fs/{smb/server => ksmbd}/crypto_ctx.h              |   0
 fs/{smb/server => ksmbd}/glob.h                    |   0
 fs/{smb/server => ksmbd}/ksmbd_netlink.h           |   0
 .../ksmbd_spnego_negtokeninit.asn1                 |   0
 .../ksmbd_spnego_negtokentarg.asn1                 |   0
 fs/{smb/server => ksmbd}/ksmbd_work.c              |   0
 fs/{smb/server => ksmbd}/ksmbd_work.h              |   0
 fs/{smb/server => ksmbd}/mgmt/ksmbd_ida.c          |   0
 fs/{smb/server => ksmbd}/mgmt/ksmbd_ida.h          |   0
 fs/{smb/server => ksmbd}/mgmt/share_config.c       |   0
 fs/{smb/server => ksmbd}/mgmt/share_config.h       |   0
 fs/{smb/server => ksmbd}/mgmt/tree_connect.c       |   0
 fs/{smb/server => ksmbd}/mgmt/tree_connect.h       |   0
 fs/{smb/server => ksmbd}/mgmt/user_config.c        |   0
 fs/{smb/server => ksmbd}/mgmt/user_config.h        |   0
 fs/{smb/server => ksmbd}/mgmt/user_session.c       |   0
 fs/{smb/server => ksmbd}/mgmt/user_session.h       |   0
 fs/{smb/server => ksmbd}/misc.c                    |   0
 fs/{smb/server => ksmbd}/misc.h                    |   0
 fs/{smb/server => ksmbd}/ndr.c                     |   0
 fs/{smb/server => ksmbd}/ndr.h                     |   0
 fs/{smb/server => ksmbd}/nterr.h                   |   0
 fs/{smb/server => ksmbd}/ntlmssp.h                 |   0
 fs/{smb/server => ksmbd}/oplock.c                  |  72 ++--
 fs/{smb/server => ksmbd}/oplock.h                  |   0
 fs/{smb/server => ksmbd}/server.c                  |   0
 fs/{smb/server => ksmbd}/server.h                  |   0
 fs/{smb/server => ksmbd}/smb2misc.c                |   0
 fs/{smb/server => ksmbd}/smb2ops.c                 |   0
 fs/{smb/server => ksmbd}/smb2pdu.c                 |  96 ++---
 fs/{smb/server => ksmbd}/smb2pdu.h                 |   0
 fs/{smb/server => ksmbd}/smb_common.c              |   0
 fs/{smb/server => ksmbd}/smb_common.h              |   2 +-
 fs/{smb/server => ksmbd}/smbacl.c                  |   0
 fs/{smb/server => ksmbd}/smbacl.h                  |   0
 fs/{smb/server => ksmbd}/smbfsctl.h                |   2 +-
 fs/{smb/server => ksmbd}/smbstatus.h               |   2 +-
 fs/{smb/server => ksmbd}/transport_ipc.c           |   0
 fs/{smb/server => ksmbd}/transport_ipc.h           |   0
 fs/{smb/server => ksmbd}/transport_rdma.c          |   0
 fs/{smb/server => ksmbd}/transport_rdma.h          |   0
 fs/{smb/server => ksmbd}/transport_tcp.c           |   0
 fs/{smb/server => ksmbd}/transport_tcp.h           |   0
 fs/{smb/server => ksmbd}/unicode.c                 |   0
 fs/{smb/server => ksmbd}/unicode.h                 |   0
 fs/{smb/server => ksmbd}/uniupr.h                  |   0
 fs/{smb/server => ksmbd}/vfs.c                     |   9 +-
 fs/{smb/server => ksmbd}/vfs.h                     |   0
 fs/{smb/server => ksmbd}/vfs_cache.c               |   0
 fs/{smb/server => ksmbd}/vfs_cache.h               |   0
 fs/{smb/server => ksmbd}/xattr.h                   |   0
 fs/nfs/dir.c                                       |   4 +-
 fs/nfs/nfs4proc.c                                  |  12 +-
 fs/nfsd/nfsctl.c                                   |   7 +-
 fs/nfsd/vfs.c                                      |  10 +-
 fs/smb/Kconfig                                     |  11 -
 fs/smb/Makefile                                    |   5 -
 fs/{smb/common => smbfs_common}/Makefile           |   4 +-
 fs/{smb/common => smbfs_common}/arc4.h             |   0
 fs/{smb/common => smbfs_common}/cifs_arc4.c        |   0
 fs/{smb/common => smbfs_common}/cifs_md4.c         |   0
 fs/{smb/common => smbfs_common}/md4.h              |   0
 fs/{smb/common => smbfs_common}/smb2pdu.h          |   0
 fs/{smb/common => smbfs_common}/smbfsctl.h         |   0
 fs/xattr.c                                         |  15 +-
 include/asm-generic/vmlinux.lds.h                  |   9 +-
 include/drm/drm_managed.h                          |  18 +-
 include/linux/arm_ffa.h                            |   1 -
 include/linux/cper.h                               |   6 -
 include/linux/efi.h                                |   2 -
 include/linux/firewire.h                           |   2 +-
 include/linux/fs.h                                 |  42 +--
 include/linux/if_team.h                            |   1 -
 include/linux/iio/iio-gts-helper.h                 |   2 +-
 include/linux/lockdep.h                            |  14 -
 include/linux/lockdep_types.h                      |   1 -
 include/linux/mlx5/driver.h                        |   1 -
 include/linux/mlx5/mlx5_ifc.h                      |   4 +-
 include/linux/msi.h                                |   9 +-
 include/linux/page-flags.h                         |   6 -
 include/linux/pe.h                                 |  25 +-
 include/linux/power/bq27xxx_battery.h              |   4 -
 include/linux/sched/task.h                         |   1 +
 include/linux/sched/vhost_task.h                   |  15 +-
 include/linux/skbuff.h                             |  10 -
 include/linux/skmsg.h                              |   3 +-
 include/linux/sunrpc/svcsock.h                     |   7 +-
 include/linux/usb/hcd.h                            |   5 -
 include/media/v4l2-subdev.h                        |   1 -
 include/net/bluetooth/hci_core.h                   |   2 +-
 include/net/bonding.h                              |   1 -
 include/net/handshake.h                            |   1 -
 include/net/ip.h                                   |   2 -
 include/net/mana/mana.h                            |   2 +
 include/net/page_pool.h                            |  18 +
 include/net/sock.h                                 |   4 -
 include/net/tcp.h                                  |  11 -
 include/net/tls.h                                  |   1 -
 include/sound/soc-acpi.h                           |   1 -
 include/sound/soc-dpcm.h                           |   4 -
 include/target/iscsi/iscsi_target_core.h           |   7 +-
 include/uapi/linux/handshake.h                     |   1 -
 include/uapi/linux/in.h                            |   1 -
 include/uapi/sound/skl-tplg-interface.h            |   3 +-
 io_uring/epoll.c                                   |   4 +
 io_uring/sqpoll.c                                  |   6 +-
 kernel/bpf/hashtab.c                               |   6 +-
 kernel/bpf/offload.c                               |   2 +-
 kernel/bpf/verifier.c                              |   2 +-
 kernel/exit.c                                      |   5 +-
 kernel/fork.c                                      |  13 +-
 kernel/irq/msi.c                                   |   4 +-
 kernel/locking/lockdep.c                           |  28 +-
 kernel/module/decompress.c                         |   2 +-
 kernel/module/main.c                               |   4 +-
 kernel/module/stats.c                              |   4 +-
 kernel/signal.c                                    |   8 +-
 kernel/trace/trace_events_user.c                   | 290 ++++++++++-----
 kernel/trace/trace_output.c                        |   2 +-
 kernel/trace/trace_probe.h                         |   2 +-
 kernel/vhost_task.c                                |  92 ++---
 lib/debugobjects.c                                 |  17 +-
 lib/test_firmware.c                                |  81 +----
 mm/Kconfig.debug                                   |   1 -
 mm/page_table_check.c                              |   6 -
 net/bluetooth/hci_conn.c                           |  77 ++--
 net/core/page_pool.c                               |  28 +-
 net/core/rtnetlink.c                               |  54 +--
 net/core/skbuff.c                                  |   4 +-
 net/core/skmsg.c                                   |  81 +++--
 net/core/sock.c                                    |   2 +-
 net/core/sock_map.c                                |   3 +-
 net/handshake/handshake-test.c                     |  44 +--
 net/handshake/handshake.h                          |   1 -
 net/handshake/netlink.c                            |  12 +-
 net/handshake/request.c                            |   4 -
 net/handshake/tlshd.c                              |   8 -
 net/ipv4/af_inet.c                                 |   2 -
 net/ipv4/inet_connection_sock.c                    |   1 -
 net/ipv4/ip_sockglue.c                             |  12 +-
 net/ipv4/raw.c                                     |   5 +-
 net/ipv4/tcp.c                                     |  20 +-
 net/ipv4/tcp_bpf.c                                 |  79 +----
 net/ipv4/tcp_input.c                               |   2 +-
 net/ipv4/tcp_timer.c                               |  16 +-
 net/ipv4/udp.c                                     |   7 +-
 net/ipv4/udplite.c                                 |   2 -
 net/ipv6/exthdrs_core.c                            |   2 -
 net/ipv6/raw.c                                     |   3 +-
 net/ipv6/udplite.c                                 |   2 -
 net/mptcp/protocol.c                               | 140 ++++----
 net/mptcp/protocol.h                               |  15 +-
 net/mptcp/subflow.c                                |  28 +-
 net/netlink/af_netlink.c                           |   2 +-
 net/netrom/nr_subr.c                               |   7 +-
 net/packet/af_packet.c                             |   8 +-
 net/packet/diag.c                                  |   2 +-
 net/rxrpc/af_rxrpc.c                               |   1 -
 net/rxrpc/ar-internal.h                            |   1 -
 net/rxrpc/local_event.c                            |  11 +-
 net/sched/cls_flower.c                             |   3 -
 net/sched/sch_api.c                                |  16 +-
 net/sched/sch_ingress.c                            |  16 +-
 net/sctp/transport.c                               |  11 +-
 net/smc/af_smc.c                                   |   9 +-
 net/smc/smc_core.c                                 |   1 -
 net/smc/smc_llc.c                                  |   9 +-
 net/sunrpc/sched.c                                 |   5 +-
 net/sunrpc/svcsock.c                               |  24 +-
 net/tls/tls.h                                      |   5 -
 net/tls/tls_device.c                               |  22 +-
 net/tls/tls_strp.c                                 | 189 ++--------
 net/tls/tls_sw.c                                   |   8 +-
 net/unix/af_unix.c                                 |   7 +-
 net/vmw_vsock/virtio_transport_common.c            |   5 +-
 samples/bpf/hbm.c                                  |   1 +
 security/selinux/Makefile                          |   6 +-
 sound/hda/hdac_device.c                            |   2 +-
 sound/pci/hda/patch_ca0132.c                       |   1 -
 sound/pci/hda/patch_realtek.c                      |   2 -
 sound/soc/codecs/cs35l41-lib.c                     |   6 +-
 sound/soc/codecs/lpass-tx-macro.c                  |   5 -
 sound/soc/codecs/rt5682-i2c.c                      |   4 +-
 sound/soc/codecs/rt5682.c                          |   6 -
 sound/soc/codecs/rt5682.h                          |   1 -
 sound/soc/dwc/dwc-i2s.c                            |  41 ++-
 sound/soc/intel/avs/apl.c                          |   6 +-
 sound/soc/intel/avs/avs.h                          |   4 +-
 sound/soc/intel/avs/board_selection.c              |   2 +-
 sound/soc/intel/avs/control.c                      |  22 +-
 sound/soc/intel/avs/dsp.c                          |   4 +-
 sound/soc/intel/avs/messages.h                     |   2 +-
 sound/soc/intel/avs/path.h                         |   2 +-
 sound/soc/intel/avs/pcm.c                          |  23 +-
 sound/soc/intel/avs/probes.c                       |   2 +-
 sound/soc/soc-pcm.c                                |  20 --
 tools/gpio/lsgpio.c                                |   2 +-
 tools/include/linux/coresight-pmu.h                |  13 +
 tools/include/uapi/linux/in.h                      |   1 -
 tools/net/ynl/lib/ynl.py                           |   5 +-
 tools/perf/Makefile.config                         |   1 -
 tools/perf/Makefile.perf                           |   3 +-
 tools/perf/arch/arm/util/pmu.c                     |   2 +-
 tools/perf/builtin-ftrace.c                        |   2 +-
 tools/perf/util/Build                              |   2 +-
 tools/perf/util/bpf_skel/sample_filter.bpf.c       |   4 +-
 tools/perf/util/cs-etm.h                           |  13 -
 tools/perf/util/evsel.c                            |   1 -
 tools/perf/util/evsel.h                            |   6 +-
 tools/perf/util/symbol-elf.c                       |  27 --
 tools/testing/cxl/Kbuild                           |   1 -
 tools/testing/cxl/test/mem.c                       |   1 -
 tools/testing/cxl/test/mock.c                      |  15 -
 tools/testing/selftests/bpf/Makefile               |   2 +-
 .../selftests/bpf/prog_tests/sockmap_basic.c       | 131 -------
 .../selftests/bpf/prog_tests/sockmap_helpers.h     | 390 ---------------------
 .../selftests/bpf/prog_tests/sockmap_listen.c      | 370 ++++++++++++++++++-
 .../selftests/bpf/progs/test_sockmap_drop_prog.c   |  32 --
 .../selftests/bpf/progs/test_sockmap_kern.h        |  12 +-
 .../selftests/bpf/progs/test_sockmap_pass_prog.c   |  32 --
 .../ftrace/test.d/filter/event-filter-function.tc  |  45 +--
 tools/testing/selftests/gpio/gpio-sim.sh           |   3 -
 tools/testing/selftests/kvm/Makefile               |   1 -
 .../selftests/kvm/x86_64/recalc_apic_map_test.c    |  74 ----
 tools/testing/selftests/net/fib_tests.sh           |   2 +-
 tools/testing/selftests/net/mptcp/Makefile         |   2 +-
 tools/testing/selftests/net/mptcp/diag.sh          |   4 -
 tools/testing/selftests/net/mptcp/mptcp_connect.sh |   4 -
 tools/testing/selftests/net/mptcp/mptcp_join.sh    |  17 +-
 tools/testing/selftests/net/mptcp/mptcp_lib.sh     |  40 ---
 tools/testing/selftests/net/mptcp/mptcp_sockopt.sh |   4 -
 tools/testing/selftests/net/mptcp/pm_netlink.sh    |   4 -
 tools/testing/selftests/net/mptcp/simult_flows.sh  |   4 -
 tools/testing/selftests/net/mptcp/userspace_pm.sh  |   4 -
 tools/testing/selftests/user_events/dyn_test.c     | 177 +++++++---
 tools/testing/selftests/user_events/ftrace_test.c  |  88 ++++-
 tools/testing/selftests/user_events/perf_test.c    |  82 +++++
 740 files changed, 3557 insertions(+), 5855 deletions(-)
 rename Documentation/filesystems/{smb => cifs}/cifsroot.rst (97%)
 rename Documentation/filesystems/{smb => cifs}/index.rst (100%)
 rename Documentation/filesystems/{smb => cifs}/ksmbd.rst (100%)
 rename arch/powerpc/crypto/{aesp10-ppc.pl => aesp8-ppc.pl} (99%)
 rename arch/powerpc/crypto/{ghashp10-ppc.pl => ghashp8-ppc.pl} (97%)
 delete mode 100644 arch/xtensa/lib/bswapdi2.S
 delete mode 100644 arch/xtensa/lib/bswapsi2.S
 rename fs/{smb/client => cifs}/Kconfig (100%)
 rename fs/{smb/client => cifs}/Makefile (100%)
 rename fs/{smb/client => cifs}/asn1.c (100%)
 rename fs/{smb/client => cifs}/cached_dir.c (100%)
 rename fs/{smb/client => cifs}/cached_dir.h (100%)
 rename fs/{smb/client => cifs}/cifs_debug.c (99%)
 rename fs/{smb/client => cifs}/cifs_debug.h (100%)
 rename fs/{smb/client => cifs}/cifs_dfs_ref.c (100%)
 rename fs/{smb/client => cifs}/cifs_fs_sb.h (100%)
 rename fs/{smb/client => cifs}/cifs_ioctl.h (100%)
 rename fs/{smb/client => cifs}/cifs_spnego.c (100%)
 rename fs/{smb/client => cifs}/cifs_spnego.h (100%)
 rename fs/{smb/client => cifs}/cifs_spnego_negtokeninit.asn1 (100%)
 rename fs/{smb/client => cifs}/cifs_swn.c (100%)
 rename fs/{smb/client => cifs}/cifs_swn.h (100%)
 rename fs/{smb/client => cifs}/cifs_unicode.c (100%)
 rename fs/{smb/client => cifs}/cifs_unicode.h (100%)
 rename fs/{smb/client => cifs}/cifs_uniupr.h (100%)
 rename fs/{smb/client => cifs}/cifsacl.c (100%)
 rename fs/{smb/client => cifs}/cifsacl.h (100%)
 rename fs/{smb/client => cifs}/cifsencrypt.c (99%)
 rename fs/{smb/client => cifs}/cifsfs.c (100%)
 rename fs/{smb/client => cifs}/cifsfs.h (100%)
 rename fs/{smb/client => cifs}/cifsglob.h (99%)
 rename fs/{smb/client => cifs}/cifspdu.h (99%)
 rename fs/{smb/client => cifs}/cifsproto.h (100%)
 rename fs/{smb/client => cifs}/cifsroot.c (100%)
 rename fs/{smb/client => cifs}/cifssmb.c (100%)
 rename fs/{smb/client => cifs}/connect.c (100%)
 rename fs/{smb/client => cifs}/dfs.c (99%)
 rename fs/{smb/client => cifs}/dfs.h (100%)
 rename fs/{smb/client => cifs}/dfs_cache.c (100%)
 rename fs/{smb/client => cifs}/dfs_cache.h (100%)
 rename fs/{smb/client => cifs}/dir.c (100%)
 rename fs/{smb/client => cifs}/dns_resolve.c (100%)
 rename fs/{smb/client => cifs}/dns_resolve.h (100%)
 rename fs/{smb/client => cifs}/export.c (100%)
 rename fs/{smb/client => cifs}/file.c (99%)
 rename fs/{smb/client => cifs}/fs_context.c (99%)
 rename fs/{smb/client => cifs}/fs_context.h (100%)
 rename fs/{smb/client => cifs}/fscache.c (100%)
 rename fs/{smb/client => cifs}/fscache.h (100%)
 rename fs/{smb/client => cifs}/inode.c (100%)
 rename fs/{smb/client => cifs}/ioctl.c (98%)
 rename fs/{smb/client => cifs}/link.c (100%)
 rename fs/{smb/client => cifs}/misc.c (100%)
 rename fs/{smb/client => cifs}/netlink.c (100%)
 rename fs/{smb/client => cifs}/netlink.h (100%)
 rename fs/{smb/client => cifs}/netmisc.c (100%)
 rename fs/{smb/client => cifs}/nterr.c (100%)
 rename fs/{smb/client => cifs}/nterr.h (100%)
 rename fs/{smb/client => cifs}/ntlmssp.h (100%)
 rename fs/{smb/client => cifs}/readdir.c (100%)
 rename fs/{smb/client => cifs}/rfc1002pdu.h (100%)
 rename fs/{smb/client => cifs}/sess.c (100%)
 rename fs/{smb/client => cifs}/smb1ops.c (100%)
 rename fs/{smb/client => cifs}/smb2file.c (100%)
 rename fs/{smb/client => cifs}/smb2glob.h (100%)
 rename fs/{smb/client => cifs}/smb2inode.c (100%)
 rename fs/{smb/client => cifs}/smb2maperror.c (100%)
 rename fs/{smb/client => cifs}/smb2misc.c (100%)
 rename fs/{smb/client => cifs}/smb2ops.c (99%)
 rename fs/{smb/client => cifs}/smb2pdu.c (99%)
 rename fs/{smb/client => cifs}/smb2pdu.h (100%)
 rename fs/{smb/client => cifs}/smb2proto.h (100%)
 rename fs/{smb/client => cifs}/smb2status.h (100%)
 rename fs/{smb/client => cifs}/smb2transport.c (100%)
 rename fs/{smb/client => cifs}/smbdirect.c (100%)
 rename fs/{smb/client => cifs}/smbdirect.h (100%)
 rename fs/{smb/client => cifs}/smbencrypt.c (98%)
 rename fs/{smb/client => cifs}/smberr.h (100%)
 rename fs/{smb/client => cifs}/trace.c (100%)
 rename fs/{smb/client => cifs}/trace.h (100%)
 rename fs/{smb/client => cifs}/transport.c (100%)
 rename fs/{smb/client => cifs}/unc.c (100%)
 rename fs/{smb/client => cifs}/winucase.c (100%)
 rename fs/{smb/client => cifs}/xattr.c (100%)
 rename fs/{smb/server => ksmbd}/Kconfig (100%)
 rename fs/{smb/server => ksmbd}/Makefile (100%)
 rename fs/{smb/server => ksmbd}/asn1.c (100%)
 rename fs/{smb/server => ksmbd}/asn1.h (100%)
 rename fs/{smb/server => ksmbd}/auth.c (99%)
 rename fs/{smb/server => ksmbd}/auth.h (100%)
 rename fs/{smb/server => ksmbd}/connection.c (100%)
 rename fs/{smb/server => ksmbd}/connection.h (100%)
 rename fs/{smb/server => ksmbd}/crypto_ctx.c (100%)
 rename fs/{smb/server => ksmbd}/crypto_ctx.h (100%)
 rename fs/{smb/server => ksmbd}/glob.h (100%)
 rename fs/{smb/server => ksmbd}/ksmbd_netlink.h (100%)
 rename fs/{smb/server => ksmbd}/ksmbd_spnego_negtokeninit.asn1 (100%)
 rename fs/{smb/server => ksmbd}/ksmbd_spnego_negtokentarg.asn1 (100%)
 rename fs/{smb/server => ksmbd}/ksmbd_work.c (100%)
 rename fs/{smb/server => ksmbd}/ksmbd_work.h (100%)
 rename fs/{smb/server => ksmbd}/mgmt/ksmbd_ida.c (100%)
 rename fs/{smb/server => ksmbd}/mgmt/ksmbd_ida.h (100%)
 rename fs/{smb/server => ksmbd}/mgmt/share_config.c (100%)
 rename fs/{smb/server => ksmbd}/mgmt/share_config.h (100%)
 rename fs/{smb/server => ksmbd}/mgmt/tree_connect.c (100%)
 rename fs/{smb/server => ksmbd}/mgmt/tree_connect.h (100%)
 rename fs/{smb/server => ksmbd}/mgmt/user_config.c (100%)
 rename fs/{smb/server => ksmbd}/mgmt/user_config.h (100%)
 rename fs/{smb/server => ksmbd}/mgmt/user_session.c (100%)
 rename fs/{smb/server => ksmbd}/mgmt/user_session.h (100%)
 rename fs/{smb/server => ksmbd}/misc.c (100%)
 rename fs/{smb/server => ksmbd}/misc.h (100%)
 rename fs/{smb/server => ksmbd}/ndr.c (100%)
 rename fs/{smb/server => ksmbd}/ndr.h (100%)
 rename fs/{smb/server => ksmbd}/nterr.h (100%)
 rename fs/{smb/server => ksmbd}/ntlmssp.h (100%)
 rename fs/{smb/server => ksmbd}/oplock.c (98%)
 rename fs/{smb/server => ksmbd}/oplock.h (100%)
 rename fs/{smb/server => ksmbd}/server.c (100%)
 rename fs/{smb/server => ksmbd}/server.h (100%)
 rename fs/{smb/server => ksmbd}/smb2misc.c (100%)
 rename fs/{smb/server => ksmbd}/smb2ops.c (100%)
 rename fs/{smb/server => ksmbd}/smb2pdu.c (99%)
 rename fs/{smb/server => ksmbd}/smb2pdu.h (100%)
 rename fs/{smb/server => ksmbd}/smb_common.c (100%)
 rename fs/{smb/server => ksmbd}/smb_common.h (99%)
 rename fs/{smb/server => ksmbd}/smbacl.c (100%)
 rename fs/{smb/server => ksmbd}/smbacl.h (100%)
 rename fs/{smb/server => ksmbd}/smbfsctl.h (98%)
 rename fs/{smb/server => ksmbd}/smbstatus.h (99%)
 rename fs/{smb/server => ksmbd}/transport_ipc.c (100%)
 rename fs/{smb/server => ksmbd}/transport_ipc.h (100%)
 rename fs/{smb/server => ksmbd}/transport_rdma.c (100%)
 rename fs/{smb/server => ksmbd}/transport_rdma.h (100%)
 rename fs/{smb/server => ksmbd}/transport_tcp.c (100%)
 rename fs/{smb/server => ksmbd}/transport_tcp.h (100%)
 rename fs/{smb/server => ksmbd}/unicode.c (100%)
 rename fs/{smb/server => ksmbd}/unicode.h (100%)
 rename fs/{smb/server => ksmbd}/uniupr.h (100%)
 rename fs/{smb/server => ksmbd}/vfs.c (99%)
 rename fs/{smb/server => ksmbd}/vfs.h (100%)
 rename fs/{smb/server => ksmbd}/vfs_cache.c (100%)
 rename fs/{smb/server => ksmbd}/vfs_cache.h (100%)
 rename fs/{smb/server => ksmbd}/xattr.h (100%)
 delete mode 100644 fs/smb/Kconfig
 delete mode 100644 fs/smb/Makefile
 rename fs/{smb/common => smbfs_common}/Makefile (59%)
 rename fs/{smb/common => smbfs_common}/arc4.h (100%)
 rename fs/{smb/common => smbfs_common}/cifs_arc4.c (100%)
 rename fs/{smb/common => smbfs_common}/cifs_md4.c (100%)
 rename fs/{smb/common => smbfs_common}/md4.h (100%)
 rename fs/{smb/common => smbfs_common}/smb2pdu.h (100%)
 rename fs/{smb/common => smbfs_common}/smbfsctl.h (100%)
 delete mode 100644 tools/testing/selftests/bpf/prog_tests/sockmap_helpers.h
 delete mode 100644 tools/testing/selftests/bpf/progs/test_sockmap_drop_prog.c
 delete mode 100644 tools/testing/selftests/bpf/progs/test_sockmap_pass_prog.c
 delete mode 100644 tools/testing/selftests/kvm/x86_64/recalc_apic_map_test.c
 delete mode 100644 tools/testing/selftests/net/mptcp/mptcp_lib.sh

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

* [for-linus][PATCH 01/15] tracing/rv/rtla: Update MAINTAINERS file to point to proper mailing list
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 02/15] tracing/user_events: Prevent same name but different args event Steven Rostedt
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton,
	Daniel Bristot de Oliveira, Daniel Bristot de Oliveira

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The mailing list that goes to linux-trace-devel is for the tracing
libraries, and the patchwork associated to the tracing libraries keys
off of that mailing list.

For anything that lives in the Linux kernel proper (including the tools
directory) must go through linux-trace-kernel, as the patchwork to that
list keys off of the Linux kernel proper.

Update the MAINTAINERS file to reflect the proper mailing lists.

Link: https://lore.kernel.org/linux-trace-kernel/20230529044002.0481452b@rorschach.local.home

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Daniel Bristot de Oliveira <bristot@kernel.org>
---
 MAINTAINERS | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 27ef11624748..725d35b5d328 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -17806,7 +17806,7 @@ F:	tools/testing/selftests/rtc/
 Real-time Linux Analysis (RTLA) tools
 M:	Daniel Bristot de Oliveira <bristot@kernel.org>
 M:	Steven Rostedt <rostedt@goodmis.org>
-L:	linux-trace-devel@vger.kernel.org
+L:	linux-trace-kernel@vger.kernel.org
 S:	Maintained
 F:	Documentation/tools/rtla/
 F:	tools/tracing/rtla/
@@ -18368,7 +18368,7 @@ F:	drivers/infiniband/ulp/rtrs/
 RUNTIME VERIFICATION (RV)
 M:	Daniel Bristot de Oliveira <bristot@kernel.org>
 M:	Steven Rostedt <rostedt@goodmis.org>
-L:	linux-trace-devel@vger.kernel.org
+L:	linux-trace-kernel@vger.kernel.org
 S:	Maintained
 F:	Documentation/trace/rv/
 F:	include/linux/rv.h
-- 
2.39.2

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

* [for-linus][PATCH 02/15] tracing/user_events: Prevent same name but different args event
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 01/15] tracing/rv/rtla: Update MAINTAINERS file to point to proper mailing list Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 03/15] tracing/user_events: Handle matching arguments that is null from dyn_events Steven Rostedt
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, sunliming,
	Beau Belgrave

From: sunliming <sunliming@kylinos.cn>

User processes register name_args for events. If the same name but different
args event are registered. The trace outputs of second event are printed
as the first event. This is incorrect.

Return EADDRINUSE back to the user process if the same name but different args
event has being registered.

Link: https://lore.kernel.org/linux-trace-kernel/20230529032100.286534-1-sunliming@kylinos.cn

Signed-off-by: sunliming <sunliming@kylinos.cn>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_user.c              | 36 +++++++++++++++----
 .../selftests/user_events/ftrace_test.c       |  6 ++++
 2 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index dbb14705d0d3..37a38496a6be 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1786,6 +1786,8 @@ static int user_event_parse(struct user_event_group *group, char *name,
 	int ret;
 	u32 key;
 	struct user_event *user;
+	int argc = 0;
+	char **argv;
 
 	/* Prevent dyn_event from racing */
 	mutex_lock(&event_mutex);
@@ -1793,13 +1795,35 @@ static int user_event_parse(struct user_event_group *group, char *name,
 	mutex_unlock(&event_mutex);
 
 	if (user) {
-		*newuser = user;
-		/*
-		 * Name is allocated by caller, free it since it already exists.
-		 * Caller only worries about failure cases for freeing.
-		 */
-		kfree(name);
+		if (args) {
+			argv = argv_split(GFP_KERNEL, args, &argc);
+			if (!argv) {
+				ret = -ENOMEM;
+				goto error;
+			}
+
+			ret = user_fields_match(user, argc, (const char **)argv);
+			argv_free(argv);
+
+		} else
+			ret = list_empty(&user->fields);
+
+		if (ret) {
+			*newuser = user;
+			/*
+			 * Name is allocated by caller, free it since it already exists.
+			 * Caller only worries about failure cases for freeing.
+			 */
+			kfree(name);
+		} else {
+			ret = -EADDRINUSE;
+			goto error;
+		}
+
 		return 0;
+error:
+		refcount_dec(&user->refcnt);
+		return ret;
 	}
 
 	user = kzalloc(sizeof(*user), GFP_KERNEL_ACCOUNT);
diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c
index 7c99cef94a65..6e8c4b47281c 100644
--- a/tools/testing/selftests/user_events/ftrace_test.c
+++ b/tools/testing/selftests/user_events/ftrace_test.c
@@ -228,6 +228,12 @@ TEST_F(user, register_events) {
 	ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, &reg));
 	ASSERT_EQ(0, reg.write_index);
 
+	/* Multiple registers to same name but different args should fail */
+	reg.enable_bit = 29;
+	reg.name_args = (__u64)"__test_event u32 field1;";
+	ASSERT_EQ(-1, ioctl(self->data_fd, DIAG_IOCSREG, &reg));
+	ASSERT_EQ(EADDRINUSE, errno);
+
 	/* Ensure disabled */
 	self->enable_fd = open(enable_file, O_RDWR);
 	ASSERT_NE(-1, self->enable_fd);
-- 
2.39.2

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

* [for-linus][PATCH 03/15] tracing/user_events: Handle matching arguments that is null from dyn_events
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 01/15] tracing/rv/rtla: Update MAINTAINERS file to point to proper mailing list Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 02/15] tracing/user_events: Prevent same name but different args event Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 04/15] tracing: Modify print_fields() for fields output order Steven Rostedt
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, sunliming

From: sunliming <sunliming@kylinos.cn>

When A registering user event from dyn_events has no argments, it will pass the
matching check, regardless of whether there is a user event with the same name
and arguments. Add the matching check when the arguments of registering user
event is null.

Link: https://lore.kernel.org/linux-trace-kernel/20230529065110.303440-1-sunliming@kylinos.cn

Signed-off-by: sunliming <sunliming@kylinos.cn>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_user.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index 37a38496a6be..afe61dc86543 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1745,6 +1745,8 @@ static bool user_event_match(const char *system, const char *event,
 
 	if (match && argc > 0)
 		match = user_fields_match(user, argc, argv);
+	else if (match && argc == 0)
+		match = list_empty(&user->fields);
 
 	return match;
 }
-- 
2.39.2

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

* [for-linus][PATCH 04/15] tracing: Modify print_fields() for fields output order
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (2 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 03/15] tracing/user_events: Handle matching arguments that is null from dyn_events Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 05/15] tracing/user_events: Fix the incorrect trace record for empty arguments events Steven Rostedt
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, sunliming

From: sunliming <sunliming@kylinos.cn>

Now the print_fields() print trace event fields in reverse order. Modify
it to the positive sequence.

Example outputs for a user event:
	test0 u32 count1; u32 count2

Output before:
	example-2547    [000] .....   325.666387: test0: count2=0x2 (2) count1=0x1 (1)

Output after:
	example-2742    [002] .....   429.769370: test0: count1=0x1 (1) count2=0x2 (2)

Link: https://lore.kernel.org/linux-trace-kernel/20230525085232.5096-1-sunliming@kylinos.cn

Fixes: 80a76994b2d88 ("tracing: Add "fields" option to show raw trace event fields")
Signed-off-by: sunliming <sunliming@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_output.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 15f05faaae44..1e33f367783e 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -847,7 +847,7 @@ static void print_fields(struct trace_iterator *iter, struct trace_event_call *c
 	int ret;
 	void *pos;
 
-	list_for_each_entry(field, head, link) {
+	list_for_each_entry_reverse(field, head, link) {
 		trace_seq_printf(&iter->seq, " %s=", field->name);
 		if (field->offset + field->size > iter->ent_size) {
 			trace_seq_puts(&iter->seq, "<OVERFLOW>");
-- 
2.39.2

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

* [for-linus][PATCH 05/15] tracing/user_events: Fix the incorrect trace record for empty arguments events
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (3 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 04/15] tracing: Modify print_fields() for fields output order Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 06/15] selftests/user_events: Add ftrace self-test " Steven Rostedt
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave,
	sunliming

From: sunliming <sunliming@kylinos.cn>

The user_events support events that has empty arguments. But the trace event
is discarded and not really committed when the arguments is empty. Fix this
by not attempting to copy in zero-length data.

Link: https://lkml.kernel.org/r/20230606062027.1008398-2-sunliming@kylinos.cn

Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: sunliming <sunliming@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index afe61dc86543..49914b6cb651 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -1432,7 +1432,7 @@ static void user_event_ftrace(struct user_event *user, struct iov_iter *i,
 	if (unlikely(!entry))
 		return;
 
-	if (unlikely(!copy_nofault(entry + 1, i->count, i)))
+	if (unlikely(i->count != 0 && !copy_nofault(entry + 1, i->count, i)))
 		goto discard;
 
 	if (!list_empty(&user->validators) &&
@@ -1473,7 +1473,7 @@ static void user_event_perf(struct user_event *user, struct iov_iter *i,
 
 		perf_fetch_caller_regs(regs);
 
-		if (unlikely(!copy_nofault(perf_entry + 1, i->count, i)))
+		if (unlikely(i->count != 0 && !copy_nofault(perf_entry + 1, i->count, i)))
 			goto discard;
 
 		if (!list_empty(&user->validators) &&
-- 
2.39.2

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

* [for-linus][PATCH 06/15] selftests/user_events: Add ftrace self-test for empty arguments events
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (4 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 05/15] tracing/user_events: Fix the incorrect trace record for empty arguments events Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 07/15] selftests/user_events: Clear the events after perf self-test Steven Rostedt
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave,
	sunliming

From: sunliming <sunliming@kylinos.cn>

Tests to ensure events that has empty arguments can input trace record
correctly when using ftrace.

Link: https://lkml.kernel.org/r/20230606062027.1008398-3-sunliming@kylinos.cn

Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: sunliming <sunliming@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 .../selftests/user_events/ftrace_test.c       | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c
index 6e8c4b47281c..abfb49558a26 100644
--- a/tools/testing/selftests/user_events/ftrace_test.c
+++ b/tools/testing/selftests/user_events/ftrace_test.c
@@ -316,6 +316,39 @@ TEST_F(user, write_events) {
 	ASSERT_EQ(EINVAL, errno);
 }
 
+TEST_F(user, write_empty_events) {
+	struct user_reg reg = {0};
+	struct iovec io[1];
+	int before = 0, after = 0;
+
+	reg.size = sizeof(reg);
+	reg.name_args = (__u64)"__test_event";
+	reg.enable_bit = 31;
+	reg.enable_addr = (__u64)&self->check;
+	reg.enable_size = sizeof(self->check);
+
+	io[0].iov_base = &reg.write_index;
+	io[0].iov_len = sizeof(reg.write_index);
+
+	/* Register should work */
+	ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, &reg));
+	ASSERT_EQ(0, reg.write_index);
+	ASSERT_EQ(0, self->check);
+
+	/* Enable event */
+	self->enable_fd = open(enable_file, O_RDWR);
+	ASSERT_NE(-1, write(self->enable_fd, "1", sizeof("1")))
+
+	/* Event should now be enabled */
+	ASSERT_EQ(1 << reg.enable_bit, self->check);
+
+	/* Write should make it out to ftrace buffers */
+	before = trace_bytes();
+	ASSERT_NE(-1, writev(self->data_fd, (const struct iovec *)io, 1));
+	after = trace_bytes();
+	ASSERT_GT(after, before);
+}
+
 TEST_F(user, write_fault) {
 	struct user_reg reg = {0};
 	struct iovec io[2];
-- 
2.39.2

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

* [for-linus][PATCH 07/15] selftests/user_events: Clear the events after perf self-test
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (5 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 06/15] selftests/user_events: Add ftrace self-test " Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 08/15] selftests/user_events: Add perf self-test for empty arguments events Steven Rostedt
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave,
	sunliming

From: sunliming <sunliming@kylinos.cn>

When the self test is completed, perf self-test left the user events not to
be cleared. Clear the events by unregister and delete the event.

Link: https://lkml.kernel.org/r/20230606062027.1008398-4-sunliming@kylinos.cn

Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: sunliming <sunliming@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 .../testing/selftests/user_events/perf_test.c | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/tools/testing/selftests/user_events/perf_test.c b/tools/testing/selftests/user_events/perf_test.c
index a070258d4449..e97f24ab6e2f 100644
--- a/tools/testing/selftests/user_events/perf_test.c
+++ b/tools/testing/selftests/user_events/perf_test.c
@@ -81,6 +81,32 @@ static int get_offset(void)
 	return offset;
 }
 
+static int clear(int *check)
+{
+	struct user_unreg unreg = {0};
+
+	unreg.size = sizeof(unreg);
+	unreg.disable_bit = 31;
+	unreg.disable_addr = (__u64)check;
+
+	int fd = open(data_file, O_RDWR);
+
+	if (fd == -1)
+		return -1;
+
+	if (ioctl(fd, DIAG_IOCSUNREG, &unreg) == -1)
+		if (errno != ENOENT)
+			return -1;
+
+	if (ioctl(fd, DIAG_IOCSDEL, "__test_event") == -1)
+		if (errno != ENOENT)
+			return -1;
+
+	close(fd);
+
+	return 0;
+}
+
 FIXTURE(user) {
 	int data_fd;
 	int check;
@@ -93,6 +119,9 @@ FIXTURE_SETUP(user) {
 
 FIXTURE_TEARDOWN(user) {
 	close(self->data_fd);
+
+	if (clear(&self->check) != 0)
+		printf("WARNING: Clear didn't work!\n");
 }
 
 TEST_F(user, perf_write) {
-- 
2.39.2

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

* [for-linus][PATCH 08/15] selftests/user_events: Add perf self-test for empty arguments events
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (6 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 07/15] selftests/user_events: Clear the events after perf self-test Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 09/15] tracing/user_events: Remove user_ns walk for groups Steven Rostedt
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave,
	sunliming

From: sunliming <sunliming@kylinos.cn>

Tests to ensure events that has empty arguments can input trace record
correctly when using perf.

Link: https://lkml.kernel.org/r/20230606062027.1008398-5-sunliming@kylinos.cn

Acked-by: Beau Belgrave <beaub@linux.microsoft.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: sunliming <sunliming@kylinos.cn>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 .../testing/selftests/user_events/perf_test.c | 53 +++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/tools/testing/selftests/user_events/perf_test.c b/tools/testing/selftests/user_events/perf_test.c
index e97f24ab6e2f..8b09be566fa2 100644
--- a/tools/testing/selftests/user_events/perf_test.c
+++ b/tools/testing/selftests/user_events/perf_test.c
@@ -189,6 +189,59 @@ TEST_F(user, perf_write) {
 	ASSERT_EQ(0, self->check);
 }
 
+TEST_F(user, perf_empty_events) {
+	struct perf_event_attr pe = {0};
+	struct user_reg reg = {0};
+	struct perf_event_mmap_page *perf_page;
+	int page_size = sysconf(_SC_PAGESIZE);
+	int id, fd;
+	__u32 *val;
+
+	reg.size = sizeof(reg);
+	reg.name_args = (__u64)"__test_event";
+	reg.enable_bit = 31;
+	reg.enable_addr = (__u64)&self->check;
+	reg.enable_size = sizeof(self->check);
+
+	/* Register should work */
+	ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSREG, &reg));
+	ASSERT_EQ(0, reg.write_index);
+	ASSERT_EQ(0, self->check);
+
+	/* Id should be there */
+	id = get_id();
+	ASSERT_NE(-1, id);
+
+	pe.type = PERF_TYPE_TRACEPOINT;
+	pe.size = sizeof(pe);
+	pe.config = id;
+	pe.sample_type = PERF_SAMPLE_RAW;
+	pe.sample_period = 1;
+	pe.wakeup_events = 1;
+
+	/* Tracepoint attach should work */
+	fd = perf_event_open(&pe, 0, -1, -1, 0);
+	ASSERT_NE(-1, fd);
+
+	perf_page = mmap(NULL, page_size * 2, PROT_READ, MAP_SHARED, fd, 0);
+	ASSERT_NE(MAP_FAILED, perf_page);
+
+	/* Status should be updated */
+	ASSERT_EQ(1 << reg.enable_bit, self->check);
+
+	/* Ensure write shows up at correct offset */
+	ASSERT_NE(-1, write(self->data_fd, &reg.write_index,
+					sizeof(reg.write_index)));
+	val = (void *)(((char *)perf_page) + perf_page->data_offset);
+	ASSERT_EQ(PERF_RECORD_SAMPLE, *val);
+
+	munmap(perf_page, page_size * 2);
+	close(fd);
+
+	/* Status should be updated */
+	ASSERT_EQ(0, self->check);
+}
+
 int main(int argc, char **argv)
 {
 	return test_harness_run(argc, argv);
-- 
2.39.2

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

* [for-linus][PATCH 09/15] tracing/user_events: Remove user_ns walk for groups
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (7 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 08/15] selftests/user_events: Add perf self-test for empty arguments events Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 10/15] tracing/user_events: Store register flags on events Steven Rostedt
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Christian Brauner,
	Beau Belgrave

From: Beau Belgrave <beaub@linux.microsoft.com>

During discussions it was suggested that user_ns is not a good place to
try to attach a tracing namespace. The current code has stubs to enable
that work that are very likely to change and incur a performance cost.

Remove the user_ns walk when creating a group and determining the system
name to use, since it's unlikely user_ns will be used in the future.

Link: https://lore.kernel.org/all/20230601-urenkel-holzofen-cd9403b9cadd@brauner/
Link: https://lore.kernel.org/linux-trace-kernel/20230601224928.301-1-beaub@linux.microsoft.com

Suggested-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_user.c | 42 ++++----------------------------
 1 file changed, 5 insertions(+), 37 deletions(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index 49914b6cb651..cf6d4c02c363 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -182,21 +182,11 @@ static void user_event_group_destroy(struct user_event_group *group)
 	kfree(group);
 }
 
-static char *user_event_group_system_name(struct user_namespace *user_ns)
+static char *user_event_group_system_name(void)
 {
 	char *system_name;
 	int len = sizeof(USER_EVENTS_SYSTEM) + 1;
 
-	if (user_ns != &init_user_ns) {
-		/*
-		 * Unexpected at this point:
-		 * We only currently support init_user_ns.
-		 * When we enable more, this will trigger a failure so log.
-		 */
-		pr_warn("user_events: Namespace other than init_user_ns!\n");
-		return NULL;
-	}
-
 	system_name = kmalloc(len, GFP_KERNEL);
 
 	if (!system_name)
@@ -207,34 +197,12 @@ static char *user_event_group_system_name(struct user_namespace *user_ns)
 	return system_name;
 }
 
-static inline struct user_event_group
-*user_event_group_from_user_ns(struct user_namespace *user_ns)
-{
-	if (user_ns == &init_user_ns)
-		return init_group;
-
-	return NULL;
-}
-
 static struct user_event_group *current_user_event_group(void)
 {
-	struct user_namespace *user_ns = current_user_ns();
-	struct user_event_group *group = NULL;
-
-	while (user_ns) {
-		group = user_event_group_from_user_ns(user_ns);
-
-		if (group)
-			break;
-
-		user_ns = user_ns->parent;
-	}
-
-	return group;
+	return init_group;
 }
 
-static struct user_event_group
-*user_event_group_create(struct user_namespace *user_ns)
+static struct user_event_group *user_event_group_create(void)
 {
 	struct user_event_group *group;
 
@@ -243,7 +211,7 @@ static struct user_event_group
 	if (!group)
 		return NULL;
 
-	group->system_name = user_event_group_system_name(user_ns);
+	group->system_name = user_event_group_system_name();
 
 	if (!group->system_name)
 		goto error;
@@ -2603,7 +2571,7 @@ static int __init trace_events_user_init(void)
 	if (!fault_cache)
 		return -ENOMEM;
 
-	init_group = user_event_group_create(&init_user_ns);
+	init_group = user_event_group_create();
 
 	if (!init_group) {
 		kmem_cache_destroy(fault_cache);
-- 
2.39.2

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

* [for-linus][PATCH 10/15] tracing/user_events: Store register flags on events
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (8 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 09/15] tracing/user_events: Remove user_ns walk for groups Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 11/15] tracing/user_events: Track refcount consistently via put/get Steven Rostedt
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave

From: Beau Belgrave <beaub@linux.microsoft.com>

Currently we don't have any available flags for user processes to use to
indicate options for user_events. We will soon have a flag to indicate
the event should or should not auto-delete once it's not being used by
anyone.

Add a reg_flags field to user_events and parameters to existing
functions to allow for this in future patches.

Link: https://lkml.kernel.org/r/20230614163336.5797-2-beaub@linux.microsoft.com

Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_user.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index cf6d4c02c363..629823e21447 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -87,6 +87,7 @@ struct user_event {
 	struct list_head		validators;
 	refcount_t			refcnt;
 	int				min_size;
+	int				reg_flags;
 	char				status;
 };
 
@@ -165,7 +166,7 @@ typedef void (*user_event_func_t) (struct user_event *user, struct iov_iter *i,
 
 static int user_event_parse(struct user_event_group *group, char *name,
 			    char *args, char *flags,
-			    struct user_event **newuser);
+			    struct user_event **newuser, int reg_flags);
 
 static struct user_event_mm *user_event_mm_get(struct user_event_mm *mm);
 static struct user_event_mm *user_event_mm_get_all(struct user_event *user);
@@ -810,7 +811,8 @@ static struct list_head *user_event_get_fields(struct trace_event_call *call)
  * Upon success user_event has its ref count increased by 1.
  */
 static int user_event_parse_cmd(struct user_event_group *group,
-				char *raw_command, struct user_event **newuser)
+				char *raw_command, struct user_event **newuser,
+				int reg_flags)
 {
 	char *name = raw_command;
 	char *args = strpbrk(name, " ");
@@ -824,7 +826,7 @@ static int user_event_parse_cmd(struct user_event_group *group,
 	if (flags)
 		*flags++ = '\0';
 
-	return user_event_parse(group, name, args, flags, newuser);
+	return user_event_parse(group, name, args, flags, newuser, reg_flags);
 }
 
 static int user_field_array_size(const char *type)
@@ -1588,7 +1590,7 @@ static int user_event_create(const char *raw_command)
 
 	mutex_lock(&group->reg_mutex);
 
-	ret = user_event_parse_cmd(group, name, &user);
+	ret = user_event_parse_cmd(group, name, &user, 0);
 
 	if (!ret)
 		refcount_dec(&user->refcnt);
@@ -1751,7 +1753,7 @@ static int user_event_trace_register(struct user_event *user)
  */
 static int user_event_parse(struct user_event_group *group, char *name,
 			    char *args, char *flags,
-			    struct user_event **newuser)
+			    struct user_event **newuser, int reg_flags)
 {
 	int ret;
 	u32 key;
@@ -1846,6 +1848,8 @@ static int user_event_parse(struct user_event_group *group, char *name,
 	if (ret)
 		goto put_user_lock;
 
+	user->reg_flags = reg_flags;
+
 	/* Ensure we track self ref and caller ref (2) */
 	refcount_set(&user->refcnt, 2);
 
@@ -2144,7 +2148,7 @@ static long user_events_ioctl_reg(struct user_event_file_info *info,
 		return ret;
 	}
 
-	ret = user_event_parse_cmd(info->group, name, &user);
+	ret = user_event_parse_cmd(info->group, name, &user, reg.flags);
 
 	if (ret) {
 		kfree(name);
-- 
2.39.2

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

* [for-linus][PATCH 11/15] tracing/user_events: Track refcount consistently via put/get
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (9 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 10/15] tracing/user_events: Store register flags on events Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 12/15] tracing/user_events: Add auto cleanup and future persist flag Steven Rostedt
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave

From: Beau Belgrave <beaub@linux.microsoft.com>

Various parts of the code today track user_event's refcnt field directly
via a refcount_add/dec. This makes it hard to modify the behavior of the
last reference decrement in all code paths consistently. For example, in
the future we will auto-delete events upon the last reference going
away. This last reference could happen in many places, but we want it to
be consistently handled.

Add user_event_get() and user_event_put() for the add/dec. Update all
places where direct refcounts are being used to utilize these new
functions. In each location pass if event_mutex is locked or not. This
allows us to drop events automatically in future patches clearly. Ensure
when caller states the lock is held, it really is (or is not) held.

Link: https://lkml.kernel.org/r/20230614163336.5797-3-beaub@linux.microsoft.com

Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_user.c | 69 +++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 28 deletions(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index 629823e21447..c064458eea5c 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -177,6 +177,28 @@ static u32 user_event_key(char *name)
 	return jhash(name, strlen(name), 0);
 }
 
+static struct user_event *user_event_get(struct user_event *user)
+{
+	refcount_inc(&user->refcnt);
+
+	return user;
+}
+
+static void user_event_put(struct user_event *user, bool locked)
+{
+#ifdef CONFIG_LOCKDEP
+	if (locked)
+		lockdep_assert_held(&event_mutex);
+	else
+		lockdep_assert_not_held(&event_mutex);
+#endif
+
+	if (unlikely(!user))
+		return;
+
+	refcount_dec(&user->refcnt);
+}
+
 static void user_event_group_destroy(struct user_event_group *group)
 {
 	kfree(group->system_name);
@@ -228,12 +250,13 @@ static struct user_event_group *user_event_group_create(void)
 	return NULL;
 };
 
-static void user_event_enabler_destroy(struct user_event_enabler *enabler)
+static void user_event_enabler_destroy(struct user_event_enabler *enabler,
+				       bool locked)
 {
 	list_del_rcu(&enabler->mm_enablers_link);
 
 	/* No longer tracking the event via the enabler */
-	refcount_dec(&enabler->event->refcnt);
+	user_event_put(enabler->event, locked);
 
 	kfree(enabler);
 }
@@ -295,7 +318,7 @@ static void user_event_enabler_fault_fixup(struct work_struct *work)
 
 	/* User asked for enabler to be removed during fault */
 	if (test_bit(ENABLE_VAL_FREEING_BIT, ENABLE_BITOPS(enabler))) {
-		user_event_enabler_destroy(enabler);
+		user_event_enabler_destroy(enabler, true);
 		goto out;
 	}
 
@@ -470,14 +493,12 @@ static bool user_event_enabler_dup(struct user_event_enabler *orig,
 	if (!enabler)
 		return false;
 
-	enabler->event = orig->event;
+	enabler->event = user_event_get(orig->event);
 	enabler->addr = orig->addr;
 
 	/* Only dup part of value (ignore future flags, etc) */
 	enabler->values = orig->values & ENABLE_VAL_DUP_MASK;
 
-	refcount_inc(&enabler->event->refcnt);
-
 	/* Enablers not exposed yet, RCU not required */
 	list_add(&enabler->mm_enablers_link, &mm->enablers);
 
@@ -594,7 +615,7 @@ static void user_event_mm_destroy(struct user_event_mm *mm)
 	struct user_event_enabler *enabler, *next;
 
 	list_for_each_entry_safe(enabler, next, &mm->enablers, mm_enablers_link)
-		user_event_enabler_destroy(enabler);
+		user_event_enabler_destroy(enabler, false);
 
 	mmdrop(mm->mm);
 	kfree(mm);
@@ -749,7 +770,7 @@ static struct user_event_enabler
 	 * exit or run exec(), which includes forks and clones.
 	 */
 	if (!*write_result) {
-		refcount_inc(&enabler->event->refcnt);
+		user_event_get(user);
 		list_add_rcu(&enabler->mm_enablers_link, &user_mm->enablers);
 	}
 
@@ -1337,10 +1358,8 @@ static struct user_event *find_user_event(struct user_event_group *group,
 	*outkey = key;
 
 	hash_for_each_possible(group->register_table, user, node, key)
-		if (!strcmp(EVENT_NAME(user), name)) {
-			refcount_inc(&user->refcnt);
-			return user;
-		}
+		if (!strcmp(EVENT_NAME(user), name))
+			return user_event_get(user);
 
 	return NULL;
 }
@@ -1554,12 +1573,12 @@ static int user_event_reg(struct trace_event_call *call,
 
 	return ret;
 inc:
-	refcount_inc(&user->refcnt);
+	user_event_get(user);
 	update_enable_bit_for(user);
 	return 0;
 dec:
 	update_enable_bit_for(user);
-	refcount_dec(&user->refcnt);
+	user_event_put(user, true);
 	return 0;
 }
 
@@ -1593,7 +1612,7 @@ static int user_event_create(const char *raw_command)
 	ret = user_event_parse_cmd(group, name, &user, 0);
 
 	if (!ret)
-		refcount_dec(&user->refcnt);
+		user_event_put(user, false);
 
 	mutex_unlock(&group->reg_mutex);
 
@@ -1794,7 +1813,7 @@ static int user_event_parse(struct user_event_group *group, char *name,
 
 		return 0;
 error:
-		refcount_dec(&user->refcnt);
+		user_event_put(user, false);
 		return ret;
 	}
 
@@ -1883,7 +1902,7 @@ static int delete_user_event(struct user_event_group *group, char *name)
 	if (!user)
 		return -ENOENT;
 
-	refcount_dec(&user->refcnt);
+	user_event_put(user, true);
 
 	if (!user_event_last_ref(user))
 		return -EBUSY;
@@ -2042,9 +2061,7 @@ static int user_events_ref_add(struct user_event_file_info *info,
 	for (i = 0; i < count; ++i)
 		new_refs->events[i] = refs->events[i];
 
-	new_refs->events[i] = user;
-
-	refcount_inc(&user->refcnt);
+	new_refs->events[i] = user_event_get(user);
 
 	rcu_assign_pointer(info->refs, new_refs);
 
@@ -2158,7 +2175,7 @@ static long user_events_ioctl_reg(struct user_event_file_info *info,
 	ret = user_events_ref_add(info, user);
 
 	/* No longer need parse ref, ref_add either worked or not */
-	refcount_dec(&user->refcnt);
+	user_event_put(user, false);
 
 	/* Positive number is index and valid */
 	if (ret < 0)
@@ -2307,7 +2324,7 @@ static long user_events_ioctl_unreg(unsigned long uarg)
 			set_bit(ENABLE_VAL_FREEING_BIT, ENABLE_BITOPS(enabler));
 
 			if (!test_bit(ENABLE_VAL_FAULTING_BIT, ENABLE_BITOPS(enabler)))
-				user_event_enabler_destroy(enabler);
+				user_event_enabler_destroy(enabler, true);
 
 			/* Removed at least one */
 			ret = 0;
@@ -2365,7 +2382,6 @@ static int user_events_release(struct inode *node, struct file *file)
 	struct user_event_file_info *info = file->private_data;
 	struct user_event_group *group;
 	struct user_event_refs *refs;
-	struct user_event *user;
 	int i;
 
 	if (!info)
@@ -2389,12 +2405,9 @@ static int user_events_release(struct inode *node, struct file *file)
 	 * The underlying user_events are ref counted, and cannot be freed.
 	 * After this decrement, the user_events may be freed elsewhere.
 	 */
-	for (i = 0; i < refs->count; ++i) {
-		user = refs->events[i];
+	for (i = 0; i < refs->count; ++i)
+		user_event_put(refs->events[i], false);
 
-		if (user)
-			refcount_dec(&user->refcnt);
-	}
 out:
 	file->private_data = NULL;
 
-- 
2.39.2

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

* [for-linus][PATCH 12/15] tracing/user_events: Add auto cleanup and future persist flag
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (10 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 11/15] tracing/user_events: Track refcount consistently via put/get Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 13/15] selftests/user_events: Ensure auto cleanup works as expected Steven Rostedt
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave

From: Beau Belgrave <beaub@linux.microsoft.com>

Currently user events need to be manually deleted via the delete IOCTL
call or via the dynamic_events file. Most operators and processes wish
to have these events auto cleanup when they are no longer used by
anything to prevent them piling without manual maintenance. However,
some operators may not want this, such as pre-registering events via the
dynamic_events tracefs file.

Update user_event_put() to attempt an auto delete of the event if it's
the last reference. The auto delete must run in a work queue to ensure
proper behavior of class->reg() invocations that don't expect the call
to go away from underneath them during the unregister. Add work_struct
to user_event struct to ensure we can do this reliably.

Add a persist flag, that is not yet exposed, to ensure we can toggle
between auto-cleanup and leaving the events existing in the future. When
a non-zero flag is seen during register, return -EINVAL to ensure ABI
is clear for the user processes while we work out the best approach for
persistent events.

Link: https://lkml.kernel.org/r/20230614163336.5797-4-beaub@linux.microsoft.com
Link: https://lore.kernel.org/linux-trace-kernel/20230518093600.3f119d68@rorschach.local.home/

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events_user.c | 139 ++++++++++++++++++++++++++++---
 1 file changed, 126 insertions(+), 13 deletions(-)

diff --git a/kernel/trace/trace_events_user.c b/kernel/trace/trace_events_user.c
index c064458eea5c..8df0550415e7 100644
--- a/kernel/trace/trace_events_user.c
+++ b/kernel/trace/trace_events_user.c
@@ -49,6 +49,18 @@
 #define EVENT_STATUS_PERF BIT(1)
 #define EVENT_STATUS_OTHER BIT(7)
 
+/*
+ * User register flags are not allowed yet, keep them here until we are
+ * ready to expose them out to the user ABI.
+ */
+enum user_reg_flag {
+	/* Event will not delete upon last reference closing */
+	USER_EVENT_REG_PERSIST		= 1U << 0,
+
+	/* This value or above is currently non-ABI */
+	USER_EVENT_REG_MAX		= 1U << 1,
+};
+
 /*
  * Stores the system name, tables, and locks for a group of events. This
  * allows isolation for events by various means.
@@ -85,6 +97,7 @@ struct user_event {
 	struct hlist_node		node;
 	struct list_head		fields;
 	struct list_head		validators;
+	struct work_struct		put_work;
 	refcount_t			refcnt;
 	int				min_size;
 	int				reg_flags;
@@ -171,6 +184,7 @@ static int user_event_parse(struct user_event_group *group, char *name,
 static struct user_event_mm *user_event_mm_get(struct user_event_mm *mm);
 static struct user_event_mm *user_event_mm_get_all(struct user_event *user);
 static void user_event_mm_put(struct user_event_mm *mm);
+static int destroy_user_event(struct user_event *user);
 
 static u32 user_event_key(char *name)
 {
@@ -184,19 +198,103 @@ static struct user_event *user_event_get(struct user_event *user)
 	return user;
 }
 
+static void delayed_destroy_user_event(struct work_struct *work)
+{
+	struct user_event *user = container_of(
+		work, struct user_event, put_work);
+
+	mutex_lock(&event_mutex);
+
+	if (!refcount_dec_and_test(&user->refcnt))
+		goto out;
+
+	if (destroy_user_event(user)) {
+		/*
+		 * The only reason this would fail here is if we cannot
+		 * update the visibility of the event. In this case the
+		 * event stays in the hashtable, waiting for someone to
+		 * attempt to delete it later.
+		 */
+		pr_warn("user_events: Unable to delete event\n");
+		refcount_set(&user->refcnt, 1);
+	}
+out:
+	mutex_unlock(&event_mutex);
+}
+
 static void user_event_put(struct user_event *user, bool locked)
 {
-#ifdef CONFIG_LOCKDEP
-	if (locked)
-		lockdep_assert_held(&event_mutex);
-	else
-		lockdep_assert_not_held(&event_mutex);
-#endif
+	bool delete;
 
 	if (unlikely(!user))
 		return;
 
-	refcount_dec(&user->refcnt);
+	/*
+	 * When the event is not enabled for auto-delete there will always
+	 * be at least 1 reference to the event. During the event creation
+	 * we initially set the refcnt to 2 to achieve this. In those cases
+	 * the caller must acquire event_mutex and after decrement check if
+	 * the refcnt is 1, meaning this is the last reference. When auto
+	 * delete is enabled, there will only be 1 ref, IE: refcnt will be
+	 * only set to 1 during creation to allow the below checks to go
+	 * through upon the last put. The last put must always be done with
+	 * the event mutex held.
+	 */
+	if (!locked) {
+		lockdep_assert_not_held(&event_mutex);
+		delete = refcount_dec_and_mutex_lock(&user->refcnt, &event_mutex);
+	} else {
+		lockdep_assert_held(&event_mutex);
+		delete = refcount_dec_and_test(&user->refcnt);
+	}
+
+	if (!delete)
+		return;
+
+	/*
+	 * We now have the event_mutex in all cases, which ensures that
+	 * no new references will be taken until event_mutex is released.
+	 * New references come through find_user_event(), which requires
+	 * the event_mutex to be held.
+	 */
+
+	if (user->reg_flags & USER_EVENT_REG_PERSIST) {
+		/* We should not get here when persist flag is set */
+		pr_alert("BUG: Auto-delete engaged on persistent event\n");
+		goto out;
+	}
+
+	/*
+	 * Unfortunately we have to attempt the actual destroy in a work
+	 * queue. This is because not all cases handle a trace_event_call
+	 * being removed within the class->reg() operation for unregister.
+	 */
+	INIT_WORK(&user->put_work, delayed_destroy_user_event);
+
+	/*
+	 * Since the event is still in the hashtable, we have to re-inc
+	 * the ref count to 1. This count will be decremented and checked
+	 * in the work queue to ensure it's still the last ref. This is
+	 * needed because a user-process could register the same event in
+	 * between the time of event_mutex release and the work queue
+	 * running the delayed destroy. If we removed the item now from
+	 * the hashtable, this would result in a timing window where a
+	 * user process would fail a register because the trace_event_call
+	 * register would fail in the tracing layers.
+	 */
+	refcount_set(&user->refcnt, 1);
+
+	if (WARN_ON_ONCE(!schedule_work(&user->put_work))) {
+		/*
+		 * If we fail we must wait for an admin to attempt delete or
+		 * another register/close of the event, whichever is first.
+		 */
+		pr_warn("user_events: Unable to queue delayed destroy\n");
+	}
+out:
+	/* Ensure if we didn't have event_mutex before we unlock it */
+	if (!locked)
+		mutex_unlock(&event_mutex);
 }
 
 static void user_event_group_destroy(struct user_event_group *group)
@@ -793,7 +891,12 @@ static struct user_event_enabler
 static __always_inline __must_check
 bool user_event_last_ref(struct user_event *user)
 {
-	return refcount_read(&user->refcnt) == 1;
+	int last = 0;
+
+	if (user->reg_flags & USER_EVENT_REG_PERSIST)
+		last = 1;
+
+	return refcount_read(&user->refcnt) == last;
 }
 
 static __always_inline __must_check
@@ -1609,7 +1712,8 @@ static int user_event_create(const char *raw_command)
 
 	mutex_lock(&group->reg_mutex);
 
-	ret = user_event_parse_cmd(group, name, &user, 0);
+	/* Dyn events persist, otherwise they would cleanup immediately */
+	ret = user_event_parse_cmd(group, name, &user, USER_EVENT_REG_PERSIST);
 
 	if (!ret)
 		user_event_put(user, false);
@@ -1780,6 +1884,10 @@ static int user_event_parse(struct user_event_group *group, char *name,
 	int argc = 0;
 	char **argv;
 
+	/* User register flags are not ready yet */
+	if (reg_flags != 0 || flags != NULL)
+		return -EINVAL;
+
 	/* Prevent dyn_event from racing */
 	mutex_lock(&event_mutex);
 	user = find_user_event(group, name, &key);
@@ -1869,8 +1977,13 @@ static int user_event_parse(struct user_event_group *group, char *name,
 
 	user->reg_flags = reg_flags;
 
-	/* Ensure we track self ref and caller ref (2) */
-	refcount_set(&user->refcnt, 2);
+	if (user->reg_flags & USER_EVENT_REG_PERSIST) {
+		/* Ensure we track self ref and caller ref (2) */
+		refcount_set(&user->refcnt, 2);
+	} else {
+		/* Ensure we track only caller ref (1) */
+		refcount_set(&user->refcnt, 1);
+	}
 
 	dyn_event_init(&user->devent, &user_event_dops);
 	dyn_event_add(&user->devent, &user->call);
@@ -2092,8 +2205,8 @@ static long user_reg_get(struct user_reg __user *ureg, struct user_reg *kreg)
 	if (ret)
 		return ret;
 
-	/* Ensure no flags, since we don't support any yet */
-	if (kreg->flags != 0)
+	/* Ensure only valid flags */
+	if (kreg->flags & ~(USER_EVENT_REG_MAX-1))
 		return -EINVAL;
 
 	/* Ensure supported size */
-- 
2.39.2

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

* [for-linus][PATCH 13/15] selftests/user_events: Ensure auto cleanup works as expected
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (11 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 12/15] tracing/user_events: Add auto cleanup and future persist flag Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 14/15] selftests/user_events: Adapt dyn_test to non-persist events Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 15/15] tracing/user_events: Document auto-cleanup and remove dyn_event refs Steven Rostedt
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave

From: Beau Belgrave <beaub@linux.microsoft.com>

User events now auto cleanup upon the last reference put. Update
ftrace_test to ensure this works as expected. Ensure EBUSY delays
while event is being deleted do not cause transient failures by
waiting and re-attempting.

Link: https://lkml.kernel.org/r/20230614163336.5797-5-beaub@linux.microsoft.com

Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 .../selftests/user_events/ftrace_test.c       | 49 ++++++++++++++-----
 1 file changed, 38 insertions(+), 11 deletions(-)

diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c
index abfb49558a26..eb6904d89f14 100644
--- a/tools/testing/selftests/user_events/ftrace_test.c
+++ b/tools/testing/selftests/user_events/ftrace_test.c
@@ -102,30 +102,56 @@ static int get_print_fmt(char *buffer, int len)
 	return -1;
 }
 
+static bool wait_for_delete(void)
+{
+	int i;
+
+	for (i = 0; i < 1000; ++i) {
+		int fd = open(enable_file, O_RDONLY);
+
+		if (fd == -1)
+			return true;
+
+		close(fd);
+		usleep(1000);
+	}
+
+	return false;
+}
+
 static int clear(int *check)
 {
 	struct user_unreg unreg = {0};
+	int fd;
 
 	unreg.size = sizeof(unreg);
 	unreg.disable_bit = 31;
 	unreg.disable_addr = (__u64)check;
 
-	int fd = open(data_file, O_RDWR);
+	fd = open(data_file, O_RDWR);
 
 	if (fd == -1)
 		return -1;
 
 	if (ioctl(fd, DIAG_IOCSUNREG, &unreg) == -1)
 		if (errno != ENOENT)
-			return -1;
-
-	if (ioctl(fd, DIAG_IOCSDEL, "__test_event") == -1)
-		if (errno != ENOENT)
-			return -1;
+			goto fail;
+
+	if (ioctl(fd, DIAG_IOCSDEL, "__test_event") == -1) {
+		if (errno == EBUSY) {
+			if (!wait_for_delete())
+				goto fail;
+		} else if (errno != ENOENT)
+			goto fail;
+	}
 
 	close(fd);
 
 	return 0;
+fail:
+	close(fd);
+
+	return -1;
 }
 
 static int check_print_fmt(const char *event, const char *expected, int *check)
@@ -155,9 +181,8 @@ static int check_print_fmt(const char *event, const char *expected, int *check)
 	/* Register should work */
 	ret = ioctl(fd, DIAG_IOCSREG, &reg);
 
-	close(fd);
-
 	if (ret != 0) {
+		close(fd);
 		printf("Reg failed in fmt\n");
 		return ret;
 	}
@@ -165,6 +190,8 @@ static int check_print_fmt(const char *event, const char *expected, int *check)
 	/* Ensure correct print_fmt */
 	ret = get_print_fmt(print_fmt, sizeof(print_fmt));
 
+	close(fd);
+
 	if (ret != 0)
 		return ret;
 
@@ -256,10 +283,10 @@ TEST_F(user, register_events) {
 	unreg.disable_bit = 30;
 	ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSUNREG, &unreg));
 
-	/* Delete should work only after close and unregister */
+	/* Delete should have been auto-done after close and unregister */
 	close(self->data_fd);
-	self->data_fd = open(data_file, O_RDWR);
-	ASSERT_EQ(0, ioctl(self->data_fd, DIAG_IOCSDEL, "__test_event"));
+
+	ASSERT_EQ(true, wait_for_delete());
 }
 
 TEST_F(user, write_events) {
-- 
2.39.2

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

* [for-linus][PATCH 14/15] selftests/user_events: Adapt dyn_test to non-persist events
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (12 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 13/15] selftests/user_events: Ensure auto cleanup works as expected Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  2023-06-15 13:05 ` [for-linus][PATCH 15/15] tracing/user_events: Document auto-cleanup and remove dyn_event refs Steven Rostedt
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave

From: Beau Belgrave <beaub@linux.microsoft.com>

Now that user_events does not honor persist events the dynamic_events
file cannot be easily used to test parsing and matching cases.

Update dyn_test to use the direct ABI file instead of dynamic_events so
that we still have testing coverage until persist events and
dynamic_events file integration has been decided.

Link: https://lkml.kernel.org/r/20230614163336.5797-6-beaub@linux.microsoft.com

Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 .../testing/selftests/user_events/dyn_test.c  | 177 ++++++++++++++----
 1 file changed, 136 insertions(+), 41 deletions(-)

diff --git a/tools/testing/selftests/user_events/dyn_test.c b/tools/testing/selftests/user_events/dyn_test.c
index 8879a7b04c6a..d6979a48478f 100644
--- a/tools/testing/selftests/user_events/dyn_test.c
+++ b/tools/testing/selftests/user_events/dyn_test.c
@@ -16,42 +16,140 @@
 
 #include "../kselftest_harness.h"
 
-const char *dyn_file = "/sys/kernel/tracing/dynamic_events";
-const char *clear = "!u:__test_event";
+const char *abi_file = "/sys/kernel/tracing/user_events_data";
+const char *enable_file = "/sys/kernel/tracing/events/user_events/__test_event/enable";
 
-static int Append(const char *value)
+static bool wait_for_delete(void)
 {
-	int fd = open(dyn_file, O_RDWR | O_APPEND);
-	int ret = write(fd, value, strlen(value));
+	int i;
+
+	for (i = 0; i < 1000; ++i) {
+		int fd = open(enable_file, O_RDONLY);
+
+		if (fd == -1)
+			return true;
+
+		close(fd);
+		usleep(1000);
+	}
+
+	return false;
+}
+
+static int reg_event(int fd, int *check, int bit, const char *value)
+{
+	struct user_reg reg = {0};
+
+	reg.size = sizeof(reg);
+	reg.name_args = (__u64)value;
+	reg.enable_bit = bit;
+	reg.enable_addr = (__u64)check;
+	reg.enable_size = sizeof(*check);
+
+	if (ioctl(fd, DIAG_IOCSREG, &reg) == -1)
+		return -1;
+
+	return 0;
+}
+
+static int unreg_event(int fd, int *check, int bit)
+{
+	struct user_unreg unreg = {0};
+
+	unreg.size = sizeof(unreg);
+	unreg.disable_bit = bit;
+	unreg.disable_addr = (__u64)check;
+
+	return ioctl(fd, DIAG_IOCSUNREG, &unreg);
+}
+
+static int parse(int *check, const char *value)
+{
+	int fd = open(abi_file, O_RDWR);
+	int ret;
+
+	if (fd == -1)
+		return -1;
+
+	/* Until we have persist flags via dynamic events, use the base name */
+	if (value[0] != 'u' || value[1] != ':') {
+		close(fd);
+		return -1;
+	}
+
+	ret = reg_event(fd, check, 31, value + 2);
+
+	if (ret != -1) {
+		if (unreg_event(fd, check, 31) == -1)
+			printf("WARN: Couldn't unreg event\n");
+	}
 
 	close(fd);
+
 	return ret;
 }
 
-#define CLEAR() \
+static int check_match(int *check, const char *first, const char *second, bool *match)
+{
+	int fd = open(abi_file, O_RDWR);
+	int ret = -1;
+
+	if (fd == -1)
+		return -1;
+
+	if (reg_event(fd, check, 31, first) == -1)
+		goto cleanup;
+
+	if (reg_event(fd, check, 30, second) == -1) {
+		if (errno == EADDRINUSE) {
+			/* Name is in use, with different fields */
+			*match = false;
+			ret = 0;
+		}
+
+		goto cleanup;
+	}
+
+	*match = true;
+	ret = 0;
+cleanup:
+	unreg_event(fd, check, 31);
+	unreg_event(fd, check, 30);
+
+	close(fd);
+
+	wait_for_delete();
+
+	return ret;
+}
+
+#define TEST_MATCH(x, y) \
 do { \
-	int ret = Append(clear); \
-	if (ret == -1) \
-		ASSERT_EQ(ENOENT, errno); \
+	bool match; \
+	ASSERT_NE(-1, check_match(&self->check, x, y, &match)); \
+	ASSERT_EQ(true, match); \
 } while (0)
 
-#define TEST_PARSE(x) \
+#define TEST_NMATCH(x, y) \
 do { \
-	ASSERT_NE(-1, Append(x)); \
-	CLEAR(); \
+	bool match; \
+	ASSERT_NE(-1, check_match(&self->check, x, y, &match)); \
+	ASSERT_EQ(false, match); \
 } while (0)
 
-#define TEST_NPARSE(x) ASSERT_EQ(-1, Append(x))
+#define TEST_PARSE(x) ASSERT_NE(-1, parse(&self->check, x))
+
+#define TEST_NPARSE(x) ASSERT_EQ(-1, parse(&self->check, x))
 
 FIXTURE(user) {
+	int check;
 };
 
 FIXTURE_SETUP(user) {
-	CLEAR();
 }
 
 FIXTURE_TEARDOWN(user) {
-	CLEAR();
+	wait_for_delete();
 }
 
 TEST_F(user, basic_types) {
@@ -95,33 +193,30 @@ TEST_F(user, size_types) {
 	TEST_NPARSE("u:__test_event char a 20");
 }
 
-TEST_F(user, flags) {
-	/* Should work */
-	TEST_PARSE("u:__test_event:BPF_ITER u32 a");
-	/* Forward compat */
-	TEST_PARSE("u:__test_event:BPF_ITER,FLAG_FUTURE u32 a");
-}
-
 TEST_F(user, matching) {
-	/* Register */
-	ASSERT_NE(-1, Append("u:__test_event struct custom a 20"));
-	/* Should not match */
-	TEST_NPARSE("!u:__test_event struct custom b");
-	/* Should match */
-	TEST_PARSE("!u:__test_event struct custom a");
-	/* Multi field reg */
-	ASSERT_NE(-1, Append("u:__test_event u32 a; u32 b"));
-	/* Non matching cases */
-	TEST_NPARSE("!u:__test_event u32 a");
-	TEST_NPARSE("!u:__test_event u32 b");
-	TEST_NPARSE("!u:__test_event u32 a; u32 ");
-	TEST_NPARSE("!u:__test_event u32 a; u32 a");
-	/* Matching case */
-	TEST_PARSE("!u:__test_event u32 a; u32 b");
-	/* Register */
-	ASSERT_NE(-1, Append("u:__test_event u32 a; u32 b"));
-	/* Ensure trailing semi-colon case */
-	TEST_PARSE("!u:__test_event u32 a; u32 b;");
+	/* Single name matches */
+	TEST_MATCH("__test_event u32 a",
+		   "__test_event u32 a");
+
+	/* Multiple names match */
+	TEST_MATCH("__test_event u32 a; u32 b",
+		   "__test_event u32 a; u32 b");
+
+	/* Multiple names match with dangling ; */
+	TEST_MATCH("__test_event u32 a; u32 b",
+		   "__test_event u32 a; u32 b;");
+
+	/* Single name doesn't match */
+	TEST_NMATCH("__test_event u32 a",
+		    "__test_event u32 b");
+
+	/* Multiple names don't match */
+	TEST_NMATCH("__test_event u32 a; u32 b",
+		    "__test_event u32 b; u32 a");
+
+	/* Types don't match */
+	TEST_NMATCH("__test_event u64 a; u64 b",
+		    "__test_event u32 a; u32 b");
 }
 
 int main(int argc, char **argv)
-- 
2.39.2

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

* [for-linus][PATCH 15/15] tracing/user_events: Document auto-cleanup and remove dyn_event refs
  2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
                   ` (13 preceding siblings ...)
  2023-06-15 13:05 ` [for-linus][PATCH 14/15] selftests/user_events: Adapt dyn_test to non-persist events Steven Rostedt
@ 2023-06-15 13:05 ` Steven Rostedt
  14 siblings, 0 replies; 16+ messages in thread
From: Steven Rostedt @ 2023-06-15 13:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: Masami Hiramatsu, Mark Rutland, Andrew Morton, Beau Belgrave

From: Beau Belgrave <beaub@linux.microsoft.com>

Now user_events auto-cleanup upon the last reference by default. This
makes it not possible to use the dynamics event file via tracefs.

Document that auto-cleanup is enabled by default and remove the refernce
to /sys/kernel/tracing/dynamic_events file to make this clear.

Link: https://lkml.kernel.org/r/20230614163336.5797-7-beaub@linux.microsoft.com

Signed-off-by: Beau Belgrave <beaub@linux.microsoft.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 Documentation/trace/user_events.rst | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Documentation/trace/user_events.rst b/Documentation/trace/user_events.rst
index f79987e16cf4..e7b07313550a 100644
--- a/Documentation/trace/user_events.rst
+++ b/Documentation/trace/user_events.rst
@@ -14,10 +14,6 @@ Programs can view status of the events via
 /sys/kernel/tracing/user_events_status and can both register and write
 data out via /sys/kernel/tracing/user_events_data.
 
-Programs can also use /sys/kernel/tracing/dynamic_events to register and
-delete user based events via the u: prefix. The format of the command to
-dynamic_events is the same as the ioctl with the u: prefix applied.
-
 Typically programs will register a set of events that they wish to expose to
 tools that can read trace_events (such as ftrace and perf). The registration
 process tells the kernel which address and bit to reflect if any tool has
@@ -144,6 +140,9 @@ its name. Delete will only succeed if there are no references left to the
 event (in both user and kernel space). User programs should use a separate file
 to request deletes than the one used for registration due to this.
 
+**NOTE:** By default events will auto-delete when there are no references left
+to the event. Flags in the future may change this logic.
+
 Unregistering
 -------------
 If after registering an event it is no longer wanted to be updated then it can
-- 
2.39.2

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

end of thread, other threads:[~2023-06-15 13:37 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-15 13:05 [for-linus][PATCH 00/15] tracing: Updates for 6.4 Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 01/15] tracing/rv/rtla: Update MAINTAINERS file to point to proper mailing list Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 02/15] tracing/user_events: Prevent same name but different args event Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 03/15] tracing/user_events: Handle matching arguments that is null from dyn_events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 04/15] tracing: Modify print_fields() for fields output order Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 05/15] tracing/user_events: Fix the incorrect trace record for empty arguments events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 06/15] selftests/user_events: Add ftrace self-test " Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 07/15] selftests/user_events: Clear the events after perf self-test Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 08/15] selftests/user_events: Add perf self-test for empty arguments events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 09/15] tracing/user_events: Remove user_ns walk for groups Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 10/15] tracing/user_events: Store register flags on events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 11/15] tracing/user_events: Track refcount consistently via put/get Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 12/15] tracing/user_events: Add auto cleanup and future persist flag Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 13/15] selftests/user_events: Ensure auto cleanup works as expected Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 14/15] selftests/user_events: Adapt dyn_test to non-persist events Steven Rostedt
2023-06-15 13:05 ` [for-linus][PATCH 15/15] tracing/user_events: Document auto-cleanup and remove dyn_event refs Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox