mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-11-12 08:22:35 +00:00
documented (hopefully adequately) in the respective changelogs. Notable
series include:
- Lucas Stach has provided some page-mapping
cleanup/consolidation/maintainability work in the series "mm/treewide:
Remove pXd_huge() API".
- In the series "Allow migrate on protnone reference with
MPOL_PREFERRED_MANY policy", Donet Tom has optimized mempolicy's
MPOL_PREFERRED_MANY mode, yielding almost doubled performance in one
test.
- In their series "Memory allocation profiling" Kent Overstreet and
Suren Baghdasaryan have contributed a means of determining (via
/proc/allocinfo) whereabouts in the kernel memory is being allocated:
number of calls and amount of memory.
- Matthew Wilcox has provided the series "Various significant MM
patches" which does a number of rather unrelated things, but in largely
similar code sites.
- In his series "mm: page_alloc: freelist migratetype hygiene" Johannes
Weiner has fixed the page allocator's handling of migratetype requests,
with resulting improvements in compaction efficiency.
- In the series "make the hugetlb migration strategy consistent" Baolin
Wang has fixed a hugetlb migration issue, which should improve hugetlb
allocation reliability.
- Liu Shixin has hit an I/O meltdown caused by readahead in a
memory-tight memcg. Addressed in the series "Fix I/O high when memory
almost met memcg limit".
- In the series "mm/filemap: optimize folio adding and splitting" Kairui
Song has optimized pagecache insertion, yielding ~10% performance
improvement in one test.
- Baoquan He has cleaned up and consolidated the early zone
initialization code in the series "mm/mm_init.c: refactor
free_area_init_core()".
- Baoquan has also redone some MM initializatio code in the series
"mm/init: minor clean up and improvement".
- MM helper cleanups from Christoph Hellwig in his series "remove
follow_pfn".
- More cleanups from Matthew Wilcox in the series "Various page->flags
cleanups".
- Vlastimil Babka has contributed maintainability improvements in the
series "memcg_kmem hooks refactoring".
- More folio conversions and cleanups in Matthew Wilcox's series
"Convert huge_zero_page to huge_zero_folio"
"khugepaged folio conversions"
"Remove page_idle and page_young wrappers"
"Use folio APIs in procfs"
"Clean up __folio_put()"
"Some cleanups for memory-failure"
"Remove page_mapping()"
"More folio compat code removal"
- David Hildenbrand chipped in with "fs/proc/task_mmu: convert hugetlb
functions to work on folis".
- Code consolidation and cleanup work related to GUP's handling of
hugetlbs in Peter Xu's series "mm/gup: Unify hugetlb, part 2".
- Rick Edgecombe has developed some fixes to stack guard gaps in the
series "Cover a guard gap corner case".
- Jinjiang Tu has fixed KSM's behaviour after a fork+exec in the series
"mm/ksm: fix ksm exec support for prctl".
- Baolin Wang has implemented NUMA balancing for multi-size THPs. This
is a simple first-cut implementation for now. The series is "support
multi-size THP numa balancing".
- Cleanups to vma handling helper functions from Matthew Wilcox in the
series "Unify vma_address and vma_pgoff_address".
- Some selftests maintenance work from Dev Jain in the series
"selftests/mm: mremap_test: Optimizations and style fixes".
- Improvements to the swapping of multi-size THPs from Ryan Roberts in
the series "Swap-out mTHP without splitting".
- Kefeng Wang has significantly optimized the handling of arm64's
permission page faults in the series
"arch/mm/fault: accelerate pagefault when badaccess"
"mm: remove arch's private VM_FAULT_BADMAP/BADACCESS"
- GUP cleanups from David Hildenbrand in "mm/gup: consistently call it
GUP-fast".
- hugetlb fault code cleanups from Vishal Moola in "Hugetlb fault path to
use struct vm_fault".
- selftests build fixes from John Hubbard in the series "Fix
selftests/mm build without requiring "make headers"".
- Memory tiering fixes/improvements from Ho-Ren (Jack) Chuang in the
series "Improved Memory Tier Creation for CPUless NUMA Nodes". Fixes
the initialization code so that migration between different memory types
works as intended.
- David Hildenbrand has improved follow_pte() and fixed an errant driver
in the series "mm: follow_pte() improvements and acrn follow_pte()
fixes".
- David also did some cleanup work on large folio mapcounts in his
series "mm: mapcount for large folios + page_mapcount() cleanups".
- Folio conversions in KSM in Alex Shi's series "transfer page to folio
in KSM".
- Barry Song has added some sysfs stats for monitoring multi-size THP's
in the series "mm: add per-order mTHP alloc and swpout counters".
- Some zswap cleanups from Yosry Ahmed in the series "zswap same-filled
and limit checking cleanups".
- Matthew Wilcox has been looking at buffer_head code and found the
documentation to be lacking. The series is "Improve buffer head
documentation".
- Multi-size THPs get more work, this time from Lance Yang. His series
"mm/madvise: enhance lazyfreeing with mTHP in madvise_free" optimizes
the freeing of these things.
- Kemeng Shi has added more userspace-visible writeback instrumentation
in the series "Improve visibility of writeback".
- Kemeng Shi then sent some maintenance work on top in the series "Fix
and cleanups to page-writeback".
- Matthew Wilcox reduces mmap_lock traffic in the anon vma code in the
series "Improve anon_vma scalability for anon VMAs". Intel's test bot
reported an improbable 3x improvement in one test.
- SeongJae Park adds some DAMON feature work in the series
"mm/damon: add a DAMOS filter type for page granularity access recheck"
"selftests/damon: add DAMOS quota goal test"
- Also some maintenance work in the series
"mm/damon/paddr: simplify page level access re-check for pageout"
"mm/damon: misc fixes and improvements"
- David Hildenbrand has disabled some known-to-fail selftests ni the
series "selftests: mm: cow: flag vmsplice() hugetlb tests as XFAIL".
- memcg metadata storage optimizations from Shakeel Butt in "memcg:
reduce memory consumption by memcg stats".
- DAX fixes and maintenance work from Vishal Verma in the series
"dax/bus.c: Fixups for dax-bus locking".
-----BEGIN PGP SIGNATURE-----
iHUEABYIAB0WIQTTMBEPP41GrTpTJgfdBJ7gKXxAjgUCZkgQYwAKCRDdBJ7gKXxA
jrdKAP9WVJdpEcXxpoub/vVE0UWGtffr8foifi9bCwrQrGh5mgEAx7Yf0+d/oBZB
nvA4E0DcPrUAFy144FNM0NTCb7u9vAw=
=V3R/
-----END PGP SIGNATURE-----
Merge tag 'mm-stable-2024-05-17-19-19' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Pull mm updates from Andrew Morton:
"The usual shower of singleton fixes and minor series all over MM,
documented (hopefully adequately) in the respective changelogs.
Notable series include:
- Lucas Stach has provided some page-mapping cleanup/consolidation/
maintainability work in the series "mm/treewide: Remove pXd_huge()
API".
- In the series "Allow migrate on protnone reference with
MPOL_PREFERRED_MANY policy", Donet Tom has optimized mempolicy's
MPOL_PREFERRED_MANY mode, yielding almost doubled performance in
one test.
- In their series "Memory allocation profiling" Kent Overstreet and
Suren Baghdasaryan have contributed a means of determining (via
/proc/allocinfo) whereabouts in the kernel memory is being
allocated: number of calls and amount of memory.
- Matthew Wilcox has provided the series "Various significant MM
patches" which does a number of rather unrelated things, but in
largely similar code sites.
- In his series "mm: page_alloc: freelist migratetype hygiene"
Johannes Weiner has fixed the page allocator's handling of
migratetype requests, with resulting improvements in compaction
efficiency.
- In the series "make the hugetlb migration strategy consistent"
Baolin Wang has fixed a hugetlb migration issue, which should
improve hugetlb allocation reliability.
- Liu Shixin has hit an I/O meltdown caused by readahead in a
memory-tight memcg. Addressed in the series "Fix I/O high when
memory almost met memcg limit".
- In the series "mm/filemap: optimize folio adding and splitting"
Kairui Song has optimized pagecache insertion, yielding ~10%
performance improvement in one test.
- Baoquan He has cleaned up and consolidated the early zone
initialization code in the series "mm/mm_init.c: refactor
free_area_init_core()".
- Baoquan has also redone some MM initializatio code in the series
"mm/init: minor clean up and improvement".
- MM helper cleanups from Christoph Hellwig in his series "remove
follow_pfn".
- More cleanups from Matthew Wilcox in the series "Various
page->flags cleanups".
- Vlastimil Babka has contributed maintainability improvements in the
series "memcg_kmem hooks refactoring".
- More folio conversions and cleanups in Matthew Wilcox's series:
"Convert huge_zero_page to huge_zero_folio"
"khugepaged folio conversions"
"Remove page_idle and page_young wrappers"
"Use folio APIs in procfs"
"Clean up __folio_put()"
"Some cleanups for memory-failure"
"Remove page_mapping()"
"More folio compat code removal"
- David Hildenbrand chipped in with "fs/proc/task_mmu: convert
hugetlb functions to work on folis".
- Code consolidation and cleanup work related to GUP's handling of
hugetlbs in Peter Xu's series "mm/gup: Unify hugetlb, part 2".
- Rick Edgecombe has developed some fixes to stack guard gaps in the
series "Cover a guard gap corner case".
- Jinjiang Tu has fixed KSM's behaviour after a fork+exec in the
series "mm/ksm: fix ksm exec support for prctl".
- Baolin Wang has implemented NUMA balancing for multi-size THPs.
This is a simple first-cut implementation for now. The series is
"support multi-size THP numa balancing".
- Cleanups to vma handling helper functions from Matthew Wilcox in
the series "Unify vma_address and vma_pgoff_address".
- Some selftests maintenance work from Dev Jain in the series
"selftests/mm: mremap_test: Optimizations and style fixes".
- Improvements to the swapping of multi-size THPs from Ryan Roberts
in the series "Swap-out mTHP without splitting".
- Kefeng Wang has significantly optimized the handling of arm64's
permission page faults in the series
"arch/mm/fault: accelerate pagefault when badaccess"
"mm: remove arch's private VM_FAULT_BADMAP/BADACCESS"
- GUP cleanups from David Hildenbrand in "mm/gup: consistently call
it GUP-fast".
- hugetlb fault code cleanups from Vishal Moola in "Hugetlb fault
path to use struct vm_fault".
- selftests build fixes from John Hubbard in the series "Fix
selftests/mm build without requiring "make headers"".
- Memory tiering fixes/improvements from Ho-Ren (Jack) Chuang in the
series "Improved Memory Tier Creation for CPUless NUMA Nodes".
Fixes the initialization code so that migration between different
memory types works as intended.
- David Hildenbrand has improved follow_pte() and fixed an errant
driver in the series "mm: follow_pte() improvements and acrn
follow_pte() fixes".
- David also did some cleanup work on large folio mapcounts in his
series "mm: mapcount for large folios + page_mapcount() cleanups".
- Folio conversions in KSM in Alex Shi's series "transfer page to
folio in KSM".
- Barry Song has added some sysfs stats for monitoring multi-size
THP's in the series "mm: add per-order mTHP alloc and swpout
counters".
- Some zswap cleanups from Yosry Ahmed in the series "zswap
same-filled and limit checking cleanups".
- Matthew Wilcox has been looking at buffer_head code and found the
documentation to be lacking. The series is "Improve buffer head
documentation".
- Multi-size THPs get more work, this time from Lance Yang. His
series "mm/madvise: enhance lazyfreeing with mTHP in madvise_free"
optimizes the freeing of these things.
- Kemeng Shi has added more userspace-visible writeback
instrumentation in the series "Improve visibility of writeback".
- Kemeng Shi then sent some maintenance work on top in the series
"Fix and cleanups to page-writeback".
- Matthew Wilcox reduces mmap_lock traffic in the anon vma code in
the series "Improve anon_vma scalability for anon VMAs". Intel's
test bot reported an improbable 3x improvement in one test.
- SeongJae Park adds some DAMON feature work in the series
"mm/damon: add a DAMOS filter type for page granularity access recheck"
"selftests/damon: add DAMOS quota goal test"
- Also some maintenance work in the series
"mm/damon/paddr: simplify page level access re-check for pageout"
"mm/damon: misc fixes and improvements"
- David Hildenbrand has disabled some known-to-fail selftests ni the
series "selftests: mm: cow: flag vmsplice() hugetlb tests as
XFAIL".
- memcg metadata storage optimizations from Shakeel Butt in "memcg:
reduce memory consumption by memcg stats".
- DAX fixes and maintenance work from Vishal Verma in the series
"dax/bus.c: Fixups for dax-bus locking""
* tag 'mm-stable-2024-05-17-19-19' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (426 commits)
memcg, oom: cleanup unused memcg_oom_gfp_mask and memcg_oom_order
selftests/mm: hugetlb_madv_vs_map: avoid test skipping by querying hugepage size at runtime
mm/hugetlb: add missing VM_FAULT_SET_HINDEX in hugetlb_wp
mm/hugetlb: add missing VM_FAULT_SET_HINDEX in hugetlb_fault
selftests: cgroup: add tests to verify the zswap writeback path
mm: memcg: make alloc_mem_cgroup_per_node_info() return bool
mm/damon/core: fix return value from damos_wmark_metric_value
mm: do not update memcg stats for NR_{FILE/SHMEM}_PMDMAPPED
selftests: cgroup: remove redundant enabling of memory controller
Docs/mm/damon/maintainer-profile: allow posting patches based on damon/next tree
Docs/mm/damon/maintainer-profile: change the maintainer's timezone from PST to PT
Docs/mm/damon/design: use a list for supported filters
Docs/admin-guide/mm/damon/usage: fix wrong schemes effective quota update command
Docs/admin-guide/mm/damon/usage: fix wrong example of DAMOS filter matching sysfs file
selftests/damon: classify tests for functionalities and regressions
selftests/damon/_damon_sysfs: use 'is' instead of '==' for 'None'
selftests/damon/_damon_sysfs: find sysfs mount point from /proc/mounts
selftests/damon/_damon_sysfs: check errors from nr_schemes file reads
mm/damon/core: initialize ->esz_bp from damos_quota_init_priv()
selftests/damon: add a test for DAMOS quota goal
...
161 lines
5.4 KiB
C
161 lines
5.4 KiB
C
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
#ifndef __HID_BPF_H
|
|
#define __HID_BPF_H
|
|
|
|
#include <linux/bpf.h>
|
|
#include <linux/spinlock.h>
|
|
#include <uapi/linux/hid.h>
|
|
|
|
struct hid_device;
|
|
|
|
/*
|
|
* The following is the user facing HID BPF API.
|
|
*
|
|
* Extra care should be taken when editing this part, as
|
|
* it might break existing out of the tree bpf programs.
|
|
*/
|
|
|
|
/**
|
|
* struct hid_bpf_ctx - User accessible data for all HID programs
|
|
*
|
|
* ``data`` is not directly accessible from the context. We need to issue
|
|
* a call to ``hid_bpf_get_data()`` in order to get a pointer to that field.
|
|
*
|
|
* All of these fields are currently read-only.
|
|
*
|
|
* @index: program index in the jump table. No special meaning (a smaller index
|
|
* doesn't mean the program will be executed before another program with
|
|
* a bigger index).
|
|
* @hid: the ``struct hid_device`` representing the device itself
|
|
* @report_type: used for ``hid_bpf_device_event()``
|
|
* @allocated_size: Allocated size of data.
|
|
*
|
|
* This is how much memory is available and can be requested
|
|
* by the HID program.
|
|
* Note that for ``HID_BPF_RDESC_FIXUP``, that memory is set to
|
|
* ``4096`` (4 KB)
|
|
* @size: Valid data in the data field.
|
|
*
|
|
* Programs can get the available valid size in data by fetching this field.
|
|
* Programs can also change this value by returning a positive number in the
|
|
* program.
|
|
* To discard the event, return a negative error code.
|
|
*
|
|
* ``size`` must always be less or equal than ``allocated_size`` (it is enforced
|
|
* once all BPF programs have been run).
|
|
* @retval: Return value of the previous program.
|
|
*/
|
|
struct hid_bpf_ctx {
|
|
__u32 index;
|
|
const struct hid_device *hid;
|
|
__u32 allocated_size;
|
|
enum hid_report_type report_type;
|
|
union {
|
|
__s32 retval;
|
|
__s32 size;
|
|
};
|
|
};
|
|
|
|
/**
|
|
* enum hid_bpf_attach_flags - flags used when attaching a HIF-BPF program
|
|
*
|
|
* @HID_BPF_FLAG_NONE: no specific flag is used, the kernel choses where to
|
|
* insert the program
|
|
* @HID_BPF_FLAG_INSERT_HEAD: insert the given program before any other program
|
|
* currently attached to the device. This doesn't
|
|
* guarantee that this program will always be first
|
|
* @HID_BPF_FLAG_MAX: sentinel value, not to be used by the callers
|
|
*/
|
|
enum hid_bpf_attach_flags {
|
|
HID_BPF_FLAG_NONE = 0,
|
|
HID_BPF_FLAG_INSERT_HEAD = _BITUL(0),
|
|
HID_BPF_FLAG_MAX,
|
|
};
|
|
|
|
/* Following functions are tracepoints that BPF programs can attach to */
|
|
int hid_bpf_device_event(struct hid_bpf_ctx *ctx);
|
|
int hid_bpf_rdesc_fixup(struct hid_bpf_ctx *ctx);
|
|
|
|
/*
|
|
* Below is HID internal
|
|
*/
|
|
|
|
/* internal function to call eBPF programs, not to be used by anybody */
|
|
int __hid_bpf_tail_call(struct hid_bpf_ctx *ctx);
|
|
|
|
#define HID_BPF_MAX_PROGS_PER_DEV 64
|
|
#define HID_BPF_FLAG_MASK (((HID_BPF_FLAG_MAX - 1) << 1) - 1)
|
|
|
|
/* types of HID programs to attach to */
|
|
enum hid_bpf_prog_type {
|
|
HID_BPF_PROG_TYPE_UNDEF = -1,
|
|
HID_BPF_PROG_TYPE_DEVICE_EVENT, /* an event is emitted from the device */
|
|
HID_BPF_PROG_TYPE_RDESC_FIXUP,
|
|
HID_BPF_PROG_TYPE_MAX,
|
|
};
|
|
|
|
struct hid_report_enum;
|
|
|
|
struct hid_bpf_ops {
|
|
struct hid_report *(*hid_get_report)(struct hid_report_enum *report_enum, const u8 *data);
|
|
int (*hid_hw_raw_request)(struct hid_device *hdev,
|
|
unsigned char reportnum, __u8 *buf,
|
|
size_t len, enum hid_report_type rtype,
|
|
enum hid_class_request reqtype);
|
|
int (*hid_hw_output_report)(struct hid_device *hdev, __u8 *buf, size_t len);
|
|
int (*hid_input_report)(struct hid_device *hid, enum hid_report_type type,
|
|
u8 *data, u32 size, int interrupt);
|
|
struct module *owner;
|
|
const struct bus_type *bus_type;
|
|
};
|
|
|
|
extern struct hid_bpf_ops *hid_bpf_ops;
|
|
|
|
struct hid_bpf_prog_list {
|
|
u16 prog_idx[HID_BPF_MAX_PROGS_PER_DEV];
|
|
u8 prog_cnt;
|
|
};
|
|
|
|
/* stored in each device */
|
|
struct hid_bpf {
|
|
u8 *device_data; /* allocated when a bpf program of type
|
|
* SEC(f.../hid_bpf_device_event) has been attached
|
|
* to this HID device
|
|
*/
|
|
u32 allocated_data;
|
|
|
|
struct hid_bpf_prog_list __rcu *progs[HID_BPF_PROG_TYPE_MAX]; /* attached BPF progs */
|
|
bool destroyed; /* prevents the assignment of any progs */
|
|
|
|
spinlock_t progs_lock; /* protects RCU update of progs */
|
|
};
|
|
|
|
/* specific HID-BPF link when a program is attached to a device */
|
|
struct hid_bpf_link {
|
|
struct bpf_link link;
|
|
int hid_table_index;
|
|
};
|
|
|
|
#ifdef CONFIG_HID_BPF
|
|
u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type, u8 *data,
|
|
u32 *size, int interrupt);
|
|
int hid_bpf_connect_device(struct hid_device *hdev);
|
|
void hid_bpf_disconnect_device(struct hid_device *hdev);
|
|
void hid_bpf_destroy_device(struct hid_device *hid);
|
|
void hid_bpf_device_init(struct hid_device *hid);
|
|
u8 *call_hid_bpf_rdesc_fixup(struct hid_device *hdev, u8 *rdesc, unsigned int *size);
|
|
#else /* CONFIG_HID_BPF */
|
|
static inline u8 *dispatch_hid_bpf_device_event(struct hid_device *hid, enum hid_report_type type,
|
|
u8 *data, u32 *size, int interrupt) { return data; }
|
|
static inline int hid_bpf_connect_device(struct hid_device *hdev) { return 0; }
|
|
static inline void hid_bpf_disconnect_device(struct hid_device *hdev) {}
|
|
static inline void hid_bpf_destroy_device(struct hid_device *hid) {}
|
|
static inline void hid_bpf_device_init(struct hid_device *hid) {}
|
|
#define call_hid_bpf_rdesc_fixup(_hdev, _rdesc, _size) \
|
|
((u8 *)kmemdup(_rdesc, *(_size), GFP_KERNEL))
|
|
|
|
#endif /* CONFIG_HID_BPF */
|
|
|
|
#endif /* __HID_BPF_H */
|