All of lore.kernel.org
 help / color / mirror / Atom feed
* [opencloudos:next 12024/13046] block/blk-wbt.c:1016:70: sparse: sparse: incorrect type in argument 2 (different base types)
@ 2024-10-31 23:53 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-10-31 23:53 UTC (permalink / raw)
  To: kaixuxia, frankjpliu, kasong, sagazchen, kernelxing, aurelianliu,
	deshengwu, flyingpeng, jingqunli, jason.zeng, wu.zheng,
	yingbao.jia, pei.p.jia
  Cc: oe-kbuild-all

tree:   https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel.git next
head:   ce9f9d823a41831d622fa11e29c3d620c044f51b
commit: 3796036b9f46addfd1485d7ebecff5da4fc9cb27 [12024/13046] rue/io: introduce wbt class for cgroup priority
config: x86_64-randconfig-122-20241029 (https://download.01.org/0day-ci/archive/20241101/202411010756.CWiLppSb-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241101/202411010756.CWiLppSb-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/202411010756.CWiLppSb-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> block/blk-wbt.c:1016:70: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long rw @@     got restricted blk_opf_t [usertype] opf @@
   block/blk-wbt.c:1016:70: sparse:     expected unsigned long rw
   block/blk-wbt.c:1016:70: sparse:     got restricted blk_opf_t [usertype] opf
>> block/blk-wbt.c:870:19: sparse: sparse: restricted blk_opf_t degrades to integer
   block/blk-wbt.c:870:35: sparse: sparse: restricted blk_opf_t degrades to integer
   block/blk-wbt.c:872:18: sparse: sparse: restricted blk_opf_t degrades to integer
   block/blk-wbt.c:874:23: sparse: sparse: restricted blk_opf_t degrades to integer

vim +1016 block/blk-wbt.c

   862	
   863	static inline unsigned int throtl_info_get_limit(struct wbt_throtl_info *ti,
   864							 unsigned long rw)
   865	{
   866		unsigned int limit;
   867	
   868		if (!throtl_info_enabled(ti))
   869			return UINT_MAX;
 > 870		if ((rw & REQ_OP_MASK) == REQ_OP_DISCARD)
   871			return ti->wb_background;
   872		if (rw & REQ_HIPRIO || current_is_kswapd())
   873			limit = ti->max_depth;
   874		else if (rw & REQ_BACKGROUND)
   875			limit = ti->wb_background;
   876		else
   877			limit = ti->wb_normal;
   878	
   879		return limit;
   880	}
   881	
   882	static void throtl_info_rqw_done(struct rq_wb *rwb, struct wbt_throtl_info *ti,
   883					 struct rq_wait *rqw, enum wbt_flags wbt_acct)
   884	{
   885		int inflight, limit;
   886	
   887		if (!(wbt_acct & WBT_CLASS_TRACKED))
   888			return;
   889	
   890		inflight = atomic_dec_return(&rqw->inflight);
   891	
   892		if (!throtl_info_enabled(ti)) {
   893			throtl_info_wake_all(ti);
   894			return;
   895		}
   896	
   897		if (wbt_acct & WBT_DISCARD)
   898			limit = ti->wb_background;
   899		else
   900			limit = ti->wb_normal;
   901	
   902		/*
   903		 * Don't wake anyone up if we are above the normal limit.
   904		 */
   905		if (inflight && inflight >= limit)
   906			return;
   907	
   908		if (wq_has_sleeper(&rqw->wait)) {
   909			int diff = limit - inflight;
   910	
   911			if (!inflight || diff >= ti->wb_background / 2)
   912				wake_up_nr(&rqw->wait, diff);
   913		}
   914	}
   915	
   916	static void wbt_class_timer_fn(struct timer_list *t)
   917	{
   918		struct rq_wb *rwb = from_timer(rwb, t, wbt_class_timer);
   919		struct wbt_throtl_info *ti;
   920		u64 rd_expired_cnt;
   921		int highest_class = WBT_CLASS_NR;
   922		int i;
   923	
   924		for (i = 0; i < WBT_CLASS_NR; i++) {
   925			ti = rwb_to_wbt_class_info(rwb, i);
   926			rd_expired_cnt = atomic64_read(&ti->read_expired_cnt);
   927			atomic64_set(&ti->read_expired_cnt, 0);
   928	
   929			if (rd_expired_cnt && highest_class == WBT_CLASS_NR)
   930				highest_class = i;
   931		}
   932	
   933		if (highest_class == WBT_CLASS_NR)
   934			goto depth_scale_up;
   935	
   936		/*expired read did happen!!! throttle from the lowest class*/
   937		for (i = WBT_CLASS_NR - 1; i >= highest_class; i--) {
   938			struct wbt_throtl_info *throtl_ti =
   939				rwb_to_wbt_class_info(rwb, i);
   940	
   941			if (!throtl_info_enabled(throtl_ti))
   942				continue;
   943	
   944			/*skip if can't be scaled down*/
   945			if (!RUE_CALL_TYPE(IO, throtl_info_scale_down, bool, throtl_ti, true))
   946				continue;
   947	
   948			/*current_depth changed, recal wb_normal and wb_background */
   949			RUE_CALL_VOID(IO, throtl_info_calc_limit, throtl_ti);
   950	
   951			if (throtl_info_inflight(throtl_ti) >
   952			    throtl_ti->wb_background) {
   953				/*
   954				 * we did throttle some buffer write,
   955				 * go and observe the effect
   956				 */
   957				break;
   958			}
   959		}
   960		goto out;
   961	
   962	depth_scale_up:
   963		/*amazing!!! everything goes fine, try to scale up queue depth*/
   964		for (i = 0; i < WBT_CLASS_NR; i++) {
   965			struct wbt_throtl_info *ti = rwb_to_wbt_class_info(rwb, i);
   966	
   967			if (ti->current_depth < ti->max_depth) {
   968				if (RUE_CALL_TYPE(IO, throtl_info_scale_up, bool, ti, false)) {
   969					RUE_CALL_VOID(IO, throtl_info_calc_limit, ti);
   970					throtl_info_wake_all(ti);
   971					goto out;
   972				}
   973			}
   974		}
   975	
   976	out:
   977		for (i = 0; i < WBT_CLASS_NR; i++) {
   978			ti = rwb_to_wbt_class_info(rwb, i);
   979			if (throtl_info_inflight(ti) ||
   980			    ti->current_depth < ti->max_depth) {
   981				mod_timer(t, jiffies + nsecs_to_jiffies(rwb->win_nsec));
   982				break;
   983			}
   984		}
   985	}
   986	
   987	static void wbt_class_account_bio_begin(struct rq_wb *rwb, struct bio *bio)
   988	{
   989		int i;
   990		enum wbt_flags flags;
   991		struct wbt_throtl_info *ti = bio_to_wbt_class_info(rwb, bio);
   992	
   993		flags = bio_to_wbt_class_flags(bio);
   994		if (bio_op(bio) == REQ_OP_READ)
   995			atomic64_inc(&ti->read_cnt);
   996	
   997		if (bio_op(bio) == REQ_OP_WRITE &&
   998		    (bio->bi_opf & (REQ_SYNC | REQ_IDLE)) == (REQ_SYNC | REQ_IDLE))
   999			atomic64_inc(&ti->direct_write_cnt);
  1000	
  1001		if (bio_op(bio) == REQ_OP_WRITE && (bio->bi_opf & REQ_SYNC) &&
  1002		    !(bio->bi_opf & REQ_IDLE))
  1003			atomic64_inc(&ti->wr_sync_cnt);
  1004	
  1005		if (flags & WBT_CLASS_TRACKED) {
  1006			i = wbt_flags_to_counter_idx(flags);
  1007			atomic64_inc(&ti->tracked_cnt[i]);
  1008		}
  1009	}
  1010	
  1011	static bool wbt_class_inflight_cb(struct rq_wait *rqw, void *private_data)
  1012	{
  1013		struct wbt_wait_data *data = private_data;
  1014	
  1015		return rq_wait_inc_below(rqw,
> 1016					 throtl_info_get_limit(data->ti, data->opf));
  1017	}
  1018	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-31 23:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31 23:53 [opencloudos:next 12024/13046] block/blk-wbt.c:1016:70: sparse: sparse: incorrect type in argument 2 (different base types) kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.