Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6100277rdb; Thu, 14 Dec 2023 08:17:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJif8VlUKa/1tq20PwgV2bKPfFTQ4+xc+tnGnRhPOGnzFVF3sYtFHs7dpS6wL8JyhCZGnk X-Received: by 2002:a05:6a00:3095:b0:6ce:2731:c247 with SMTP id bh21-20020a056a00309500b006ce2731c247mr3499943pfb.54.1702570635806; Thu, 14 Dec 2023 08:17:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702570635; cv=none; d=google.com; s=arc-20160816; b=H207lFRXmbyeumLYWEyVtQUDj88NU7uEgAAtVUv9AuuhgzWaehZVMwvIbIVmuV81a+ A9WZazLnH6JEqCSZ3oqqPbal403nTLigzr8U0otdVWid/QY1I6YFF3OFbCYliqCts7Mn VYDRcE0bi3mfEMGAUdxzBZzYOA2SjD8p7OAn//U3y3VCEKH27MARXwvQu0iw7A6EvE+0 fD//ZWkG+mu2Ij4ZmItTpAqM+U1/TdoYWjySXCmFPVPknXBRd+SztVZzQh9F+8BvDCci HR/JBUqYx/zosu/FbVnrEnB/bWIm5w86V56Et/UMzAJvqNCtpR+B8KWpAk5JVjZ7vXGI vluA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=QbYix1w4UHJyJ+ioQYc4DJ91pPGmRQo7dHrqC9f0kgk=; fh=OIuyOU9GxDIwQJ5U+dekdoyBWIweC/Lmzy/PbLIx2w4=; b=v7oioSrGT63IDpxVEW3xDLDnx+iqsIvqqSuPmFuUnqjv2Xd8B6qVb/8Bgr+HCuE542 Cw9nOt3F7V956H5rimSUPAGMveOJH0Bpr3agkaajEhK7RTuNzDHFhVvyZZA6olKoimi2 Ix8JFvUgFgGvCP289ChSxsEfJrMtIMTMDU8qmDWhBp5i2dgJEvVySP3w2XKGxWA5GH/O SIdPUhWNlNYXteN8vjvTRoueIZWMbvRKMDmkXG/TANff5SoYoOGCDr/zKOKYvDpTzq1s Sbd7onTAWrVngSTz4ImjZaIBglVXOY1WdfsiuJO3yptA/8VeEu0z9zZQpA1Q4KLcJvE/ NJfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=egtvOHQ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id c37-20020a630d25000000b005a0788d4a50si11119477pgl.376.2023.12.14.08.17.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 08:17:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=egtvOHQ0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 61E3D806E56B; Thu, 14 Dec 2023 08:15:57 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230082AbjLNQPj (ORCPT + 99 others); Thu, 14 Dec 2023 11:15:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjLNQPh (ORCPT ); Thu, 14 Dec 2023 11:15:37 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35044128 for ; Thu, 14 Dec 2023 08:15:42 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-54c77e0835bso11484306a12.2 for ; Thu, 14 Dec 2023 08:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702570540; x=1703175340; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QbYix1w4UHJyJ+ioQYc4DJ91pPGmRQo7dHrqC9f0kgk=; b=egtvOHQ0Yi8ktTAKeS+Qi/PmdKfW0m5GP8IMExuS+YUHBES6F+6NNjCPxBiRKW1R/z DKOR6v292fE+cCpilsuVRacJpmcEM+GzqeYCUJE7aK1+AIUCo1535Cpz12lRLlcP+fHF cWuEyE+KykIqnrNKXj024KNWTcrI+YrUKYZnCA2twydlNCbQk+wGRQzHhnzsm7rSGpY7 LFYrNKrrpKwSKxkmrYy0I/deLLKIxIf3SgUB5yh7dPy/l8r4afGXf4uo2RBZsOijt6ZE XWyh3R5brCouz0SFg29St1P37sQ8W70cWxDrKPpoWuW7nRoJaHaanb8Ydy7fm+tXMwc5 lt4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702570540; x=1703175340; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QbYix1w4UHJyJ+ioQYc4DJ91pPGmRQo7dHrqC9f0kgk=; b=Jc2I7Vx8uaSnjJcRzAIMyFikVu/5U+BLagSFMt0VnDrMzfyiAlJIitXj+At/ptkFqU 5Bd3SJPA7ubRj8LwKLo+iyd0xM1LHEjItXy8gTv1g5kB5g+Y5u0d4nv69aLKpDpjaGWh rip1fUQk2g4TdwetlpmIxXCgS2ORtsjdLVpWKvhRnCWBt07ZJGYnDWVbxO21dbMSsmZn lX4d3mPOg2x1aXQPYObYNc8qFOxhoi4+ecVqkddqvCLMLvYFunzJXt1V8ncjFRRTEFH7 4V2tsYQicYRMcZXrClTUGNebT4JJQxEUikA6VN2tmKCOJ7ICX/f4tOQsYnjvnL1OAYk9 NHYw== X-Gm-Message-State: AOJu0Yzb567SCd3PN+wmuZL0w97a92PFGvHPinCpp6gBjKzWp+8EHh6W uQ4kiRVceYuQgIU/M1XlhvEtVw== X-Received: by 2002:a17:906:560c:b0:a1d:f89d:7cb7 with SMTP id f12-20020a170906560c00b00a1df89d7cb7mr5469221ejq.92.1702570540553; Thu, 14 Dec 2023 08:15:40 -0800 (PST) Received: from [192.168.2.107] ([79.115.63.202]) by smtp.gmail.com with ESMTPSA id v20-20020a170906489400b00a1de512fa24sm9537667ejq.191.2023.12.14.08.15.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Dec 2023 08:15:40 -0800 (PST) Message-ID: <5de5cddd-2bab-4408-b31f-f48bef98f14c@linaro.org> Date: Thu, 14 Dec 2023 16:15:37 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 07/13] clk: samsung: gs101: mark PERIC0 IP TOP gate clock as critical Content-Language: en-US To: Sam Protsenko Cc: peter.griffin@linaro.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, mturquette@baylibre.com, sboyd@kernel.org, conor+dt@kernel.org, andi.shyti@kernel.org, alim.akhtar@samsung.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, catalin.marinas@arm.com, will@kernel.org, s.nawrocki@samsung.com, tomasz.figa@gmail.com, cw00.choi@samsung.com, arnd@arndb.de, andre.draszik@linaro.org, saravanak@google.com, willmcvicker@google.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-serial@vger.kernel.org References: <20231214105243.3707730-1-tudor.ambarus@linaro.org> <20231214105243.3707730-8-tudor.ambarus@linaro.org> From: Tudor Ambarus In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 14 Dec 2023 08:15:57 -0800 (PST) On 12/14/23 16:09, Sam Protsenko wrote: > On Thu, Dec 14, 2023 at 10:01 AM Tudor Ambarus wrote: >> >> >> >> On 12/14/23 15:37, Sam Protsenko wrote: >>> On Thu, Dec 14, 2023 at 4:52 AM Tudor Ambarus wrote: >>>> >>>> Testing USI8 I2C with an eeprom revealed that when the USI8 leaf clock >>>> is disabled it leads to the CMU_TOP PERIC0 IP gate clock disablement, >>>> which then makes the system hang. To prevent this, mark >>>> CLK_GOUT_CMU_PERIC0_IP as critical. Other clocks will be marked >>>> accordingly when tested. >>>> >>>> Signed-off-by: Tudor Ambarus >>>> --- >>>> drivers/clk/samsung/clk-gs101.c | 2 +- >>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/clk/samsung/clk-gs101.c b/drivers/clk/samsung/clk-gs101.c >>>> index 3d194520b05e..08d80fca9cd6 100644 >>>> --- a/drivers/clk/samsung/clk-gs101.c >>>> +++ b/drivers/clk/samsung/clk-gs101.c >>>> @@ -1402,7 +1402,7 @@ static const struct samsung_gate_clock cmu_top_gate_clks[] __initconst = { >>>> "mout_cmu_peric0_bus", CLK_CON_GAT_GATE_CLKCMU_PERIC0_BUS, >>>> 21, 0, 0), >>>> GATE(CLK_GOUT_CMU_PERIC0_IP, "gout_cmu_peric0_ip", "mout_cmu_peric0_ip", >>>> - CLK_CON_GAT_GATE_CLKCMU_PERIC0_IP, 21, 0, 0), >>>> + CLK_CON_GAT_GATE_CLKCMU_PERIC0_IP, 21, CLK_IS_CRITICAL, 0), >>> >>> This clock doesn't seem like a leaf clock. It's also not a bus clock. >>> Leaving it always running makes the whole PERIC0 CMU clocked, which >>> usually should be avoided. Is it possible that the system freezes >>> because some other clock (which depends on peric0_ip) gets disabled as >>> a consequence of disabling peric0_ip? Maybe it's some leaf clock which >>> is not implemented yet in the clock driver? Just looks weird to me >>> that the system hangs because of CMU IP clock disablement. It's >>> usually something much more specific. >> >> The system hang happened when I tested USI8 in I2C configuration with an >> eeprom. After the eeprom is read the leaf gate clock that gets disabled >> is the one on PERIC0 (CLK_GOUT_PERIC0_CLK_PERIC0_USI8_USI_CLK). I assume >> this leads to the CMU_TOP gate (CLK_CON_GAT_GATE_CLKCMU_PERIC0_IP) >> disablement which makes the system hang. Either marking the CMU_TOP gate >> clock as critical (as I did in this patch) or marking the leaf PERIC0 >> gate clock as critical, gets rid of the system hang. Did I choose wrong? >> > > Did you already implement 100% of clocks in CMU_PERIC0? If no, there yes. > is a chance some other leaf clock (which is not implemented yet in > your driver) gets disabled as a result of PERIC0_IP disablement, which > might actually lead to that hang you observe. Usually it's some > meaningful leaf clock, e.g. GIC or interconnect clocks. Please check > clk-exynos850.c driver for CLK_IS_CRITICAL and CLK_IGNORE_UNUSED flags > and the corresponding comments I left there, maybe it'll give you more > particular idea about what to look for. Yes, making the whole CMU > always running without understanding why (i.e. because of which > particular leaf clock) might not be the best way of handling this because of CLK_GOUT_PERIC0_CLK_PERIC0_USI8_USI_CLK > issue. I might be mistaken, but at least please check if you > implemented all clocks for PERIC0 first and if making some meaningful > leaf clock critical makes more sense. > Thanks, ta