@@ -147,6 +147,21 @@ impl<'tcx> AnalysisCtxt<'tcx> {
147147
148148 // FFI functions defined in C
149149
150+ // atomic.h
151+ f if f. starts_with ( "atomic" ) => NO_ASSUMPTION ,
152+
153+ // bitops.h
154+ "__clear_bit" | "__set_bit" | "_find_next_bit" | "_find_next_zero_bit"
155+ | "_find_last_bit" => NO_ASSUMPTION ,
156+
157+ // bitmap.h
158+ "bitmap_copy_and_extend" => NO_ASSUMPTION ,
159+ "bitmap_zalloc" => MIGHT_SLEEP ,
160+
161+ // blk-mq.h
162+ "blk_mq_rq_to_pdu" | "blk_mq_start_request" | "blk_mq_end_request" => NO_ASSUMPTION ,
163+ "blk_mq_alloc_tag_set" | "__blk_mq_alloc_disk" | "blk_mq_free_tag_set" => MIGHT_SLEEP ,
164+
150165 // bug.h
151166 "BUG" => NO_ASSUMPTION ,
152167 "rust_build_error" => NO_ASSUMPTION ,
@@ -159,7 +174,21 @@ impl<'tcx> AnalysisCtxt<'tcx> {
159174 | "clk_prepare_enable"
160175 | "clk_disable_unprepare"
161176 | "clk_get"
162- | "clk_put" => MIGHT_SLEEP ,
177+ | "clk_put"
178+ | "clk_set_rate" => MIGHT_SLEEP ,
179+
180+ // completion.h
181+ "init_completion" | "complete_all" => NO_ASSUMPTION ,
182+ "wait_for_completion" => MIGHT_SLEEP ,
183+
184+ // cpufreq.h
185+ "cpufreq_generic_frequency_table_verify" | "cpufreq_generic_get" => NO_ASSUMPTION ,
186+ "cpufreq_generic_suspend" | "cpufreq_register_driver"
187+ | "cpufreq_unregister_driver" => MIGHT_SLEEP ,
188+
189+ // cpumask.h
190+ "cpumask_empty" | "__cpumask_set_cpu" | "__cpumask_clear_cpu"
191+ | "cpumask_test_cpu" | "cpumask_weight" => NO_ASSUMPTION ,
163192
164193 // current.h
165194 "get_current" => NO_ASSUMPTION ,
@@ -168,10 +197,17 @@ impl<'tcx> AnalysisCtxt<'tcx> {
168197 "msleep" => MIGHT_SLEEP ,
169198
170199 // device.h
171- "dev_name" => NO_ASSUMPTION ,
200+ "dev_name" | "__dev_fwnode" => NO_ASSUMPTION ,
201+
202+ // devres.h
203+ "devm_add_action_or_reset" => MIGHT_SLEEP ,
204+
205+ // dma-mapping.h
206+ "dma_max_mapping_size" | "dma_unmap_sgtable" => NO_ASSUMPTION ,
207+ "dma_alloc_attrs" | "dma_free_attrs" => MIGHT_SLEEP ,
172208
173209 // err.h
174- "IS_ERR" | "PTR_ERR" | "errname" => NO_ASSUMPTION ,
210+ "IS_ERR" | "PTR_ERR" | "ERR_PTR" | " errname" => NO_ASSUMPTION ,
175211
176212 // fs.h
177213 "alloc_chrdev_region" | "unregister_chrdev_region" => MIGHT_SLEEP ,
@@ -180,16 +216,25 @@ impl<'tcx> AnalysisCtxt<'tcx> {
180216 "fs_param_is_bool" | "fs_param_is_enum" | "fs_param_is_s32" | "fs_param_is_string"
181217 | "fs_param_is_u32" | "fs_param_is_u64" => NO_ASSUMPTION ,
182218
219+ // genhd.h
220+ "set_capacity" => USE_SPINLOCK ,
221+ "device_add_disk" | "del_gendisk" | "put_disk" => MIGHT_SLEEP ,
222+
183223 // gfp.h
224+ "alloc_pages" => MIGHT_SLEEP ,
184225 "__free_pages" => USE_SPINLOCK ,
185226
227+ // hrtimer.h
228+ "hrtimer_setup" | "hrtimer_start_range_ns" => NO_ASSUMPTION ,
229+ "hrtimer_cancel" => MIGHT_SLEEP ,
230+
186231 // io.h
187232 // I/O functions do not sleep.
188233 "readb" | "readw" | "readl" | "readq" | "readb_relaxed" | "readw_relaxed"
189234 | "readl_relaxed" | "readq_relaxed" | "writeb" | "writew" | "writel" | "writeq"
190235 | "writeb_relaxed" | "writew_relaxed" | "writel_relaxed" | "writeq_relaxed"
191236 | "memcpy_fromio" => NO_ASSUMPTION ,
192- "ioremap" | "iounmap" => MIGHT_SLEEP ,
237+ "ioremap" | "ioremap_np" | " iounmap" => MIGHT_SLEEP ,
193238
194239 // irq.h
195240 "handle_level_irq" | "handle_edge_irq" | "handle_bad_irq" => NO_ASSUMPTION ,
@@ -201,6 +246,13 @@ impl<'tcx> AnalysisCtxt<'tcx> {
201246 "__cant_sleep" => ( 0 , ExpectationRange { lo : 1 , hi : None } ) ,
202247 "__might_sleep" => MIGHT_SLEEP ,
203248
249+ // kunit
250+ "kunit_get_current_test" | "kunit_unary_assert_format"
251+ | "__kunit_do_failed_assertion" | "__kunit_abort" => NO_ASSUMPTION ,
252+
253+ // list.h
254+ "INIT_LIST_HEAD" | "list_add_tail" => NO_ASSUMPTION ,
255+
204256 // list_lru.h
205257 "list_lru_add" | "list_lru_add_obj" | "list_lru_del_obj" | "list_lru_walk" => {
206258 USE_SPINLOCK
@@ -210,6 +262,15 @@ impl<'tcx> AnalysisCtxt<'tcx> {
210262 // lockdep.h
211263 "mutex_assert_is_held" => NO_ASSUMPTION ,
212264 "spin_assert_is_held" => NO_ASSUMPTION ,
265+ "lockdep_register_key" => NO_ASSUMPTION ,
266+
267+ // maple_tree.h
268+ "mas_find" | "mtree_load" | "mt_init_flags" => NO_ASSUMPTION ,
269+ "mtree_insert_range" | "mtree_erase" | "mtree_alloc_range"
270+ | "mtree_destroy" => MIGHT_SLEEP ,
271+
272+ // mm.h
273+ "is_vmalloc_addr" | "vmalloc_to_page" => NO_ASSUMPTION ,
213274
214275 // moduleparam.h
215276 "kernel_param_lock" => MIGHT_SLEEP ,
@@ -220,10 +281,16 @@ impl<'tcx> AnalysisCtxt<'tcx> {
220281 "mutex_lock" => MIGHT_SLEEP ,
221282 "mutex_unlock" => MIGHT_SLEEP ,
222283
284+ // pci.h
285+ "pci_iounmap" | "pci_release_region" => MIGHT_SLEEP ,
286+
223287 // printk.h
224288 // printk can be called from any context.
225289 "_printk" | "_dev_printk" | "rust_fmt_argument" => NO_ASSUMPTION ,
226290
291+ // processor.h
292+ "cpu_relax" => NO_ASSUMPTION ,
293+
227294 // property.h
228295 "fwnode_get_name" | "fwnode_count_parents" | "fwnode_get_name_prefix" => NO_ASSUMPTION ,
229296 "fwnode_handle_get" | "fwnode_get_nth_parent" => NO_ASSUMPTION ,
@@ -244,25 +311,36 @@ impl<'tcx> AnalysisCtxt<'tcx> {
244311 "synchronize_rcu" => MIGHT_SLEEP ,
245312
246313 // refcount.h
247- "REFCOUNT_INIT" | "refcount_inc" | "refcount_dec_and_test" => NO_ASSUMPTION ,
314+ "REFCOUNT_INIT" | "refcount_set" | "refcount_inc"
315+ | "refcount_dec_and_test" => NO_ASSUMPTION ,
316+
317+ // regulator.h
318+ "regulator_set_voltage" | "regulator_get_voltage" | "regulator_disable"
319+ | "regulator_put" => MIGHT_SLEEP ,
248320
249321 // rwsem.h
250322 "__init_rwsem" => NO_ASSUMPTION ,
251323 "down_read" | "down_write" => MIGHT_SLEEP ,
252324 "up_read" | "up_write" => MIGHT_SLEEP ,
253325
254326 // sched.h
255- "schedule" => MIGHT_SLEEP ,
327+ "schedule" | "schedule_timeout" | "might_resched" => MIGHT_SLEEP ,
256328
257329 // sched/signal.h
258330 "signal_pending" => NO_ASSUMPTION ,
259331
332+ // sched/task.h
333+ "get_task_struct" | "put_task_struct" => NO_ASSUMPTION ,
334+
335+ // scatterlist.h
336+ "sg_free_table" => USE_SPINLOCK ,
337+
260338 // seq_file.h
261339 "seq_printf" => NO_ASSUMPTION ,
262340
263341 // slab.h
264- // What krealloc does depend on flags. Assume it may sleep for conservative purpose.
265- "krealloc " => MIGHT_SLEEP ,
342+ " krealloc" | "krealloc_node_align" | "kvrealloc_node_align"
343+ | "vrealloc_node_align " => MIGHT_SLEEP ,
266344 "kfree" => USE_SPINLOCK ,
267345 "slab_is_available" => NO_ASSUMPTION ,
268346
@@ -279,21 +357,32 @@ impl<'tcx> AnalysisCtxt<'tcx> {
279357 // timekeeping.h
280358 "ktime_get" => NO_ASSUMPTION ,
281359
360+ // timer.h
361+ "timer_init_key" | "delayed_work_timer_fn" => NO_ASSUMPTION ,
362+
282363 // uaccess.h
283364 // Userspace memory access might fault, and thus sleep.
284365 "copy_from_user" | "copy_to_user" | "clear_user" | "copy_from_iter"
285366 | "copy_to_iter" | "iov_iter_zero" => MIGHT_SLEEP ,
286367
287368 // wait.h
288- "init_wait" => NO_ASSUMPTION ,
369+ "init_wait" | "__init_waitqueue_head" => NO_ASSUMPTION ,
289370 "prepare_to_wait_exclusive" | "finish_wait" => USE_SPINLOCK ,
290371 "init_waitqueue_func_entry" => NO_ASSUMPTION ,
291372 "add_wait_queue" | "remove_wait_queue" => USE_SPINLOCK ,
292373
293374 // workqueue.h
294- "__INIT_WORK_WITH_KEY" | "queue_work_on" => NO_ASSUMPTION ,
375+ "__INIT_WORK_WITH_KEY" | "init_work_with_key" | "queue_work_on"
376+ | "queue_delayed_work_on" => NO_ASSUMPTION ,
295377 "destroy_workqueue" => MIGHT_SLEEP ,
296378
379+ // xarray.h
380+ "xa_init_flags" | "xa_load" | "xa_err" | "xa_find"
381+ | "xa_find_after" => NO_ASSUMPTION ,
382+ "__xa_store" | "__xa_erase" | "xa_destroy" => USE_SPINLOCK ,
383+ "xa_lock" => SPIN_LOCK ,
384+ "xa_unlock" => SPIN_UNLOCK ,
385+
297386 f if f. starts_with ( "rust_do_trace" ) => NO_ASSUMPTION ,
298387
299388 _ => {
0 commit comments