All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [l1k:pciehp_deadlock_v2_attempt_per_dev_rwsem 3/3] drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock'.
Date: Sun, 22 Jan 2023 09:23:05 +0800	[thread overview]
Message-ID: <202301220912.A7Z0o7dG-lkp@intel.com> (raw)

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

             reply	other threads:[~2023-01-22  1:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-22  1:23 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-01-23 12:03 [l1k:pciehp_deadlock_v2_attempt_per_dev_rwsem 3/3] drivers/pci/doe.c:313 doe_statemachine_work() warn: inconsistent returns '&pdev->reset_lock' Dan Carpenter

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=202301220912.A7Z0o7dG-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=error27@gmail.com \
    --cc=oe-kbuild@lists.linux.dev \
    /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.