1. 24 Mar, 2022 5 commits
    • Linus Torvalds's avatar
      Merge tag 'arm-drivers-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · b4bc93bd
      Linus Torvalds authored
      Pull ARM driver updates from Arnd Bergmann:
       "There are a few separately maintained driver subsystems that we merge
        through the SoC tree, notable changes are:
      
         - Memory controller updates, mainly for Tegra and Mediatek SoCs, and
           clarifications for the memory controller DT bindings
      
         - SCMI firmware interface updates, in particular a new transport
           based on OPTEE and support for atomic operations.
      
         - Cleanups to the TEE subsystem, refactoring its memory management
      
        For SoC specific drivers without a separate subsystem, changes include
      
         - Smaller updates and fixes for TI, AT91/SAMA5, Qualcomm and NXP
           Layerscape SoCs.
      
         - Driver support for Microchip SAMA5D29, Tesla FSD, Renesas RZ/G2L,
           and Qualcomm SM8450.
      
         - Better power management on Mediatek MT81xx, NXP i.MX8MQ and older
           NVIDIA Tegra chips"
      
      * tag 'arm-drivers-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (154 commits)
        ARM: spear: fix typos in comments
        soc/microchip: fix invalid free in mpfs_sys_controller_delete
        soc: s4: Add support for power domains controller
        dt-bindings: power: add Amlogic s4 power domains bindings
        ARM: at91: add support in soc driver for new SAMA5D29
        soc: mediatek: mmsys: add sw0_rst_offset in mmsys driver data
        dt-bindings: memory: renesas,rpc-if: Document RZ/V2L SoC
        memory: emif: check the pointer temp in get_device_details()
        memory: emif: Add check for setup_interrupts
        dt-bindings: arm: mediatek: mmsys: add support for MT8186
        dt-bindings: mediatek: add compatible for MT8186 pwrap
        soc: mediatek: pwrap: add pwrap driver for MT8186 SoC
        soc: mediatek: mmsys: add mmsys reset control for MT8186
        soc: mediatek: mtk-infracfg: Disable ACP on MT8192
        soc: ti: k3-socinfo: Add AM62x JTAG ID
        soc: mediatek: add MTK mutex support for MT8186
        soc: mediatek: mmsys: add mt8186 mmsys routing table
        soc: mediatek: pm-domains: Add support for mt8186
        dt-bindings: power: Add MT8186 power domains
        soc: mediatek: pm-domains: Add support for mt8195
        ...
      b4bc93bd
    • Linus Torvalds's avatar
      Merge tag 'arm-soc-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · baaa68a9
      Linus Torvalds authored
      Pull ARM SoC updates from Arnd Bergmann:
       "SoC specific code is generally used for older platforms that don't
        (yet) use device tree to do the same things.
      
         - Support is added for i.MXRT10xx, a Cortex-M7 based microcontroller
           from NXP. At the moment this is still incomplete as other portions
           are merged through different trees.
      
         - Long abandoned support for running NOMMU ARMv4 or ARMv5 platforms
           gets removed, now the Arm NOMMU platforms are limited to the
           Cortex-M family of microcontrollers
      
         - Two old PXA boards get removed, along with corresponding driver
           bits.
      
         - Continued cleanup of the Intel IXP4xx platforms, removing some
           remnants of the old board files.
      
         - Minor Cleanups and fixes for Orion, PXA, MMP, Mstar, Samsung
      
         - CPU idle support for AT91
      
         - A system controller driver for Polarfire"
      
      * tag 'arm-soc-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (29 commits)
        ARM: remove support for NOMMU ARMv4/v5
        ARM: PXA: fix up decompressor code
        soc: microchip: make mpfs_sys_controller_put static
        ARM: pxa: remove Intel Imote2 and Stargate 2 boards
        ARM: mmp: Fix failure to remove sram device
        ARM: mstar: Select ARM_ERRATA_814220
        soc: add microchip polarfire soc system controller
        ARM: at91: Kconfig: select PM_OPP
        ARM: at91: PM: add cpu idle support for sama7g5
        ARM: at91: ddr: fix typo to align with datasheet naming
        ARM: at91: ddr: align macro definitions
        ARM: at91: ddr: remove CONFIG_SOC_SAMA7 dependency
        ARM: ixp4xx: Convert to SPARSE_IRQ and P2V
        ARM: ixp4xx: Drop all common code
        ARM: ixp4xx: Drop custom DMA coherency and bouncing
        ARM: ixp4xx: Remove feature bit accessors
        net: ixp4xx_hss: Check features using syscon
        net: ixp4xx_eth: Drop platform data support
        soc: ixp4xx-npe: Access syscon regs using regmap
        soc: ixp4xx: Add features from regmap helper
        ...
      baaa68a9
    • Linus Torvalds's avatar
      Merge tag 'arm-defconfig-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 8ffa5709
      Linus Torvalds authored
      Pull ARM defconfig updates from Arnd Bergmann:
       "Various updates for the 32-bit and 64-bit defconfig files, mostly to
        enable additional hardware drivers for more machines, specifically for
        the Allwinner F1C100, Altera SoCFPGA, Broadcom, Microchip, Qualcomm,
        Airoha, Tegra, Renesas, and i.NX.
      
        The multi_v5_defconfig for older ARMv5 configs gets a rework for Andre
        Przywara to cleans up the multi_v5_defconfig for some cruft that has
        accumulated and drivers that got disabled unintentionally, while
        Anders Roxell makes it more useful for running under Qemu"
      
      * tag 'arm-defconfig-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (41 commits)
        ARM: configs: multi_v5: Enable Allwinner F1C100
        ARM: configs: clean up multi_v5_defconfig
        ARM: configs: multi_v5_defconfig: re-enable DRM_PANEL and FB_xxx
        ARM: configs: multi_v5_defconfig: re-enable CONFIG_V4L_PLATFORM_DRIVERS
        ARM: configs: multi_v5_defconfig: remove deleted platforms
        ARM: defconfig: add SMB347 charger driver for p4note
        arm: multi_v5: enable configs for versatile
        arm64: defconfig: enable Layerscape SFP driver
        ARM: configs: at91: sama7: Unselect CONFIG_DMATEST
        ARM: configs: at91: add eic
        arm64: defconfig: enable the CVP driver
        ARM: multi_v7_defconfig: Add support for Airoha EN7523 SoC
        ARM: multi_v7_defconfig: Enable BCM23550 and BCM53573
        ARM: multi_v7_defconfig: Enable Broadcom STB USB drivers
        ARM: configs: at91: sama7: add config for cpufreq
        ARM: configs: at91: sama7: enable cpu idle
        ARM: configs: at91: sama7: Enable crypto IPs and software algs
        ARM: configs: at91: sama7: Enable UBIFS_FS
        ARM: configs: at91: sama7: Enable NAND / SMC
        arm64: defconfig: tegra: Enable GPCDMA
        ...
      8ffa5709
    • Linus Torvalds's avatar
      Merge tag 'asm-generic-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic · 194dfe88
      Linus Torvalds authored
      Pull asm-generic updates from Arnd Bergmann:
       "There are three sets of updates for 5.18 in the asm-generic tree:
      
         - The set_fs()/get_fs() infrastructure gets removed for good.
      
           This was already gone from all major architectures, but now we can
           finally remove it everywhere, which loses some particularly tricky
           and error-prone code. There is a small merge conflict against a
           parisc cleanup, the solution is to use their new version.
      
         - The nds32 architecture ends its tenure in the Linux kernel.
      
           The hardware is still used and the code is in reasonable shape, but
           the mainline port is not actively maintained any more, as all
           remaining users are thought to run vendor kernels that would never
           be updated to a future release.
      
         - A series from Masahiro Yamada cleans up some of the uapi header
           files to pass the compile-time checks"
      
      * tag 'asm-generic-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/arnd/asm-generic: (27 commits)
        nds32: Remove the architecture
        uaccess: remove CONFIG_SET_FS
        ia64: remove CONFIG_SET_FS support
        sh: remove CONFIG_SET_FS support
        sparc64: remove CONFIG_SET_FS support
        lib/test_lockup: fix kernel pointer check for separate address spaces
        uaccess: generalize access_ok()
        uaccess: fix type mismatch warnings from access_ok()
        arm64: simplify access_ok()
        m68k: fix access_ok for coldfire
        MIPS: use simpler access_ok()
        MIPS: Handle address errors for accesses above CPU max virtual user address
        uaccess: add generic __{get,put}_kernel_nofault
        nios2: drop access_ok() check from __put_user()
        x86: use more conventional access_ok() definition
        x86: remove __range_not_ok()
        sparc64: add __{get,put}_kernel_nofault()
        nds32: fix access_ok() checks in get/put_user
        uaccess: fix nios2 and microblaze get_user_8()
        sparc64: fix building assembly files
        ...
      194dfe88
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm · 9c0e6a89
      Linus Torvalds authored
      Pull ARM updates from Russell King:
       "Updates for IRQ stacks and virtually mapped stack support, and ftrace:
      
         - Support for IRQ and vmap'ed stacks
      
           This covers all the work related to implementing IRQ stacks and
           vmap'ed stacks for all 32-bit ARM systems that are currently
           supported by the Linux kernel, including RiscPC and Footbridge. It
           has been submitted for review in four different waves:
      
            - IRQ stacks support for v7 SMP systems [0]
      
            - vmap'ed stacks support for v7 SMP systems[1]
      
            - extending support for both IRQ stacks and vmap'ed stacks for all
              remaining configurations, including v6/v7 SMP multiplatform
              kernels and uniprocessor configurations including v7-M [2]
      
            - fixes and updates in [3]
      
         - ftrace fixes and cleanups
      
           Make all flavors of ftrace available on all builds, regardless of
           ISA choice, unwinder choice or compiler [4]:
      
            - use ADD not POP where possible
      
            - fix a couple of Thumb2 related issues
      
            - enable HAVE_FUNCTION_GRAPH_FP_TEST for robustness
      
            - enable the graph tracer with the EABI unwinder
      
            - avoid clobbering frame pointer registers to make Clang happy
      
         - Fixes for the above"
      
      [0] https://lore.kernel.org/linux-arm-kernel/20211115084732.3704393-1-ardb@kernel.org/
      [1] https://lore.kernel.org/linux-arm-kernel/20211122092816.2865873-1-ardb@kernel.org/
      [2] https://lore.kernel.org/linux-arm-kernel/20211206164659.1495084-1-ardb@kernel.org/
      [3] https://lore.kernel.org/linux-arm-kernel/20220124174744.1054712-1-ardb@kernel.org/
      [4] https://lore.kernel.org/linux-arm-kernel/20220203082204.1176734-1-ardb@kernel.org/
      
      * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm: (62 commits)
        ARM: fix building NOMMU ARMv4/v5 kernels
        ARM: unwind: only permit stack switch when unwinding call_with_stack()
        ARM: Revert "unwind: dump exception stack from calling frame"
        ARM: entry: fix unwinder problems caused by IRQ stacks
        ARM: unwind: set frame.pc correctly for current-thread unwinding
        ARM: 9184/1: return_address: disable again for CONFIG_ARM_UNWIND=y
        ARM: 9183/1: unwind: avoid spurious warnings on bogus code addresses
        Revert "ARM: 9144/1: forbid ftrace with clang and thumb2_kernel"
        ARM: mach-bcm: disable ftrace in SMC invocation routines
        ARM: cacheflush: avoid clobbering the frame pointer
        ARM: kprobes: treat R7 as the frame pointer register in Thumb2 builds
        ARM: ftrace: enable the graph tracer with the EABI unwinder
        ARM: unwind: track location of LR value in stack frame
        ARM: ftrace: enable HAVE_FUNCTION_GRAPH_FP_TEST
        ARM: ftrace: avoid unnecessary literal loads
        ARM: ftrace: avoid redundant loads or clobbering IP
        ARM: ftrace: use trampolines to keep .init.text in branching range
        ARM: ftrace: use ADD not POP to counter PUSH at entry
        ARM: ftrace: ensure that ADR takes the Thumb bit into account
        ARM: make get_current() and __my_cpu_offset() __always_inline
        ...
      9c0e6a89
  2. 23 Mar, 2022 18 commits
    • Linus Torvalds's avatar
      Merge tag 'm68knommu-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu · e6aef349
      Linus Torvalds authored
      Pull m68knommu updates from Greg Ungerer:
       "A few fixes, nothing too exciting.
      
        Fix warnings when building for dragen2 targets (sparse and
        "screen_bits") and ucsimm targets. Fix compilation problems when test
        compiling for ColdFire targets with the mcf_edma driver enabled.
        Remove an incorrect clock definition for the ColdFire m5441x.
      
        Summary:
      
         - fix 'screen_bits' defined but not used
      
         - fix ucsimm sparse warnings
      
         - fix dragen2 warnings
      
         - fix test builds with the mcf_edma driver enabled"
      
      * tag 'm68knommu-for-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
        m68k: coldfire/device.c: only build for MCF_EDMA when h/w macros are defined
        m68k: m5441x: remove erroneous clock disable
        m68knommu: fix ucsimm sparse warnings
        m68knommu: fix 'screen_bits' defined but not used
        m68knommu: fix warning: no previous prototype for 'init_dragen2'
      e6aef349
    • Linus Torvalds's avatar
      Merge tag 'sound-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 40037e4f
      Linus Torvalds authored
      Pull sound updates from Takashi Iwai:
       "It's been a fairly calm development cycle. There are a few last-minute
        ALSA core fixes, most notably for covering PCM ioctl races, but the
        most of rest are device-specific changes.
      
        Below are some highlights:
      
        ALSA core:
      
         - Fixes for PCM ioctl races that may lead to UAF
      
         - Fix for oversized allocations in PCM OSS layer
      
        ASoC:
      
         - Start of moving SoF to support multiple IPC mechanisms
      
         - Use of NHLT ACPI table to reduce the amount of quirking required
           for Intel systems
      
         - Preliminary works forthcoming Intel AVS driver for legacy Intel DSP
           firmwares
      
         - Support for AMD PDM, Atmel PDMC, Awinic AW8738, i.MX cards with
           TLV320AIC31xx, Intel machines with CS35L41 and ESSX8336, Mediatek
           MT8181 wideband bluetooth, nVidia Tegra234, Qualcomm SC7280,
           Renesas RZ/V2L, Texas Instruments TAS585M
      
        HD-audio:
      
         - Driver re-binding fix for HD-audio
      
         - Updates for Intel ADL and Tegra234, various platform quirks for
           Dell, HP, Lenovo, ASUS, Samsung and Clevo machines
      
        USB-audio:
      
         - Quirk updates for Scarlett2, RODE, Corsair devices"
      
      * tag 'sound-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (486 commits)
        ALSA: hda/realtek: Add alc256-samsung-headphone fixup
        ALSA: pci: fix reading of swapped values from pcmreg in AC97 codec
        ALSA: pcm: Add stream lock during PCM reset ioctl operations
        ALSA: pcm: Fix races among concurrent prealloc proc writes
        ALSA: pcm: Fix races among concurrent prepare and hw_params/hw_free calls
        ALSA: pcm: Fix races among concurrent read/write and buffer changes
        ALSA: pcm: Fix races among concurrent hw_params and hw_free calls
        ASoC: atmel: mchp-pdmc: print the correct property name
        MAINTAINERS: Add Shengjiu to maintainer list of sound/soc/fsl
        ASoC: SOF: Add a new dai_get_clk topology IPC op
        ASoC: SOF: topology: Add ops for setting up and tearing down pipelines
        ASoC: SOF: expose sof_route_setup()
        ASoC: SOF: Add dai_link_fixup PCM op for IPC3
        ASoC: SOF: Add trigger PCM op for IPC3
        ASoC: SOF: Define hw_params PCM op for IPC3
        ASoC: SOF: Introduce IPC3 PCM hw_free op
        ASoC: SOF: pcm: expose the sof_pcm_setup_connected_widgets() function
        ASoC: SOF: Introduce IPC-specific PCM ops
        ASoC: SOF: Add bytes_ext control IPC ops for IPC3
        ASoC: SOF: Add bytes_get/put control IPC ops for IPC3
        ...
      40037e4f
    • Linus Torvalds's avatar
      Merge tag 'media/v5.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 182966e1
      Linus Torvalds authored
      Pull media updates from Mauro Carvalho Chehab:
      
       - a major reorg at platform Kconfig/Makefile files, organizing them per
         vendor. The other media Kconfig/Makefile files also sorted
      
       - New sensor drivers: hi847, isl7998x, ov08d10
      
       - New Amphion vpu decoder stateful driver
      
       - New Atmel microchip csi2dc driver
      
       - tegra-vde driver promoted from staging
      
       - atomisp: some fixes for it to work on BYT
      
       - imx7-mipi-csis driver promoted from staging and renamed
      
       - camss driver got initial support for VFE hardware version Titan 480
      
       - mtk-vcodec has gained support for MT8192
      
       - lots of driver changes, fixes and improvements
      
      * tag 'media/v5.18-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (417 commits)
        media: nxp: Restrict VIDEO_IMX_MIPI_CSIS to ARCH_MXC or COMPILE_TEST
        media: amphion: cleanup media device if register it fail
        media: amphion: fix some issues to improve robust
        media: amphion: fix some error related with undefined reference to __divdi3
        media: amphion: fix an issue that using pm_runtime_get_sync incorrectly
        media: vidtv: use vfree() for memory allocated with vzalloc()
        media: m5mols/m5mols.h: document new reset field
        media: pixfmt-yuv-planar.rst: fix PIX_FMT labels
        media: platform: Remove unnecessary print function dev_err()
        media: amphion: Add missing of_node_put() in vpu_core_parse_dt()
        media: mtk-vcodec: Add missing of_node_put() in mtk_vdec_hw_prob_done()
        media: platform: amphion: Fix build error without MAILBOX
        media: spi: Kconfig: Place SPI drivers on a single menu
        media: i2c: Kconfig: move camera drivers to the top
        media: atomisp: fix bad usage at error handling logic
        media: platform: rename mediatek/mtk-jpeg/ to mediatek/jpeg/
        media: media/*/Kconfig: sort entries
        media: Kconfig: cleanup VIDEO_DEV dependencies
        media: platform/*/Kconfig: make manufacturer menus more uniform
        media: platform: Create vendor/{Makefile,Kconfig} files
        ...
      182966e1
    • Linus Torvalds's avatar
      Merge tag 'for-5.18/fbdev-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev · 9c4b86eb
      Linus Torvalds authored
      Pull fbdev updates from Helge Deller:
       "Lots of small fixes and code cleanups across most of the fbdev
        drivers.
      
        This includes conversions to use helper functions, const conversions,
        spelling fixes, help text updates, adding return value checks, small
        build fixes, and much more"
      
      * tag 'for-5.18/fbdev-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev: (59 commits)
        video: fbdev: kyro: make read-only array ODValues static const
        video: fbdev: offb: fix warning comparing pointer to 0
        video: fbdev: omapfb: Add missing of_node_put() in dvic_probe_of
        video: fbdev: sm712fb: Fix crash in smtcfb_write()
        video: fbdev: s3c-fb: fix platform_get_irq.cocci warning
        video: fbdev: sm712fb: Fix crash in smtcfb_read()
        video: fbdev: via: check the return value of kstrdup()
        video: fbdev: au1100fb: Spelling s/palette/palette/
        video: fbdev: atari: Atari 2 bpp (STe) palette bugfix
        video: fbdev: atari: Remove unused atafb_setcolreg()
        video: fbdev: atari: Convert to standard round_up() helper
        video: fbdev: atari: Fix TT High video mode
        video: fbdev: udlfb: replace snprintf in show functions with sysfs_emit
        video: fbdev: omapfb: panel-tpo-td043mtea1: Use sysfs_emit() instead of snprintf()
        video: fbdev: omapfb: panel-dsi-cm: Use sysfs_emit() instead of snprintf()
        video: fbdev: omapfb: Use sysfs_emit() instead of snprintf()
        video: fbdev: s3c-fb: Use platform_get_irq() to get the interrupt
        video: fbdev: Fix wrong file path for pvr2fb.c in Kconfig help text
        video: fbdev: pxa3xx-gcu: Remove unnecessary print function dev_err()
        video: fbdev: pxa168fb: Remove unnecessary print function dev_err()
        ...
      9c4b86eb
    • Linus Torvalds's avatar
      Merge tag 'mmc-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 5bebe2c9
      Linus Torvalds authored
      Pull MMC updates from Ulf Hansson:
       "MMC core:
         - Convert to sysfs_emit() in favor of sprintf()
      
         - Improve fallback to speed modes if eMMC HS200 fails
      
        MMC host:
         - dw_mmc: Allow variants to set minimal supported clock rate
      
         - dw-mmc-rockchip: Fix problems with invalid clock rates
      
         - litex_mmc: Add new DT based driver for the LiteX's LiteSDCard
           interface
      
         - litex_mmc: Add Gabriel Somlo and Joel Stanley as co-maintainers for
           LiteX
      
         - mtk-sd: Add support for the Mediatek MT8186 variant
      
         - renesas_sdhi: Add support for RZ/G2UL variant
      
         - renesas_sdhi: Add support for RZ/V2L variant
      
         - rtsx_pci: Adjust power-on sequence to conform to the SD spec
      
         - sdhci-am654: Add support for TI's AM62 variant
      
         - sdhci_am654: Fixup support for TI's AM64 variant
      
         - sdhci-esdhc-imx: Add support for the imx93 variant
      
         - sdhci-msm: Add support for the msm8953 variant
      
         - sdhci-pci-gli: Add support for runtime PM for the GL9763E variant
      
         - sdhci-pci-gli: Adjustments of the SSC function for the GL975x
           variants
      
         - sdhci-tegra: Add support for wake on SD card event
      
         - sunxi-mmc: Add support for Allwinner's F1c100s variant
      
         - sunxi-mmc: Add support for D1 MMC variant"
      
      * tag 'mmc-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc: (37 commits)
        dt-bindings: mmc: renesas,sdhi: Document RZ/G2UL SoC
        mmc: tmio: remove outdated members from host struct
        mmc: mtk-sd: Silence delay phase calculation debug log
        mmc: davinci_mmc: Handle error for clk_enable
        mmc: sdhci-pci-gli: Add runtime PM for GL9763E
        mmc: core: Drop HS400 caps unless 8-bit bus is supported too
        mmc: host: Return an error when ->enable_sdio_irq() ops is missing
        mmc: core: Improve fallback to speed modes if eMMC HS200 fails
        dt-bindings: mmc: sunxi: add Allwinner F1c100s compatible
        mmc: dw-mmc-rockchip: Fix handling invalid clock rates
        mmc: dw_mmc: Support setting f_min from host drivers
        mmc: host: Drop commas after SoC match table sentinels
        mmc: rtsx: add 74 Clocks in power on flow
        dt-bindings: mmc: renesas,sdhi: Document RZ/V2L SoC
        mmc: sh_mmcif: Simplify division/shift logic
        mmc: sdhci_am654: Add Support for TI's AM62 SoC
        dt-bindings: mmc: imx-esdhc: Add imx93 compatible string
        dt-bindings: mmc: sdhci-am654: Add compatible string for AM62 SoC
        mmc: sdhci_am654: Fix the driver data of AM64 SoC
        mmc: core: use sysfs_emit() instead of sprintf()
        ...
      5bebe2c9
    • Linus Torvalds's avatar
      Merge tag 'ata-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata · c7d4b153
      Linus Torvalds authored
      Pull ata updates from Damien Le Moal:
       "For this cycle, no big change but many small fixes and code cleanup to
        libata, the ahci driver and various pata drivers. In more details:
      
         - Code simplification in pata_platform using
           platform_get_mem_or_io(), from Lad.
      
         - Fix read-only arrays declarations as const in pata_atiixp and
           pata_pdc202xx_old, from Colin.
      
         - Various cleanups and code simplification in libata-scsi, from me.
      
         - Remove dead code in libata-acpi, from Sergey.
      
         - Skip device scan deboune delay for Marvell 88SE9235 adapters (ahci)
           to speedup boot, from Paul.
      
         - Simplify functions declaration and use for functions always
           returning 0 in libata-core, from Sergey.
      
         - Non-fatal error fixes and in the pata_hpt366 and pata_hpt3x2n
           drivers, from Sergey.
      
         - Various code cleanup in the pata_artop, pata_hpt37x, pata_hpt366,
           pata_hpt3x2n, pata_samsung_cf and sata_rcar drivers, from Sergey.
      
         - Some libata-sff and libata-scsi code cleanup (e.g. change functions
           to return "bool"), from Sergey.
      
         - Renae ahci_board_mobile to board_ahci_low_power to be more
           descriptive of the feature as that is also used on PC and server
           AHCI adapters, from Mario.
      
         - Cleanup of OF match tables, from Geert.
      
         - Simplify the pata_pxa driver initialization using
           platform_get_irq(), from Minghao"
      
      * tag 'ata-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata: (38 commits)
        ata: pata_pxa: Use platform_get_irq() to get the interrupt
        ata: Drop commas after OF match table sentinels
        ata: ahci: Rename CONFIG_SATA_LPM_MOBILE_POLICY configuration item
        ata: ahci: Rename `AHCI_HFLAG_IS_MOBILE`
        ata: ahci: Rename board_ahci_mobile
        ata: pata_hpt37x: merge transfer mode setting methods
        ata: libata-sff: use *switch* statement in ata_sff_dev_classify()
        ata: add/use ata_taskfile::{error|status} fields
        ata: Kconfig: fix sata gemini compile test condition
        ata: libata-scsi: use *switch* statements to check SCSI command codes
        ata: libata-sff: refactor ata_sff_altstatus()
        ata: libata-sff: refactor ata_sff_set_devctl()
        ata: libata-sff: make ata_resources_present() return 'bool'
        ata: pata_hpt3x2n: disable fast interrupts in prereset() method
        ata: pata_hpt37x: disable fast interrupts in prereset() method
        ata: pata_hpt366: disable fast interrupts in prereset() method
        ata: pata_mpc52xx: use GFP_KERNEL
        ata: sata_rcar: drop unused #define's
        ata: pata_hpt366: check channel enable bits
        ata: sata_rcar: make sata_rcar_ata_devchk() return 'bool'
        ...
      c7d4b153
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-kunit-5.18-rc1' of... · d51b1b33
      Linus Torvalds authored
      Merge tag 'linux-kselftest-kunit-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull KUnit updates from Shuah Khan:
      
       - changes to decrease macro layering string, integer, EQ/NE asserts
      
       - remove unused macros
      
       - several cleanups and fixes
      
       - new list tests for list_del_init_careful(), list_is_head() and
         list_entry_is_head()
      
      * tag 'linux-kselftest-kunit-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        list: test: Add a test for list_entry_is_head()
        list: test: Add a test for list_is_head()
        list: test: Add test for list_del_init_careful()
        kunit: cleanup assertion macro internal variables
        kunit: factor out str constants from binary assertion structs
        kunit: consolidate KUNIT_INIT_BINARY_ASSERT_STRUCT macros
        kunit: remove va_format from kunit_assert
        kunit: tool: drop mostly unused KunitResult.result field
        kunit: decrease macro layering for EQ/NE asserts
        kunit: decrease macro layering for integer asserts
        kunit: reduce layering in string assertion macros
        kunit: drop unused intermediate macros for ptr inequality checks
        kunit: make KUNIT_EXPECT_EQ() use KUNIT_EXPECT_EQ_MSG(), etc.
        kunit: drop unused assert_type from kunit_assert and clean up macros
        kunit: split out part of kunit_assert into a static const
        kunit: factor out kunit_base_assert_format() call into kunit_fail()
        kunit: drop unused kunit* field in kunit_assert
        kunit: move check if assertion passed into the macros
        kunit: add example test case showing off all the expect macros
      d51b1b33
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-next-5.18-rc1' of... · 23d1dea5
      Linus Torvalds authored
      Merge tag 'linux-kselftest-next-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest updates from Shuah Khan:
       "Several build and cleanup fixes:
      
         - removing obsolete config options
      
         - removing dependency on internal kernel macros
      
         - adding config options
      
         - several build fixes related to headers and install paths"
      
      * tag 'linux-kselftest-next-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (22 commits)
        selftests: Fix build when $(O) points to a relative path
        selftests: netfilter: fix a build error on openSUSE
        selftests: kvm: add generated file to the .gitignore
        selftests/exec: add generated files to .gitignore
        selftests: add kselftest_install to .gitignore
        selftests/rtc: continuously read RTC in a loop for 30s
        selftests/lkdtm: Add UBSAN config
        selftests/lkdtm: Remove dead config option
        selftests/exec: Rename file binfmt_script to binfmt_script.py
        selftests: Use -isystem instead of -I to include headers
        selftests: vm: remove dependecy from internal kernel macros
        selftests: vm: Add the uapi headers include variable
        selftests: mptcp: Add the uapi headers include variable
        selftests: net: Add the uapi headers include variable
        selftests: landlock: Add the uapi headers include variable
        selftests: kvm: Add the uapi headers include variable
        selftests: futex: Add the uapi headers include variable
        selftests: Correct the headers install path
        selftests: Add and export a kernel uapi headers path
        selftests: set the BUILD variable to absolute path
        ...
      23d1dea5
    • Linus Torvalds's avatar
      Merge branch 'for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · 2fce7ea0
      Linus Torvalds authored
      Pull cgroup updates from Tejun Heo:
       "All trivial cleanups without meaningful behavior changes"
      
      * 'for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
        cgroup: cleanup comments
        cgroup: Fix cgroup_can_fork() and cgroup_post_fork() kernel-doc comment
        cgroup: rstat: retrieve current bstat to delta directly
        cgroup: rstat: use same convention to assign cgroup_base_stat
      2fce7ea0
    • Linus Torvalds's avatar
      Merge branch 'for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq · 78383162
      Linus Torvalds authored
      Pull workqueue updates from Tejun Heo:
       "Nothing major. Just follow-up cleanups from Lai after the earlier
        synchronization simplification"
      
      * 'for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq:
        workqueue: Convert the type of pool->nr_running to int
        workqueue: Use wake_up_worker() in wq_worker_sleeping() instead of open code
        workqueue: Change the comments of the synchronization about the idle_list
        workqueue: Remove the mb() pair between wq_worker_sleeping() and insert_work()
      78383162
    • Linus Torvalds's avatar
      Merge tag 'slab-for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab · c5c009e2
      Linus Torvalds authored
      Pull slab updates from Vlastimil Babka:
      
       - A few non-trivial SLUB code cleanups, most notably a refactoring of
         deactivate_slab().
      
       - A bunch of trivial changes, such as removal of unused parameters,
         making stuff static, and employing helper functions.
      
      * tag 'slab-for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab:
        mm: slub: Delete useless parameter of alloc_slab_page()
        mm: slab: Delete unused SLAB_DEACTIVATED flag
        mm/slub: remove forced_order parameter in calculate_sizes
        mm/slub: refactor deactivate_slab()
        mm/slub: limit number of node partial slabs only in cache creation
        mm/slub: use helper macro __ATTR_XX_MODE for SLAB_ATTR(_RO)
        mm/slab_common: use helper function is_power_of_2()
        mm/slob: make kmem_cache_boot static
      c5c009e2
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 1bc19105
      Linus Torvalds authored
      Pull tracing updates from Steven Rostedt:
      
       - New user_events interface. User space can register an event with the
         kernel describing the format of the event. Then it will receive a
         byte in a page mapping that it can check against. A privileged task
         can then enable that event like any other event, which will change
         the mapped byte to true, telling the user space application to start
         writing the event to the tracing buffer.
      
       - Add new "ftrace_boot_snapshot" kernel command line parameter. When
         set, the tracing buffer will be saved in the snapshot buffer at boot
         up when the kernel hands things over to user space. This will keep
         the traces that happened at boot up available even if user space boot
         up has tracing as well.
      
       - Have TRACE_EVENT_ENUM() also update trace event field type
         descriptions. Thus if a static array defines its size with an enum,
         the user space trace event parsers can still know how to parse that
         array.
      
       - Add new TRACE_CUSTOM_EVENT() macro. This acts the same as the
         TRACE_EVENT() macro, but will attach to an existing tracepoint. This
         will make one tracepoint be able to trace different content and not
         be stuck at only what the original TRACE_EVENT() macro exports.
      
       - Fixes to tracing error logging.
      
       - Better saving of cmdlines to PIDs when tracing (use the wakeup events
         for mapping).
      
      * tag 'trace-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (30 commits)
        tracing: Have type enum modifications copy the strings
        user_events: Add trace event call as root for low permission cases
        tracing/user_events: Use alloc_pages instead of kzalloc() for register pages
        tracing: Add snapshot at end of kernel boot up
        tracing: Have TRACE_DEFINE_ENUM affect trace event types as well
        tracing: Fix strncpy warning in trace_events_synth.c
        user_events: Prevent dyn_event delete racing with ioctl add/delete
        tracing: Add TRACE_CUSTOM_EVENT() macro
        tracing: Move the defines to create TRACE_EVENTS into their own files
        tracing: Add sample code for custom trace events
        tracing: Allow custom events to be added to the tracefs directory
        tracing: Fix last_cmd_set() string management in histogram code
        user_events: Fix potential uninitialized pointer while parsing field
        tracing: Fix allocation of last_cmd in last_cmd_set()
        user_events: Add documentation file
        user_events: Add sample code for typical usage
        user_events: Add self-test for validator boundaries
        user_events: Add self-test for perf_event integration
        user_events: Add self-test for dynamic_events integration
        user_events: Add self-test for ftrace integration
        ...
      1bc19105
    • Linus Torvalds's avatar
      Merge tag 'trace-rtla-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 20f463fb
      Linus Torvalds authored
      Pull RTLA tracing tool updates from Steven Rostedt:
       "Real Time Analysis Tool updatesfor 5.18:
      
         - Support for adjusting tracing_threashold
      
         - Add -a (auto) option to make it easier for users to debug in the field
      
         - Add -e option to add more events to the trace
      
         - Add --trigger option to add triggers to events
      
         - Add --filter option to filter events
      
         - Add support to save histograms to the file
      
         - Add --dma-latency to set /dev/cpu_dma_latency
      
         - Other fixes and cleanups"
      
      * tag 'trace-rtla-v5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        rtla: Tools main loop cleanup
        rtla/timerlat: Add --dma-latency option
        rtla/osnoise: Fix osnoise hist stop tracing message
        rtla: Check for trace off also in the trace instance
        rtla/trace: Save event histogram output to a file
        rtla: Add --filter support
        rtla/trace: Add trace event filter helpers
        rtla: Add --trigger support
        rtla/trace: Add trace event trigger helpers
        rtla: Add -e/--event support
        rtla/trace: Add trace events helpers
        rtla/timerlat: Add the automatic trace option
        rtla/osnoise: Add the automatic trace option
        rtla/osnoise: Add an option to set the threshold
        rtla/osnoise: Add support to adjust the tracing_thresh
      20f463fb
    • Linus Torvalds's avatar
      Merge tag 'printk-for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux · 3ef4ea3d
      Linus Torvalds authored
      Pull printk updates from Petr Mladek:
      
       - Make %pK behave the same as %p for kptr_restrict == 0 also with
         no_hash_pointers parameter
      
       - Ignore the default console in the device tree also when console=null
         or console="" is used on the command line
      
       - Document console=null and console="" behavior
      
       - Prevent a deadlock and a livelock caused by console_lock in panic()
      
       - Make console_lock available for panicking CPU
      
       - Fast query for the next to-be-used sequence number
      
       - Use the expected return values in printk.devkmsg __setup handler
      
       - Use the correct atomic operations in wake_up_klogd() irq_work handler
      
       - Avoid possible unaligned access when handling %4cc printing format
      
      * tag 'printk-for-5.18' of git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux:
        printk: fix return value of printk.devkmsg __setup handler
        vsprintf: Fix %pK with kptr_restrict == 0
        printk: make suppress_panic_printk static
        printk: Set console_set_on_cmdline=1 when __add_preferred_console() is called with user_specified == true
        Docs: printk: add 'console=null|""' to admin/kernel-parameters
        printk: use atomic updates for klogd work
        printk: Drop console_sem during panic
        printk: Avoid livelock with heavy printk during panic
        printk: disable optimistic spin during panic
        printk: Add panic_in_progress helper
        vsprintf: Move space out of string literals in fourcc_string()
        vsprintf: Fix potential unaligned access
        printk: ringbuffer: Improve prb_next_seq() performance
      3ef4ea3d
    • Herbert Xu's avatar
      cacheflush.h: Add forward declaration for struct folio · 30d024b5
      Herbert Xu authored
      The struct folio is not declared in cacheflush.h so we need to provide
      a forward declaration as otherwise users of this header file may get
      warnings.
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Fixes: 522a0032 ("Add linux/cacheflush.h")
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      30d024b5
    • Andre Przywara's avatar
      ARM: configs: multi_v5: Enable Allwinner F1C100 · cf383260
      Andre Przywara authored
      The Kconfig symbols required for the Allwinner F1C100 (MACH_SUNIV) are
      currently not selected by any defconfig. sunxi_defconfig only covers the
      v7 SoCs, but the F1C100s is ARMv5, so we cannot share a single image.
      
      Add the required symbols to multi_v5_defconfig, to give people some sane
      default config when playing around with this chip. This is probably more
      important as there are surely not many distros out there supporting
      ARMv5 out of the box.
      
      This allows my LicheePi Nano board to boot to a busybox prompt.
      
      The zImage size grows by about 50 KB, in detail:
      
          text    data     bss     dec     hex   filename
      10510000  4400700  687740 15598440 ee0368 vmlinux-old
      10588592  4469096  686812 15744500 f03df4 vmlinux-new
      
      14922908			arch/arm/boot/Image-old
      15067388			arch/arm/boot/Image-new
      6388016				arch/arm/boot/zImage-old
      6440064				arch/arm/boot/zImage-new
      Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
      Link: https://lore.kernel.org/r/20220317183043.948432-6-andre.przywara@arm.com'
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      cf383260
    • Linus Torvalds's avatar
      Merge tag 'folio-5.18b' of git://git.infradead.org/users/willy/pagecache · 6b1f86f8
      Linus Torvalds authored
      Pull filesystem folio updates from Matthew Wilcox:
       "Primarily this series converts some of the address_space operations to
        take a folio instead of a page.
      
        Notably:
      
         - a_ops->is_partially_uptodate() takes a folio instead of a page and
           changes the type of the 'from' and 'count' arguments to make it
           obvious they're bytes.
      
         - a_ops->invalidatepage() becomes ->invalidate_folio() and has a
           similar type change.
      
         - a_ops->launder_page() becomes ->launder_folio()
      
         - a_ops->set_page_dirty() becomes ->dirty_folio() and adds the
           address_space as an argument.
      
        There are a couple of other misc changes up front that weren't worth
        separating into their own pull request"
      
      * tag 'folio-5.18b' of git://git.infradead.org/users/willy/pagecache: (53 commits)
        fs: Remove aops ->set_page_dirty
        fb_defio: Use noop_dirty_folio()
        fs: Convert __set_page_dirty_no_writeback to noop_dirty_folio
        fs: Convert __set_page_dirty_buffers to block_dirty_folio
        nilfs: Convert nilfs_set_page_dirty() to nilfs_dirty_folio()
        mm: Convert swap_set_page_dirty() to swap_dirty_folio()
        ubifs: Convert ubifs_set_page_dirty to ubifs_dirty_folio
        f2fs: Convert f2fs_set_node_page_dirty to f2fs_dirty_node_folio
        f2fs: Convert f2fs_set_data_page_dirty to f2fs_dirty_data_folio
        f2fs: Convert f2fs_set_meta_page_dirty to f2fs_dirty_meta_folio
        afs: Convert afs_dir_set_page_dirty() to afs_dir_dirty_folio()
        btrfs: Convert extent_range_redirty_for_io() to use folios
        fs: Convert trivial uses of __set_page_dirty_nobuffers to filemap_dirty_folio
        btrfs: Convert from set_page_dirty to dirty_folio
        fscache: Convert fscache_set_page_dirty() to fscache_dirty_folio()
        fs: Add aops->dirty_folio
        fs: Remove aops->launder_page
        orangefs: Convert launder_page to launder_folio
        nfs: Convert from launder_page to launder_folio
        fuse: Convert from launder_page to launder_folio
        ...
      6b1f86f8
    • Linus Torvalds's avatar
      Merge tag 'folio-5.18c' of git://git.infradead.org/users/willy/pagecache · 9030fb0b
      Linus Torvalds authored
      Pull folio updates from Matthew Wilcox:
      
       - Rewrite how munlock works to massively reduce the contention on
         i_mmap_rwsem (Hugh Dickins):
      
           https://lore.kernel.org/linux-mm/8e4356d-9622-a7f0-b2c-f116b5f2efea@google.com/
      
       - Sort out the page refcount mess for ZONE_DEVICE pages (Christoph
         Hellwig):
      
           https://lore.kernel.org/linux-mm/20220210072828.2930359-1-hch@lst.de/
      
       - Convert GUP to use folios and make pincount available for order-1
         pages. (Matthew Wilcox)
      
       - Convert a few more truncation functions to use folios (Matthew
         Wilcox)
      
       - Convert page_vma_mapped_walk to use PFNs instead of pages (Matthew
         Wilcox)
      
       - Convert rmap_walk to use folios (Matthew Wilcox)
      
       - Convert most of shrink_page_list() to use a folio (Matthew Wilcox)
      
       - Add support for creating large folios in readahead (Matthew Wilcox)
      
      * tag 'folio-5.18c' of git://git.infradead.org/users/willy/pagecache: (114 commits)
        mm/damon: minor cleanup for damon_pa_young
        selftests/vm/transhuge-stress: Support file-backed PMD folios
        mm/filemap: Support VM_HUGEPAGE for file mappings
        mm/readahead: Switch to page_cache_ra_order
        mm/readahead: Align file mappings for non-DAX
        mm/readahead: Add large folio readahead
        mm: Support arbitrary THP sizes
        mm: Make large folios depend on THP
        mm: Fix READ_ONLY_THP warning
        mm/filemap: Allow large folios to be added to the page cache
        mm: Turn can_split_huge_page() into can_split_folio()
        mm/vmscan: Convert pageout() to take a folio
        mm/vmscan: Turn page_check_references() into folio_check_references()
        mm/vmscan: Account large folios correctly
        mm/vmscan: Optimise shrink_page_list for non-PMD-sized folios
        mm/vmscan: Free non-shmem folios without splitting them
        mm/rmap: Constify the rmap_walk_control argument
        mm/rmap: Convert rmap_walk() to take a folio
        mm: Turn page_anon_vma() into folio_anon_vma()
        mm/rmap: Turn page_lock_anon_vma_read() into folio_lock_anon_vma_read()
        ...
      9030fb0b
  3. 22 Mar, 2022 17 commits
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 3bf03b9a
      Linus Torvalds authored
      Merge updates from Andrew Morton:
      
       - A few misc subsystems: kthread, scripts, ntfs, ocfs2, block, and vfs
      
       - Most the MM patches which precede the patches in Willy's tree: kasan,
         pagecache, gup, swap, shmem, memcg, selftests, pagemap, mremap,
         sparsemem, vmalloc, pagealloc, memory-failure, mlock, hugetlb,
         userfaultfd, vmscan, compaction, mempolicy, oom-kill, migration, thp,
         cma, autonuma, psi, ksm, page-poison, madvise, memory-hotplug, rmap,
         zswap, uaccess, ioremap, highmem, cleanups, kfence, hmm, and damon.
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (227 commits)
        mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release()
        Docs/ABI/testing: add DAMON sysfs interface ABI document
        Docs/admin-guide/mm/damon/usage: document DAMON sysfs interface
        selftests/damon: add a test for DAMON sysfs interface
        mm/damon/sysfs: support DAMOS stats
        mm/damon/sysfs: support DAMOS watermarks
        mm/damon/sysfs: support schemes prioritization
        mm/damon/sysfs: support DAMOS quotas
        mm/damon/sysfs: support DAMON-based Operation Schemes
        mm/damon/sysfs: support the physical address space monitoring
        mm/damon/sysfs: link DAMON for virtual address spaces monitoring
        mm/damon: implement a minimal stub for sysfs-based DAMON interface
        mm/damon/core: add number of each enum type values
        mm/damon/core: allow non-exclusive DAMON start/stop
        Docs/damon: update outdated term 'regions update interval'
        Docs/vm/damon/design: update DAMON-Idle Page Tracking interference handling
        Docs/vm/damon: call low level monitoring primitives the operations
        mm/damon: remove unnecessary CONFIG_DAMON option
        mm/damon/paddr,vaddr: remove damon_{p,v}a_{target_valid,set_operations}()
        mm/damon/dbgfs-test: fix is_target_id() change
        ...
      3bf03b9a
    • Xin Hao's avatar
      mm/damon/sysfs: remove repeat container_of() in damon_sysfs_kdamond_release() · 15423a52
      Xin Hao authored
      In damon_sysfs_kdamond_release(), we have use container_of() to get
      "kdamond" pointer, so there no need to get it once again.
      
      Link: https://lkml.kernel.org/r/20220303075314.22502-1-xhao@linux.alibaba.comSigned-off-by: default avatarXin Hao <xhao@linux.alibaba.com>
      Reviewed-by: default avatarSeongJae Park <sj@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      15423a52
    • SeongJae Park's avatar
      Docs/ABI/testing: add DAMON sysfs interface ABI document · f968c6a4
      SeongJae Park authored
      This commit adds DAMON sysfs interface ABI document under
      Documentation/ABI/testing.
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-14-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f968c6a4
    • SeongJae Park's avatar
      Docs/admin-guide/mm/damon/usage: document DAMON sysfs interface · b1840272
      SeongJae Park authored
      This commit adds detailed usage of DAMON sysfs interface in the
      admin-guide document for DAMON.
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-13-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b1840272
    • SeongJae Park's avatar
      selftests/damon: add a test for DAMON sysfs interface · 40184e48
      SeongJae Park authored
      This commit adds a selftest for DAMON sysfs interface.  It tests the
      functionality of 'nr' files and existence of files in each directory of
      the hierarchy.
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-12-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      40184e48
    • SeongJae Park's avatar
      mm/damon/sysfs: support DAMOS stats · 0ac32b8a
      SeongJae Park authored
      This commit makes DAMON sysfs interface supports the DAMOS stats feature.
      Specifically, this commit adds 'stats' directory under each scheme
      directory, and update the contents of the files under the directory
      according to the latest monitoring results, when the user writes special
      keyword, 'update_schemes_stats' to the 'state' file of the kdamond.
      
      As a result, the files hierarchy becomes as below:
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr_kdamonds
          │ │ 0/state,pid
          │ │ │ contexts/nr_contexts
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr_targets
          │ │ │ │ │ │ 0/pid_target
          │ │ │ │ │ │ │ regions/nr_regions
          │ │ │ │ │ │ │ │ 0/start,end
          │ │ │ │ │ │ │ │ ...
          │ │ │ │ │ │ ...
          │ │ │ │ │ schemes/nr_schemes
          │ │ │ │ │ │ 0/action
          │ │ │ │ │ │ │ access_pattern/
          │ │ │ │ │ │ │ │ sz/min,max
          │ │ │ │ │ │ │ │ nr_accesses/min,max
          │ │ │ │ │ │ │ │ age/min,max
          │ │ │ │ │ │ │ quotas/ms,sz,reset_interval_ms
          │ │ │ │ │ │ │ │ weights/sz_permil,nr_accesses_permil,age_permil
          │ │ │ │ │ │ │ watermarks/metric,interval_us,high,mid,low
          │ │ │ │ │ │ │ stats/    <- NEW DIRECTORY
          │ │ │ │ │ │ │ │ nr_tried,sz_tried,nr_applied,sz_applied,qt_exceeds
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-11-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0ac32b8a
    • SeongJae Park's avatar
      mm/damon/sysfs: support DAMOS watermarks · 1b32234a
      SeongJae Park authored
      This commit makes DAMON sysfs interface supports the DAMOS watermarks
      feature.  Specifically, this commit adds 'watermarks' directory under each
      scheme directory and makes kdamond 'state' file writing respects the
      contents in the directory.
      
      As a result, the files hierarchy becomes as below:
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr_kdamonds
          │ │ 0/state,pid
          │ │ │ contexts/nr_contexts
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr_targets
          │ │ │ │ │ │ 0/pid_target
          │ │ │ │ │ │ │ regions/nr_regions
          │ │ │ │ │ │ │ │ 0/start,end
          │ │ │ │ │ │ │ │ ...
          │ │ │ │ │ │ ...
          │ │ │ │ │ schemes/nr_schemes
          │ │ │ │ │ │ 0/action
          │ │ │ │ │ │ │ access_pattern/
          │ │ │ │ │ │ │ │ sz/min,max
          │ │ │ │ │ │ │ │ nr_accesses/min,max
          │ │ │ │ │ │ │ │ age/min,max
          │ │ │ │ │ │ │ quotas/ms,sz,reset_interval_ms
          │ │ │ │ │ │ │ │ weights/sz_permil,nr_accesses_permil,age_permil
          │ │ │ │ │ │ │ watermarks/    <- NEW DIRECTORY
          │ │ │ │ │ │ │ │ metric,interval_us,high,mid,lo
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      [sj@kernel.org: fix out-of-bound array access for wmark_metric_strs[]]
        Link: https://lkml.kernel.org/r/20220301185619.2904-1-sj@kernel.org
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-10-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Cc: Colin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1b32234a
    • SeongJae Park's avatar
      mm/damon/sysfs: support schemes prioritization · 1c78b2bc
      SeongJae Park authored
      This commit makes DAMON sysfs interface supports the DAMOS' regions
      prioritization weights feature under quotas limitation.  Specifically,
      this commit adds 'weights' directory under each scheme directory and makes
      kdamond 'state' file writing respects the contents in the directory.
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr
          │ │ 0/state,pid
          │ │ │ contexts/nr
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr
          │ │ │ │ │ │ 0/pid
          │ │ │ │ │ │ │ regions/nr
          │ │ │ │ │ │ │ │ 0/start,end
          │ │ │ │ │ │ │ │ ...
          │ │ │ │ │ │ ...
          │ │ │ │ │ schemes/nr
          │ │ │ │ │ │ 0/action
          │ │ │ │ │ │ │ access_pattern/
          │ │ │ │ │ │ │ │ sz/min,max
          │ │ │ │ │ │ │ │ nr_accesses/min,max
          │ │ │ │ │ │ │ │ age/min,max
          │ │ │ │ │ │ │ quotas/ms,bytes,reset_interval_ms
          │ │ │ │ │ │ │ │ weights/    <- NEW DIRECTORY
          │ │ │ │ │ │ │ │ │ weights/sz_permil,nr_accesses_permil,age_permil
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-9-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1c78b2bc
    • SeongJae Park's avatar
      mm/damon/sysfs: support DAMOS quotas · 9bbb820a
      SeongJae Park authored
      This commit makes DAMON sysfs interface supports the DAMOS quotas feature.
      Specifically, this commit adds 'quotas' directory under each scheme
      directory and makes kdamond 'state' file writing respects the contents in
      the directory.
      
      As a result, the files hierarchy becomes as below:
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr_kdamonds
          │ │ 0/state,pid
          │ │ │ contexts/nr_contexts
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr_targets
          │ │ │ │ │ │ 0/pid_target
          │ │ │ │ │ │ │ regions/nr_regions
          │ │ │ │ │ │ │ │ 0/start,end
          │ │ │ │ │ │ │ │ ...
          │ │ │ │ │ │ ...
          │ │ │ │ │ schemes/nr_schemes
          │ │ │ │ │ │ 0/action
          │ │ │ │ │ │ │ access_pattern/
          │ │ │ │ │ │ │ │ sz/min,max
          │ │ │ │ │ │ │ │ nr_accesses/min,max
          │ │ │ │ │ │ │ │ age/min,max
          │ │ │ │ │ │ │ quotas/ms,bytes,reset_interval_ms    <- NEW DIRECTORY
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-8-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9bbb820a
    • SeongJae Park's avatar
      mm/damon/sysfs: support DAMON-based Operation Schemes · 7e84b1f8
      SeongJae Park authored
      This commit makes DAMON sysfs interface supports the DAMON-based operation
      schemes (DAMOS) feature.  Specifically, this commit adds 'schemes'
      directory under each context direcotry, and makes kdamond 'state' file
      writing respects the contents in the directory.
      
      Note that this commit doesn't support all features of DAMOS but only the
      target access pattern and action feature.  Supports for quotas,
      prioritization, watermarks will follow.
      
      As a result, the files hierarchy becomes as below:
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr_kdamonds
          │ │ 0/state,pid
          │ │ │ contexts/nr_contexts
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr_targets
          │ │ │ │ │ │ 0/pid_target
          │ │ │ │ │ │ │ regions/nr_regions
          │ │ │ │ │ │ │ │ 0/start,end
          │ │ │ │ │ │ │ │ ...
          │ │ │ │ │ │ ...
          │ │ │ │ │ schemes/nr_schemes    <- NEW DIRECTORY
          │ │ │ │ │ │ 0/action
          │ │ │ │ │ │ │ access_pattern/
          │ │ │ │ │ │ │ │ sz/min,max
          │ │ │ │ │ │ │ │ nr_accesses/min,max
          │ │ │ │ │ │ │ │ age/min,max
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-7-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7e84b1f8
    • SeongJae Park's avatar
      mm/damon/sysfs: support the physical address space monitoring · 2031b14e
      SeongJae Park authored
      This commit makes DAMON sysfs interface supports the physical address
      space monitoring.  Specifically, this commit adds support of the initial
      monitoring regions set feature by adding 'regions' directory under each
      target directory and makes context operations file to receive 'paddr' in
      addition to 'vaddr'.
      
      As a result, the files hierarchy becomes as below:
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr_kdamonds
          │ │ 0/state,pid
          │ │ │ contexts/nr_contexts
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/
          │ │ │ │ │ │ intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr_targets
          │ │ │ │ │ │ 0/pid_target
          │ │ │ │ │ │ │ regions/nr_regions    <- NEW DIRECTORY
          │ │ │ │ │ │ │ │ 0/start,end
          │ │ │ │ │ │ │ │ ...
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-6-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      2031b14e
    • SeongJae Park's avatar
      mm/damon/sysfs: link DAMON for virtual address spaces monitoring · a61ea561
      SeongJae Park authored
      This commit links the DAMON sysfs interface to DAMON so that users can
      control DAMON via the interface.  In detail, this commit makes writing
      'on' to 'state' file constructs DAMON contexts based on values that users
      have written to relevant sysfs files and start the context.  It supports
      only virtual address spaces monitoring at the moment, though.
      
      The files hierarchy of DAMON sysfs interface after this commit is shown
      below.  In the below figure, parents-children relations are represented
      with indentations, each directory is having ``/`` suffix, and files in
      each directory are separated by comma (",").
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr_kdamonds
          │ │ 0/state,pid
          │ │ │ contexts/nr_contexts
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/
          │ │ │ │ │ │ intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr_targets
          │ │ │ │ │ │ 0/pid_target
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      The usage is straightforward.  Writing a number ('N') to each 'nr_*' file
      makes directories named '0' to 'N-1'.  Users can construct DAMON contexts
      by writing proper values to the files in the straightforward manner and
      start each kdamond by writing 'on' to 'kdamonds/<N>/state'.
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-5-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a61ea561
    • SeongJae Park's avatar
      mm/damon: implement a minimal stub for sysfs-based DAMON interface · c951cd3b
      SeongJae Park authored
      DAMON's debugfs-based user interface served very well, so far.  However,
      it unnecessarily depends on debugfs, while DAMON is not aimed to be used
      for only debugging.  Also, the interface receives multiple values via one
      file.  For example, schemes file receives 18 values separated by white
      spaces.  As a result, it is ineffient, hard to be used, and difficult to
      be extended.  Especially, keeping backward compatibility of user space
      tools is getting only challenging.  It would be better to implement
      another reliable and flexible interface and deprecate the debugfs
      interface in long term.
      
      To this end, this commit implements a stub of a part of the new user
      interface of DAMON using sysfs.  Specifically, this commit implements the
      sysfs control parts for virtual address space monitoring.
      
      More specifically, the idea of the new interface is, using directory
      hierarchies and making one file for one value.  The hierarchy that this
      commit is introducing is as below.  In the below figure, parents-children
      relations are represented with indentations, each directory is having
      ``/`` suffix, and files in each directory are separated by comma (",").
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr_kdamonds
          │ │ 0/state,pid
          │ │ │ contexts/nr_contexts
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/
          │ │ │ │ │ │ intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr_targets
          │ │ │ │ │ │ 0/pid_target
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      Writing a number <N> to each 'nr' file makes directories of name <0> to
      <N-1> in the directory of the 'nr' file.  That's all this commit does.
      Writing proper values to relevant files will construct the DAMON contexts,
      and writing a special keyword, 'on', to 'state' files for each kdamond
      will ask DAMON to start the constructed contexts.
      
      For a short example, using below commands for monitoring virtual address
      spaces of a given workload is imaginable:
      
          # cd /sys/kernel/mm/damon/admin/
          # echo 1 > kdamonds/nr_kdamonds
          # echo 1 > kdamonds/0/contexts/nr_contexts
          # echo vaddr > kdamonds/0/contexts/0/operations
          # echo 1 > kdamonds/0/contexts/0/targets/nr_targets
          # echo $(pidof <workload>) > kdamonds/0/contexts/0/targets/0/pid_target
          # echo on > kdamonds/0/state
      
      Please note that this commit is implementing only the sysfs part stub as
      abovely mentioned.  This commit doesn't implement the special keywords for
      'state' files.  Following commits will do that.
      
      [jiapeng.chong@linux.alibaba.com: fix missing error code in damon_sysfs_attrs_add_dirs()]
        Link: https://lkml.kernel.org/r/20220302111120.24984-1-jiapeng.chong@linux.alibaba.com
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-4-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Signed-off-by: default avatarJiapeng Chong <jiapeng.chong@linux.alibaba.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c951cd3b
    • SeongJae Park's avatar
      mm/damon/core: add number of each enum type values · 5257f36e
      SeongJae Park authored
      This commit declares the number of legal values for each DAMON enum types
      to make traversals of such DAMON enum types easy and safe.
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-3-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5257f36e
    • SeongJae Park's avatar
      mm/damon/core: allow non-exclusive DAMON start/stop · 8b9b0d33
      SeongJae Park authored
      Patch series "Introduce DAMON sysfs interface", v3.
      
      Introduction
      ============
      
      DAMON's debugfs-based user interface (DAMON_DBGFS) served very well, so
      far.  However, it unnecessarily depends on debugfs, while DAMON is not
      aimed to be used for only debugging.  Also, the interface receives
      multiple values via one file.  For example, schemes file receives 18
      values.  As a result, it is inefficient, hard to be used, and difficult to
      be extended.  Especially, keeping backward compatibility of user space
      tools is getting only challenging.  It would be better to implement
      another reliable and flexible interface and deprecate DAMON_DBGFS in long
      term.
      
      For the reason, this patchset introduces a sysfs-based new user interface
      of DAMON.  The idea of the new interface is, using directory hierarchies
      and having one dedicated file for each value.  For a short example, users
      can do the virtual address monitoring via the interface as below:
      
          # cd /sys/kernel/mm/damon/admin/
          # echo 1 > kdamonds/nr_kdamonds
          # echo 1 > kdamonds/0/contexts/nr_contexts
          # echo vaddr > kdamonds/0/contexts/0/operations
          # echo 1 > kdamonds/0/contexts/0/targets/nr_targets
          # echo $(pidof <workload>) > kdamonds/0/contexts/0/targets/0/pid_target
          # echo on > kdamonds/0/state
      
      A brief representation of the files hierarchy of DAMON sysfs interface is
      as below.  Childs are represented with indentation, directories are having
      '/' suffix, and files in each directory are separated by comma.
      
          /sys/kernel/mm/damon/admin
          │ kdamonds/nr_kdamonds
          │ │ 0/state,pid
          │ │ │ contexts/nr_contexts
          │ │ │ │ 0/operations
          │ │ │ │ │ monitoring_attrs/
          │ │ │ │ │ │ intervals/sample_us,aggr_us,update_us
          │ │ │ │ │ │ nr_regions/min,max
          │ │ │ │ │ targets/nr_targets
          │ │ │ │ │ │ 0/pid_target
          │ │ │ │ │ │ │ regions/nr_regions
          │ │ │ │ │ │ │ │ 0/start,end
          │ │ │ │ │ │ │ │ ...
          │ │ │ │ │ │ ...
          │ │ │ │ │ schemes/nr_schemes
          │ │ │ │ │ │ 0/action
          │ │ │ │ │ │ │ access_pattern/
          │ │ │ │ │ │ │ │ sz/min,max
          │ │ │ │ │ │ │ │ nr_accesses/min,max
          │ │ │ │ │ │ │ │ age/min,max
          │ │ │ │ │ │ │ quotas/ms,bytes,reset_interval_ms
          │ │ │ │ │ │ │ │ weights/sz_permil,nr_accesses_permil,age_permil
          │ │ │ │ │ │ │ watermarks/metric,interval_us,high,mid,low
          │ │ │ │ │ │ │ stats/nr_tried,sz_tried,nr_applied,sz_applied,qt_exceeds
          │ │ │ │ │ │ ...
          │ │ │ │ ...
          │ │ ...
      
      Detailed usage of the files will be described in the final Documentation
      patch of this patchset.
      
      Main Difference Between DAMON_DBGFS and DAMON_SYSFS
      ---------------------------------------------------
      
      At the moment, DAMON_DBGFS and DAMON_SYSFS provides same features.  One
      important difference between them is their exclusiveness.  DAMON_DBGFS
      works in an exclusive manner, so that no DAMON worker thread (kdamond) in
      the system can run concurrently and interfere somehow.  For the reason,
      DAMON_DBGFS asks users to construct all monitoring contexts and start them
      at once.  It's not a big problem but makes the operation a little bit
      complex and unflexible.
      
      For more flexible usage, DAMON_SYSFS moves the responsibility of
      preventing any possible interference to the admins and work in a
      non-exclusive manner.  That is, users can configure and start contexts one
      by one.  Note that DAMON respects both exclusive groups and non-exclusive
      groups of contexts, in a manner similar to that of reader-writer locks.
      That is, if any exclusive monitoring contexts (e.g., contexts that started
      via DAMON_DBGFS) are running, DAMON_SYSFS does not start new contexts, and
      vice versa.
      
      Future Plan of DAMON_DBGFS Deprecation
      ======================================
      
      Once this patchset is merged, DAMON_DBGFS development will be frozen.
      That is, we will maintain it to work as is now so that no users will be
      break.  But, it will not be extended to provide any new feature of DAMON.
      The support will be continued only until next LTS release.  After that, we
      will drop DAMON_DBGFS.
      
      User-space Tooling Compatibility
      --------------------------------
      
      As DAMON_SYSFS provides all features of DAMON_DBGFS, all user space
      tooling can move to DAMON_SYSFS.  As we will continue supporting
      DAMON_DBGFS until next LTS kernel release, user space tools would have
      enough time to move to DAMON_SYSFS.
      
      The official user space tool, damo[1], is already supporting both
      DAMON_SYSFS and DAMON_DBGFS.  Both correctness tests[2] and performance
      tests[3] of DAMON using DAMON_SYSFS also passed.
      
      [1] https://github.com/awslabs/damo
      [2] https://github.com/awslabs/damon-tests/tree/master/corr
      [3] https://github.com/awslabs/damon-tests/tree/master/perf
      
      Sequence of Patches
      ===================
      
      First two patches (patches 1-2) make core changes for DAMON_SYSFS.  The
      first one (patch 1) allows non-exclusive DAMON contexts so that
      DAMON_SYSFS can work in non-exclusive mode, while the second one (patch 2)
      adds size of DAMON enum types so that DAMON API users can safely iterate
      the enums.
      
      Third patch (patch 3) implements basic sysfs stub for virtual address
      spaces monitoring.  Note that this implements only sysfs files and DAMON
      is not linked.  Fourth patch (patch 4) links the DAMON_SYSFS to DAMON so
      that users can control DAMON using the sysfs files.
      
      Following six patches (patches 5-10) implements other DAMON features that
      DAMON_DBGFS supports one by one (physical address space monitoring,
      DAMON-based operation schemes, schemes quotas, schemes prioritization
      weights, schemes watermarks, and schemes stats).
      
      Following patch (patch 11) adds a simple selftest for DAMON_SYSFS, and the
      final one (patch 12) documents DAMON_SYSFS.
      
      This patch (of 13):
      
      To avoid interference between DAMON contexts monitoring overlapping memory
      regions, damon_start() works in an exclusive manner.  That is,
      damon_start() does nothing bug fails if any context that started by
      another instance of the function is still running.  This makes its usage a
      little bit restrictive.  However, admins could aware each DAMON usage and
      address such interferences on their own in some cases.
      
      This commit hence implements non-exclusive mode of the function and allows
      the callers to select the mode.  Note that the exclusive groups and
      non-exclusive groups of contexts will respect each other in a manner
      similar to that of reader-writer locks.  Therefore, this commit will not
      cause any behavioral change to the exclusive groups.
      
      Link: https://lkml.kernel.org/r/20220228081314.5770-1-sj@kernel.org
      Link: https://lkml.kernel.org/r/20220228081314.5770-2-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Xin Hao <xhao@linux.alibaba.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8b9b0d33
    • SeongJae Park's avatar
      Docs/damon: update outdated term 'regions update interval' · 4c1f287f
      SeongJae Park authored
      Before DAMON is merged in the mainline, the concept of 'regions update
      interval' has generalized to be used as the time interval for update of
      any monitoring operations related data structure, but the document has not
      updated properly.  This commit updates the document for better
      consistency.
      
      Link: https://lkml.kernel.org/r/20220222170100.17068-4-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4c1f287f
    • SeongJae Park's avatar
      Docs/vm/damon/design: update DAMON-Idle Page Tracking interference handling · 742cc2bf
      SeongJae Park authored
      In DAMON's early development stage before it be merged in the mainline, it
      was first designed to work exclusively with Idle page tracking to avoid
      any interference between each other.  Later, but still before be merged in
      the mainline, because Idle page tracking is fully under the control of
      sysadmins, we made the resolving of conflict as the responsibility of
      sysadmins.  The document is not updated for the change, though.  This
      commit updates the document for that.
      
      Link: https://lkml.kernel.org/r/20220222170100.17068-3-sj@kernel.orgSigned-off-by: default avatarSeongJae Park <sj@kernel.org>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      742cc2bf