[PATCH 1/4] echoaudio: Race conditions around "opencount"

kernel test robot lkp at intel.com
Wed Jul 1 19:32:49 CEST 2020


Hi Mark,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sound/for-next]
[also build test ERROR on v5.8-rc3 next-20200701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use  as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Mark-Hills/echoaudio-Race-conditions-around-opencount/20200701-203413
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11,
                    from include/linux/delay.h:22,
                    from sound/pci/echoaudio/mona.c:35:
   sound/pci/echoaudio/mona_dsp.c: In function 'set_input_clock':
>> arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:2: note: in expansion of macro 'compiletime_assert'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:21: note: in expansion of macro '__native_word'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |                     ^~~~~~~~~~~~~
   include/linux/compiler.h:291:2: note: in expansion of macro 'compiletime_assert_rwonce_type'
     291 |  compiletime_assert_rwonce_type(x);    \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
>> sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:2: note: in expansion of macro 'compiletime_assert'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:21: note: in expansion of macro '__native_word'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |                     ^~~~~~~~~~~~~
   include/linux/compiler.h:291:2: note: in expansion of macro 'compiletime_assert_rwonce_type'
     291 |  compiletime_assert_rwonce_type(x);    \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
>> sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:2: note: in expansion of macro 'compiletime_assert'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:21: note: in expansion of macro '__native_word'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |                     ^~~~~~~~~~~~~
   include/linux/compiler.h:291:2: note: in expansion of macro 'compiletime_assert_rwonce_type'
     291 |  compiletime_assert_rwonce_type(x);    \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
>> sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:2: note: in expansion of macro 'compiletime_assert'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:21: note: in expansion of macro '__native_word'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |                     ^~~~~~~~~~~~~
   include/linux/compiler.h:291:2: note: in expansion of macro 'compiletime_assert_rwonce_type'
     291 |  compiletime_assert_rwonce_type(x);    \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
>> sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:405:2: note: in expansion of macro 'compiletime_assert'
     405 |  compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long), \
         |  ^~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:291:2: note: in expansion of macro 'compiletime_assert_rwonce_type'
     291 |  compiletime_assert_rwonce_type(x);    \
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
>> sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~
   In file included from <command-line>:
>> arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler_types.h:290:13: note: in definition of macro '__unqual_scalar_typeof'
     290 |   _Generic((x),      \
         |             ^
   include/linux/compiler.h:292:2: note: in expansion of macro '__READ_ONCE_SCALAR'
     292 |  __READ_ONCE_SCALAR(x);      \
         |  ^~~~~~~~~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
>> sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler_types.h:290:13: note: in definition of macro '__unqual_scalar_typeof'
     290 |   _Generic((x),      \
         |             ^
   include/linux/compiler.h:284:34: note: in expansion of macro '__READ_ONCE'
     284 |  __unqual_scalar_typeof(x) __x = __READ_ONCE(x);   \
         |                                  ^~~~~~~~~~~
   include/linux/compiler.h:292:2: note: in expansion of macro '__READ_ONCE_SCALAR'
     292 |  __READ_ONCE_SCALAR(x);      \
         |  ^~~~~~~~~~~~~~~~~~
>> arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
   sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~
   In file included from include/linux/kernel.h:11,
                    from include/linux/delay.h:22,
                    from sound/pci/echoaudio/mona.c:35:
   arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler.h:280:72: note: in definition of macro '__READ_ONCE'
     280 | #define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
         |                                                                        ^
   include/linux/compiler.h:292:2: note: in expansion of macro '__READ_ONCE_SCALAR'
     292 |  __READ_ONCE_SCALAR(x);      \
         |  ^~~~~~~~~~~~~~~~~~
   arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
   sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~
   arch/arm/include/asm/atomic.h:27:37: error: request for member 'counter' in something not a structure or union
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                                     ^~
   include/linux/compiler.h:286:10: note: in definition of macro '__READ_ONCE_SCALAR'
     286 |  (typeof(x))__x;       \
         |          ^
   arch/arm/include/asm/atomic.h:27:24: note: in expansion of macro 'READ_ONCE'
      27 | #define atomic_read(v) READ_ONCE((v)->counter)
         |                        ^~~~~~~~~
   sound/pci/echoaudio/mona_dsp.c:305:6: note: in expansion of macro 'atomic_read'
     305 |  if (atomic_read(&chip->opencount))
         |      ^~~~~~~~~~~

vim +/atomic_read +305 sound/pci/echoaudio/mona_dsp.c

dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  295  
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  296  
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  297  
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  298  static int set_input_clock(struct echoaudio *chip, u16 clock)
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  299  {
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  300  	u32 control_reg, clocks_from_dsp;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  301  	int err;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  302  
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  303  
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  304  	/* Prevent two simultaneous calls to switch_asic() */
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28 @305  	if (atomic_read(&chip->opencount))
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  306  		return -EAGAIN;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  307  
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  308  	/* Mask off the clock select bits */
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  309  	control_reg = le32_to_cpu(chip->comm_page->control_register) &
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  310  		GML_CLOCK_CLEAR_MASK;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  311  	clocks_from_dsp = le32_to_cpu(chip->comm_page->status_clocks);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  312  
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  313  	switch (clock) {
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  314  	case ECHO_CLOCK_INTERNAL:
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  315  		chip->input_clock = ECHO_CLOCK_INTERNAL;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  316  		return set_sample_rate(chip, chip->sample_rate);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  317  	case ECHO_CLOCK_SPDIF:
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  318  		if (chip->digital_mode == DIGITAL_MODE_ADAT)
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  319  			return -EAGAIN;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  320  		spin_unlock_irq(&chip->lock);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  321  		err = switch_asic(chip, clocks_from_dsp &
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  322  				  GML_CLOCK_DETECT_BIT_SPDIF96);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  323  		spin_lock_irq(&chip->lock);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  324  		if (err < 0)
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  325  			return err;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  326  		control_reg |= GML_SPDIF_CLOCK;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  327  		if (clocks_from_dsp & GML_CLOCK_DETECT_BIT_SPDIF96)
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  328  			control_reg |= GML_DOUBLE_SPEED_MODE;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  329  		else
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  330  			control_reg &= ~GML_DOUBLE_SPEED_MODE;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  331  		break;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  332  	case ECHO_CLOCK_WORD:
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  333  		spin_unlock_irq(&chip->lock);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  334  		err = switch_asic(chip, clocks_from_dsp &
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  335  				  GML_CLOCK_DETECT_BIT_WORD96);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  336  		spin_lock_irq(&chip->lock);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  337  		if (err < 0)
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  338  			return err;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  339  		control_reg |= GML_WORD_CLOCK;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  340  		if (clocks_from_dsp & GML_CLOCK_DETECT_BIT_WORD96)
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  341  			control_reg |= GML_DOUBLE_SPEED_MODE;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  342  		else
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  343  			control_reg &= ~GML_DOUBLE_SPEED_MODE;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  344  		break;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  345  	case ECHO_CLOCK_ADAT:
b5b4a41b392960 Sudip Mukherjee  2014-11-03  346  		dev_dbg(chip->card->dev, "Set Mona clock to ADAT\n");
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  347  		if (chip->digital_mode != DIGITAL_MODE_ADAT)
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  348  			return -EAGAIN;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  349  		control_reg |= GML_ADAT_CLOCK;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  350  		control_reg &= ~GML_DOUBLE_SPEED_MODE;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  351  		break;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  352  	default:
b5b4a41b392960 Sudip Mukherjee  2014-11-03  353  		dev_err(chip->card->dev,
b5b4a41b392960 Sudip Mukherjee  2014-11-03  354  			"Input clock 0x%x not supported for Mona\n", clock);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  355  		return -EINVAL;
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  356  	}
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  357  
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  358  	chip->input_clock = clock;
3f6175ece94735 Mark Brown       2015-08-10  359  	return write_control_reg(chip, control_reg, true);
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  360  }
dd7b254d8dd3a9 Giuliano Pochini 2006-06-28  361  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 75683 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20200702/b2227446/attachment-0001.gz>


More information about the Alsa-devel mailing list