* [l1k:pciehp_deadlock_v2_attempt_per_dev_rwsem 3/3] drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock'.
@ 2023-01-22 1:23 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2023-01-22 1:23 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Lukas Wunner <lukas@wunner.de>
tree: https://github.com/l1k/linux pciehp_deadlock_v2_attempt_per_dev_rwsem
head: 1fd5c4fbe98942fb0a686f116616b8f3098e2680
commit: 1fd5c4fbe98942fb0a686f116616b8f3098e2680 [3/3] PCI/DOE: Protect DOE exchanges against concurrent reset.
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20230122/202301220912.A7Z0o7dG-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
smatch warnings:
drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock'.
vim +313 drivers/pci/doe.c
9d24322e887b6a Jonathan Cameron 2022-07-19 249
9d24322e887b6a Jonathan Cameron 2022-07-19 250 static void doe_statemachine_work(struct work_struct *work)
9d24322e887b6a Jonathan Cameron 2022-07-19 251 {
9d24322e887b6a Jonathan Cameron 2022-07-19 252 struct pci_doe_task *task = container_of(work, struct pci_doe_task,
9d24322e887b6a Jonathan Cameron 2022-07-19 253 work);
9d24322e887b6a Jonathan Cameron 2022-07-19 254 struct pci_doe_mb *doe_mb = task->doe_mb;
9d24322e887b6a Jonathan Cameron 2022-07-19 255 struct pci_dev *pdev = doe_mb->pdev;
9d24322e887b6a Jonathan Cameron 2022-07-19 256 int offset = doe_mb->cap_offset;
9d24322e887b6a Jonathan Cameron 2022-07-19 257 unsigned long timeout_jiffies;
9d24322e887b6a Jonathan Cameron 2022-07-19 258 u32 val;
9d24322e887b6a Jonathan Cameron 2022-07-19 259 int rc;
9d24322e887b6a Jonathan Cameron 2022-07-19 260
9d24322e887b6a Jonathan Cameron 2022-07-19 261 if (test_bit(PCI_DOE_FLAG_DEAD, &doe_mb->flags)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 262 signal_task_complete(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 263 return;
9d24322e887b6a Jonathan Cameron 2022-07-19 264 }
9d24322e887b6a Jonathan Cameron 2022-07-19 265
1fd5c4fbe98942 Lukas Wunner 2023-01-21 266 down_read(&pdev->reset_lock);
1fd5c4fbe98942 Lukas Wunner 2023-01-21 267
9d24322e887b6a Jonathan Cameron 2022-07-19 268 /* Send request */
9d24322e887b6a Jonathan Cameron 2022-07-19 269 rc = pci_doe_send_req(doe_mb, task);
9d24322e887b6a Jonathan Cameron 2022-07-19 270 if (rc) {
9d24322e887b6a Jonathan Cameron 2022-07-19 271 /*
9d24322e887b6a Jonathan Cameron 2022-07-19 272 * The specification does not provide any guidance on how to
9d24322e887b6a Jonathan Cameron 2022-07-19 273 * resolve conflicting requests from other entities.
9d24322e887b6a Jonathan Cameron 2022-07-19 274 * Furthermore, it is likely that busy will not be detected
9d24322e887b6a Jonathan Cameron 2022-07-19 275 * most of the time. Flag any detection of status busy with an
9d24322e887b6a Jonathan Cameron 2022-07-19 276 * error.
9d24322e887b6a Jonathan Cameron 2022-07-19 277 */
9d24322e887b6a Jonathan Cameron 2022-07-19 278 if (rc == -EBUSY)
9d24322e887b6a Jonathan Cameron 2022-07-19 279 dev_err_ratelimited(&pdev->dev, "[%x] busy detected; another entity is sending conflicting requests\n",
9d24322e887b6a Jonathan Cameron 2022-07-19 280 offset);
9d24322e887b6a Jonathan Cameron 2022-07-19 281 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 282 return;
9d24322e887b6a Jonathan Cameron 2022-07-19 283 }
9d24322e887b6a Jonathan Cameron 2022-07-19 284
9d24322e887b6a Jonathan Cameron 2022-07-19 285 timeout_jiffies = jiffies + PCI_DOE_TIMEOUT;
9d24322e887b6a Jonathan Cameron 2022-07-19 286 /* Poll for response */
9d24322e887b6a Jonathan Cameron 2022-07-19 287 retry_resp:
9d24322e887b6a Jonathan Cameron 2022-07-19 288 pci_read_config_dword(pdev, offset + PCI_DOE_STATUS, &val);
9d24322e887b6a Jonathan Cameron 2022-07-19 289 if (FIELD_GET(PCI_DOE_STATUS_ERROR, val)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 290 signal_task_abort(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 291 return;
9d24322e887b6a Jonathan Cameron 2022-07-19 292 }
9d24322e887b6a Jonathan Cameron 2022-07-19 293
9d24322e887b6a Jonathan Cameron 2022-07-19 294 if (!FIELD_GET(PCI_DOE_STATUS_DATA_OBJECT_READY, val)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 295 if (time_after(jiffies, timeout_jiffies)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 296 signal_task_abort(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 297 return;
9d24322e887b6a Jonathan Cameron 2022-07-19 298 }
9d24322e887b6a Jonathan Cameron 2022-07-19 299 rc = pci_doe_wait(doe_mb, PCI_DOE_POLL_INTERVAL);
9d24322e887b6a Jonathan Cameron 2022-07-19 300 if (rc) {
9d24322e887b6a Jonathan Cameron 2022-07-19 301 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 302 return;
9d24322e887b6a Jonathan Cameron 2022-07-19 303 }
9d24322e887b6a Jonathan Cameron 2022-07-19 304 goto retry_resp;
9d24322e887b6a Jonathan Cameron 2022-07-19 305 }
9d24322e887b6a Jonathan Cameron 2022-07-19 306
9d24322e887b6a Jonathan Cameron 2022-07-19 307 rc = pci_doe_recv_resp(doe_mb, task);
9d24322e887b6a Jonathan Cameron 2022-07-19 308 if (rc < 0) {
9d24322e887b6a Jonathan Cameron 2022-07-19 309 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 310 return;
9d24322e887b6a Jonathan Cameron 2022-07-19 311 }
9d24322e887b6a Jonathan Cameron 2022-07-19 312
9d24322e887b6a Jonathan Cameron 2022-07-19 @313 signal_task_complete(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 314 }
9d24322e887b6a Jonathan Cameron 2022-07-19 315
:::::: The code at line 313 was first introduced by commit
:::::: 9d24322e887b6a3d3f9f9c3e76937a646102c8c1 PCI/DOE: Add DOE mailbox support functions
:::::: TO: Jonathan Cameron <Jonathan.Cameron@huawei.com>
:::::: CC: Dan Williams <dan.j.williams@intel.com>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 2+ messages in thread
* [l1k:pciehp_deadlock_v2_attempt_per_dev_rwsem 3/3] drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock'.
@ 2023-01-23 12:03 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2023-01-23 12:03 UTC (permalink / raw)
To: oe-kbuild, Lukas Wunner; +Cc: lkp, oe-kbuild-all
tree: https://github.com/l1k/linux pciehp_deadlock_v2_attempt_per_dev_rwsem
head: 1fd5c4fbe98942fb0a686f116616b8f3098e2680
commit: 1fd5c4fbe98942fb0a686f116616b8f3098e2680 [3/3] PCI/DOE: Protect DOE exchanges against concurrent reset.
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20230122/202301220912.A7Z0o7dG-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
smatch warnings:
drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock'.
vim +313 drivers/pci/doe.c
9d24322e887b6a Jonathan Cameron 2022-07-19 250 static void doe_statemachine_work(struct work_struct *work)
9d24322e887b6a Jonathan Cameron 2022-07-19 251 {
9d24322e887b6a Jonathan Cameron 2022-07-19 252 struct pci_doe_task *task = container_of(work, struct pci_doe_task,
9d24322e887b6a Jonathan Cameron 2022-07-19 253 work);
9d24322e887b6a Jonathan Cameron 2022-07-19 254 struct pci_doe_mb *doe_mb = task->doe_mb;
9d24322e887b6a Jonathan Cameron 2022-07-19 255 struct pci_dev *pdev = doe_mb->pdev;
9d24322e887b6a Jonathan Cameron 2022-07-19 256 int offset = doe_mb->cap_offset;
9d24322e887b6a Jonathan Cameron 2022-07-19 257 unsigned long timeout_jiffies;
9d24322e887b6a Jonathan Cameron 2022-07-19 258 u32 val;
9d24322e887b6a Jonathan Cameron 2022-07-19 259 int rc;
9d24322e887b6a Jonathan Cameron 2022-07-19 260
9d24322e887b6a Jonathan Cameron 2022-07-19 261 if (test_bit(PCI_DOE_FLAG_DEAD, &doe_mb->flags)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 262 signal_task_complete(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 263 return;
9d24322e887b6a Jonathan Cameron 2022-07-19 264 }
9d24322e887b6a Jonathan Cameron 2022-07-19 265
1fd5c4fbe98942 Lukas Wunner 2023-01-21 266 down_read(&pdev->reset_lock);
1fd5c4fbe98942 Lukas Wunner 2023-01-21 267
9d24322e887b6a Jonathan Cameron 2022-07-19 268 /* Send request */
9d24322e887b6a Jonathan Cameron 2022-07-19 269 rc = pci_doe_send_req(doe_mb, task);
9d24322e887b6a Jonathan Cameron 2022-07-19 270 if (rc) {
9d24322e887b6a Jonathan Cameron 2022-07-19 271 /*
9d24322e887b6a Jonathan Cameron 2022-07-19 272 * The specification does not provide any guidance on how to
9d24322e887b6a Jonathan Cameron 2022-07-19 273 * resolve conflicting requests from other entities.
9d24322e887b6a Jonathan Cameron 2022-07-19 274 * Furthermore, it is likely that busy will not be detected
9d24322e887b6a Jonathan Cameron 2022-07-19 275 * most of the time. Flag any detection of status busy with an
9d24322e887b6a Jonathan Cameron 2022-07-19 276 * error.
9d24322e887b6a Jonathan Cameron 2022-07-19 277 */
9d24322e887b6a Jonathan Cameron 2022-07-19 278 if (rc == -EBUSY)
9d24322e887b6a Jonathan Cameron 2022-07-19 279 dev_err_ratelimited(&pdev->dev, "[%x] busy detected; another entity is sending conflicting requests\n",
9d24322e887b6a Jonathan Cameron 2022-07-19 280 offset);
9d24322e887b6a Jonathan Cameron 2022-07-19 281 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 282 return;
Needs to drop the lock before returning
9d24322e887b6a Jonathan Cameron 2022-07-19 283 }
9d24322e887b6a Jonathan Cameron 2022-07-19 284
9d24322e887b6a Jonathan Cameron 2022-07-19 285 timeout_jiffies = jiffies + PCI_DOE_TIMEOUT;
9d24322e887b6a Jonathan Cameron 2022-07-19 286 /* Poll for response */
9d24322e887b6a Jonathan Cameron 2022-07-19 287 retry_resp:
9d24322e887b6a Jonathan Cameron 2022-07-19 288 pci_read_config_dword(pdev, offset + PCI_DOE_STATUS, &val);
9d24322e887b6a Jonathan Cameron 2022-07-19 289 if (FIELD_GET(PCI_DOE_STATUS_ERROR, val)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 290 signal_task_abort(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 291 return;
Same
9d24322e887b6a Jonathan Cameron 2022-07-19 292 }
9d24322e887b6a Jonathan Cameron 2022-07-19 293
9d24322e887b6a Jonathan Cameron 2022-07-19 294 if (!FIELD_GET(PCI_DOE_STATUS_DATA_OBJECT_READY, val)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 295 if (time_after(jiffies, timeout_jiffies)) {
9d24322e887b6a Jonathan Cameron 2022-07-19 296 signal_task_abort(task, -EIO);
9d24322e887b6a Jonathan Cameron 2022-07-19 297 return;
Same
9d24322e887b6a Jonathan Cameron 2022-07-19 298 }
9d24322e887b6a Jonathan Cameron 2022-07-19 299 rc = pci_doe_wait(doe_mb, PCI_DOE_POLL_INTERVAL);
9d24322e887b6a Jonathan Cameron 2022-07-19 300 if (rc) {
9d24322e887b6a Jonathan Cameron 2022-07-19 301 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 302 return;
Same
9d24322e887b6a Jonathan Cameron 2022-07-19 303 }
9d24322e887b6a Jonathan Cameron 2022-07-19 304 goto retry_resp;
9d24322e887b6a Jonathan Cameron 2022-07-19 305 }
9d24322e887b6a Jonathan Cameron 2022-07-19 306
9d24322e887b6a Jonathan Cameron 2022-07-19 307 rc = pci_doe_recv_resp(doe_mb, task);
9d24322e887b6a Jonathan Cameron 2022-07-19 308 if (rc < 0) {
9d24322e887b6a Jonathan Cameron 2022-07-19 309 signal_task_abort(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 310 return;
Same
9d24322e887b6a Jonathan Cameron 2022-07-19 311 }
9d24322e887b6a Jonathan Cameron 2022-07-19 312
9d24322e887b6a Jonathan Cameron 2022-07-19 @313 signal_task_complete(task, rc);
9d24322e887b6a Jonathan Cameron 2022-07-19 314 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-23 12:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-22 1:23 [l1k:pciehp_deadlock_v2_attempt_per_dev_rwsem 3/3] drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock' kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2023-01-23 12:03 Dan Carpenter
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.