drivers/net/wireless/ti/wlcore/main.c:643:34: sparse: sparse: context imbalance in 'wlcore_irq_locked' - different lock contexts for basic block

From: kernel test robot
Date: Tue Aug 11 2020 - 07:31:22 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 00e4db51259a5f936fec1424b884f029479d3981
commit: f0325e38ab39c2e270770b72c79795772ac3b49e wlcore: Use spin_trylock in wlcore_irq_locked() for running the queue
date: 4 weeks ago
config: mips-randconfig-s032-20200811 (attached as .config)
compiler: mips64-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-168-g9554805c-dirty
git checkout f0325e38ab39c2e270770b72c79795772ac3b49e
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=mips

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> drivers/net/wireless/ti/wlcore/main.c:643:34: sparse: sparse: context imbalance in 'wlcore_irq_locked' - different lock contexts for basic block

vim +/wlcore_irq_locked +643 drivers/net/wireless/ti/wlcore/main.c

1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 518
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 519 static int wlcore_irq_locked(struct wl1271 *wl)
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 520 {
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 521 int ret = 0;
c15f63bffabb99 drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2009-10-12 522 u32 intr;
1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 523 int loopcount = WL1271_IRQ_MAX_LOOPS;
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 524 bool run_tx_queue = true;
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 525 bool done = false;
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 526 unsigned int defer_count;
b07d4037051318 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 527 unsigned long flags;
b07d4037051318 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 528
341b7cde6ccc60 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-31 529 /*
341b7cde6ccc60 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-31 530 * In case edge triggered interrupt must be used, we cannot iterate
341b7cde6ccc60 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-31 531 * more than once without introducing race conditions with the hardirq.
341b7cde6ccc60 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-31 532 */
6f921fab584494 drivers/net/wireless/ti/wlcore/main.c Luciano Coelho 2015-03-18 533 if (wl->irq_flags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))
341b7cde6ccc60 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-31 534 loopcount = 1;
341b7cde6ccc60 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-31 535
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 536 wl1271_debug(DEBUG_IRQ, "IRQ work");
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 537
4cc533830b7e6b drivers/net/wireless/ti/wlcore/main.c Ido Yariv 2012-07-24 538 if (unlikely(wl->state != WLCORE_STATE_ON))
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 539 goto out;
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 540
fa2648a34e73fb drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2018-06-19 541 ret = pm_runtime_get_sync(wl->dev);
fa2648a34e73fb drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2018-06-19 542 if (ret < 0) {
fa2648a34e73fb drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2018-06-19 543 pm_runtime_put_noidle(wl->dev);
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 544 goto out;
fa2648a34e73fb drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2018-06-19 545 }
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 546
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 547 while (!done && loopcount--) {
4e857c58efeb99 drivers/net/wireless/ti/wlcore/main.c Peter Zijlstra 2014-03-17 548 smp_mb__after_atomic();
1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 549
75fb4df7f80422 drivers/net/wireless/ti/wlcore/main.c Eliad Peller 2014-02-10 550 ret = wlcore_fw_status(wl, wl->fw_status);
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 551 if (ret < 0)
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 552 goto err_ret;
53d67a50cd17ac drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2011-12-12 553
53d67a50cd17ac drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2011-12-12 554 wlcore_hw_tx_immediate_compl(wl);
53d67a50cd17ac drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2011-12-12 555
75fb4df7f80422 drivers/net/wireless/ti/wlcore/main.c Eliad Peller 2014-02-10 556 intr = wl->fw_status->intr;
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 557 intr &= WLCORE_ALL_INTR_MASK;
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 558 if (!intr) {
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 559 done = true;
1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 560 continue;
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 561 }
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 562
ccc83b046c0337 drivers/net/wireless/wl12xx/wl1271_main.c Eliad Peller 2010-10-27 563 if (unlikely(intr & WL1271_ACX_INTR_WATCHDOG)) {
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 564 wl1271_error("HW watchdog interrupt received! starting recovery.");
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 565 wl->watchdog_recovery = true;
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 566 ret = -EIO;
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 567
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 568 /* restarting the chip. ignore any other interrupt. */
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 569 goto err_ret;
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 570 }
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 571
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 572 if (unlikely(intr & WL1271_ACX_SW_INTR_WATCHDOG)) {
f5755fe96cb010 drivers/net/wireless/ti/wlcore/main.c Ido Reis 2012-04-23 573 wl1271_error("SW watchdog interrupt received! "
ccc83b046c0337 drivers/net/wireless/wl12xx/wl1271_main.c Eliad Peller 2010-10-27 574 "starting recovery.");
afbe37185c0eca drivers/net/wireless/ti/wlcore/main.c Yoni Divinsky 2012-05-16 575 wl->watchdog_recovery = true;
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 576 ret = -EIO;
ccc83b046c0337 drivers/net/wireless/wl12xx/wl1271_main.c Eliad Peller 2010-10-27 577
ccc83b046c0337 drivers/net/wireless/wl12xx/wl1271_main.c Eliad Peller 2010-10-27 578 /* restarting the chip. ignore any other interrupt. */
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 579 goto err_ret;
ccc83b046c0337 drivers/net/wireless/wl12xx/wl1271_main.c Eliad Peller 2010-10-27 580 }
ccc83b046c0337 drivers/net/wireless/wl12xx/wl1271_main.c Eliad Peller 2010-10-27 581
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 582 if (likely(intr & WL1271_ACX_INTR_DATA)) {
1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 583 wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_DATA");
1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 584
75fb4df7f80422 drivers/net/wireless/ti/wlcore/main.c Eliad Peller 2014-02-10 585 ret = wlcore_rx(wl, wl->fw_status);
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 586 if (ret < 0)
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 587 goto err_ret;
1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 588
a522550a283de3 drivers/net/wireless/wl12xx/wl1271_main.c Ido Yariv 2010-10-12 589 /* Check if any tx blocks were freed */
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 590 if (!test_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags)) {
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 591 if (spin_trylock_irqsave(&wl->wl_lock, flags)) {
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 592 if (!wl1271_tx_total_queue_count(wl))
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 593 run_tx_queue = false;
b07d4037051318 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 594 spin_unlock_irqrestore(&wl->wl_lock, flags);
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 595 }
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 596
a522550a283de3 drivers/net/wireless/wl12xx/wl1271_main.c Ido Yariv 2010-10-12 597 /*
a522550a283de3 drivers/net/wireless/wl12xx/wl1271_main.c Ido Yariv 2010-10-12 598 * In order to avoid starvation of the TX path,
a522550a283de3 drivers/net/wireless/wl12xx/wl1271_main.c Ido Yariv 2010-10-12 599 * call the work function directly.
a522550a283de3 drivers/net/wireless/wl12xx/wl1271_main.c Ido Yariv 2010-10-12 600 */
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 601 if (run_tx_queue) {
eb96f841b9563b drivers/net/wireless/ti/wlcore/main.c Ido Yariv 2012-06-18 602 ret = wlcore_tx_work_locked(wl);
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 603 if (ret < 0)
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 604 goto err_ret;
f0325e38ab39c2 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2020-07-02 605 }
a522550a283de3 drivers/net/wireless/wl12xx/wl1271_main.c Ido Yariv 2010-10-12 606 }
a522550a283de3 drivers/net/wireless/wl12xx/wl1271_main.c Ido Yariv 2010-10-12 607
8aad24642a7c06 drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 608 /* check for tx results */
045b9b5f4172b2 drivers/net/wireless/ti/wlcore/main.c Ido Yariv 2012-06-18 609 ret = wlcore_hw_tx_delayed_compl(wl);
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 610 if (ret < 0)
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 611 goto err_ret;
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 612
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 613 /* Make sure the deferred queues don't get too long */
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 614 defer_count = skb_queue_len(&wl->deferred_tx_queue) +
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 615 skb_queue_len(&wl->deferred_rx_queue);
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 616 if (defer_count > WL1271_DEFERRED_QUEUE_LIMIT)
a620865edf62ea drivers/net/wireless/wl12xx/main.c Ido Yariv 2011-03-01 617 wl1271_flush_deferred_work(wl);
1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 618 }
1e73eb62cec7cf drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2010-02-22 619
1fd2794f369139 drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2009-10-13 620 if (intr & WL1271_ACX_INTR_EVENT_A) {
1fd2794f369139 drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2009-10-13 621 wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_A");
045b9b5f4172b2 drivers/net/wireless/ti/wlcore/main.c Ido Yariv 2012-06-18 622 ret = wl1271_event_handle(wl, 0);
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 623 if (ret < 0)
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 624 goto err_ret;
1fd2794f369139 drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2009-10-13 625 }
1fd2794f369139 drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2009-10-13 626
1fd2794f369139 drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2009-10-13 627 if (intr & WL1271_ACX_INTR_EVENT_B) {
1fd2794f369139 drivers/net/wireless/wl12xx/wl1271_main.c Juuso Oikarinen 2009-10-13 628 wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_EVENT_B");
045b9b5f4172b2 drivers/net/wireless/ti/wlcore/main.c Ido Yariv 2012-06-18 629 ret = wl1271_event_handle(wl, 1);
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 630 if (ret < 0)
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 631 goto err_ret;
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 632 }
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 633
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 634 if (intr & WL1271_ACX_INTR_INIT_COMPLETE)
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 635 wl1271_debug(DEBUG_IRQ,
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 636 "WL1271_ACX_INTR_INIT_COMPLETE");
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 637
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 638 if (intr & WL1271_ACX_INTR_HW_AVAILABLE)
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 639 wl1271_debug(DEBUG_IRQ, "WL1271_ACX_INTR_HW_AVAILABLE");
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 640 }
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 641
da74b6933b3ba2 drivers/net/wireless/ti/wlcore/main.c Dinghao Liu 2020-05-22 642 err_ret:
9b71578de08748 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2018-06-19 @643 pm_runtime_mark_last_busy(wl->dev);
9b71578de08748 drivers/net/wireless/ti/wlcore/main.c Tony Lindgren 2018-06-19 644 pm_runtime_put_autosuspend(wl->dev);
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 645
f5fc0f86b02afe drivers/net/wireless/wl12xx/wl1271_main.c Luciano Coelho 2009-08-06 646 out:
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 647 return ret;
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 648 }
b5b45b3cbd5616 drivers/net/wireless/ti/wlcore/main.c Arik Nemtsov 2012-06-21 649

:::::: The code at line 643 was first introduced by commit
:::::: 9b71578de08748defb3bcae3ce8ed1a75cb6a8d7 wlcore: Enable runtime PM autosuspend support

:::::: TO: Tony Lindgren <tony@xxxxxxxxxxx>
:::::: CC: Kalle Valo <kvalo@xxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip