From: Shuah Khan <shuahkh@osg.samsung.com>
To: Takashi Iwai <tiwai@suse.de>, m.chehab@samsung.com
Cc: Lars-Peter Clausen <lars@metafoo.de>,
akpm@linux-foundation.org, gregkh@linuxfoundation.org,
crope@iki.fi, olebowle@gmx.com, dheitmueller@kernellabs.com,
hverkuil@xs4all.nl, ramakrmu@cisco.com,
sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com,
perex@perex.cz, prabhakar.csengg@gmail.com,
tim.gardner@canonical.com, linux@eikelenboom.it,
linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
linux-media@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH v2 5/6] sound/usb: pcm changes to use media token api
Date: Thu, 16 Oct 2014 08:59:29 -0600 [thread overview]
Message-ID: <543FDD51.9040404@osg.samsung.com> (raw)
In-Reply-To: <s5htx34ul3w.wl-tiwai@suse.de>
On 10/16/2014 08:48 AM, Takashi Iwai wrote:
> At Thu, 16 Oct 2014 08:39:14 -0600,
> Shuah Khan wrote:
>>
>> On 10/16/2014 08:16 AM, Takashi Iwai wrote:
>>> At Thu, 16 Oct 2014 08:10:52 -0600,
>>> Shuah Khan wrote:
>>>>
>>>> On 10/16/2014 08:01 AM, Takashi Iwai wrote:
>>>>> At Thu, 16 Oct 2014 07:10:37 -0600,
>>>>> Shuah Khan wrote:
>>>>>>
>>>>>> On 10/16/2014 06:00 AM, Lars-Peter Clausen wrote:
>>>>>>> On 10/14/2014 04:58 PM, Shuah Khan wrote:
>>>>>>> [...]
>>>>>>>> switch (cmd) {
>>>>>>>> case SNDRV_PCM_TRIGGER_START:
>>>>>>>> + err = media_get_audio_tkn(&subs->dev->dev);
>>>>>>>> + if (err == -EBUSY) {
>>>>>>>> + dev_info(&subs->dev->dev, "%s device is busy\n",
>>>>>>>> + __func__);
>>>>>>>
>>>>>>> In my opinion this should not dev_info() as this is out of band error
>>>>>>> signaling and also as the potential to spam the log. The userspace
>>>>>>> application is already properly notified by the return code.
>>>>>>>
>>>>>>
>>>>>> Yes it has the potential to flood the dmesg especially with alsa,
>>>>>> I will remove the dev_info().
>>>>>
>>>>> Yes. And, I think doing this in the trigger isn't the best.
>>>>> Why not in open & close?
>>>>
>>>> My first cut of this change was in open and close. I saw pulseaudio
>>>> application go into this loop trying to open the device. To avoid
>>>> such problems, I went with trigger stat and stop. That made all the
>>>> pulseaudio continues attempts to open problems go away.
>>>
>>> But now starting the stream gives the error, and PA would loop it
>>> again, no?
>>>
>>>
>>>>> Also, is this token restriction needed only for PCM? No mixer or
>>>>> other controls?
>>>>
>>>> snd_pcm_ops are the only ones media drivers implement and use. So
>>>> I don't think mixer is needed. If it is needed, it is not to hard
>>>> to add for that case.
>>>
>>> Well, then I wonder what resource does actually conflict with
>>> usb-audio and media drivers at all...?
>>>
>>
>> audio for dvb/v4l apps gets disrupted when audio app starts. For
>> example, dvb or v4l app tuned to a channel, and when an audio app
>> starts. audio path needs protected to avoid conflicts between
>> digital and analog applications as well.
>
> OK, then concentrating on only PCM is fine.
>
> But, I'm still not convinced about doing the token management in the
> trigger. The reason -EBUSY doesn't work is that it's the very same
> error code when a PCM device is blocked by other processes. And
> -EAGAIN is interpreted by PCM core to -EBUSY for historical reasons.
ah. ok your recommendation is to go with open and close.
Mauro has some reservations with holding at open when I discussed
my observations with pulseaudio when I was holding token in open
instead of trigger start. Maybe he can chime with his concerns.
I think his concern was breaking applications if token is held in
open().
Based on what you are seeing trigger could be worse.
>
> How applications (e.g. PA) should behave if the token get fails?
> Shouldn't it retry or totally give up?
>
It would be up to the application I would think. I see that arecord
quits right away when it finds the device busy. pluseaudio on the other
hand appears to retry. I downloaded pulseaudio sources to understand
what it is doing, however I didn't get too far. The way it does audio
handling is complex for me to follow without spending a lot of time.
thanks,
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
next prev parent reply other threads:[~2014-10-16 14:59 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 14:58 [PATCH v2 0/6] media token resource framework Shuah Khan
2014-10-14 14:58 ` [PATCH v2 1/6] media: add media token device " Shuah Khan
2014-10-15 17:05 ` Takashi Iwai
2014-10-16 0:53 ` Shuah Khan
2014-10-16 14:00 ` Takashi Iwai
2014-10-16 14:39 ` Shuah Khan
2014-10-21 10:46 ` Hans Verkuil
2014-10-21 11:51 ` Takashi Iwai
2014-10-21 11:58 ` Hans Verkuil
2014-10-21 13:07 ` Takashi Iwai
2014-11-18 21:33 ` Sakari Ailus
2014-10-14 14:58 ` [PATCH v2 2/6] media: v4l2-core changes to use media token api Shuah Khan
2014-10-14 14:58 ` [PATCH v2 3/6] media: au0828-video " Shuah Khan
2014-10-14 14:58 ` [PATCH v2 4/6] media: dvb-core " Shuah Khan
2014-10-14 14:58 ` [PATCH v2 5/6] sound/usb: pcm " Shuah Khan
2014-10-16 12:00 ` [alsa-devel] " Lars-Peter Clausen
2014-10-16 13:10 ` Shuah Khan
2014-10-16 14:01 ` Takashi Iwai
2014-10-16 14:10 ` Shuah Khan
2014-10-16 14:16 ` Takashi Iwai
2014-10-16 14:39 ` Shuah Khan
2014-10-16 14:48 ` Takashi Iwai
2014-10-16 14:59 ` Shuah Khan [this message]
2014-10-18 18:49 ` Mauro Carvalho Chehab
2014-10-19 9:00 ` Takashi Iwai
2014-10-21 15:42 ` Hans Verkuil
2014-10-21 16:05 ` Takashi Iwai
2014-10-21 16:08 ` Devin Heitmueller
2014-10-21 16:14 ` Takashi Iwai
2014-10-22 19:26 ` Pierre-Louis Bossart
2014-10-22 19:45 ` Devin Heitmueller
2014-10-24 14:44 ` Shuah Khan
2014-10-25 12:44 ` Mauro Carvalho Chehab
2014-10-25 13:20 ` Mauro Carvalho Chehab
2014-10-25 13:41 ` Mauro Carvalho Chehab
2014-10-26 8:27 ` Takashi Iwai
2014-10-27 12:52 ` Mauro Carvalho Chehab
2014-10-28 21:15 ` Shuah Khan
2014-10-28 23:42 ` [RFCv1] Media Token API needs - Was: " Mauro Carvalho Chehab
2014-10-29 0:00 ` Mauro Carvalho Chehab
2014-10-29 11:19 ` Mauro Carvalho Chehab
2014-10-29 16:06 ` Shuah Khan
2014-10-29 17:56 ` Mauro Carvalho Chehab
2014-11-04 23:08 ` [RFCv2] Media Token API Spec Shuah Khan
2014-11-10 14:15 ` Hans Verkuil
2014-11-18 21:15 ` Sakari Ailus
2014-11-18 21:27 ` Shuah Khan
2014-10-21 17:32 ` [alsa-devel] [PATCH v2 5/6] sound/usb: pcm changes to use media token api Shuah Khan
2014-10-22 15:24 ` Hans Verkuil
[not found] ` <20141025085742.43e20bb5.m.chehab@samsung.com>
2014-10-27 15:47 ` Shuah Khan
2014-10-14 14:58 ` [PATCH v2 6/6] media: au0828-core changes to create and destroy media Shuah Khan
2014-10-15 16:48 ` [PATCH v2 0/6] media token resource framework Takashi Iwai
2014-10-15 20:21 ` Shuah Khan
2014-10-16 14:02 ` Takashi Iwai
2014-10-29 9:17 ` Sakari Ailus
2014-10-29 9:33 ` Mauro Carvalho Chehab
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=543FDD51.9040404@osg.samsung.com \
--to=shuahkh@osg.samsung.com \
--cc=akpm@linux-foundation.org \
--cc=alsa-devel@alsa-project.org \
--cc=crope@iki.fi \
--cc=dheitmueller@kernellabs.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil@xs4all.nl \
--cc=lars@metafoo.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@eikelenboom.it \
--cc=m.chehab@samsung.com \
--cc=olebowle@gmx.com \
--cc=perex@perex.cz \
--cc=prabhakar.csengg@gmail.com \
--cc=ramakrmu@cisco.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tim.gardner@canonical.com \
--cc=tiwai@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox