CC: [email protected] TO: Nicolas Pitre <[email protected]> CC: 0day robot <[email protected]>
tree: https://github.com/0day-ci/linux/commits/UPDATE-20210126-181502/Nicolas-Pitre/PM-clk-make-PM-clock-layer-compatible-with-clocks-that-must-sleep/20210105-112132 head: 0cb78b56c569d32e0b7b5bc0115d958e71481291 commit: 0cb78b56c569d32e0b7b5bc0115d958e71481291 PM / clk: make PM clock layer compatible with clocks that must sleep date: 5 hours ago :::::: branch date: 5 hours ago :::::: commit date: 5 hours ago config: i386-randconfig-c003-20210126 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> Reported-by: Julia Lawall <[email protected]> "coccinelle warnings: (new ones prefixed by >>)" >> drivers/base/power/clock_ops.c:118:2-8: preceding lock on line 111 vim +118 drivers/base/power/clock_ops.c 0cb78b56c569d3 Nicolas Pitre 2021-01-25 70 0cb78b56c569d3 Nicolas Pitre 2021-01-25 71 /** 0cb78b56c569d3 Nicolas Pitre 2021-01-25 72 * pm_clk_op_lock - ensure exclusive access for performing clock operations. 0cb78b56c569d3 Nicolas Pitre 2021-01-25 73 * @psd: pm_subsys_data instance corresponding to the PM clock entry list 0cb78b56c569d3 Nicolas Pitre 2021-01-25 74 * and clk_op_might_sleep count being used. 0cb78b56c569d3 Nicolas Pitre 2021-01-25 75 * @flags: stored irq flags. 0cb78b56c569d3 Nicolas Pitre 2021-01-25 76 * @fn: string for the caller function's name. 0cb78b56c569d3 Nicolas Pitre 2021-01-25 77 * 0cb78b56c569d3 Nicolas Pitre 2021-01-25 78 * This is used by pm_clk_suspend() and pm_clk_resume() to guard 0cb78b56c569d3 Nicolas Pitre 2021-01-25 79 * against concurrent modifications to the clock entry list and the 0cb78b56c569d3 Nicolas Pitre 2021-01-25 80 * clock_op_might_sleep count. If clock_op_might_sleep is != 0 then 0cb78b56c569d3 Nicolas Pitre 2021-01-25 81 * only the mutex can be locked and those functions can only be used in 0cb78b56c569d3 Nicolas Pitre 2021-01-25 82 * non atomic context. If clock_op_might_sleep == 0 then these functions 0cb78b56c569d3 Nicolas Pitre 2021-01-25 83 * may be used in any context and only the spinlock can be locked. 0cb78b56c569d3 Nicolas Pitre 2021-01-25 84 * Returns -EINVAL if called in atomic context when clock ops might sleep. 0cb78b56c569d3 Nicolas Pitre 2021-01-25 85 */ 0cb78b56c569d3 Nicolas Pitre 2021-01-25 86 static int pm_clk_op_lock(struct pm_subsys_data *psd, unsigned long *flags, 0cb78b56c569d3 Nicolas Pitre 2021-01-25 87 const char *fn) 0cb78b56c569d3 Nicolas Pitre 2021-01-25 88 /* sparse annotations don't work here as exit state isn't static */ 0cb78b56c569d3 Nicolas Pitre 2021-01-25 89 { 0cb78b56c569d3 Nicolas Pitre 2021-01-25 90 bool atomic_context = in_atomic() || irqs_disabled(); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 91 0cb78b56c569d3 Nicolas Pitre 2021-01-25 92 try_again: 0cb78b56c569d3 Nicolas Pitre 2021-01-25 93 spin_lock_irqsave(&psd->lock, *flags); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 94 if (!psd->clock_op_might_sleep) { 0cb78b56c569d3 Nicolas Pitre 2021-01-25 95 /* the __release is there to work around sparse limitations */ 0cb78b56c569d3 Nicolas Pitre 2021-01-25 96 __release(&psd->lock); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 97 return 0; 0cb78b56c569d3 Nicolas Pitre 2021-01-25 98 } 0cb78b56c569d3 Nicolas Pitre 2021-01-25 99 0cb78b56c569d3 Nicolas Pitre 2021-01-25 100 /* bail out if in atomic context */ 0cb78b56c569d3 Nicolas Pitre 2021-01-25 101 if (atomic_context) { 0cb78b56c569d3 Nicolas Pitre 2021-01-25 102 pr_err("%s: atomic context with clock_ops_might_sleep = %d", 0cb78b56c569d3 Nicolas Pitre 2021-01-25 103 fn, psd->clock_op_might_sleep); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 104 spin_unlock_irqrestore(&psd->lock, *flags); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 105 might_sleep(); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 106 return -EPERM; 0cb78b56c569d3 Nicolas Pitre 2021-01-25 107 } 0cb78b56c569d3 Nicolas Pitre 2021-01-25 108 0cb78b56c569d3 Nicolas Pitre 2021-01-25 109 /* we must switch to the mutex */ 0cb78b56c569d3 Nicolas Pitre 2021-01-25 110 spin_unlock_irqrestore(&psd->lock, *flags); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 @111 mutex_lock(&psd->clock_mutex); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 112 0cb78b56c569d3 Nicolas Pitre 2021-01-25 113 /* 0cb78b56c569d3 Nicolas Pitre 2021-01-25 114 * There was a possibility for psd->clock_op_might_sleep 0cb78b56c569d3 Nicolas Pitre 2021-01-25 115 * to become 0 above. Keep the mutex only if not the case. 0cb78b56c569d3 Nicolas Pitre 2021-01-25 116 */ 0cb78b56c569d3 Nicolas Pitre 2021-01-25 117 if (likely(psd->clock_op_might_sleep)) 0cb78b56c569d3 Nicolas Pitre 2021-01-25 @118 return 0; 0cb78b56c569d3 Nicolas Pitre 2021-01-25 119 0cb78b56c569d3 Nicolas Pitre 2021-01-25 120 mutex_unlock(&psd->clock_mutex); 0cb78b56c569d3 Nicolas Pitre 2021-01-25 121 goto try_again; 0cb78b56c569d3 Nicolas Pitre 2021-01-25 122 } 0cb78b56c569d3 Nicolas Pitre 2021-01-25 123 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
