Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3045774img; Mon, 25 Mar 2019 02:36:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUIex8Hn5w4Bna+qPAR1gH410VZ5Zn/ohe0alcHWQZvCzZ7iSaU1LNKJxd9/UATmAcLCV/ X-Received: by 2002:a65:5049:: with SMTP id k9mr9772139pgo.229.1553506582587; Mon, 25 Mar 2019 02:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553506582; cv=none; d=google.com; s=arc-20160816; b=TbCNdUVI9dbKinbg7NPL9OR6VGGqoakAWcYB6XxqIfm8DbaFarMaI16BDiwuB3WSet Gg7AWVIMOY3TL4yASI63HXj1/rG2ADFqlgtl/xjngB9CYCqZWyaAQWJ6QPUmluVUa5w4 h9dMLBOSEapK9l1CJ3GgbHqwALXY8FCl4G5mCZe0AP1wKWkeuVCbjHm0Ougt0lSE4SKz a/zHbVnJjJPVsJohwI/yIlEnPSRrkW2dCE6bhn4+Vk3C+7Bj2b6OPCuAo7u+h9rvwEPq TlTz+VI52uJpdoaww6pJ7ub0ExbTiI+BYYe/osgWuex2KE8unhawUYErgnYKnAruPXOS AwHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=Rle8vsvUTQ0auhIf9QOOwZv4gCpStzfFAzM2K4rd5bI=; b=0/8rCgHU0g9hM7KeZ3Wd68Cjebt9kF91Ox4Jmb2Iz8sUojBYf0qYJhxJrRhvHDBZKW g7TH+YVSBOLu0Qde9DkFGMKYG9NcH3NUhLgspv0fnD7WdMjpOb8nR2K13azBBYlMfZOE HP++E3LrROVQelaBBh2StXAHZtaSWiMydhY0RQAyTmD+8I+orz+/dtnLgv3kbxa/Oqgz kru1NvTenerImUAftmA18mE3XOcDNx5q/DdQaQxE4fb1a1XRcWfOIWPyjnxSbdgTNtng UjB/avuHSKpv5PujBpBUgbbNYiQcknWXY2uNl37D0DtB7uqwyNx2mh2K3yemYxKVWTCu QFvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=YAUBhxw0; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9si13837101plr.319.2019.03.25.02.36.07; Mon, 25 Mar 2019 02:36:22 -0700 (PDT) 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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=YAUBhxw0; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730339AbfCYJfS (ORCPT + 99 others); Mon, 25 Mar 2019 05:35:18 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37387 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730327AbfCYJfR (ORCPT ); Mon, 25 Mar 2019 05:35:17 -0400 Received: by mail-wr1-f65.google.com with SMTP id w10so9247191wrm.4 for ; Mon, 25 Mar 2019 02:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=Rle8vsvUTQ0auhIf9QOOwZv4gCpStzfFAzM2K4rd5bI=; b=YAUBhxw07k758cPR309I54mxOBzO4+i34SGMAJRJF0dJ6SBAJIRbN3OuPKtbfURt7j 6vtJ3zINHrUu+3z7r1Q8Q9svGY5oTHOp348UJC7MP4FOnGyF+hKkPl/GliTKjL3rl5/K iJtsW9fHYUQh9SbuE65iW6QsB8aHgr40tai5IGUHjG77LyYsvizvwy+5kWr9dcUQJQUm f4qDbuxVvDsxkWsHu/BVx+u1Z3Niob3BAIA2qx2gnRMygGsCeFK0N1f58/4uxTJlcWcD /9kpEjeWrZgfTjWHYx5Ksq7ciMl3ge6CP5Hz05dSLnbEwr1YRTOUftm45VMFJignrcfb ndFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=Rle8vsvUTQ0auhIf9QOOwZv4gCpStzfFAzM2K4rd5bI=; b=fJDZsKNMQ1UMW3wjCq8z/E69bQhO4Vd/44gIX6UrsnWM3mUpvbLbRZ8fiOuqAhWR3t Fbb1XD2su3Y0SbCjC9B7p+0lF7n9RxT9FeJQin/8LkxdbpoE6OuYCoqj38nnU51K/5/O k5UEZcSctuLctEIDi5coLaS/HJmm6O7yVHqrMmHr9bxzkXbsiPK03VXK1TrtkH01KEoy igFyWdYa1zoblrYZotpNCFpBwvkawYdcs7gRCOEyT48R+mYN1O6YUVRmZZRToZrxlaS1 8uLbsfyOtX0G/1rw6j2xcpwv8SgqH93c2tZ0cHSHd/b1ND+v8UKpQkekjzM6SnnTCS2C 8J7Q== X-Gm-Message-State: APjAAAVCEhc1z2bVSqWBLKNMi+QVXiAZl1AbWrgUK9qAXNr1tNwa59lJ WawUTjR7ns0jpcbYyxWnDXfArQ== X-Received: by 2002:adf:f286:: with SMTP id k6mr6509521wro.137.1553506515639; Mon, 25 Mar 2019 02:35:15 -0700 (PDT) Received: from boomer.baylibre.com ([2a01:e34:eeb6:4690:106b:bae3:31ed:7561]) by smtp.gmail.com with ESMTPSA id 3sm20408847wrk.68.2019.03.25.02.35.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 25 Mar 2019 02:35:14 -0700 (PDT) Message-ID: <47e944da1c3b0a11cf46fc5ad5678ba961b9f9d3.camel@baylibre.com> Subject: Re: [PATCH 0/1] pwm: meson: fix scheduling while atomic issue From: Jerome Brunet To: Martin Blumenstingl , thierry.reding@gmail.com, narmstrong@baylibre.com, linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Mon, 25 Mar 2019 10:35:12 +0100 In-Reply-To: <20190324220217.15813-1-martin.blumenstingl@googlemail.com> References: <20190324220217.15813-1-martin.blumenstingl@googlemail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 2019-03-24 at 23:02 +0100, Martin Blumenstingl wrote: > Back in January a "BUG: scheduling while atomic" error showed up during > boot on my Meson8b Odroid-C1 (which uses a PWM regulator as CPU supply). > The call trace comes down to: > __mutex_lock > clk_prepare_lock > clk_core_get_rate > meson_pwm_apply > .. > dev_pm_opp_set_rate > .. > > Jerome has also seen the same problem but from pwm-leds (instead of a > pwm-regulator). He posted a patch which replaces the spinlock with a > mutex. That works. I believe we can optimize this by reducing the time > where the lock is held - that also allows to keep the spin-lock. > > Analyzing this issue helped me understand the pwm-meson driver better. > My plan is to send some cleanups (with the goal of re-using more of the > goodies from the PWM core in the pwm-meson driver) after this single fix > is merged (they can be found here: [1]). Thanks for fixing this Martin. As for the future enhancement, I'd like to know what you have in mind. As I have told you previously, I think the clock bindings of this driver are not great. The global name of the input clocks are hard coded in this driver and it sucks. CCF is evolving to rely less on these global names. In addition, the 'clock' binding should be used to refer to the clock 'consumed' by the device, not to define a setting (as done now). 'assigned- clock' binding can be used for that. This would be a significant change in the binding meaning of this driver, which probably calls for a v2. Last, instead of specifying the parent to be used, I think we should come up with some code to let the driver pick the most appropriate parent for the period/duty requested. > > Dependencies: none > > Target version: please queue this for -fixes so it makes it's way into > v5.1-rc (so we can get it backported from there, because this issue has > existed since the pwm-meson driver was introduced). > > > [0] http://lists.infradead.org/pipermail/linux-amlogic/2019-January/009690.html > [1] https://github.com/xdarklight/linux/commits/meson-pwm-for-5.2-v0 > > > Martin Blumenstingl (1): > pwm: meson: use the spin-lock only to protect register modifications > > drivers/pwm/pwm-meson.c | 21 +++++++++++++-------- > 1 file changed, 13 insertions(+), 8 deletions(-) >