Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp508300ima; Wed, 6 Feb 2019 03:58:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IbETLDD2qr4O00nhLtVY1/8aHjg4IVd0E3p58insZzmsSTvK9T9Cu0lZ+IIXzFcfw/tA5VT X-Received: by 2002:a17:902:b214:: with SMTP id t20mr10054538plr.248.1549454325699; Wed, 06 Feb 2019 03:58:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549454325; cv=none; d=google.com; s=arc-20160816; b=Ykq5PfHH1owGHk9WzoEPbYrlr7a91zUTAxVY4viCIdUUDV/oQfjSr5ouVzpdpLZdTr eiE9+Wy/V4Ob2uxUnRJpAFe/dQLhPwCoVOa/p8OI6+iMgs0cwwzZPEm/XLtoC/3j63jE VoYhzASai3BBmNwCvFEB08zPtV0x3HNQ4DuxAuTCsI4IjjCr2OBi3svP77Ng+Q2vqDSm S2NYjAeO17xCHuSuQl1ajZ92c5kzNFDlJRi0Fnl6xZCGKbM3hq2xdMUV+A5zhct7LrZW h21FdYLkPEGi5H+Bb7IH09O16XF68FX8J0/dv1bnzqc6asIPnV+5RThA8/L8gbvYFkq0 fU+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=9cAx3mTJqMODZxOOZ32jgLnIve8NGicMu6kC5sDlmOo=; b=ucWoBK8LkBD4Z0gadROob2L7BREprp1aEgx34CT1XbU7qFJSbmYYtNSTP1/EQr8rVu 5LhthyG2KD1D7S3ic+cdLz91b8nYXXoHdZVWKu2iokZs2zN+rU8nchZWhcKGNBPp9AGt DiWuaZHxvWQ5Lz3GUfv2zEm9T+mgfr5gTm5uojRyoTkfxGwmx25EwarZiutFYkTGDUG1 VJekBrPUzIV/cT0Cg3Cm5HqSNAY6G0ODhYAS50kuG7GUD0QT4EauP3h878qOH3VdOghg EoyqHkIZBcyaPjgq7gYWzp9l/wvc43BElIjbdeepeGCvlchSpAMi/mdxLa/MP78fSlqe f4pw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3si5582095plk.424.2019.02.06.03.58.30; Wed, 06 Feb 2019 03:58:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729863AbfBFLq3 (ORCPT + 99 others); Wed, 6 Feb 2019 06:46:29 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:55560 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727080AbfBFLq2 (ORCPT ); Wed, 6 Feb 2019 06:46:28 -0500 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x16BdHuG023808; Wed, 6 Feb 2019 05:45:48 -0600 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0a-001ae601.pphosted.com with ESMTP id 2qfp5p8sut-1; Wed, 06 Feb 2019 05:45:48 -0600 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail1.cirrus.com (Postfix) with ESMTP id 899E8611C8B2; Wed, 6 Feb 2019 05:45:47 -0600 (CST) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Wed, 6 Feb 2019 11:45:47 +0000 Received: from imbe.wolfsonmicro.main (imbe.wolfsonmicro.main [198.61.95.81]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id x16BjjKE024165; Wed, 6 Feb 2019 11:45:45 GMT Date: Wed, 6 Feb 2019 11:45:45 +0000 From: Charles Keepax To: Krzysztof Kozlowski CC: Sylwester Nawrocki , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , , , "linux-samsung-soc@vger.kernel.org" , Marek Szyprowski Subject: Re: [PATCH] ASoC: dapm: Check for NULL widget in dapm_update_dai_unlocked Message-ID: <20190206114545.GR3837@imbe.wolfsonmicro.main> References: <20190205211622.GA5891@kozik-lap> <844c3f34-f7db-6b26-169a-994922367c78@samsung.com> <20190206100549.GO3837@imbe.wolfsonmicro.main> <20190206105955.GP3837@imbe.wolfsonmicro.main> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902060093 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 06, 2019 at 12:14:56PM +0100, Krzysztof Kozlowski wrote: > On Wed, 6 Feb 2019 at 12:00, Charles Keepax > wrote: > > > > On Wed, Feb 06, 2019 at 11:22:33AM +0100, Krzysztof Kozlowski wrote: > > > 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 > > > > Does this probably definitely get fixed by reverting my patch? > > It's just a bit odd as this seems to be complaining about a clock > > operation in i2s_trigger and I don't think my patch should have > > any affect on the trigger callback. It should get run from either > > the dai_link DAPM event or hw_params, neither of which should > > happen in an atomic context. > > Before this fixup, probably NULL pointer happened before any of this. > I tried it now few times and the possible deadlock and sleeping in > invalid context did not appear. It might be random/racy or totally > unrelated to your change. > Looking through I think this is an unrelated issue. Assuming the driver in question is (sound/soc/samsung/i2s.c). Inside i2s_trigger, there is a call to config_setup(i2s), which in turn will call clk_get_rate if i2s->quirks contains the flag QUIRK_NO_MUXPSR. The trigger callback can be made from an atomic context and clk_get_rate will take the prepare lock of the clock. The clock prepare lock is always a mutex which shouldn't be locked from an atomic context. So it seems like this will fail whenever that QUIRK_NO_MUXPSR flag is set, no idea what causes that to be set. It looks like this bug was introduced by this change: 647d04f8e07a ("ASoC: samsung: i2s: Ensure the RCLK rate is properly determined") Thanks, Charles