* [PATCH 2/2] mm/kmemleak: Use IS_ERR_PCPU() for pointer in the percpu address space
2024-08-13 17:25 [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions Uros Bizjak
@ 2024-08-13 17:25 ` Uros Bizjak
2024-08-14 12:15 ` Catalin Marinas
2024-08-14 12:15 ` [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions Catalin Marinas
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Uros Bizjak @ 2024-08-13 17:25 UTC (permalink / raw)
To: linux-mm, linux-kernel; +Cc: Uros Bizjak, Catalin Marinas, Andrew Morton
Use IS_ERR_PCPU() instead of IS_ERR() for pointers in the percpu address
space. The patch also fixes following sparse warnings:
kmemleak.c:1063:39: warning: cast removes address space '__percpu' of expression
kmemleak.c:1138:37: warning: cast removes address space '__percpu' of expression
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
mm/kmemleak.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 764b08100570..fa468809d043 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1059,8 +1059,8 @@ void __ref kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,
* Percpu allocations are only scanned and not reported as leaks
* (min_count is set to 0).
*/
- if (kmemleak_enabled && ptr && !IS_ERR(ptr))
- create_object_percpu((unsigned long)ptr, size, 0, gfp);
+ if (kmemleak_enabled && ptr && !IS_ERR_PCPU(ptr))
+ create_object_percpu((__force unsigned long)ptr, size, 0, gfp);
}
EXPORT_SYMBOL_GPL(kmemleak_alloc_percpu);
@@ -1134,8 +1134,8 @@ void __ref kmemleak_free_percpu(const void __percpu *ptr)
{
pr_debug("%s(0x%px)\n", __func__, ptr);
- if (kmemleak_free_enabled && ptr && !IS_ERR(ptr))
- delete_object_full((unsigned long)ptr, OBJECT_PERCPU);
+ if (kmemleak_free_enabled && ptr && !IS_ERR_PCPU(ptr))
+ delete_object_full((__force unsigned long)ptr, OBJECT_PERCPU);
}
EXPORT_SYMBOL_GPL(kmemleak_free_percpu);
--
2.42.0
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] mm/kmemleak: Use IS_ERR_PCPU() for pointer in the percpu address space
2024-08-13 17:25 ` [PATCH 2/2] mm/kmemleak: Use IS_ERR_PCPU() for pointer in the percpu address space Uros Bizjak
@ 2024-08-14 12:15 ` Catalin Marinas
0 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2024-08-14 12:15 UTC (permalink / raw)
To: Uros Bizjak; +Cc: linux-mm, linux-kernel, Andrew Morton
On Tue, Aug 13, 2024 at 07:25:11PM +0200, Uros Bizjak wrote:
> Use IS_ERR_PCPU() instead of IS_ERR() for pointers in the percpu address
> space. The patch also fixes following sparse warnings:
>
> kmemleak.c:1063:39: warning: cast removes address space '__percpu' of expression
> kmemleak.c:1138:37: warning: cast removes address space '__percpu' of expression
>
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions
2024-08-13 17:25 [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions Uros Bizjak
2024-08-13 17:25 ` [PATCH 2/2] mm/kmemleak: Use IS_ERR_PCPU() for pointer in the percpu address space Uros Bizjak
@ 2024-08-14 12:15 ` Catalin Marinas
2024-08-15 1:52 ` kernel test robot
2024-08-15 4:29 ` kernel test robot
3 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2024-08-14 12:15 UTC (permalink / raw)
To: Uros Bizjak; +Cc: linux-mm, linux-kernel, Andrew Morton
On Tue, Aug 13, 2024 at 07:25:10PM +0200, Uros Bizjak wrote:
> 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.
>
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions
2024-08-13 17:25 [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions Uros Bizjak
2024-08-13 17:25 ` [PATCH 2/2] mm/kmemleak: Use IS_ERR_PCPU() for pointer in the percpu address space Uros Bizjak
2024-08-14 12:15 ` [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions Catalin Marinas
@ 2024-08-15 1:52 ` kernel test robot
2024-08-15 4:29 ` kernel test robot
3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2024-08-15 1:52 UTC (permalink / raw)
To: Uros Bizjak, linux-mm, linux-kernel
Cc: oe-kbuild-all, Uros Bizjak, Catalin Marinas, Andrew Morton,
Linux Memory Management List
Hi Uros,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.11-rc3 next-20240814]
[cannot apply to akpm-mm/mm-everything]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Uros-Bizjak/mm-kmemleak-Use-IS_ERR_PCPU-for-pointer-in-the-percpu-address-space/20240814-223016
base: linus/master
patch link: https://lore.kernel.org/r/20240813172543.38411-1-ubizjak%40gmail.com
patch subject: [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20240815/202408150948.jjcISdEv-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240815/202408150948.jjcISdEv-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408150948.jjcISdEv-lkp@intel.com/
All errors (new ones prefixed by >>):
arch/powerpc/include/asm/paca.h: Assembler messages:
>> arch/powerpc/include/asm/paca.h:293: Error: unrecognized opcode: `static'
arch/powerpc/include/asm/paca.h:294: Error: unrecognized opcode: `static'
vim +293 arch/powerpc/include/asm/paca.h
1426d5a3bd0758 Michael Ellerman 2010-01-28 292
6c6fdbb2b7002a Chengyang Fan 2021-01-25 @293 static inline void allocate_paca(int cpu) { }
6c6fdbb2b7002a Chengyang Fan 2021-01-25 294 static inline void free_unused_pacas(void) { }
1426d5a3bd0758 Michael Ellerman 2010-01-28 295
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions
2024-08-13 17:25 [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions Uros Bizjak
` (2 preceding siblings ...)
2024-08-15 1:52 ` kernel test robot
@ 2024-08-15 4:29 ` kernel test robot
3 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2024-08-15 4:29 UTC (permalink / raw)
To: Uros Bizjak, linux-mm, linux-kernel
Cc: llvm, oe-kbuild-all, Uros Bizjak, Catalin Marinas, Andrew Morton,
Linux Memory Management List
Hi Uros,
kernel test robot noticed the following build errors:
[auto build test ERROR on linus/master]
[also build test ERROR on v6.11-rc3 next-20240814]
[cannot apply to akpm-mm/mm-everything]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Uros-Bizjak/mm-kmemleak-Use-IS_ERR_PCPU-for-pointer-in-the-percpu-address-space/20240814-223016
base: linus/master
patch link: https://lore.kernel.org/r/20240813172543.38411-1-ubizjak%40gmail.com
patch subject: [PATCH 1/2] err.h: Add ERR_PTR_PCPU(), PTR_ERR_PCPU() and IS_ERR_PCPU() functions
config: powerpc-sequoia_defconfig (https://download.01.org/0day-ci/archive/20240815/202408151256.8zNulgGN-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project f86594788ce93b696675c94f54016d27a6c21d18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240815/202408151256.8zNulgGN-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408151256.8zNulgGN-lkp@intel.com/
All errors (new ones prefixed by >>):
>> arch/powerpc/include/asm/paca.h:293:15: error: unexpected token
static inline void allocate_paca(int cpu) { }
^
arch/powerpc/include/asm/paca.h:294:15: error: unexpected token
static inline void free_unused_pacas(void) { }
^
vim +293 arch/powerpc/include/asm/paca.h
1426d5a3bd0758 Michael Ellerman 2010-01-28 292
6c6fdbb2b7002a Chengyang Fan 2021-01-25 @293 static inline void allocate_paca(int cpu) { }
6c6fdbb2b7002a Chengyang Fan 2021-01-25 294 static inline void free_unused_pacas(void) { }
1426d5a3bd0758 Michael Ellerman 2010-01-28 295
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread