* [linux-next:master 2674/3921] mm/vmalloc.c:1079:3-9: preceding lock on line 1075 (fwd)
@ 2024-04-04 20:19 Julia Lawall
2024-04-04 20:41 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2024-04-04 20:19 UTC (permalink / raw)
To: Uladzislau Rezki (Sony), Andrew Morton, Linux Memory Management List
Cc: oe-kbuild-all
Please check whether an unlock is needed before the return on line 1079.
julia
---------- Forwarded message ----------
Date: Fri, 5 Apr 2024 04:15:36 +0800
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: [linux-next:master 2674/3921] mm/vmalloc.c:1079:3-9: preceding lock on
line 1075
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Linux Memory Management List <linux-mm@kvack.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 2b3d5988ae2cb5cd945ddbc653f0a71706231fdd
commit: 936eedaeacdee6663fa552fc650df4cd4d75d3e4 [2674/3921] mm: vmalloc: fix lockdep warning
:::::: branch date: 17 hours ago
:::::: commit date: 3 days ago
config: x86_64-randconfig-104-20240405 (https://download.01.org/0day-ci/archive/20240405/202404050445.yVFqmYIK-lkp@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
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>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202404050445.yVFqmYIK-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> mm/vmalloc.c:1079:3-9: preceding lock on line 1075
vim +1079 mm/vmalloc.c
f181234a5a21fd Chen Wandun 2021-09-02 1038
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1039) /*
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1040) * Returns a node where a first VA, that satisfies addr < va_end, resides.
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1041) * If success, a node is locked. A user is responsible to unlock it when a
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1042) * VA is no longer needed to be accessed.
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1043) *
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1044) * Returns NULL if nothing found.
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1045) */
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1046) static struct vmap_node *
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1047) find_vmap_area_exceed_addr_lock(unsigned long addr, struct vmap_area **va)
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1048) {
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1049) unsigned long va_start_lowest;
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1050) struct vmap_node *vn;
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1051) int i;
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1052)
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1053) repeat:
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1054) for (i = 0, va_start_lowest = 0; i < nr_vmap_nodes; i++) {
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1055) vn = &vmap_nodes[i];
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1056)
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1057) spin_lock(&vn->busy.lock);
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1058) *va = __find_vmap_area_exceed_addr(addr, &vn->busy.root);
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1059)
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1060) if (*va)
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1061) if (!va_start_lowest || (*va)->va_start < va_start_lowest)
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1062) va_start_lowest = (*va)->va_start;
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1063) spin_unlock(&vn->busy.lock);
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1064) }
53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1065)
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1066) /*
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1067) * Check if found VA exists, it might it is gone away.
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1068) * In this case we repeat the search because a VA has
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1069) * been removed concurrently thus we need to proceed
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1070) * with next one what is a rare case.
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1071) */
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1072) if (va_start_lowest) {
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1073) vn = addr_to_node(va_start_lowest);
db64fe02258f15 Nicholas Piggin 2008-10-18 1074
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 @1075) spin_lock(&vn->busy.lock);
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1076) *va = __find_vmap_area(va_start_lowest, &vn->busy.root);
4aff1dc4fb3a5a Andrey Konovalov 2022-03-24 1077
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1078) if (*va)
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 @1079) return vn;
db64fe02258f15 Nicholas Piggin 2008-10-18 1080
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1081) spin_unlock(&vn->busy.lock);
936eedaeacdee6 Uladzislau Rezki (Sony 2024-03-28 1082) goto repeat;
db64fe02258f15 Nicholas Piggin 2008-10-18 1083 }
db64fe02258f15 Nicholas Piggin 2008-10-18 1084
db64fe02258f15 Nicholas Piggin 2008-10-18 1085 return NULL;
db64fe02258f15 Nicholas Piggin 2008-10-18 1086 }
db64fe02258f15 Nicholas Piggin 2008-10-18 1087
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [linux-next:master 2674/3921] mm/vmalloc.c:1079:3-9: preceding lock on line 1075 (fwd)
2024-04-04 20:19 [linux-next:master 2674/3921] mm/vmalloc.c:1079:3-9: preceding lock on line 1075 (fwd) Julia Lawall
@ 2024-04-04 20:41 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2024-04-04 20:41 UTC (permalink / raw)
To: Julia Lawall
Cc: Uladzislau Rezki (Sony), Linux Memory Management List, oe-kbuild-all
On Thu, 4 Apr 2024 16:19:42 -0400 (EDT) Julia Lawall <julia.lawall@inria.fr> wrote:
> Please check whether an unlock is needed before the return on line 1079.
>
Thanks. The code looks OK. And documented!
> 53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1041) * If success, a node is locked. A user is responsible to unlock it when a
> 53becf32aec1c8 Uladzislau Rezki (Sony 2024-01-02 1042) * VA is no longer needed to be accessed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-04-04 20:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-04 20:19 [linux-next:master 2674/3921] mm/vmalloc.c:1079:3-9: preceding lock on line 1075 (fwd) Julia Lawall
2024-04-04 20:41 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox