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: [linux-next:master 10969/12618] drivers/md/dm-mpath.c:2104 probe_active_paths() warn: mixing irqsave and irq
Date: Thu, 22 May 2025 12:37:34 +0800	[thread overview]
Message-ID: <202505221209.UJOI2rXT-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Benjamin Marzinski <bmarzins@redhat.com>
CC: Mikulas Patocka <mpatocka@redhat.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7bac2c97af4078d7a627500c9bcdd5b033f97718
commit: 5c977f1023156938915c57d362fddde8fad2b052 [10969/12618] dm-mpath: Don't grab work_mutex while probing paths
:::::: branch date: 17 hours ago
:::::: commit date: 6 days ago
config: i386-randconfig-141-20250521 (https://download.01.org/0day-ci/archive/20250522/202505221209.UJOI2rXT-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)

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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202505221209.UJOI2rXT-lkp@intel.com/

smatch warnings:
drivers/md/dm-mpath.c:2104 probe_active_paths() warn: mixing irqsave and irq

vim +2104 drivers/md/dm-mpath.c

7734fb4ad98c3f Kevin Wolf         2025-04-29  2082  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2083  /*
7734fb4ad98c3f Kevin Wolf         2025-04-29  2084   * Probe all active paths in current_pg to find out whether they still work.
7734fb4ad98c3f Kevin Wolf         2025-04-29  2085   * Fail all paths that do not work.
7734fb4ad98c3f Kevin Wolf         2025-04-29  2086   *
7734fb4ad98c3f Kevin Wolf         2025-04-29  2087   * Return -ENOTCONN if no valid path is left (even outside of current_pg). We
7734fb4ad98c3f Kevin Wolf         2025-04-29  2088   * cannot probe paths in other pgs without switching current_pg, so if valid
7734fb4ad98c3f Kevin Wolf         2025-04-29  2089   * paths are only in different pgs, they may or may not work. Additionally
7734fb4ad98c3f Kevin Wolf         2025-04-29  2090   * we should not probe paths in a pathgroup that is in the process of
7734fb4ad98c3f Kevin Wolf         2025-04-29  2091   * Initializing. Userspace can submit a request and we'll switch and wait
7734fb4ad98c3f Kevin Wolf         2025-04-29  2092   * for the pathgroup to be initialized. If the request fails, it may need to
7734fb4ad98c3f Kevin Wolf         2025-04-29  2093   * probe again.
7734fb4ad98c3f Kevin Wolf         2025-04-29  2094   */
7734fb4ad98c3f Kevin Wolf         2025-04-29  2095  static int probe_active_paths(struct multipath *m)
7734fb4ad98c3f Kevin Wolf         2025-04-29  2096  {
7734fb4ad98c3f Kevin Wolf         2025-04-29  2097  	struct pgpath *pgpath;
5c977f10231569 Benjamin Marzinski 2025-05-15  2098  	struct priority_group *pg = NULL;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2099  	unsigned long flags;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2100  	int r = 0;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2101  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2102  	spin_lock_irqsave(&m->lock, flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2103  	if (test_bit(MPATHF_DELAY_PG_SWITCH, &m->flags)) {
5c977f10231569 Benjamin Marzinski 2025-05-15 @2104  		wait_event_lock_irq(m->probe_wait,
5c977f10231569 Benjamin Marzinski 2025-05-15  2105  				    !test_bit(MPATHF_DELAY_PG_SWITCH, &m->flags),
5c977f10231569 Benjamin Marzinski 2025-05-15  2106  				    m->lock);
5c977f10231569 Benjamin Marzinski 2025-05-15  2107  		/*
5c977f10231569 Benjamin Marzinski 2025-05-15  2108  		 * if we waited because a probe was already in progress,
5c977f10231569 Benjamin Marzinski 2025-05-15  2109  		 * and it probed the current active pathgroup, don't
5c977f10231569 Benjamin Marzinski 2025-05-15  2110  		 * reprobe. Just return the number of valid paths
5c977f10231569 Benjamin Marzinski 2025-05-15  2111  		 */
5c977f10231569 Benjamin Marzinski 2025-05-15  2112  		if (m->current_pg == m->last_probed_pg)
5c977f10231569 Benjamin Marzinski 2025-05-15  2113  			goto skip_probe;
5c977f10231569 Benjamin Marzinski 2025-05-15  2114  	}
5c977f10231569 Benjamin Marzinski 2025-05-15  2115  	if (!m->current_pg || m->is_suspending ||
5c977f10231569 Benjamin Marzinski 2025-05-15  2116  	    test_bit(MPATHF_QUEUE_IO, &m->flags))
5c977f10231569 Benjamin Marzinski 2025-05-15  2117  		goto skip_probe;
5c977f10231569 Benjamin Marzinski 2025-05-15  2118  	set_bit(MPATHF_DELAY_PG_SWITCH, &m->flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2119  	pg = m->last_probed_pg = m->current_pg;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2120  	spin_unlock_irqrestore(&m->lock, flags);
7734fb4ad98c3f Kevin Wolf         2025-04-29  2121  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2122  	list_for_each_entry(pgpath, &pg->pgpaths, list) {
5c977f10231569 Benjamin Marzinski 2025-05-15  2123  		if (pg != READ_ONCE(m->current_pg) ||
5c977f10231569 Benjamin Marzinski 2025-05-15  2124  		    READ_ONCE(m->is_suspending))
5c977f10231569 Benjamin Marzinski 2025-05-15  2125  			goto out;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2126  		if (!pgpath->is_active)
7734fb4ad98c3f Kevin Wolf         2025-04-29  2127  			continue;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2128  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2129  		r = probe_path(pgpath);
7734fb4ad98c3f Kevin Wolf         2025-04-29  2130  		if (r < 0)
7734fb4ad98c3f Kevin Wolf         2025-04-29  2131  			goto out;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2132  	}
7734fb4ad98c3f Kevin Wolf         2025-04-29  2133  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2134  out:
5c977f10231569 Benjamin Marzinski 2025-05-15  2135  	spin_lock_irqsave(&m->lock, flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2136  	clear_bit(MPATHF_DELAY_PG_SWITCH, &m->flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2137  	if (test_and_clear_bit(MPATHF_NEED_PG_SWITCH, &m->flags)) {
5c977f10231569 Benjamin Marzinski 2025-05-15  2138  		m->current_pgpath = NULL;
5c977f10231569 Benjamin Marzinski 2025-05-15  2139  		m->current_pg = NULL;
5c977f10231569 Benjamin Marzinski 2025-05-15  2140  	}
5c977f10231569 Benjamin Marzinski 2025-05-15  2141  skip_probe:
5c977f10231569 Benjamin Marzinski 2025-05-15  2142  	if (r == 0 && !atomic_read(&m->nr_valid_paths))
5c977f10231569 Benjamin Marzinski 2025-05-15  2143  		r = -ENOTCONN;
5c977f10231569 Benjamin Marzinski 2025-05-15  2144  	spin_unlock_irqrestore(&m->lock, flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2145  	if (pg)
5c977f10231569 Benjamin Marzinski 2025-05-15  2146  		wake_up(&m->probe_wait);
7734fb4ad98c3f Kevin Wolf         2025-04-29  2147  	return r;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2148  }
7734fb4ad98c3f Kevin Wolf         2025-04-29  2149  

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Benjamin Marzinski <bmarzins@redhat.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	Mikulas Patocka <mpatocka@redhat.com>
Subject: [linux-next:master 10969/12618] drivers/md/dm-mpath.c:2104 probe_active_paths() warn: mixing irqsave and irq
Date: Fri, 23 May 2025 12:43:22 +0300	[thread overview]
Message-ID: <202505221209.UJOI2rXT-lkp@intel.com> (raw)
Message-ID: <20250523094322.v7P45RclTcyzt1VWyY51XvX3CtM4nv6TRsWM0xWbYi8@z> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7bac2c97af4078d7a627500c9bcdd5b033f97718
commit: 5c977f1023156938915c57d362fddde8fad2b052 [10969/12618] dm-mpath: Don't grab work_mutex while probing paths
config: i386-randconfig-141-20250521 (https://download.01.org/0day-ci/archive/20250522/202505221209.UJOI2rXT-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)

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>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202505221209.UJOI2rXT-lkp@intel.com/

smatch warnings:
drivers/md/dm-mpath.c:2104 probe_active_paths() warn: mixing irqsave and irq

vim +2104 drivers/md/dm-mpath.c

7734fb4ad98c3f Kevin Wolf         2025-04-29  2095  static int probe_active_paths(struct multipath *m)
7734fb4ad98c3f Kevin Wolf         2025-04-29  2096  {
7734fb4ad98c3f Kevin Wolf         2025-04-29  2097  	struct pgpath *pgpath;
5c977f10231569 Benjamin Marzinski 2025-05-15  2098  	struct priority_group *pg = NULL;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2099  	unsigned long flags;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2100  	int r = 0;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2101  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2102  	spin_lock_irqsave(&m->lock, flags);

_irqsave() is for if we don't know if the caller has disabled IRQs or
not.

5c977f10231569 Benjamin Marzinski 2025-05-15  2103  	if (test_bit(MPATHF_DELAY_PG_SWITCH, &m->flags)) {
5c977f10231569 Benjamin Marzinski 2025-05-15 @2104  		wait_event_lock_irq(m->probe_wait,
5c977f10231569 Benjamin Marzinski 2025-05-15  2105  				    !test_bit(MPATHF_DELAY_PG_SWITCH, &m->flags),
5c977f10231569 Benjamin Marzinski 2025-05-15  2106  				    m->lock);

The wait_event_lock_irq() macro calls spin_unlock_irq(), so hopefully
none of the callers of probe_active_paths() actually relied on having
IRQs disabled.

5c977f10231569 Benjamin Marzinski 2025-05-15  2107  		/*
5c977f10231569 Benjamin Marzinski 2025-05-15  2108  		 * if we waited because a probe was already in progress,
5c977f10231569 Benjamin Marzinski 2025-05-15  2109  		 * and it probed the current active pathgroup, don't
5c977f10231569 Benjamin Marzinski 2025-05-15  2110  		 * reprobe. Just return the number of valid paths
5c977f10231569 Benjamin Marzinski 2025-05-15  2111  		 */
5c977f10231569 Benjamin Marzinski 2025-05-15  2112  		if (m->current_pg == m->last_probed_pg)
5c977f10231569 Benjamin Marzinski 2025-05-15  2113  			goto skip_probe;
5c977f10231569 Benjamin Marzinski 2025-05-15  2114  	}
5c977f10231569 Benjamin Marzinski 2025-05-15  2115  	if (!m->current_pg || m->is_suspending ||
5c977f10231569 Benjamin Marzinski 2025-05-15  2116  	    test_bit(MPATHF_QUEUE_IO, &m->flags))
5c977f10231569 Benjamin Marzinski 2025-05-15  2117  		goto skip_probe;
5c977f10231569 Benjamin Marzinski 2025-05-15  2118  	set_bit(MPATHF_DELAY_PG_SWITCH, &m->flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2119  	pg = m->last_probed_pg = m->current_pg;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2120  	spin_unlock_irqrestore(&m->lock, flags);
7734fb4ad98c3f Kevin Wolf         2025-04-29  2121  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2122  	list_for_each_entry(pgpath, &pg->pgpaths, list) {
5c977f10231569 Benjamin Marzinski 2025-05-15  2123  		if (pg != READ_ONCE(m->current_pg) ||
5c977f10231569 Benjamin Marzinski 2025-05-15  2124  		    READ_ONCE(m->is_suspending))
5c977f10231569 Benjamin Marzinski 2025-05-15  2125  			goto out;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2126  		if (!pgpath->is_active)
7734fb4ad98c3f Kevin Wolf         2025-04-29  2127  			continue;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2128  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2129  		r = probe_path(pgpath);
7734fb4ad98c3f Kevin Wolf         2025-04-29  2130  		if (r < 0)
7734fb4ad98c3f Kevin Wolf         2025-04-29  2131  			goto out;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2132  	}
7734fb4ad98c3f Kevin Wolf         2025-04-29  2133  
7734fb4ad98c3f Kevin Wolf         2025-04-29  2134  out:
5c977f10231569 Benjamin Marzinski 2025-05-15  2135  	spin_lock_irqsave(&m->lock, flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2136  	clear_bit(MPATHF_DELAY_PG_SWITCH, &m->flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2137  	if (test_and_clear_bit(MPATHF_NEED_PG_SWITCH, &m->flags)) {
5c977f10231569 Benjamin Marzinski 2025-05-15  2138  		m->current_pgpath = NULL;
5c977f10231569 Benjamin Marzinski 2025-05-15  2139  		m->current_pg = NULL;
5c977f10231569 Benjamin Marzinski 2025-05-15  2140  	}
5c977f10231569 Benjamin Marzinski 2025-05-15  2141  skip_probe:
5c977f10231569 Benjamin Marzinski 2025-05-15  2142  	if (r == 0 && !atomic_read(&m->nr_valid_paths))
5c977f10231569 Benjamin Marzinski 2025-05-15  2143  		r = -ENOTCONN;
5c977f10231569 Benjamin Marzinski 2025-05-15  2144  	spin_unlock_irqrestore(&m->lock, flags);
5c977f10231569 Benjamin Marzinski 2025-05-15  2145  	if (pg)
5c977f10231569 Benjamin Marzinski 2025-05-15  2146  		wake_up(&m->probe_wait);
7734fb4ad98c3f Kevin Wolf         2025-04-29  2147  	return r;
7734fb4ad98c3f Kevin Wolf         2025-04-29  2148  }

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


             reply	other threads:[~2025-05-22  4:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-22  4:37 kernel test robot [this message]
2025-05-23  9:43 ` [linux-next:master 10969/12618] drivers/md/dm-mpath.c:2104 probe_active_paths() warn: mixing irqsave and irq Dan Carpenter
2025-05-29 14:22 ` Mikulas Patocka

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=202505221209.UJOI2rXT-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.