Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp427910ima; Wed, 6 Feb 2019 02:27:21 -0800 (PST) X-Google-Smtp-Source: AHgI3IaG6/+tk8jXU/1L5Rliv43RybaPc1Vqh2VrITPf5bE5Hw+9J4vNZQzsydLHgi3EcEUdlq4u X-Received: by 2002:a65:534b:: with SMTP id w11mr8935541pgr.125.1549448840898; Wed, 06 Feb 2019 02:27:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549448840; cv=none; d=google.com; s=arc-20160816; b=keUrYSH5uIfmtZydkq15avLM68kBLt9rThyR0EkxCJ4613c01bib/8sW+uc9IpDmbx yxhbtl1q3EtoFpY6Hf36QwQwECPY6Vh93NUZlesepovnsvd8lr3jk6kQq7fnHrUmq2gN bHBdKYzkXwn3cwtBmKVekzociVCABoay7yxhJWhzAHD6jbemJ7j6xT6RFo70sv3smnrV IADk+ZoMnhy1AG4y6NEOIIt6bHPop90i9ogzWKPMAX2iM7khh2P5M3B86UkE9tYKhIuM NUojkrLDtPbUaH5eI0BRQeqQlnaOedGuFJp5hyYbqrR3WGkVyfC9WMIcYsdxfkyOCAnq vnqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=idhxzeqr/n8LEYPpm3MH5jQRo8XGFytxRx9esKx99eA=; b=IDTwGL98nsbygGwlgSuJeVXzn5J7ebIp4FpmJT++nc+q2BAB9MCyDaL5W6oaD4AZaY qxB5gkV9NfBbZJwr5ujof+OsJolGMapiUGRb37MsnK2Ipqmxprku2mJSQihtMuZLsAK4 ZmXSr6IPPYDAY+RUykvsg1MEqGTz0P4/RHFXzM8S/G4acaCgVa1PVpRUNff88ZtTlvLD liER6VI4+SlFvYKMaQYCRhOm8y4uxn3znJ4R/KoOXzA0L+VN8dqVSWgHaibVT5D6Efoy NwvoBD/JWGtNdiYkUkT4tvYns4NcqPLf5b19zgXPolmp9+OqKOp+y4HF8lhdFms0iFu8 em4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=c48E7MMO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si1559485pgn.32.2019.02.06.02.27.03; Wed, 06 Feb 2019 02:27:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=c48E7MMO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727644AbfBFKWs (ORCPT + 99 others); Wed, 6 Feb 2019 05:22:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:59654 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726598AbfBFKWs (ORCPT ); Wed, 6 Feb 2019 05:22:48 -0500 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C2C86218AE; Wed, 6 Feb 2019 10:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549448567; bh=nbDjTOJfpeqHX9ibHSMc8fTmADZOS4UiaCEGnSQz+a0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=c48E7MMO8FSUXJFTGfb+HvPQPhndudfqofH2p4S1vaD25PsoohQmqUTIkpHAwsGFJ ifcZoSXk8j1HyNWTK07q22aMREEB+XFyTI/LjwuPui9S5zfYtpJmND5KlodFwTAtEI 6M4906AyIXd+Fqg78TBR0VwJUkQBTpk4coEe5ir0= Received: by mail-lf1-f45.google.com with SMTP id b20so4891749lfa.12; Wed, 06 Feb 2019 02:22:46 -0800 (PST) X-Gm-Message-State: AHQUAubWt0sAIukrTapT43pgbYfRxXAQWJ344brB8+3eXOHdSh0QcAIn wS2xEgMRXaGMF35vKWRkdK0FD9VvqHxClBjpOXI= X-Received: by 2002:a19:4948:: with SMTP id l8mr6565339lfj.156.1549448564730; Wed, 06 Feb 2019 02:22:44 -0800 (PST) MIME-Version: 1.0 References: <20190205211622.GA5891@kozik-lap> <844c3f34-f7db-6b26-169a-994922367c78@samsung.com> <20190206100549.GO3837@imbe.wolfsonmicro.main> In-Reply-To: <20190206100549.GO3837@imbe.wolfsonmicro.main> From: Krzysztof Kozlowski Date: Wed, 6 Feb 2019 11:22:33 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ASoC: dapm: Check for NULL widget in dapm_update_dai_unlocked To: Charles Keepax Cc: Sylwester Nawrocki , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, "linux-samsung-soc@vger.kernel.org" , Marek Szyprowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 6 Feb 2019 at 11:05, Charles Keepax wrote: > > DAIs linked to the dummy will not have an associated playback/capture > widget, so we need to skip the update in that case. > > Fixes: 078a85f2806f ("ASoC: dapm: Only power up active channels from a DAI") > Signed-off-by: Charles Keepax > --- > > Ok so that all makes sense, this patch is probably the best fix? > > Thanks, > Charles For this particular issue (NULL-pointer): Reported-by: Krzysztof Kozlowski Tested-by: Krzysztof Kozlowski However now I see bug sleeping in atomic context: [ 64.000828] BUG: sleeping function called from invalid context at ../kernel/locking/mutex.c:908 [ 64.008483] in_atomic(): 1, irqs_disabled(): 128, pid: 353, name: aplay [ 64.014978] 2 locks held by aplay/353: [ 64.018671] #0: 1fb9b63d (&(&group->lock)->rlock){....}, at: snd_pcm_action_lock_irq+0x18/0x3c [ 64.027337] #1: 8b42bfe8 (&(&pri_dai->spinlock)->rlock){....}, at: i2s_trigger+0x130/0x6c8 [ 64.035654] irq event stamp: 8754 [ 64.038925] hardirqs last enabled at (8753): [] _raw_spin_unlock_irq+0x24/0x5c [ 64.047094] hardirqs last disabled at (8754): [] _raw_spin_lock_irq+0x18/0x50 [ 64.055068] softirqs last enabled at (8096): [] __do_softirq+0x4f0/0x5e4 [ 64.062680] softirqs last disabled at (8083): [] irq_exit+0x160/0x16c [ 64.069953] Preemption disabled at: [ 64.069956] [<00000000>] (null) [ 64.076700] CPU: 6 PID: 353 Comm: aplay Not tainted 5.0.0-rc5-next-20190206-00001-g101ffa564f78 #348 [ 64.085822] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 64.091882] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 64.099601] [] (show_stack) from [] (dump_stack+0x98/0xc4) [ 64.106788] [] (dump_stack) from [] (___might_sleep+0x264/0x2cc) [ 64.114501] [] (___might_sleep) from [] (__mutex_lock+0x40/0xa98) [ 64.122300] [] (__mutex_lock) from [] (mutex_lock_nested+0x1c/0x24) [ 64.130275] [] (mutex_lock_nested) from [] (clk_prepare_lock+0x50/0xf8) [ 64.138596] [] (clk_prepare_lock) from [] (clk_core_get_rate+0xc/0x60) [ 64.146824] [] (clk_core_get_rate) from [] (i2s_trigger+0x444/0x6c8) [ 64.154883] [] (i2s_trigger) from [] (soc_pcm_trigger+0x100/0x140) [ 64.162768] [] (soc_pcm_trigger) from [] (snd_pcm_action_single+0x38/0x80) [ 64.171349] [] (snd_pcm_action_single) from [] (snd_pcm_action+0x54/0x5c) [ 64.179841] [] (snd_pcm_action) from [] (snd_pcm_action_lock_irq+0x28/0x3c) [ 64.188508] [] (snd_pcm_action_lock_irq) from [] (snd_pcm_ioctl+0x920/0x123c) [ 64.197350] [] (snd_pcm_ioctl) from [] (do_vfs_ioctl+0xb0/0x9f8) [ 64.205054] [] (do_vfs_ioctl) from [] (ksys_ioctl+0x34/0x5c) [ 64.212418] [] (ksys_ioctl) from [] (ret_fast_syscall+0x0/0x28) [ 64.220045] Exception stack(0xe69dffa8 to 0xe69dfff0) [ 64.225058] ffa0: 004391b8 00001770 00000004 00004142 00439340 00439340 [ 64.233218] ffc0: 004391b8 00001770 00001770 00000036 00001770 00000000 00000000 be8db940 [ 64.241361] ffe0: b6fa382c be8db8ec b6f32a3c b6e42bdc [ 64.246386] [ 64.247823] ====================================================== [ 64.253979] WARNING: possible circular locking dependency detected [ 64.260133] 5.0.0-rc5-next-20190206-00001-g101ffa564f78 #348 Tainted: G W [ 64.268193] ------------------------------------------------------ [ 64.274342] aplay/353 is trying to acquire lock: [ 64.278937] 51044846 (prepare_lock){+.+.}, at: clk_prepare_lock+0x50/0xf8 [ 64.285694] [ 64.285694] but task is already holding lock: [ 64.291500] 8b42bfe8 (&(&pri_dai->spinlock)->rlock){....}, at: i2s_trigger+0x130/0x6c8 [ 64.299387] [ 64.299387] which lock already depends on the new lock. [ 64.299387] [ 64.307534] [ 64.307534] the existing dependency chain (in reverse order) is: [ 64.314985] [ 64.314985] -> #1 (&(&pri_dai->spinlock)->rlock){....}: [ 64.321667] clk_mux_set_parent+0x34/0xb8 [ 64.326162] clk_core_set_parent_nolock+0x21c/0x54c [ 64.331535] clk_set_parent+0x38/0x6c [ 64.335696] of_clk_set_defaults+0x11c/0x384 [ 64.340460] of_clk_add_provider+0x8c/0xc8 [ 64.345054] samsung_i2s_probe+0x484/0x64c [ 64.349651] platform_drv_probe+0x6c/0xa4 [ 64.354153] really_probe+0x280/0x414 [ 64.358311] driver_probe_device+0x78/0x1c4 [ 64.362991] bus_for_each_drv+0x74/0xb8 [ 64.367323] __device_attach+0xd4/0x16c [ 64.371655] bus_probe_device+0x88/0x90 [ 64.375988] deferred_probe_work_func+0x4c/0xd0 [ 64.381017] process_one_work+0x228/0x810 [ 64.385520] worker_thread+0x30/0x570 [ 64.389681] kthread+0x134/0x164 [ 64.393405] ret_from_fork+0x14/0x20 [ 64.397477] (null) [ 64.400249] [ 64.400249] -> #0 (prepare_lock){+.+.}: [ 64.405539] __mutex_lock+0x7c/0xa98 [ 64.409610] mutex_lock_nested+0x1c/0x24 [ 64.414029] clk_prepare_lock+0x50/0xf8 [ 64.418362] clk_core_get_rate+0xc/0x60 [ 64.422695] i2s_trigger+0x444/0x6c8 [ 64.426768] soc_pcm_trigger+0x100/0x140 [ 64.431188] snd_pcm_action_single+0x38/0x80 [ 64.435953] snd_pcm_action+0x54/0x5c [ 64.440112] snd_pcm_action_lock_irq+0x28/0x3c [ 64.445052] snd_pcm_ioctl+0x920/0x123c [ 64.449386] do_vfs_ioctl+0xb0/0x9f8 [ 64.453457] ksys_ioctl+0x34/0x5c [ 64.457269] ret_fast_syscall+0x0/0x28 [ 64.461516] 0xbe8db8ec [ 64.464460] [ 64.464460] other info that might help us debug this: [ 64.464460] [ 64.472438] Possible unsafe locking scenario: [ 64.472438] [ 64.478327] CPU0 CPU1 [ 64.482831] ---- ---- [ 64.487336] lock(&(&pri_dai->spinlock)->rlock); [ 64.492017] lock(prepare_lock); [ 64.497823] lock(&(&pri_dai->spinlock)->rlock); [ 64.505017] lock(prepare_lock); [ 64.508306] [ 64.508306] *** DEADLOCK *** [ 64.508306] [ 64.514203] 2 locks held by aplay/353: [ 64.517935] #0: 1fb9b63d (&(&group->lock)->rlock){....}, at: snd_pcm_action_lock_irq+0x18/0x3c [ 64.526596] #1: 8b42bfe8 (&(&pri_dai->spinlock)->rlock){....}, at: i2s_trigger+0x130/0x6c8 [ 64.534915] [ 64.534915] stack backtrace: [ 64.539246] CPU: 6 PID: 353 Comm: aplay Tainted: G W 5.0.0-rc5-next-20190206-00001-g101ffa564f78 #348 [ 64.549734] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 64.555802] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 64.563515] [] (show_stack) from [] (dump_stack+0x98/0xc4) [ 64.570708] [] (dump_stack) from [] (print_circular_bug+0x210/0x334) [ 64.578765] [] (print_circular_bug) from [] (__lock_acquire+0x12cc/0x1a5c) [ 64.587344] [] (__lock_acquire) from [] (lock_acquire+0xe0/0x268) [ 64.595142] [] (lock_acquire) from [] (__mutex_lock+0x7c/0xa98) [ 64.602768] [] (__mutex_lock) from [] (mutex_lock_nested+0x1c/0x24) [ 64.610740] [] (mutex_lock_nested) from [] (clk_prepare_lock+0x50/0xf8) [ 64.619059] [] (clk_prepare_lock) from [] (clk_core_get_rate+0xc/0x60) [ 64.627291] [] (clk_core_get_rate) from [] (i2s_trigger+0x444/0x6c8) [ 64.635349] [] (i2s_trigger) from [] (soc_pcm_trigger+0x100/0x140) [ 64.643235] [] (soc_pcm_trigger) from [] (snd_pcm_action_single+0x38/0x80) [ 64.651815] [] (snd_pcm_action_single) from [] (snd_pcm_action+0x54/0x5c) [ 64.660306] [] (snd_pcm_action) from [] (snd_pcm_action_lock_irq+0x28/0x3c) [ 64.668972] [] (snd_pcm_action_lock_irq) from [] (snd_pcm_ioctl+0x920/0x123c) [ 64.677811] [] (snd_pcm_ioctl) from [] (do_vfs_ioctl+0xb0/0x9f8) [ 64.685522] [] (do_vfs_ioctl) from [] (ksys_ioctl+0x34/0x5c) [ 64.692887] [] (ksys_ioctl) from [] (ret_fast_syscall+0x0/0x28) [ 64.700510] Exception stack(0xe69dffa8 to 0xe69dfff0) [ 64.705536] ffa0: 004391b8 00001770 00000004 00004142 00439340 00439340 [ 64.713684] ffc0: 004391b8 00001770 00001770 00000036 00001770 00000000 00000000 be8db940 [ 64.721828] ffe0: b6fa382c be8db8ec b6f32a3c b6e42bdc Best regards, Krzysztof