From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754432AbcHaTLJ (ORCPT ); Wed, 31 Aug 2016 15:11:09 -0400 Received: from bear.ext.ti.com ([198.47.19.11]:34034 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752930AbcHaTLH (ORCPT ); Wed, 31 Aug 2016 15:11:07 -0400 Subject: Re: [alsa-devel] [PATCH] ASoC: tlv320dac33: Remove deprecated create_singlethread_workqueue To: Tejun Heo References: <20160830182750.GA8074@Karyakshetra> <7abb8b68-760b-cf67-17a5-d120136d6ec5@ti.com> <20160831144408.GX12660@htj.duckdns.org> CC: Bhaktipriya Shridhar , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , , From: Peter Ujfalusi Message-ID: <88b9a137-b934-f928-535f-719cfbc9bff3@ti.com> Date: Wed, 31 Aug 2016 22:10:47 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160831144408.GX12660@htj.duckdns.org> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/31/16 17:44, Tejun Heo wrote: > Hello, Peter. > > On Wed, Aug 31, 2016 at 02:56:50PM +0300, Peter Ujfalusi wrote: >> On 08/30/16 21:27, Bhaktipriya Shridhar wrote: >>> The workqueue "dac33_wq" queues a single work item &dac33->work and hence >>> doesn't require ordering. Also, it is not being used on a memory reclaim >>> path. Hence, it has been converted to use system_wq. >>> >>> The work item has been flushed in dac33_soc_remove to ensure that >>> there are no pending tasks while disconnecting the driver. >> >> The reason why dac33 had it's own wq is that it is absolutely time critical >> that the work is not going to be delayed by the scheduling needs with the >> system_wq. If the work execution is delayed, we could run out of time in FIFO >> mode, which can cause the chip to hang do to FIFO underrun. > > In the current implementation of wq, which has been around for many > years now, there's no real timing advantage to using a dedicated > workqueue or rather system_wq doesn't get blocked by other work items > on it. They are all served by the same backend pools and dedicated > workqueues mostly serve as attribute, flush and mem-reclaim domains. The dac33 driver was productised with 2.6.32 kernel and there the dedicated wq was needed. I know lots have changed, so it is most likely not the case anymore. >> Unfortunately I'm no longer able to test the dac33 as I don't have the HW any >> more. >> >> If you are 100% percent sure that this is not going to delay the work, then >> I'm OK with the change, but I have used the dedicated queue at the time, >> because the system_wq given unpredictable latencies. > > What kind of time frame are we talking about? If it really needs high > priority, the right thing to do would be using a WQ_HIGHPRI workqueue. In order to be tune the performance and power saving during audio playback lower is better, but consistency matters more to be able have stable system. I have some latency compensation in the code so it could tolerate some drift, but big spikes can cause the codec to go underflow and we can not recover from that w/o hard reset of the codec. I do believe that Linux got much better over the years since I wrote the dac33 driver, so I'm fine with the move to system_wq. The most problematic mode (I think it was MODE7LP or smthing) is not upstream so this change should not break audio on the n9/n950. -- Péter