Skip to contentSkip to conversation

Misc fix and pcm-multi-thread test

PATCH New Takashi Iwai 1 participant 4 messages Jul 7, 2016

lore
Share & tools
lore
#0 lore raw

cover Misc fix and pcm-multi-thread test

Hi,

this is an excerpt from my previous RFC patchset for thread safety, containing a trivial cleanup and an addition of pcm-multi-thread test program, where both can be applied generically without thread-safe patches.

It's just a resend, as these have no changes from the previous post.

Takashi

===

Takashi Iwai (3):
pcm: Remove superfluous rmb() from PCM meter plugin
test: Add pcm-multi-thread program
Add pcm-multi-thread to .gitignore

 .gitignore              |   1 +
 src/pcm/pcm_meter.c     |   1 -
 test/Makefile.am        |   3 +-
 test/pcm-multi-thread.c | 263 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 266 insertions(+), 2 deletions(-)
 create mode 100644 test/pcm-multi-thread.c
Signature · 1 line
2.9.0
#1 lore raw

PATCH 1/3 pcm: Remove superfluous rmb() from PCM meter plugin

rmb() is still left in the code without any actual meaning there just before the atomic operation. Let's clean it up.

---
 src/pcm/pcm_meter.c | 1 -
 1 file changed, 1 deletion(-)
src/pcm/pcm_meter.c +0 -1
index 1b0ccb40b3dd..d71af7a683e0 100644
@@ -136,7 +136,6 @@ static int snd_pcm_meter_update_scope(snd_pcm_t *pcm)
  _again:
 	rptr = *pcm->hw.ptr;
 	old_rptr = meter->rptr;
-	rmb();
 	if (atomic_read(&meter->reset)) {
 		reset = 1;
 		atomic_dec(&meter->reset);
Signature · 1 line
2.9.0
#2 lore raw

PATCH 2/3 test: Add pcm-multi-thread program

In reply to Takashi Iwai

A simple multi-thread stress test for PCM is added to test subdirectory. It can perform various PCM update function in the worker threads while reading/writing the data in the main thread. It can help catching the unexpected error or blockage. For example, running the capture test with a softvol plugin will lead to the assert due to the races.

---
 test/Makefile.am        |   3 +-
 test/pcm-multi-thread.c | 263 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 265 insertions(+), 1 deletion(-)
 create mode 100644 test/pcm-multi-thread.c
test/Makefile.am +2 -1
index cbf2ab4d58aa..970595ae432f 100644
@@ -3,7 +3,7 @@ SUBDIRS=. lsb
 check_PROGRAMS=control pcm pcm_min latency seq \
 	       playmidi1 timer rawmidi midiloop \
 	       oldapi queue_timer namehint client_event_filter \
-	       chmap audio_time user-ctl-element-set
+	       chmap audio_time user-ctl-element-set pcm-multi-thread
 
 control_LDADD=../src/libasound.la
 pcm_LDADD=../src/libasound.la
@@ -23,6 +23,7 @@ client_event_filter_LDADD=../src/libasound.la
 code_CFLAGS=-Wall -pipe -g -O2
 chmap_LDADD=../src/libasound.la
 audio_time_LDADD=../src/libasound.la
+pcm_multi_thread_LDADD=../src/libasound.la
 
 user_ctl_element_set_LDADD=../src/libasound.la
 user_ctl_element_set_CFLAGS=-Wall -g
test/pcm-multi-thread.c new file +263 -0

263 lines not on this page · raw message

Signature · 1 line
2.9.0
#3 lore raw

PATCH 3/3 Add pcm-multi-thread to .gitignore

In reply to Takashi Iwai
---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index f46157290d70..098de14dc332 100644
@@ -58,6 +58,7 @@ test/oldapi
 test/chmap
 test/pcm
 test/pcm_min
+test/pcm-multi-thread
 test/playmidi1
 test/queue_timer
 test/rawmidi
Signature · 1 line
2.9.0