Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp344805ybl; Tue, 7 Jan 2020 20:51:55 -0800 (PST) X-Google-Smtp-Source: APXvYqxlt6uTh/WV01voNe5NKqK6lEPJksCGQnI7STcOjTqYrUlflguhcNf4WcDozrrgx+eSla5O X-Received: by 2002:aca:c08b:: with SMTP id q133mr1577982oif.46.1578459115646; Tue, 07 Jan 2020 20:51:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578459115; cv=none; d=google.com; s=arc-20160816; b=PID/8P/xiXZRVwHT5DJTRRuqobULVVEVPTQ7+ssGawkGJj7W4o7/Cm8UV5qEfTD6we 59aPgiuj+VZw+xmWRjDYigbqnMFPFREyahxg74FajaDo2D0U3iAM0rAxrc9QczSkXVh+ 8VcTXwn5UjbA8e2Yyp+A7y7YDKMGX1Jj5P4udB8RXKX+EGGRbG+lklRdv7cMGlUT1vpN Xjl9MVPU0dJrIc1DfUnfBa1gOB5j/xW8WzcwXX8mf77uKqzwCsfWA+SlzOxQDe1C3Ajd Z4HYMxqxOW94kRxEYqCBBuLY2SqAs+qeTD0QMFSwS0J3b6EKnmOYROVNrWLFa4BuJHt0 eI0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=PCXVPzPJzd1sJcj4gbIN14vn1t4Dc66uzQlFAt6SvlE=; b=FcZBGLJqgmyq1Y1+Brfn4jd0SFPPdqtZ4f8H3K2t01Q02eVUIOO1N+PXzVaeaBX9oj WW1UyqpTieROqaefX+MYoTIQxq6EL7NRViv9vUKBuBsP1XLzSuWAtTCsWMtuVaWXKdyU 7RDJEVcLLIkDP7uofB2MBZ6GwnAGR1O1z0qmlJ1WLtJq7b26uTTlE6P8i5QjPE3STk2D DFWNwgihPUlK3sjUfyP0JQ4Z3c6hstww7Y8hmwUgLXdrJuebsJB7FFYUks19FuBZLMTQ 9x2Lu+BdWcl5iXHDtbY2drcQhikoRz26phGmFH3/nFL3tfXhcDjL72xN5KRKxFZ+qk05 QOCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=lkDhV3Vf; 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=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p6si1216739oig.88.2020.01.07.20.51.39; Tue, 07 Jan 2020 20:51:55 -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=@nvidia.com header.s=n1 header.b=lkDhV3Vf; 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=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726290AbgAHEum (ORCPT + 99 others); Tue, 7 Jan 2020 23:50:42 -0500 Received: from hqnvemgate26.nvidia.com ([216.228.121.65]:13314 "EHLO hqnvemgate26.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbgAHEum (ORCPT ); Tue, 7 Jan 2020 23:50:42 -0500 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 07 Jan 2020 20:50:24 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 07 Jan 2020 20:50:41 -0800 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 07 Jan 2020 20:50:41 -0800 Received: from [10.24.44.157] (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 8 Jan 2020 04:50:40 +0000 Subject: Re: Re: [PATCH] regmap: add iopoll-like atomic polling macro To: Mark Brown CC: , , References: <1578392889-16587-1-git-send-email-spujar@nvidia.com> <20200107120902.GC4877@sirena.org.uk> From: Sameer Pujar Message-ID: Date: Wed, 8 Jan 2020 10:20:37 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20200107120902.GC4877@sirena.org.uk> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL111.nvidia.com (172.20.187.18) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1578459024; bh=PCXVPzPJzd1sJcj4gbIN14vn1t4Dc66uzQlFAt6SvlE=; h=X-PGP-Universal:Subject:To:CC:References:From:Message-ID:Date: User-Agent:MIME-Version:In-Reply-To:X-Originating-IP: X-ClientProxiedBy:Content-Type:Content-Transfer-Encoding: Content-Language; b=lkDhV3VfhUSXG3APPOZzPXrKfJwaj/ui8XTRRS9uIPL32aNSwYv8c72VFEVKdBWQ3 zffTU/J3GugtvXQNG2R/WnGWosU6XnzW2pkFmNS1Ob5u/0MfEI/UZeMkevNXmVw6mW cOHiG6FXLMyZZ4R5QgzYf6AJl9M2t4OiPqYAsSQFEaBTw1OhyslX9hFBX70kcGJ+dt sj2G0G+Ezh7+hTp3pX+66bPIXebEXh+bkGAS/81De7Lt8ELYbycFcfPxEhJ54IO+0L NmxgGtk2BOe4FHgGmNK+/DLQkD+A2WRbbFhttjzPl0/9RGwfVK6NzRG+SW7bfFjdm4 NAzrS6M4i+yiQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/7/2020 5:39 PM, Mark Brown wrote: > On Tue, Jan 07, 2020 at 03:58:09PM +0530, Sameer Pujar wrote: >> This patch adds a macro 'regmap_read_poll_timeout_atomic' that works >> similar to 'readx_poll_timeout_atomic' defined in linux/iopoll.h; This >> is atomic version of already available 'regmap_read_poll_timeout' macro. > In general regmap really can't be used in atomic contexts - we do have > options to configure a regmap so it can be used there but they're not > the default. It'd be better if the comment mentioned this and warned > against use with normal regmaps so people are less likely to try to use > this in an atomic context when the regmap doesn't support that. Oh I see. While using regmap_read_poll_timeout() in snd_soc_dai_ops trigger callback, I was hitting below print. "BUG: scheduling while atomic" and kernel panic there after. While checking the documentation on snd_soc_dai_ops, it appears trigger() is in atomic context. This means I cannot use regmap interface (with default configuration) in trigger(). The above issue went away with usage of regmap_read_poll_timeout_atomic() and now I think I just got lucky. Also, with the limited testing, I did not see the issue in current linux-next, where as I hit above issue in older kernel. Has anything changed with respect to above? Though I need to test this, I guess there is a way to use non-atomic versions of PCM operations by setting 'nonatomic' flag in snd_pcm and continue to use regmap_read_poll_timeout(). In that case new macro may not be necessary.