All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: jason.zeng@intel.com, lin.x.wang@intel.com, pei.p.jia@intel.com
Cc: oe-kbuild-all@lists.linux.dev
Subject: [bytedance:5.15-velinux 0/1] block/blk-mq.c:1049:36: sparse: sparse: cast from restricted blk_status_t
Date: Fri, 9 May 2025 16:42:49 +0800	[thread overview]
Message-ID: <202505091618.Lsg8DFV5-lkp@intel.com> (raw)

tree:   https://github.com/bytedance/kernel.git 5.15-velinux
head:   de277dab626c9ece4c9cf99ec9c56f23b298a042
commit: 54c492f8d2da8d8ea3740dfbeb233e3649331605 [0/1] block: remove blk-exec.c
config: x86_64-randconfig-122-20250509 (https://download.01.org/0day-ci/archive/20250509/202505091618.Lsg8DFV5-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/20250509/202505091618.Lsg8DFV5-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/202505091618.Lsg8DFV5-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   block/blk-mq.c:315:26: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned int rq_flags @@     got restricted req_flags_t [usertype] @@
   block/blk-mq.c:315:26: sparse:     expected unsigned int rq_flags
   block/blk-mq.c:315:26: sparse:     got restricted req_flags_t [usertype]
   block/blk-mq.c:324:26: sparse: sparse: invalid assignment: |=
   block/blk-mq.c:324:26: sparse:    left side has type unsigned int
   block/blk-mq.c:324:26: sparse:    right side has type restricted req_flags_t
   block/blk-mq.c:326:26: sparse: sparse: invalid assignment: |=
   block/blk-mq.c:326:26: sparse:    left side has type unsigned int
   block/blk-mq.c:326:26: sparse:    right side has type restricted req_flags_t
   block/blk-mq.c:327:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted req_flags_t [usertype] rq_flags @@     got unsigned int rq_flags @@
   block/blk-mq.c:327:22: sparse:     expected restricted req_flags_t [usertype] rq_flags
   block/blk-mq.c:327:22: sparse:     got unsigned int rq_flags
>> block/blk-mq.c:1049:36: sparse: sparse: cast from restricted blk_status_t
>> block/blk-mq.c:1142:17: sparse: sparse: cast to restricted blk_status_t

vim +1049 block/blk-mq.c

  1039	
  1040	/**
  1041	 * blk_end_sync_rq - executes a completion event on a request
  1042	 * @rq: request to complete
  1043	 * @error: end I/O status of the request
  1044	 */
  1045	static void blk_end_sync_rq(struct request *rq, blk_status_t error)
  1046	{
  1047		struct completion *waiting = rq->end_io_data;
  1048	
> 1049		rq->end_io_data = (void *)(uintptr_t)error;
  1050	
  1051		/*
  1052		 * complete last, if this is a stack request the process (and thus
  1053		 * the rq pointer) could be invalid right after this complete()
  1054		 */
  1055		complete(waiting);
  1056	}
  1057	
  1058	/**
  1059	 * blk_execute_rq_nowait - insert a request to I/O scheduler for execution
  1060	 * @bd_disk:	matching gendisk
  1061	 * @rq:		request to insert
  1062	 * @at_head:    insert request at head or tail of queue
  1063	 * @done:	I/O completion handler
  1064	 *
  1065	 * Description:
  1066	 *    Insert a fully prepared request at the back of the I/O scheduler queue
  1067	 *    for execution.  Don't wait for completion.
  1068	 *
  1069	 * Note:
  1070	 *    This function will invoke @done directly if the queue is dead.
  1071	 */
  1072	void blk_execute_rq_nowait(struct gendisk *bd_disk, struct request *rq,
  1073				   int at_head, rq_end_io_fn *done)
  1074	{
  1075		WARN_ON(irqs_disabled());
  1076		WARN_ON(!blk_rq_is_passthrough(rq));
  1077	
  1078		rq->rq_disk = bd_disk;
  1079		rq->end_io = done;
  1080	
  1081		blk_account_io_start(rq);
  1082	
  1083		/*
  1084		 * don't check dying flag for MQ because the request won't
  1085		 * be reused after dying flag is set
  1086		 */
  1087		blk_mq_sched_insert_request(rq, at_head, true, false);
  1088	}
  1089	EXPORT_SYMBOL_GPL(blk_execute_rq_nowait);
  1090	
  1091	static bool blk_rq_is_poll(struct request *rq)
  1092	{
  1093		if (!rq->mq_hctx)
  1094			return false;
  1095		if (rq->mq_hctx->type != HCTX_TYPE_POLL)
  1096			return false;
  1097		if (WARN_ON_ONCE(!rq->bio))
  1098			return false;
  1099		return true;
  1100	}
  1101	
  1102	static void blk_rq_poll_completion(struct request *rq, struct completion *wait)
  1103	{
  1104		do {
  1105			bio_poll(rq->bio, NULL, 0);
  1106			cond_resched();
  1107		} while (!completion_done(wait));
  1108	}
  1109	
  1110	/**
  1111	 * blk_execute_rq - insert a request into queue for execution
  1112	 * @bd_disk:	matching gendisk
  1113	 * @rq:		request to insert
  1114	 * @at_head:    insert request at head or tail of queue
  1115	 *
  1116	 * Description:
  1117	 *    Insert a fully prepared request at the back of the I/O scheduler queue
  1118	 *    for execution and wait for completion.
  1119	 * Return: The blk_status_t result provided to blk_mq_end_request().
  1120	 */
  1121	blk_status_t blk_execute_rq(struct gendisk *bd_disk, struct request *rq,
  1122			int at_head)
  1123	{
  1124		DECLARE_COMPLETION_ONSTACK(wait);
  1125		unsigned long hang_check;
  1126	
  1127		rq->end_io_data = &wait;
  1128		blk_execute_rq_nowait(bd_disk, rq, at_head, blk_end_sync_rq);
  1129	
  1130		/* Prevent hang_check timer from firing at us during very long I/O */
  1131		hang_check = sysctl_hung_task_timeout_secs;
  1132	
  1133		if (blk_rq_is_poll(rq))
  1134			blk_rq_poll_completion(rq, &wait);
  1135		else if (hang_check)
  1136			while (!wait_for_completion_io_timeout(&wait,
  1137					hang_check * (HZ/2)))
  1138				;
  1139		else
  1140			wait_for_completion_io(&wait);
  1141	
> 1142		return (blk_status_t)(uintptr_t)rq->end_io_data;
  1143	}
  1144	EXPORT_SYMBOL(blk_execute_rq);
  1145	

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

                 reply	other threads:[~2025-05-09  8:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202505091618.Lsg8DFV5-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=jason.zeng@intel.com \
    --cc=lin.x.wang@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pei.p.jia@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.