From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752925AbcHULWC (ORCPT ); Sun, 21 Aug 2016 07:22:02 -0400 Received: from saturn.retrosnub.co.uk ([178.18.118.26]:51255 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752189AbcHULV7 (ORCPT ); Sun, 21 Aug 2016 07:21:59 -0400 Subject: Re: [PATCH v2] iio: fix sched WARNING "do not call blocking ops when !TASK_RUNNING" To: Lars-Peter Clausen , Brian Norris References: <20160802011244.GA54171@google.com> <37ea974c-9ac6-5a40-0f0e-ee34ef605a08@metafoo.de> <20160802165732.GA3310@localhost> <9a6a7f54-0343-db74-57a2-9f747ae659cc@metafoo.de> <20160804082621.GA11331@localhost> <20160809001937.GA23658@google.com> Cc: Hartmut Knaack , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck , Brian Norris , Peter Zijlstra , Ingo Molnar From: Jonathan Cameron Message-ID: <7e9386ee-176d-6959-9950-6f4c967921e4@kernel.org> Date: Sun, 21 Aug 2016 12:21:55 +0100 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: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16/08/16 16:27, Lars-Peter Clausen wrote: > On 08/15/2016 05:54 PM, Jonathan Cameron wrote: >> On 09/08/16 01:19, Brian Norris wrote: >>> When using CONFIG_DEBUG_ATOMIC_SLEEP, the scheduler nicely points out >>> that we're calling sleeping primitives within the wait_event loop, which >>> means we might clobber the task state: >>> >>> [ 10.831289] do not call blocking ops when !TASK_RUNNING; state=1 set at [] >>> [ 10.845531] ------------[ cut here ]------------ >>> [ 10.850161] WARNING: at kernel/sched/core.c:7630 >>> ... >>> [ 12.164333] ---[ end trace 45409966a9a76438 ]--- >>> [ 12.168942] Call trace: >>> [ 12.171391] [] __might_sleep+0x64/0x90 >>> [ 12.176699] [] mutex_lock_nested+0x50/0x3fc >>> [ 12.182440] [] iio_kfifo_buf_data_available+0x28/0x4c >>> [ 12.189043] [] iio_buffer_ready+0x60/0xe0 >>> [ 12.194608] [] iio_buffer_read_first_n_outer+0x108/0x1a8 >>> [ 12.201474] [] __vfs_read+0x58/0x114 >>> [ 12.206606] [] vfs_read+0x94/0x118 >>> [ 12.211564] [] SyS_read+0x64/0xb4 >>> [ 12.216436] [] el0_svc_naked+0x24/0x28 >>> >>> To avoid this, we should (a la https://lwn.net/Articles/628628/) use the >>> wait_woken() function, which avoids the nested sleeping while still >>> handling races between waiting / wake-events. >>> >>> Signed-off-by: Brian Norris >> Looks good to me, but given Lars' involvement in the discussion I'd >> like his review before applying this. > > Looks good. Thanks Brian for fixing this. > > Reviewed-by: Lars-Peter Clausen I've applied to this to the fixes-togreg branch of iio.git For now I haven't marked it for stable, purely because I'm not sure when the first 'problem' usage was introduced. I'm happy to explicitly send a request for stable inclusion if anyone wants to track down which stable trees this is applicable to. I've very low on time today (holiday catch up) so won't get to dig into it myself for a at least a few weeks. Jonathan > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >