Re: [PATCH v5 0/8] DAMON based tiered memory management for CXL memory

2024-06-13 Thread Honggyu Kim
Hi SeongJae, On Thu, 13 Jun 2024 10:46:04 -0700 SeongJae Park wrote: > Hi Honggyu, > > On Thu, 13 Jun 2024 22:20:47 +0900 Honggyu Kim wrote: > > > There was an RFC IDEA "DAMOS-based Tiered-Memory Management" previously > > posted at [1]. > > > > It says there is no implementation of the

[PATCH v6 7/7] Docs/damon: document damos_migrate_{hot,cold}

2024-06-13 Thread Honggyu Kim
This patch adds damon description for "migrate_hot" and "migrate_cold" actions for both usage and design documents as long as a new "target_nid" knob to set the migration target node. Signed-off-by: Honggyu Kim --- Documentation/admin-guide/mm/damon/usage.rst | 4

[PATCH v6 5/7] mm/damon/paddr: introduce DAMOS_MIGRATE_COLD action for demotion

2024-06-13 Thread Honggyu Kim
This patch introduces DAMOS_MIGRATE_COLD action, which is similar to DAMOS_PAGEOUT, but migrate folios to the given 'target_nid' in the sysfs instead of swapping them out. The 'target_nid' sysfs knob informs the migration target node ID. Here is one of the example usage of this 'migrate_cold'

[PATCH v6 6/7] mm/damon/paddr: introduce DAMOS_MIGRATE_HOT action for promotion

2024-06-13 Thread Honggyu Kim
From: Hyeongtak Ji This patch introduces DAMOS_MIGRATE_HOT action, which is similar to DAMOS_MIGRATE_COLD, but proritizes hot pages. It migrates pages inside the given region to the 'target_nid' NUMA node in the sysfs. Here is one of the example usage of this 'migrate_hot' action. $ cd

[PATCH v6 4/7] mm/migrate: add MR_DAMON to migrate_reason

2024-06-13 Thread Honggyu Kim
The current patch series introduces DAMON based migration across NUMA nodes so it'd be better to have a new migrate_reason in trace events. Signed-off-by: Honggyu Kim Reviewed-by: SeongJae Park Signed-off-by: SeongJae Park --- include/linux/migrate_mode.h | 1 +

[PATCH v6 2/7] mm: rename alloc_demote_folio to alloc_migrate_folio

2024-06-13 Thread Honggyu Kim
The alloc_demote_folio can also be used for general migration including both demotion and promotion so it'd be better to rename it from alloc_demote_folio to alloc_migrate_folio. Signed-off-by: Honggyu Kim Reviewed-by: SeongJae Park --- mm/internal.h | 2 +- mm/vmscan.c | 4 ++-- 2 files

[PATCH v6 3/7] mm/damon/sysfs-schemes: add target_nid on sysfs-schemes

2024-06-13 Thread Honggyu Kim
From: Hyeongtak Ji This patch adds target_nid under /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes// The 'target_nid' can be used as the destination node for DAMOS actions such as DAMOS_MIGRATE_{HOT,COLD} in the follow up patches. Signed-off-by: Hyeongtak Ji Signed-off-by: Honggyu

[PATCH v6 1/7] mm: make alloc_demote_folio externally invokable for migration

2024-06-13 Thread Honggyu Kim
The alloc_demote_folio can be used out of vmscan.c so it'd be better to remove static keyword from it. Signed-off-by: Honggyu Kim Reviewed-by: SeongJae Park Signed-off-by: SeongJae Park --- mm/internal.h | 1 + mm/vmscan.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff

[PATCH v6 0/7] DAMON based tiered memory management for CXL memory

2024-06-13 Thread Honggyu Kim
There was an RFC IDEA "DAMOS-based Tiered-Memory Management" previously posted at [1]. It says there is no implementation of the demote/promote DAMOS action are made. This patch series is about its implementation for physical address space so that this scheme can be applied in system wide level.

Re: [PATCH v4 12/35] kmsan: Support SLAB_POISON

2024-06-13 Thread Ilya Leoshkevich
On Thu, 2024-06-13 at 16:30 -0700, SeongJae Park wrote: > Hi Ilya, > > On Thu, 13 Jun 2024 17:34:14 +0200 Ilya Leoshkevich > wrote: > > > Avoid false KMSAN negatives with SLUB_DEBUG by allowing > > kmsan_slab_free() to poison the freed memory, and by preventing > > init_object() from

[PATCH v7 1/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up

2024-06-13 Thread Steven Rostedt
From: "Steven Rostedt (Google)" In order to allow for requesting a memory region that can be used for things like pstore on multiple machines where the memory layout is not the same, add a new option to the kernel command line called "reserve_mem". The format is: reserve_mem=nn:align:name

[PATCH v7 2/2] pstore/ramoops: Add ramoops.mem_name= command line option

2024-06-13 Thread Steven Rostedt
From: "Steven Rostedt (Google)" Add a method to find a region specified by reserve_mem=nn:align:name for ramoops. Adding a kernel command line parameter: reserve_mem=12M:4096:oops ramoops.mem_name=oops Will use the size and location defined by the memmap parameter where it finds the memory

[PATCH v7 0/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up

2024-06-13 Thread Steven Rostedt
Reserve unspecified location of physical memory from kernel command line Background: In ChromeOS, we have 1 MB of pstore ramoops reserved so that we can extract dmesg output and some other information when a crash happens in the field. (This is only done when the user selects "Allow Google to

Re: [PATCH v4 12/35] kmsan: Support SLAB_POISON

2024-06-13 Thread SeongJae Park
Hi Ilya, On Thu, 13 Jun 2024 17:34:14 +0200 Ilya Leoshkevich wrote: > Avoid false KMSAN negatives with SLUB_DEBUG by allowing > kmsan_slab_free() to poison the freed memory, and by preventing > init_object() from unpoisoning new allocations by using __memset(). > > There are two alternatives

Re: [PATCH 3/8] riscv: ftrace: support fastcc in Clang for WITH_ARGS

2024-06-13 Thread Nathan Chancellor
On Thu, Jun 13, 2024 at 03:11:08PM +0800, Andy Chiu wrote: > Some caller-saved registers which are not defined as function arguments > in the ABI can still be passed as arguments when the kernel is compiled > with Clang. As a result, we must save and restore those registers to > prevent ftrace

Re: [PATCH 1/1] s390/virtio_ccw: fix config change notifications

2024-06-13 Thread Vasily Gorbik
On Thu, Jun 13, 2024 at 03:21:15PM +0200, Halil Pasic wrote: > On Wed, 12 Jun 2024 16:04:15 +0200 > Thomas Huth wrote: > > > On 11/06/2024 23.47, Halil Pasic wrote: > > > Commit e3e9bda38e6d ("s390/virtio_ccw: use DMA handle from DMA API") > > > broke configuration change notifications for

Re: [PATCH v6 2/2] pstore/ramoops: Add ramoops.mem_name= command line option

2024-06-13 Thread Guilherme G. Piccoli
On 13/06/2024 15:42, Steven Rostedt wrote: > On Thu, 13 Jun 2024 15:19:50 -0300 > "Guilherme G. Piccoli" wrote: > >>> + >>> + reserver_mem=2M:4096:oops ramoops.mem_name=oops >>> + >> >> Likely this could be fixed on merge, to avoid another version, but... >> >> s/reserver_mem/reserve_mem >

Re: [PATCH] linux++: delete some forward declarations

2024-06-13 Thread Steven Rostedt
On Thu, 13 Jun 2024 14:21:10 -0700 Andrew Morton wrote: > On Thu, 13 Jun 2024 16:10:12 -0400 Steven Rostedt wrote: > > > > And... I'm a bit surprised that forward declarations are allowed in C. > > > A billion years ago I used a C compiler which would use 16 bits for > > > an enum if the

Re: [PATCH] linux++: delete some forward declarations

2024-06-13 Thread Andrew Morton
On Thu, 13 Jun 2024 16:10:12 -0400 Steven Rostedt wrote: > > And... I'm a bit surprised that forward declarations are allowed in C. > > A billion years ago I used a C compiler which would use 16 bits for > > an enum if the enumted values would fit in 16 bits. And it would use 32 > > bits

Re: [PATCH] ARM: dts: qcom: motorola-falcon: add accelerometer, magnetometer

2024-06-13 Thread Stanislav Jakubek
On Thu, Jun 13, 2024 at 09:48:26AM +0200, Konrad Dybcio wrote: > > > On 6/9/24 13:05, Stanislav Jakubek wrote: > > Add the accelerometer and magnetometer that are present on the Motorola > > Moto G (2013) device. > > > > Signed-off-by: Stanislav Jakubek > > --- > > [...] > > > +_i2c2 { > >

Re: [PATCH] linux++: delete some forward declarations

2024-06-13 Thread Steven Rostedt
On Thu, 13 Jun 2024 22:22:18 +0300 Alexey Dobriyan wrote: > g++ doesn't like forward enum declarations: > > error: use of enum ‘E’ without previous declaration > 64 | enum E; But we don't care about g++. Do we? I would make that a separate patch. > > Delete those which aren't

Re: [PATCH] ACPI: NFIT: add missing MODULE_DESCRIPTION() macro

2024-06-13 Thread Rafael J. Wysocki
On Thu, Jun 6, 2024 at 6:10 PM Dave Jiang wrote: > > > > On 6/3/24 6:30 AM, Jeff Johnson wrote: > > make allmodconfig && make W=1 C=1 reports: > > WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/acpi/nfit/nfit.o > > > > Add the missing invocation of the MODULE_DESCRIPTION() macro. > > >

Re: [PATCH] linux++: delete some forward declarations

2024-06-13 Thread Steven Rostedt
On Thu, 13 Jun 2024 13:04:20 -0700 Andrew Morton wrote: > On Thu, 13 Jun 2024 15:34:02 -0400 Steven Rostedt wrote: > > > On Thu, 13 Jun 2024 22:22:18 +0300 > > Alexey Dobriyan wrote: > > > > > g++ doesn't like forward enum declarations: > > > > > > error: use of enum ‘E’ without

Re: [PATCH] linux++: delete some forward declarations

2024-06-13 Thread Andrew Morton
On Thu, 13 Jun 2024 15:34:02 -0400 Steven Rostedt wrote: > On Thu, 13 Jun 2024 22:22:18 +0300 > Alexey Dobriyan wrote: > > > g++ doesn't like forward enum declarations: > > > > error: use of enum ‘E’ without previous declaration > >64 | enum E; > > But we don't care about g++. Do

[PATCH] linux++: delete some forward declarations

2024-06-13 Thread Alexey Dobriyan
g++ doesn't like forward enum declarations: error: use of enum ‘E’ without previous declaration 64 | enum E; Delete those which aren't used. Delete some unused/unnecessary forward struct declarations for a change. Signed-off-by: Alexey Dobriyan --- fs/ramfs/inode.c

Re: [PATCH 4/8] riscv: ftrace: align patchable functions to 4 Byte boundary

2024-06-13 Thread Nathan Chancellor
Hi Andy, On Thu, Jun 13, 2024 at 03:11:09PM +0800, Andy Chiu wrote: > We are changing ftrace code patching in order to remove dependency from > stop_machine() and enable kernel preemption. This requires us to align > functions entry at a 4-B align address. > > However, -falign-functions on older

[PATCH v4 24/35] s390/cpacf: Unpoison the results of cpacf_trng()

2024-06-13 Thread Ilya Leoshkevich
Prevent KMSAN from complaining about buffers filled by cpacf_trng() being uninitialized. Tested-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/cpacf.h | 3 +++ 1 file changed, 3 insertions(+) diff

[PATCH v4 35/35] kmsan: Enable on s390

2024-06-13 Thread Ilya Leoshkevich
Now that everything else is in place, enable KMSAN in Kconfig. Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index c59d2b54df49..3cba4993d7c7 100644 ---

[PATCH v4 29/35] s390/mm: Define KMSAN metadata for vmalloc and modules

2024-06-13 Thread Ilya Leoshkevich
The pages for the KMSAN metadata associated with most kernel mappings are taken from memblock by the common code. However, vmalloc and module metadata needs to be defined by the architectures. Be a little bit more careful than x86: allocate exactly MODULES_LEN for the module shadow and origins,

Re: [PATCH v6 2/2] pstore/ramoops: Add ramoops.mem_name= command line option

2024-06-13 Thread Steven Rostedt
On Thu, 13 Jun 2024 15:19:50 -0300 "Guilherme G. Piccoli" wrote: > > + > > + reserver_mem=2M:4096:oops ramoops.mem_name=oops > > + > > Likely this could be fixed on merge, to avoid another version, but... > > s/reserver_mem/reserve_mem That 'r' is my nemesis! Almost every time I type

[PATCH v4 05/35] kmsan: Fix is_bad_asm_addr() on arches with overlapping address spaces

2024-06-13 Thread Ilya Leoshkevich
Comparing pointers with TASK_SIZE does not make sense when kernel and userspace overlap. Skip the comparison when this is the case. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/instrumentation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff

[PATCH v4 21/35] s390: Use a larger stack for KMSAN

2024-06-13 Thread Ilya Leoshkevich
Adjust the stack size for the KMSAN-enabled kernel like it was done for the KASAN-enabled one in commit 7fef92ccadd7 ("s390/kasan: double the stack size"). Both tools have similar requirements. Reviewed-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich ---

[PATCH v4 08/35] kmsan: Remove an x86-specific #include from kmsan.h

2024-06-13 Thread Ilya Leoshkevich
Replace the x86-specific asm/pgtable_64_types.h #include with the linux/pgtable.h one, which all architectures have. While at it, sort the headers alphabetically for the sake of consistency with other KMSAN code. Fixes: f80be4571b19 ("kmsan: add KMSAN runtime core") Suggested-by: Heiko Carstens

[PATCH v2 07/14] openrisc/thread_info: Introduce TIF_NOTIFY_IPI flag

2024-06-13 Thread K Prateek Nayak
Add support for TIF_NOTIFY_IPI on OpenRISC. With TIF_NOTIFY_IPI, a sender sending an IPI to an idle CPU in TIF_POLLING mode will set the TIF_NOTIFY_IPI flag in the target's idle tasks's thread_info to pull the CPU out of idle, as opposed to setting TIF_NEED_RESCHED previously. This avoids spurious

[PATCH v4 04/35] kmsan: Increase the maximum store size to 4096

2024-06-13 Thread Ilya Leoshkevich
The inline assembly block in s390's chsc() stores that much. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/instrumentation.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/kmsan/instrumentation.c b/mm/kmsan/instrumentation.c index

Re: [PATCH v6 2/2] pstore/ramoops: Add ramoops.mem_name= command line option

2024-06-13 Thread Guilherme G. Piccoli
Thanks Steve, re-tested in my VM and it's working fine. Just a minor below... On 13/06/2024 12:55, Steven Rostedt wrote: > [...] > + D. Using a region of memory reserved via ``reserve_mem`` command line > +parameter. The address and size will be defined by the ``reserve_mem`` > +

[PATCH v4 16/35] mm: slub: Unpoison the memchr_inv() return value

2024-06-13 Thread Ilya Leoshkevich
Even though the KMSAN warnings generated by memchr_inv() are suppressed by metadata_access_enable(), its return value may still be poisoned. The reason is that the last iteration of memchr_inv() returns `*start != value ? start : NULL`, where *start is poisoned. Because of this, somewhat

[PATCH v4 19/35] kmsan: Accept ranges starting with 0 on s390

2024-06-13 Thread Ilya Leoshkevich
On s390 the virtual address 0 is valid (current CPU's lowcore is mapped there), therefore KMSAN should not complain about it. Disable the respective check on s390. There doesn't seem to be a Kconfig option to describe this situation, so explicitly check for s390. Reviewed-by: Alexander Potapenko

Re: [PATCH v5 0/8] DAMON based tiered memory management for CXL memory

2024-06-13 Thread SeongJae Park
Hi Honggyu, On Thu, 13 Jun 2024 22:20:47 +0900 Honggyu Kim wrote: > There was an RFC IDEA "DAMOS-based Tiered-Memory Management" previously > posted at [1]. > > It says there is no implementation of the demote/promote DAMOS action > are made. This patch series is about its implementation for

Re: [PATCH v5 8/8] Docs/.../mm/damon: add more damos actions

2024-06-13 Thread SeongJae Park
On Thu, 13 Jun 2024 07:07:29 -0700 SeongJae Park wrote: > Hi Honggyu, > > On Thu, 13 Jun 2024 22:20:55 +0900 Honggyu Kim wrote: > > > This patch adds damon description for "migrate_hot" and "migrate_cold" > > actions for both usage and design documents as long as a new > > "target_nid" knob

[PATCH v4 23/35] s390/checksum: Add a KMSAN check

2024-06-13 Thread Ilya Leoshkevich
Add a KMSAN check to the CKSM inline assembly, similar to how it was done for ASAN in commit e42ac7789df6 ("s390/checksum: always use cksm instruction"). Acked-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/include/asm/checksum.h | 2 ++ 1

Re: [PATCH] ARM: dts: qcom: motorola-falcon: add accelerometer, magnetometer

2024-06-13 Thread Konrad Dybcio
On 6/13/24 19:18, Stanislav Jakubek wrote: On Thu, Jun 13, 2024 at 09:48:26AM +0200, Konrad Dybcio wrote: On 6/9/24 13:05, Stanislav Jakubek wrote: Add the accelerometer and magnetometer that are present on the Motorola Moto G (2013) device. Signed-off-by: Stanislav Jakubek --- [...]

Re: [PATCH v5 2/8] mm: rename alloc_demote_folio to alloc_migrate_folio

2024-06-13 Thread SeongJae Park
On Thu, 13 Jun 2024 22:20:49 +0900 Honggyu Kim wrote: > The alloc_demote_folio can also be used for general migration including > both demotion and promotion so it'd be better to rename it from > alloc_demote_folio to alloc_migrate_folio. > > Signed-off-by: Honggyu Kim Reviewed-by: SeongJae

[PATCH v4 01/35] ftrace: Unpoison ftrace_regs in ftrace_ops_list_func()

2024-06-13 Thread Ilya Leoshkevich
Architectures use assembly code to initialize ftrace_regs and call ftrace_ops_list_func(). Therefore, from the KMSAN's point of view, ftrace_regs is poisoned on ftrace_ops_list_func entry(). This causes KMSAN warnings when running the ftrace testsuite. Fix by trusting the architecture-specific

[PATCH v6 0/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up

2024-06-13 Thread Steven Rostedt
Reserve unspecified location of physical memory from kernel command line Background: In ChromeOS, we have 1 MB of pstore ramoops reserved so that we can extract dmesg output and some other information when a crash happens in the field. (This is only done when the user selects "Allow Google to

Re: [PATCH v6 0/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up

2024-06-13 Thread Steven Rostedt
On Thu, 13 Jun 2024 18:54:12 +0200 Alexander Graf wrote: > > Do you have a "real" pstore on these systems that you could store > non-volatile variables in, such as persistent UEFI variables? If so, you > could create an actually persistent mapping for your trace pstore even > across kernel

[PATCH v4 17/35] mm: kfence: Disable KMSAN when checking the canary

2024-06-13 Thread Ilya Leoshkevich
KMSAN warns about check_canary() accessing the canary. The reason is that, even though set_canary() is properly instrumented and sets shadow, slub explicitly poisons the canary's address range afterwards. Unpoisoning the canary is not the right thing to do: only check_canary() is supposed to

[PATCH v4 22/35] s390/boot: Add the KMSAN runtime stub

2024-06-13 Thread Ilya Leoshkevich
It should be possible to have inline functions in the s390 header files, which call kmsan_unpoison_memory(). The problem is that these header files might be included by the decompressor, which does not contain KMSAN runtime, causing linker errors. Not compiling these calls if __SANITIZE_MEMORY__

Re: [PATCH v3 1/1] dt-bindings: remoteproc: imx_rproc: add minItems for power-domain

2024-06-13 Thread Rob Herring (Arm)
On Mon, 10 Jun 2024 11:17:21 -0400, Frank Li wrote: > "fsl,imx8qxp-cm4" and "fsl,imx8qm-cm4" need minimum 2 power domains. Other > platform doesn't require 'power-domain'. > > Signed-off-by: Frank Li > --- > > Notes: > Change from v2 to v3 > - only imx8qxp and imx8qm need

Re: [PATCH v6 0/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up

2024-06-13 Thread Alexander Graf
Hey Steve, On 13.06.24 17:55, Steven Rostedt wrote: Reserve unspecified location of physical memory from kernel command line Background: In ChromeOS, we have 1 MB of pstore ramoops reserved so that we can extract dmesg output and some other information when a crash happens in the field. (This

[PATCH v4 18/35] lib/zlib: Unpoison DFLTCC output buffers

2024-06-13 Thread Ilya Leoshkevich
The constraints of the DFLTCC inline assembly are not precise: they do not communicate the size of the output buffers to the compiler, so it cannot automatically instrument it. Add the manual kmsan_unpoison_memory() calls for the output buffers. The logic is the same as in [1]. [1]

Re: [PATCH v4 01/35] ftrace: Unpoison ftrace_regs in ftrace_ops_list_func()

2024-06-13 Thread Steven Rostedt
On Thu, 13 Jun 2024 17:34:03 +0200 Ilya Leoshkevich wrote: > Architectures use assembly code to initialize ftrace_regs and call > ftrace_ops_list_func(). Therefore, from the KMSAN's point of view, > ftrace_regs is poisoned on ftrace_ops_list_func entry(). This causes > KMSAN warnings when

[PATCH v4 34/35] s390: Implement the architecture-specific KMSAN functions

2024-06-13 Thread Ilya Leoshkevich
arch_kmsan_get_meta_or_null() finds the lowcore shadow by querying the prefix and calling kmsan_get_metadata() again. kmsan_virt_addr_valid() delegates to virt_addr_valid(). Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich ---

[PATCH v4 31/35] s390/traps: Unpoison the kernel_stack_overflow()'s pt_regs

2024-06-13 Thread Ilya Leoshkevich
This is normally done by the generic entry code, but the kernel_stack_overflow() flow bypasses it. Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich --- arch/s390/kernel/traps.c | 6 ++ 1 file changed, 6 insertions(+) diff --git

[PATCH v4 27/35] s390/ftrace: Unpoison ftrace_regs in kprobe_ftrace_handler()

2024-06-13 Thread Ilya Leoshkevich
s390 uses assembly code to initialize ftrace_regs and call kprobe_ftrace_handler(). Therefore, from the KMSAN's point of view, ftrace_regs is poisoned on kprobe_ftrace_handler() entry. This causes KMSAN warnings when running the ftrace testsuite. Fix by trusting the assembly code and always

[PATCH v6 1/2] mm/memblock: Add "reserve_mem" to reserved named memory at boot up

2024-06-13 Thread Steven Rostedt
From: "Steven Rostedt (Google)" In order to allow for requesting a memory region that can be used for things like pstore on multiple machines where the memory layout is not the same, add a new option to the kernel command line called "reserve_mem". The format is: reserve_mem=nn:align:name

[PATCH v6 2/2] pstore/ramoops: Add ramoops.mem_name= command line option

2024-06-13 Thread Steven Rostedt
From: "Steven Rostedt (Google)" Add a method to find a region specified by reserve_mem=nn:align:name for ramoops. Adding a kernel command line parameter: reserve_mem=12M:4096:oops ramoops.mem_name=oops Will use the size and location defined by the memmap parameter where it finds the memory

[PATCH v4 32/35] s390/uaccess: Add KMSAN support to put_user() and get_user()

2024-06-13 Thread Ilya Leoshkevich
put_user() uses inline assembly with precise constraints, so Clang is in principle capable of instrumenting it automatically. Unfortunately, one of the constraints contains a dereferenced user pointer, and Clang does not currently distinguish user and kernel pointers. Therefore KMSAN attempts to

[PATCH v4 30/35] s390/string: Add KMSAN support

2024-06-13 Thread Ilya Leoshkevich
Add KMSAN support for the s390 implementations of the string functions. Do this similar to how it's already done for KASAN, except that the optimized memset{16,32,64}() functions need to be disabled: it's important for KMSAN to know that they initialized something. The way boot code is built with

[PATCH v4 09/35] kmsan: Expose kmsan_get_metadata()

2024-06-13 Thread Ilya Leoshkevich
Each s390 CPU has lowcore pages associated with it. Each CPU sees its own lowcore at virtual address 0 through a hardware mechanism called prefixing. Additionally, all lowcores are mapped to non-0 virtual addresses stored in the lowcore_ptr[] array. When lowcore is accessed through virtual

[PATCH v4 28/35] s390/irqflags: Do not instrument arch_local_irq_*() with KMSAN

2024-06-13 Thread Ilya Leoshkevich
Lockdep generates the following false positives with KMSAN on s390x: [6.063666] DEBUG_LOCKS_WARN_ON(lockdep_hardirqs_enabled()) [ ...] [6.577050] Call Trace: [6.619637] [<0690d2de>] check_flags+0x1fe/0x210 [6.665411] ([<0690d2da>] check_flags+0x1fa/0x210)

[PATCH v4 25/35] s390/cpumf: Unpoison STCCTM output buffer

2024-06-13 Thread Ilya Leoshkevich
stcctm() uses the "Q" constraint for dest, therefore KMSAN does not understand that it fills multiple doublewords pointed to by dest, not just one. This results in false positives. Unpoison the whole dest manually with kmsan_unpoison_memory(). Reported-by: Alexander Gordeev Reviewed-by:

[PATCH v4 33/35] s390/unwind: Disable KMSAN checks

2024-06-13 Thread Ilya Leoshkevich
The unwind code can read uninitialized frames. Furthermore, even in the good case, KMSAN does not emit shadow for backchains. Therefore disable it for the unwinding functions. Reviewed-by: Alexander Potapenko Acked-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich ---

[PATCH v4 11/35] kmsan: Allow disabling KMSAN checks for the current task

2024-06-13 Thread Ilya Leoshkevich
Like for KASAN, it's useful to temporarily disable KMSAN checks around, e.g., redzone accesses. Introduce kmsan_disable_current() and kmsan_enable_current(), which are similar to their KASAN counterparts. Make them reentrant in order to handle memory allocations in interrupt context. Repurpose

[PATCH v4 10/35] kmsan: Export panic_on_kmsan

2024-06-13 Thread Ilya Leoshkevich
When building the kmsan test as a module, modpost fails with the following error message: ERROR: modpost: "panic_on_kmsan" [mm/kmsan/kmsan_test.ko] undefined! Export panic_on_kmsan in order to improve the KMSAN usability for modules. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya

[PATCH v4 26/35] s390/diag: Unpoison diag224() output buffer

2024-06-13 Thread Ilya Leoshkevich
Diagnose 224 stores 4k bytes, which currently cannot be deduced from the inline assembly constraints. This leads to KMSAN false positives. Fix the constraints by using a 4k-sized struct instead of a raw pointer. While at it, prettify them too. Suggested-by: Heiko Carstens Signed-off-by: Ilya

[PATCH v4 20/35] s390/boot: Turn off KMSAN

2024-06-13 Thread Ilya Leoshkevich
All other sanitizers are disabled for boot as well. While at it, add a comment explaining why we need this. Reviewed-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- arch/s390/boot/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH v4 00/35] kmsan: Enable on s390

2024-06-13 Thread Ilya Leoshkevich
v3: https://lore.kernel.org/lkml/20231213233605.661251-1-...@linux.ibm.com/ v3 -> v4: Rebase. Elaborate why ftrace_ops_list_func() change is needed on x64_64 (Steven). Add a comment to the DFLTCC patch (Alexander P.). Simplify diag224(); Improve

[PATCH v4 13/35] kmsan: Use ALIGN_DOWN() in kmsan_get_metadata()

2024-06-13 Thread Ilya Leoshkevich
Improve the readability by replacing the custom aligning logic with ALIGN_DOWN(). Unlike other places where a similar sequence is used, there is no size parameter that needs to be adjusted, so the standard macro fits. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich ---

[PATCH v4 12/35] kmsan: Support SLAB_POISON

2024-06-13 Thread Ilya Leoshkevich
Avoid false KMSAN negatives with SLUB_DEBUG by allowing kmsan_slab_free() to poison the freed memory, and by preventing init_object() from unpoisoning new allocations by using __memset(). There are two alternatives to this approach. First, init_object() can be marked with __no_sanitize_memory.

[PATCH v4 14/35] kmsan: Do not round up pg_data_t size

2024-06-13 Thread Ilya Leoshkevich
x86's alloc_node_data() rounds up node data size to PAGE_SIZE. It's not explained why it's needed, but it's most likely for performance reasons, since the padding bytes are not used anywhere. Some other architectures do it as well, e.g., mips rounds it up to the cache line size.

[PATCH v4 15/35] mm: slub: Let KMSAN access metadata

2024-06-13 Thread Ilya Leoshkevich
Building the kernel with CONFIG_SLUB_DEBUG and CONFIG_KMSAN causes KMSAN to complain about touching redzones in kfree(). Fix by extending the existing KASAN-related metadata_access_enable() and metadata_access_disable() functions to KMSAN. Acked-by: Vlastimil Babka Signed-off-by: Ilya

[PATCH v4 07/35] kmsan: Remove a useless assignment from kmsan_vmap_pages_range_noflush()

2024-06-13 Thread Ilya Leoshkevich
The value assigned to prot is immediately overwritten on the next line with PAGE_KERNEL. The right hand side of the assignment has no side-effects. Fixes: b073d7f8aee4 ("mm: kmsan: maintain KMSAN metadata for page operations") Suggested-by: Alexander Gordeev Reviewed-by: Alexander Potapenko

[PATCH v4 03/35] kmsan: Disable KMSAN when DEFERRED_STRUCT_PAGE_INIT is enabled

2024-06-13 Thread Ilya Leoshkevich
KMSAN relies on memblock returning all available pages to it (see kmsan_memblock_free_pages()). It partitions these pages into 3 categories: pages available to the buddy allocator, shadow pages and origin pages. This partitioning is static. If new pages appear after kmsan_init_runtime(), it is

[PATCH v4 06/35] kmsan: Fix kmsan_copy_to_user() on arches with overlapping address spaces

2024-06-13 Thread Ilya Leoshkevich
Comparing pointers with TASK_SIZE does not make sense when kernel and userspace overlap. Assume that we are handling user memory access in this case. Reported-by: Alexander Gordeev Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich --- mm/kmsan/hooks.c | 3 ++- 1 file changed, 2

[PATCH v4 02/35] kmsan: Make the tests compatible with kmsan.panic=1

2024-06-13 Thread Ilya Leoshkevich
It's useful to have both tests and kmsan.panic=1 during development, but right now the warnings, that the tests cause, lead to kernel panics. Temporarily set kmsan.panic=0 for the duration of the KMSAN testing. Reviewed-by: Alexander Potapenko Signed-off-by: Ilya Leoshkevich ---

Re: [PATCH v2] net: missing check virtio

2024-06-13 Thread Jiri Pirko
Thu, Jun 13, 2024 at 11:54:48AM CEST, are...@swemel.ru wrote: >Two missing check in virtio_net_hdr_to_skb() allowed syzbot >to crash kernels again > >1. After the skb_segment function the buffer may become non-linear >(nr_frags != 0), but since the SKBTX_SHARED_FRAG flag is not set anywhere >the

Re: [PATCH v5 8/8] Docs/.../mm/damon: add more damos actions

2024-06-13 Thread SeongJae Park
Hi Honggyu, On Thu, 13 Jun 2024 22:20:55 +0900 Honggyu Kim wrote: > This patch adds damon description for "migrate_hot" and "migrate_cold" > actions for both usage and design documents as long as a new > "target_nid" knob to set the migration target node. > > Signed-off-by: Honggyu Kim > ---

Re: [PATCH 1/2] vdpa: support set mac address from vdpa tool

2024-06-13 Thread Jiri Pirko
Thu, Jun 13, 2024 at 09:50:54AM CEST, m...@redhat.com wrote: >On Thu, Jun 13, 2024 at 09:21:07AM +0200, Jiri Pirko wrote: >> Thu, Jun 13, 2024 at 08:49:25AM CEST, m...@redhat.com wrote: >> >On Wed, Jun 12, 2024 at 09:22:32AM +0200, Jiri Pirko wrote: >> >> Wed, Jun 12, 2024 at 09:15:44AM CEST,

Re: [PATCH] function_graph: Add READ_ONCE() when accessing fgraph_array[]

2024-06-13 Thread Google
On Thu, 13 Jun 2024 09:52:23 -0400 Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > In function_graph_enter() there's a loop that looks at fgraph_array[] > elements which are fgraph_ops. It first tests if it is a fgraph_stub op, > and if so skips it, as that's just there as a place

Re: [PATCH 1/1] s390/virtio_ccw: fix config change notifications

2024-06-13 Thread Eric Farman
On Tue, 2024-06-11 at 23:47 +0200, Halil Pasic wrote: > Commit e3e9bda38e6d ("s390/virtio_ccw: use DMA handle from DMA API") > broke configuration change notifications for virtio-ccw by putting > the > DMA address of *indicatorp directly into ccw->cda disregarding the > fact > that if

Re: [PATCH v5 7/8] Docs/admin-guide/mm/damon/usage: add missing actions

2024-06-13 Thread SeongJae Park
Hi Honggyu, On Thu, 13 Jun 2024 22:20:54 +0900 Honggyu Kim wrote: > "lru_prio" and "lru_deprio" are missing in the damos action list so they > have to be added properly at damon usage document. > > Signed-off-by: Honggyu Kim > --- > Documentation/admin-guide/mm/damon/usage.rst | 4 +++- > 1

Re: [PATCH 0/8] DAMON based tiered memory management for CXL memory

2024-06-13 Thread SeongJae Park
On Thu, 13 Jun 2024 22:27:26 +0900 Honggyu Kim wrote: > On Thu, 13 Jun 2024 22:17:31 +0900 Honggyu Kim wrote: > > There was an RFC IDEA "DAMOS-based Tiered-Memory Management" previously > > posted at [1]. > > > > It says there is no implementation of the demote/promote DAMOS action > > are

[PATCH] function_graph: Add READ_ONCE() when accessing fgraph_array[]

2024-06-13 Thread Steven Rostedt
From: "Steven Rostedt (Google)" In function_graph_enter() there's a loop that looks at fgraph_array[] elements which are fgraph_ops. It first tests if it is a fgraph_stub op, and if so skips it, as that's just there as a place holder. Then it checks the fgraph_ops filters to see if the ops wants

[PATCH 6/6] ftrace: Revert the FTRACE_MCOUNT_MAX_OFFSET workaround

2024-06-13 Thread Zheng Yejian
After patch titled "ftrace: Skip invalid __fentry__ in ftrace_process_locs()", __fentry__ locations in overridden weak function have been checked and skipped, then all records in ftrace_pages are valid, the FTRACE_MCOUNT_MAX_OFFSET workaround can be reverted, include: 1. commit b39181f7c690

[PATCH 3/6] module: kallsyms: Determine exact function size

2024-06-13 Thread Zheng Yejian
When a weak type function is overridden, its symbol will be removed from the symbol table, but its code will not been removed. It will cause find_kallsyms_symbol() to compute a larger function size than it actually is, just because symbol of its following weak function is removed. To fix this

Re: [PATCH v7 3/5] regulator: add regulators driver for Marvell 88PM886 PMIC

2024-06-13 Thread Lee Jones
On Fri, 31 May 2024, Karel Balej wrote: > Support the LDO and buck regulators of the Marvell 88PM886 PMIC. > > Signed-off-by: Karel Balej > --- > > Notes: > v7: > - Address Mark's feedback: > - Drop get_current_limit op, max_uA values and thus unneeded struct >

Re: [PATCH 0/8] DAMON based tiered memory management for CXL memory

2024-06-13 Thread Honggyu Kim
On Thu, 13 Jun 2024 22:17:31 +0900 Honggyu Kim wrote: > There was an RFC IDEA "DAMOS-based Tiered-Memory Management" previously > posted at [1]. > > It says there is no implementation of the demote/promote DAMOS action > are made. This patch series is about its implementation for physical >

[PATCH 5/6] ftrace: Fix possible out-of-bound issue in ftrace_process_locs()

2024-06-13 Thread Zheng Yejian
In ftrace_process_locs(), a series pages are prepared and linked in start_pg, then fentry records are skipped or added, then unused pages are freed. However, assume that all records are skipped, currently the start_pg will still be in list of ftrace_pages_start but without any record. Then in

[PATCH 1/6] kallsyms: Optimize multiple times of realloc() to one time of malloc()

2024-06-13 Thread Zheng Yejian
Array 'table' is used to store pointers of symbols that read from in.map file, and its size depends on the number of symbols. Currently 'table' is expanded by calling realloc() every 1 symbols read. However, there generally are around 10+ symbols, which means that the expansion is

[PATCH 0/6] kallsyms: Emit symbol for holes in text and fix weak function issue

2024-06-13 Thread Zheng Yejian
ftrace_location() was changed to not only return the __fentry__ location when called for the __fentry__ location, but also when called for the sym+0 location after commit aebfd12521d9 ("x86/ibt,ftrace: Search for __fentry__ location"). That is, if sym+0 location is not __fentry__,

[PATCH 4/6] ftrace: Skip invalid __fentry__ in ftrace_process_locs()

2024-06-13 Thread Zheng Yejian
ftrace_location() was changed to not only return the __fentry__ location when called for the __fentry__ location, but also when called for the sym+0 location after commit aebfd12521d9 ("x86/ibt,ftrace: Search for __fentry__ location"). That is, if sym+0 location is not __fentry__,

[PATCH 2/6] kallsyms: Emit symbol at the holes in the text

2024-06-13 Thread Zheng Yejian
When a weak type function is overridden, its symbol will be removed from the symbol table, but its code will not be removed. Besides, due to lacking of size for kallsyms, kernel compute function size by substracting its symbol address from its next symbol address (see

[PATCH v5 5/8] mm/damon/paddr: introduce DAMOS_MIGRATE_COLD action for demotion

2024-06-13 Thread Honggyu Kim
This patch introduces DAMOS_MIGRATE_COLD action, which is similar to DAMOS_PAGEOUT, but migrate folios to the given 'target_nid' in the sysfs instead of swapping them out. The 'target_nid' sysfs knob informs the migration target node ID. Here is one of the example usage of this 'migrate_cold'

[PATCH v5 4/8] mm/migrate: add MR_DAMON to migrate_reason

2024-06-13 Thread Honggyu Kim
The current patch series introduces DAMON based migration across NUMA nodes so it'd be better to have a new migrate_reason in trace events. Signed-off-by: Honggyu Kim Reviewed-by: SeongJae Park Signed-off-by: SeongJae Park --- include/linux/migrate_mode.h | 1 +

Re: [PATCH 2/8] tracing: do not trace kernel_text_address()

2024-06-13 Thread Steven Rostedt
On Thu, 13 Jun 2024 15:11:07 +0800 Andy Chiu wrote: > kernel_text_address() and __kernel_text_address() are called in > arch_stack_walk() of riscv. This results in excess amount of un-related > traces when the kernel is compiled with CONFIG_TRACE_IRQFLAGS. The > situation worsens when

[PATCH v5 6/8] mm/damon/paddr: introduce DAMOS_MIGRATE_HOT action for promotion

2024-06-13 Thread Honggyu Kim
From: Hyeongtak Ji This patch introduces DAMOS_MIGRATE_HOT action, which is similar to DAMOS_MIGRATE_COLD, but proritizes hot pages. It migrates pages inside the given region to the 'target_nid' NUMA node in the sysfs. Here is one of the example usage of this 'migrate_hot' action. $ cd

[PATCH v5 7/8] Docs/admin-guide/mm/damon/usage: add missing actions

2024-06-13 Thread Honggyu Kim
"lru_prio" and "lru_deprio" are missing in the damos action list so they have to be added properly at damon usage document. Signed-off-by: Honggyu Kim --- Documentation/admin-guide/mm/damon/usage.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git

[PATCH v5 0/8] DAMON based tiered memory management for CXL memory

2024-06-13 Thread Honggyu Kim
There was an RFC IDEA "DAMOS-based Tiered-Memory Management" previously posted at [1]. It says there is no implementation of the demote/promote DAMOS action are made. This patch series is about its implementation for physical address space so that this scheme can be applied in system wide level.

[PATCH v5 3/8] mm/damon/sysfs-schemes: add target_nid on sysfs-schemes

2024-06-13 Thread Honggyu Kim
From: Hyeongtak Ji This patch adds target_nid under /sys/kernel/mm/damon/admin/kdamonds//contexts//schemes// The 'target_nid' can be used as the destination node for DAMOS actions such as DAMOS_MIGRATE_{HOT,COLD} in the follow up patches. Signed-off-by: Hyeongtak Ji Signed-off-by: Honggyu

  1   2   >