Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4014021ybg; Fri, 25 Oct 2019 12:06:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqys7nrPKYNTMS+ErMeIuiwXz8CAxCviaI41iV/XmG/sHAos+J7tEw3FczP6hF00rs/EHWJg X-Received: by 2002:a17:906:400f:: with SMTP id v15mr2726364ejj.126.1572030382333; Fri, 25 Oct 2019 12:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572030382; cv=none; d=google.com; s=arc-20160816; b=mMzd6UL4nUUlJhDef23BOuuncw9RNKAuTXSe5dtRGxw59rTHLD9Xd/yvkhXXV+IdeM QABhVbN370sYxAhIC/Sat5Ggjv+Wkbem6P25g8Q3m5ukQ4twESlM429HAPhBxxDmjTRE YZmzzFcAzW17MEOfsZp9zWXgbtS9N/KQ+Xaj1OY1mB5mwvbTEqOVZ0A+9vZzdrQngwoJ NHRWhFfK46xMtC5onToy0U5H0bsMbtPa4DpSlIT4wB471VJoyRXRq3vxjCEYZjNLjY0+ X3tZcT2aqgdUCTpbrhIvqXo/XzT+D3KfaF5pgMSF9qEdbpZ8MrB+IJsbQuEVOWP2B3pP +YVQ== 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=It61OojkGpwBR4FS4phB+Jtpjryl2QDg9lEM2L8kypw=; b=hcYW6T5j6XY66l/vzMesP6nJDUd0F1s+AQknnfeypYektC2qzga8od2+na6IosvbVG STTBpO6Io8MYNVi3Lo/Rlb/okInCrD8TkhBywEx9t9T+2hsBzywcdec5R0I3gVJzq6CF JEjDFtI1cFDIBHvYyBJw4GbYCivOBjRKyl0bFFWsi3EoKWuYvWX2t22ep1MsfRZvCAg+ hth7A9Q/bPcT5bMUMZQ1VFj058iJxt7lc0B4HoqfwzbvJc3bOtrXUOXkDVMALdXT2nP7 9JP8j+/T7lcwejlLspaHI0qtdJmIZZ+7lAlG9gU/Kkpxz+BrN505i8fbbLqGGpdt0nTc P6kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=grUjTgES; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si1790840edw.51.2019.10.25.12.05.58; Fri, 25 Oct 2019 12:06: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=@googlemail.com header.s=20161025 header.b=grUjTgES; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727237AbfJXUU3 (ORCPT + 99 others); Thu, 24 Oct 2019 16:20:29 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:34231 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfJXUU3 (ORCPT ); Thu, 24 Oct 2019 16:20:29 -0400 Received: by mail-oi1-f195.google.com with SMTP id 83so21821237oii.1; Thu, 24 Oct 2019 13:20:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=It61OojkGpwBR4FS4phB+Jtpjryl2QDg9lEM2L8kypw=; b=grUjTgESz2e8e+WknNShVkcsmVLbC3RLlzkivGUMvjpG41LEEyOmD0w4k5lmin/HkO ZBsNiwcd5tEhzWkgVb1yNPt9467e12h/vrq5zSQEI9iH0NJhR5U7f36EGFHIzgHuKSWS hMCBQGnDWDcCdXbPO67pe6wb8HkwXDVZf8Euf/NbT3fNlzr0oiK1dsCKQcO8LVO7qCu4 SGyEIXoE3ToaOcSiibun/aktTFQRQ8eqbul0EUXEEEPllMsr5DbUJv2cas3Yf6cnnDQC sxIIt4QLZ3sgAFkLuApxQWyIyMHHtMkZAQLCvJf8VGItzEeU2IJLgXVRSZcHQayu1Leu R1AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=It61OojkGpwBR4FS4phB+Jtpjryl2QDg9lEM2L8kypw=; b=Tj8DFXjcUvq6PILTI2fGcZ2pYDFEJFQ/MGy5zh0MfW5sFuh8zburf1e7soXcfevzp1 KZ+j7rWKA2H0G4T18unB0qzhKh+sOrZ4PqqFujH3a+CZNUJolDkN+9cadA3pUOFaPkVk JuPz/RqsYQK2jV3Zrjx7Y+HJ4rLWj70o6JOu9bnVJbWZNu2bcED0+nkzKSPzZoqOHxN0 BBs5oNKP/6uygsNcHsSLLAxTfHXbL+nYsnPdTI4ZHilS7qYX/1ZfGkvzdIjnms0q16CD vqZsRjVgNM2izfg1Skcgwpx/EwAJpNka939DjadZHlwmg0n2veCsC4LgkbheWVkLJxD4 JYJg== X-Gm-Message-State: APjAAAXzNFNgf1LIMxYhqOEu5cJgQzJGd1YDU98ivDyJSGyKOeMGa4S2 8E3uVAhF1LBCVc6/4u3W5ZPgarwyfMIe99Zk6Ag= X-Received: by 2002:aca:1b18:: with SMTP id b24mr6291732oib.15.1571948428082; Thu, 24 Oct 2019 13:20:28 -0700 (PDT) MIME-Version: 1.0 References: <20191007131649.1768-1-linux.amoon@gmail.com> <20191007131649.1768-6-linux.amoon@gmail.com> <7hsgo4cgeg.fsf@baylibre.com> <1jwode9lba.fsf@starbuckisacylon.baylibre.com> In-Reply-To: From: Martin Blumenstingl Date: Thu, 24 Oct 2019 22:20:16 +0200 Message-ID: Subject: Re: [RFCv1 5/5] arm64/ARM: configs: Change CONFIG_PWM_MESON from m to y To: Anand Moon Cc: Jerome Brunet , Kevin Hilman , Neil Armstrong , devicetree , linux-arm-kernel , linux-amlogic@lists.infradead.org, Linux Kernel 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 Hi Anand, On Mon, Oct 21, 2019 at 4:11 PM Anand Moon wrote: > > Hi Martin, > > On Fri, 18 Oct 2019 at 23:40, Martin Blumenstingl > wrote: > > > > Hi Anand, > > > > On Fri, Oct 18, 2019 at 4:04 PM Anand Moon wrote: > > [...] > > > > Next step it to try narrow down the clock causing the issue. > > > > Remove clk_ignore_unused from the command line and add CLK_INGORE_UNUSED > > > > to the flag of some clocks your clock controller (g12a I think) until > > > > > > > > The peripheral clock gates already have this flag (something we should > > > > fix someday) so don't bother looking there. > > > > > > > > Most likely the source of the pwm is getting disabled between the > > > > late_init call and the probe of the PWM module. Since the pwm is already > > > > active (w/o a driver), gating the clock source shuts dowm the power to > > > > the cores. > > > > > > > > Looking a the possible inputs in pwm driver, I'd bet on fdiv4. > > > > > > > > > > I had give this above steps a try but with little success. > > > I am still looking into this much close. > > it's not clear to me if you have only tested with the PWM and/or > > FCLK_DIV4 clocks. can you please describe what you have tested so far? > > > Sorry for delayed response. > > I had just looked into clk related to SD_EMMC_A/B/C, > with adding CLK_IGNORE/CRITICAL. > Also looked into clk_summary for eMMC and microSD card, > to identify the root cause, but I failed to move ahead. I learned to be aware of the decisions that I make when finding a bug somewhere instead of following the initial problem that I see I ask myself "is there any proof that this initial problem is the actual root cause". I can then make the decision to do some experiments to rule out a problem - until I come to a point where I ask myself again "am I still going in the right direction - how does this bring me to the root cause of the problem" unfortunately that's harder than it seems - but it keeps me from spending time going in the wrong direction > > for reference - my way of debugging this in the past was: > > 1. add some printks to clk_disable_unused_subtree (right after the > > clk_core_is_enabled check) to see which clocks are being disabled > > 2. add CLK_IGNORE_UNUSED or CLK_IS_CRITICAL to the clocks which are > > being disabled based on the information from step #1 > > 3. (at some point I had a working kernel with lots of clocks with > > CLK_IGNORE_UNUSED/CLK_IS_CRITICAL) > > 4. start dropping the CLK_IGNORE_UNUSED/CLK_IS_CRITICAL flags again > > until you have traced it down to the clocks that are the actual issue > > (so far I always had only one clock which caused issues, but it may be > > multiple) > > 5. investigate (and/or ask on the mailing list, Amlogic developers are > > reading the mails here as well) for the few clocks from step #4 > > > > Thanks for you valuable suggestion. I have your patch to debug this > [0] https://patchwork.kernel.org/patch/9725921/mbox/ > > So from the fist step I could identify that all the clk were getting closed > after some core cpu clk was failing. Here is the log. > > step1: [1] https://pastebin.com/p13F9HGG > > so I marked these clk as CLK_IGNORE_UNUSED and finally > I made it to boot using microSD card. nice, congrats for finding this! > After this just I converted these CLK to CLK_IS_CRITICAL > as mostly these are used the CPU clk for now. > Here is boot log successful for as of now. > > Finally: [2] https://pastebin.com/qB6pMyGQ > > I know clk maintainer are against marking flags as *CLK_IS_CRITICAL* > But this is just the step to move ahead. > > Attach is my local clk and dts patch.Just for testing. > [3] clk_critical.patch > > Plz share your thought on this. interesting, the clock driver for the 32-bit SoCs (driver/clk/meson/meson8b.c) sets CLK_IS_CRITICAL for meson8b_cpu_clk. you have something similar in your patch for the G12A/B CPU clocks I guess that also explains why changing CONFIG_PWM_MESON from =m to =y "fixes" it: - as long as the PWM driver is not loaded the VDDCPU regulator does not probe either - this goes on for the initial boot process - now the PWM driver is still not loaded and the common clock framework tries to disable the unused clocks - it disables the CPU clock and the system now stops working - (only later it would load the PWM driver and allow the cpufreq subsystem to come up) with CONFIG_PWM_MESON=y you get: - PWM driver is built-in so the VDDCPU regulator shows up - the cpufreq subsystem comes up and enables the clock (in reality it only increments the refcount because the clock is already enabled) - the common clock framework tries to disable the unused clocks - it doesn't disable the CPU clock this time because it's used (according to the ref count/enable count) - ... Martin