[sound:test/usb-audio-lowlatency 198/198] sound/usb/pcm.c:1322:12: sparse: sparse: context imbalance in 'prepare_playback_urb' - different lock contexts for basic block

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git test/usb-audio-lowlatency
head:   0dbf51c865c64e95c711e4adf89a89140077269e
commit: 0dbf51c865c64e95c711e4adf89a89140077269e [198/198] ALSA: usb-audio: Improved lowlatency playback support
:::::: branch date: 17 hours ago
:::::: commit date: 17 hours ago
config: arc-randconfig-s032-20210831 (attached as .config)
compiler: arc-elf-gcc (GCC) 11.2.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.3-348-gf0e6938b-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=0dbf51c865c64e95c711e4adf89a89140077269e
        git remote add sound https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git
        git fetch --no-tags sound test/usb-audio-lowlatency
        git checkout 0dbf51c865c64e95c711e4adf89a89140077269e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arc SHELL=/bin/bash sound/usb/

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


sparse warnings: (new ones prefixed by >>)
>> sound/usb/pcm.c:1322:12: sparse: sparse: context imbalance in 'prepare_playback_urb' - different lock contexts for basic block

vim +/prepare_playback_urb +1322 sound/usb/pcm.c

e0570446773623 Ricard Wanderlof     2015-10-19  1321
0dbf51c865c64e Takashi Iwai         2021-08-30 @1322  static int prepare_playback_urb(struct snd_usb_substream *subs,
edcd3633e72a15 Daniel Mack          2012-04-12  1323  				struct urb *urb)
edcd3633e72a15 Daniel Mack          2012-04-12  1324  {
edcd3633e72a15 Daniel Mack          2012-04-12  1325  	struct snd_pcm_runtime *runtime = subs->pcm_substream->runtime;
245baf983cc395 Daniel Mack          2012-08-30  1326  	struct snd_usb_endpoint *ep = subs->data_endpoint;
edcd3633e72a15 Daniel Mack          2012-04-12  1327  	struct snd_urb_ctx *ctx = urb->context;
0dbf51c865c64e Takashi Iwai         2021-08-30  1328  	unsigned int counts, frames, bytes, transfer_done;
edcd3633e72a15 Daniel Mack          2012-04-12  1329  	int i, stride, period_elapsed = 0;
edcd3633e72a15 Daniel Mack          2012-04-12  1330  	unsigned long flags;
edcd3633e72a15 Daniel Mack          2012-04-12  1331
d303c5d38b37ee Takashi Iwai         2021-06-01  1332  	stride = ep->stride;
edcd3633e72a15 Daniel Mack          2012-04-12  1333
edcd3633e72a15 Daniel Mack          2012-04-12  1334  	frames = 0;
e8a8f09cb0b3b8 Takashi Iwai         2021-06-01  1335  	ctx->queued = 0;
edcd3633e72a15 Daniel Mack          2012-04-12  1336  	urb->number_of_packets = 0;
edcd3633e72a15 Daniel Mack          2012-04-12  1337  	spin_lock_irqsave(&subs->lock, flags);
976b6c064a9574 Alan Stern           2013-09-24  1338  	subs->frame_limit += ep->max_urb_frames;
0dbf51c865c64e Takashi Iwai         2021-08-30  1339  	transfer_done = subs->transfer_done;
edcd3633e72a15 Daniel Mack          2012-04-12  1340  	for (i = 0; i < ctx->packets; i++) {
3d58760f4d0015 Takashi Iwai         2020-11-23  1341  		counts = snd_usb_endpoint_next_packet_size(ep, ctx, i);
edcd3633e72a15 Daniel Mack          2012-04-12  1342  		/* set up descriptor */
d303c5d38b37ee Takashi Iwai         2021-06-01  1343  		urb->iso_frame_desc[i].offset = frames * stride;
d303c5d38b37ee Takashi Iwai         2021-06-01  1344  		urb->iso_frame_desc[i].length = counts * stride;
edcd3633e72a15 Daniel Mack          2012-04-12  1345  		frames += counts;
edcd3633e72a15 Daniel Mack          2012-04-12  1346  		urb->number_of_packets++;
0dbf51c865c64e Takashi Iwai         2021-08-30  1347  		transfer_done += counts;
0dbf51c865c64e Takashi Iwai         2021-08-30  1348  		if (transfer_done >= runtime->period_size) {
0dbf51c865c64e Takashi Iwai         2021-08-30  1349  			transfer_done -= runtime->period_size;
976b6c064a9574 Alan Stern           2013-09-24  1350  			subs->frame_limit = 0;
edcd3633e72a15 Daniel Mack          2012-04-12  1351  			period_elapsed = 1;
edcd3633e72a15 Daniel Mack          2012-04-12  1352  			if (subs->fmt_type == UAC_FORMAT_TYPE_II) {
0dbf51c865c64e Takashi Iwai         2021-08-30  1353  				if (transfer_done > 0) {
edcd3633e72a15 Daniel Mack          2012-04-12  1354  					/* FIXME: fill-max mode is not
edcd3633e72a15 Daniel Mack          2012-04-12  1355  					 * supported yet */
0dbf51c865c64e Takashi Iwai         2021-08-30  1356  					frames -= transfer_done;
0dbf51c865c64e Takashi Iwai         2021-08-30  1357  					counts -= transfer_done;
edcd3633e72a15 Daniel Mack          2012-04-12  1358  					urb->iso_frame_desc[i].length =
d303c5d38b37ee Takashi Iwai         2021-06-01  1359  						counts * stride;
0dbf51c865c64e Takashi Iwai         2021-08-30  1360  					transfer_done = 0;
edcd3633e72a15 Daniel Mack          2012-04-12  1361  				}
edcd3633e72a15 Daniel Mack          2012-04-12  1362  				i++;
edcd3633e72a15 Daniel Mack          2012-04-12  1363  				if (i < ctx->packets) {
edcd3633e72a15 Daniel Mack          2012-04-12  1364  					/* add a transfer delimiter */
edcd3633e72a15 Daniel Mack          2012-04-12  1365  					urb->iso_frame_desc[i].offset =
d303c5d38b37ee Takashi Iwai         2021-06-01  1366  						frames * stride;
edcd3633e72a15 Daniel Mack          2012-04-12  1367  					urb->iso_frame_desc[i].length = 0;
edcd3633e72a15 Daniel Mack          2012-04-12  1368  					urb->number_of_packets++;
edcd3633e72a15 Daniel Mack          2012-04-12  1369  				}
edcd3633e72a15 Daniel Mack          2012-04-12  1370  				break;
edcd3633e72a15 Daniel Mack          2012-04-12  1371  			}
edcd3633e72a15 Daniel Mack          2012-04-12  1372  		}
976b6c064a9574 Alan Stern           2013-09-24  1373  		/* finish at the period boundary or after enough frames */
0dbf51c865c64e Takashi Iwai         2021-08-30  1374  		if ((period_elapsed || transfer_done >= subs->frame_limit) &&
976b6c064a9574 Alan Stern           2013-09-24  1375  		    !snd_usb_endpoint_implicit_feedback_sink(ep))
edcd3633e72a15 Daniel Mack          2012-04-12  1376  			break;
edcd3633e72a15 Daniel Mack          2012-04-12  1377  	}
d24f5061ee7b9b Daniel Mack          2013-04-17  1378
0dbf51c865c64e Takashi Iwai         2021-08-30  1379  	/* check the appl_ptr in low latency mode */
0dbf51c865c64e Takashi Iwai         2021-08-30  1380  	if (!subs->early_playback_start &&
0dbf51c865c64e Takashi Iwai         2021-08-30  1381  	    frames > snd_pcm_playback_hw_avail(runtime))
0dbf51c865c64e Takashi Iwai         2021-08-30 @1382  		return -EAGAIN;
0dbf51c865c64e Takashi Iwai         2021-08-30  1383
0dbf51c865c64e Takashi Iwai         2021-08-30  1384  	bytes = frames * stride;
0dbf51c865c64e Takashi Iwai         2021-08-30  1385  	subs->transfer_done = transfer_done;
6aa719d15a1903 Takashi Iwai         2020-11-23  1386  	if (unlikely(ep->cur_format == SNDRV_PCM_FORMAT_DSD_U16_LE &&
d24f5061ee7b9b Daniel Mack          2013-04-17  1387  		     subs->cur_audiofmt->dsd_dop)) {
d24f5061ee7b9b Daniel Mack          2013-04-17  1388  		fill_playback_urb_dsd_dop(subs, urb, bytes);
6aa719d15a1903 Takashi Iwai         2020-11-23  1389  	} else if (unlikely(ep->cur_format == SNDRV_PCM_FORMAT_DSD_U8 &&
44dcbbb1cd6156 Daniel Mack          2013-04-17  1390  			   subs->cur_audiofmt->dsd_bitrev)) {
4f083917994fdd Takashi Iwai         2021-06-01  1391  		fill_playback_urb_dsd_bitrev(subs, urb, bytes);
d24f5061ee7b9b Daniel Mack          2013-04-17  1392  	} else {
d24f5061ee7b9b Daniel Mack          2013-04-17  1393  		/* usual PCM */
e0570446773623 Ricard Wanderlof     2015-10-19  1394  		if (!subs->tx_length_quirk)
b97a936910c8d6 Ricard Wanderlof     2015-10-19  1395  			copy_to_urb(subs, urb, 0, stride, bytes);
e0570446773623 Ricard Wanderlof     2015-10-19  1396  		else
e0570446773623 Ricard Wanderlof     2015-10-19  1397  			bytes = copy_to_urb_quirk(subs, urb, stride, bytes);
e0570446773623 Ricard Wanderlof     2015-10-19  1398  			/* bytes is now amount of outgoing data */
d24f5061ee7b9b Daniel Mack          2013-04-17  1399  	}
d24f5061ee7b9b Daniel Mack          2013-04-17  1400
fbcfbf5f673847 Daniel Mack          2012-08-30  1401  	subs->last_frame_number = usb_get_current_frame_number(subs->dev);
fbcfbf5f673847 Daniel Mack          2012-08-30  1402
ea33d359c4421f Pierre-Louis Bossart 2015-02-06  1403  	if (subs->trigger_tstamp_pending_update) {
ea33d359c4421f Pierre-Louis Bossart 2015-02-06  1404  		/* this is the first actual URB submitted,
ea33d359c4421f Pierre-Louis Bossart 2015-02-06  1405  		 * update trigger timestamp to reflect actual start time
ea33d359c4421f Pierre-Louis Bossart 2015-02-06  1406  		 */
ea33d359c4421f Pierre-Louis Bossart 2015-02-06  1407  		snd_pcm_gettime(runtime, &runtime->trigger_tstamp);
ea33d359c4421f Pierre-Louis Bossart 2015-02-06  1408  		subs->trigger_tstamp_pending_update = false;
ea33d359c4421f Pierre-Louis Bossart 2015-02-06  1409  	}
ea33d359c4421f Pierre-Louis Bossart 2015-02-06  1410
4267c5a8f3133d Takashi Iwai         2021-08-27  1411  	if (period_elapsed && !subs->running && !subs->early_playback_start) {
307cc9baac5c07 Takashi Iwai         2021-07-07  1412  		subs->period_elapsed_pending = 1;
307cc9baac5c07 Takashi Iwai         2021-07-07  1413  		period_elapsed = 0;
307cc9baac5c07 Takashi Iwai         2021-07-07  1414  	}
edcd3633e72a15 Daniel Mack          2012-04-12  1415  	spin_unlock_irqrestore(&subs->lock, flags);
edcd3633e72a15 Daniel Mack          2012-04-12  1416  	urb->transfer_buffer_length = bytes;
edcd3633e72a15 Daniel Mack          2012-04-12  1417  	if (period_elapsed)
edcd3633e72a15 Daniel Mack          2012-04-12  1418  		snd_pcm_period_elapsed(subs->pcm_substream);
0dbf51c865c64e Takashi Iwai         2021-08-30  1419  	return 0;
edcd3633e72a15 Daniel Mack          2012-04-12  1420  }
edcd3633e72a15 Daniel Mack          2012-04-12  1421

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux