From: Takashi Iwai <tiwai@suse.de>
To: "Lin, Mengdong" <mengdong.lin@intel.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: HD-Audio: How to reduce driver initializaton time if multiple codecs present on the bus?
Date: Thu, 28 Nov 2013 16:15:51 +0100 [thread overview]
Message-ID: <s5hwqjsd0bc.wl%tiwai@suse.de> (raw)
In-Reply-To: <F46914AEC2663F4A9BB62374E5EEF8F80141EEE6@SHSMSX101.ccr.corp.intel.com>
At Thu, 28 Nov 2013 14:57:22 +0000,
Lin, Mengdong wrote:
>
> Hi Takashi,
>
> We're trying to reduce the HD-A driver initialization time when more than one codecs are connected to the bus, but are blocked.
> Would you please share some advices on this?
>
> Usually, there is one HD-A controller connecting to two codecs: one on-board codec and one integrated display codec.
> During initialization, the codecs are created and configured in a serial way.
>
> Creating a codec may cost 6~20ms, and then building controls make cost about 15~30ms.
> So I had thought it's helpful to build controls for different codecs in parallel in function snd_hda_build_controls(), as we did in driver suspend/resume.
>
> But the test shows this doesn't work:
>
> (1) Using a workqueue without WQ_UNBOUND, the work items, which calls snd_hda_codec_build_controls(), are processed one after one
You have to synchronize before starting building PCMs and controls.
That is, you can parallelize snd_hda_codec_configure() calls, but the
rest has to be serialized.
> (I think because there is no explicit sleep in the work function). So the total time does not change.
>
>
>
> (2) Using an unbouned work queue for the bus or using separate kthreads for each codec, the work items for different codecs are processed in parallel.
>
> However, the total time is still the sum of two codec as that without parallel.
> I think that because snd_hda_codec_read() are used during initialization, the command execution on bus is serialized in the low level.
> So even if we parallel initializing two codecs in high level, commands on bus are still processed one by one so the total time cannot reduce.
If the bottleneck is the time consumed to perform the whole verbs,
then it's unavoidable, of course. You have only a single street no
matter how many cars are running.
So, you must analyze the problem before starting such optimizations.
For example, put tracepoints to measure the time consumption.
> We're blocked here. Is there any other means to reduce the time?
Reduce the amount of init verbs.
So far, the driver tries to initialize all things properly by itself
without trusting the default values the codec sets (e.g. setting the
amp to mute, selecting the selector to 0). These verbs are often
redundant.
But, assuming some default values is of course risky, if the hardware
doesn't follow it by some reason -- or if the same path is executed in
a different situation like runtime PM.
Takashi
next prev parent reply other threads:[~2013-11-28 15:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-28 14:57 HD-Audio: How to reduce driver initializaton time if multiple codecs present on the bus? Lin, Mengdong
2013-11-28 15:15 ` Takashi Iwai [this message]
2013-11-29 6:30 ` David Henningsson
2013-11-29 6:40 ` Takashi Iwai
2013-11-29 7:31 ` David Henningsson
2013-11-29 7:49 ` Takashi Iwai
2013-11-29 8:05 ` Lin, Mengdong
2013-11-29 8:07 ` Takashi Iwai
2013-12-02 7:23 ` Lin, Mengdong
2013-12-02 8:24 ` Takashi Iwai
2013-12-02 9:48 ` Lin, Mengdong
2013-12-02 9:52 ` Takashi Iwai
2013-12-02 10:18 ` Takashi Iwai
2013-12-02 11:27 ` Lin, Mengdong
2013-12-02 12:18 ` Takashi Iwai
2013-12-02 14:25 ` Takashi Iwai
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=s5hwqjsd0bc.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=mengdong.lin@intel.com \
/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.