The quilt patch titled Subject: err.h: add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions has been removed from the -mm tree. Its filename was errh-add-err_ptr_pcpu-ptr_err_pcpu-and-is_err_pcpu-functions.patch This patch was dropped because an updated version will be issued ------------------------------------------------------ From: Uros Bizjak <ubizjak@xxxxxxxxx> Subject: err.h: add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions Date: Tue, 13 Aug 2024 19:25:10 +0200 Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions that operate on pointers in the percpu address space. These functions remove the need for (__force void *) function argument casts (to avoid sparse -Wcast-from-as warnings). The patch will also avoid future build errors due to pointer address space mismatch with enabled strict percpu address space checks. Link: https://lkml.kernel.org/r/20240813172543.38411-1-ubizjak@xxxxxxxxx Signed-off-by: Uros Bizjak <ubizjak@xxxxxxxxx> Acked-by: Catalin Marinas <catalin.marinas@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/err.h | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) --- a/include/linux/err.h~errh-add-err_ptr_pcpu-ptr_err_pcpu-and-is_err_pcpu-functions +++ a/include/linux/err.h @@ -6,6 +6,7 @@ #include <linux/types.h> #include <asm/errno.h> +#include <asm/percpu.h> /* * Kernel pointers have redundant information, so we can use a @@ -42,6 +43,22 @@ static inline void * __must_check ERR_PT } /** + * ERR_PTR_PCPU - Create an error pointer in the percpu address space. + * @error: A negative error code. + * + * Encodes @error into a pointer value in the percpu address space. + * Users should consider the result opaque and not assume anything + * about how the error is encoded. + * + * Return: A pointer in the percpu address space with @error encoded + * within its value. + */ +static inline void __percpu * __must_check ERR_PTR_PCPU(long error) +{ + return (void __percpu *) error; +} + +/** * PTR_ERR - Extract the error code from an error pointer. * @ptr: An error pointer. * Return: The error code within @ptr. @@ -52,6 +69,17 @@ static inline long __must_check PTR_ERR( } /** + * PTR_ERR_PCPU - Extract the error code from an error pointer in the + * percpu address space. + * @ptr: An error pointer in the percpu address space. + * Return: The error code within @ptr. + */ +static inline long __must_check PTR_ERR_PCPU(const void __percpu *ptr) +{ + return (__force long) ptr; +} + +/** * IS_ERR - Detect an error pointer. * @ptr: The pointer to check. * Return: true if @ptr is an error pointer, false otherwise. @@ -62,6 +90,16 @@ static inline bool __must_check IS_ERR(_ } /** + * IS_ERR_PCPU - Detect an error pointer in the percpu address space. + * @ptr: The pointer in the percpu address space to check. + * Return: true if @ptr is an error pointer, false otherwise. + */ +static inline bool __must_check IS_ERR_PCPU(const void __percpu *ptr) +{ + return IS_ERR_VALUE((__force unsigned long)ptr); +} + +/** * IS_ERR_OR_NULL - Detect an error pointer or a null pointer. * @ptr: The pointer to check. * _ Patches currently in -mm which might be from ubizjak@xxxxxxxxx are mm-z3fold-add-__percpu-annotation-to-unbuddied-pointer-in-struct-z3fold_pool.patch mm-kmemleak-use-is_err_pcpu-for-pointer-in-the-percpu-address-space.patch kexec-use-atomic_try_cmpxchg_acquire-in-kexec_trylock.patch lib-percpu_counter-add-missing-__percpu-qualifier-to-a-cast.patch