From patchwork Mon Apr 1 17:57:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Martin Blumenstingl X-Patchwork-Id: 10880419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B7CB21708 for ; Mon, 1 Apr 2019 17:58:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A3ACE28630 for ; Mon, 1 Apr 2019 17:58:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 972D328640; Mon, 1 Apr 2019 17:58:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3FB1528630 for ; Mon, 1 Apr 2019 17:58:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=jf+Eaxd75IdLAkea9pwkQplMl5cjHwkXUTo5QLAOWpU=; b=uFFoE86hpkRzmB j7pfPj1zGuD3DukKmtxq+0blnxxNYDrip4joJXhtmWHBuILynuCloc9xF46+yFgt4kWR5hBqgjVjU UUzwFSb2t/IPTeKyDTgz3cC8320Kt983tZUWwOxvMkjK1BeJoO2F5/9xhuvILW3IgrMj7hWvOV3TD fO444v9Nzemr6vjIHSXeMiuPrwGmdlSCfjZlnaPv1tM1aiYNVIjDjNQ0eGWPVtFwKIo5takQw4dUL eycagxLOns8imlZIxuaz5P+k+AI2YXd1TODqkOMaPv80bZxRai69Z/NuP41JkUEOw3TypPSWpoVF3 gCfe4KtWgYC2lhh4uTHQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1CM-0007Ou-Eo; Mon, 01 Apr 2019 17:58:18 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1CJ-0007O0-8R; Mon, 01 Apr 2019 17:58:16 +0000 Received: by mail-wr1-x443.google.com with SMTP id j9so13223926wrn.6; Mon, 01 Apr 2019 10:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NIsstsLHXU9Ct92TAvs2WRZTq4h4a7o49yCQryjDdYI=; b=pCxXWN9ILOqUQtaaqVwVX5ZZudlFpiL+dAZgOHbxCj53xV2w03weIzp+0x4A8nWfP3 KswrVT0yhtRLQ1dZrR5gTlgRZROhWGRHrCPXoq/M2/hZfuAoUSvESF2/E6afh0W8M2mu fPj6GpuQjFGQHLBbzaT9i6+NNr5+hxsETFl9EELM2O3/yIwkrdR8oQZpmvOtlCrrPZcC +L5QaeayQ+3p/zz2WBQwLUOpFtLLJsRoHcC+riZ/I83EhVB9Tvxsy0F12GH1iIukuVbL arpQjyejBolL680NxtNvD43FaBY/5DIozGyRgO6C9ea6C6TEOVkh0JWOISK+v4mahtND LDUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=NIsstsLHXU9Ct92TAvs2WRZTq4h4a7o49yCQryjDdYI=; b=G4k+LGotgIY5+3blr5QiXFCfumDUMjunN1fl3DChun8hVKJ7jlkZRQJVeaI9P/JgiT Gla5c0+xS7HfMGg3PaLvx6HgsO0lQgLhrqYPWdYRj8mxyDJzpec5Azz5D1fFSN9uk1iP 0sdNfMMIZ+yYWUVsjEP7NIHya7zekWL+v24jes0Mw5UnJXDPDnhaiP+cZllF2PGlv6Bi pQsraCFoir0jO24vehLPa688sa7Wb/1zo5Xj8IETPcoUSVI/xM3GO6RY0nJtb+xOouwt IHM8FGyVBA+mG99287/K5Lfj5KIqBgZR8617oOgh3rgLr9IeM20MBxr5JzG75SgxztpY qYkA== X-Gm-Message-State: APjAAAVPLXAqfGc1FWKSw06NIf2bR31uOHnMtHhbl6i41o0KAQ/6L2Vp i4KYW+rC0HF0RDx+RH5IGeE= X-Google-Smtp-Source: APXvYqzpRXEsO4JmSVwj8Jr9zU5efB21av7Qsv/rlpCtQ+3+BXiUG/rvftQ5mqXhFwjjbqXoQV2Q7g== X-Received: by 2002:adf:cf05:: with SMTP id o5mr5254195wrj.8.1554141492517; Mon, 01 Apr 2019 10:58:12 -0700 (PDT) Received: from blackbox.darklights.net (p200300DCD73A0800C9C8A7BE25478D36.dip0.t-ipconnect.de. [2003:dc:d73a:800:c9c8:a7be:2547:8d36]) by smtp.googlemail.com with ESMTPSA id s189sm16655340wmf.45.2019.04.01.10.58.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 10:58:11 -0700 (PDT) From: Martin Blumenstingl To: thierry.reding@gmail.com, linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org Subject: [PATCH v2 0/1] pwm: meson: fix scheduling while atomic issue Date: Mon, 1 Apr 2019 19:57:47 +0200 Message-Id: <20190401175748.5376-1-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_105815_293999_B07B0AF2 X-CRM114-Status: GOOD ( 11.74 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: narmstrong@baylibre.com, Martin Blumenstingl , linux-kernel@vger.kernel.org, u.kleine-koenig@pengutronix.de, linux-arm-kernel@lists.infradead.org, jbrunet@baylibre.com Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 after this single fix is merged. The goal of these cleanups is to re-use more of the goodies from the PWM core in the pwm-meson driver as well as to address issues spotted by Uwe Kleine-König (these issues violate the PWM API, but none of these result in breakage of the boards/.dts that we currently have). These follow-up patches can be found here: [1]. 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). changes since v1 at [2]: - added comment about usage of the spinlock as suggested by Uwe Kleine-König (thank you) - collected Uwe Kleine-König's Reviewed-by [0] http://lists.infradead.org/pipermail/linux-amlogic/2019-January/009690.html [1] https://github.com/xdarklight/linux/commits/meson-pwm-for-5.2-v1 [2] https://patchwork.kernel.org/cover/10867757/ Martin Blumenstingl (1): pwm: meson: use the spin-lock only to protect register modifications drivers/pwm/pwm-meson.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-)