Received: by 10.213.65.68 with SMTP id h4csp214626imn; Mon, 12 Mar 2018 11:26:59 -0700 (PDT) X-Google-Smtp-Source: AG47ELubtQBh9paIsZWG6T2Fw3zgyhC7Df9FJ5z8rF19p0hmSSJ0oDudty9CAabLwFXdQYuoPyck X-Received: by 10.98.70.198 with SMTP id o67mr8797094pfi.173.1520879219078; Mon, 12 Mar 2018 11:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520879219; cv=none; d=google.com; s=arc-20160816; b=plJDrZwrwE0cT9wiaEoOaxH23TbamrPSzQc2WtrjZHUtsqQ7eq6MI82oR7565OJx9x H3OdE+tX437MBAKf3uVXIONjt8LdpkqhtbKjdXEQAZS6wCPeeoxPdz5m0iwpYsflHk1D YUsURh2pO8OW7OCzIxTwqRSvZJ6o3mrvq4reG3m9yoFST1yRoYXZZqXbRqyjsbJ5Uank dpsRwq42Z0vTykcwGsmwA0G5D6GATrDxlIaMu0JLdkUJn4sKl5T7QQUDWG02rWxO7VDW SJqMUJzipQuS0BQRVAZ9B5dghp0FtGS5FvIiqBKTWAGUqMN3WxMdMPVtDbVE5nE1CzAc lktw== 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:message-id :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date:dkim-signature:arc-authentication-results; bh=9sBGIzm9ylNzKM26qvIsmygRmgXGtSeK+LabRxCs73I=; b=JheAldjX4k3Mm1GzW6TPfuUeqsC4M70UAdZymLVGbam0ZVf6oREhOgR6S677n03Xij xZCPx060iNTD8pWnYW86m+o+jCIE4E30I/7WxkiFEG31DH+t+IbFPfD1nhfw7W184pCz DDMnfz3+aAQUk2sCpINQtwkr3BiqFzc2GtQrN0PZtPAh87Da6yX+ogS51hMeAWR7P8Ae DP25xrbKI8kd0hix3f8MxJsEhitQtLgFc0F/rdlnsfHl4LrQqIw2W7tDJjqFDV/VhoWE ZQJzKCOeZ6ZaeTvRuM8ArqkZM31JRNdmZsylpA2XN8sC2NudwqPzOJVq84lfHtuOi5Fr 70Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=cPSkG/G/; 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 h89si6230717pfa.182.2018.03.12.11.26.44; Mon, 12 Mar 2018 11:26:59 -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=cPSkG/G/; 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 S1751478AbeCLSZs (ORCPT + 99 others); Mon, 12 Mar 2018 14:25:48 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:42064 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751232AbeCLSZq (ORCPT ); Mon, 12 Mar 2018 14:25:46 -0400 Received: by mail-pg0-f67.google.com with SMTP id x2so2717158pgo.9 for ; Mon, 12 Mar 2018 11:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=date:from:subject:to:cc:references:in-reply-to:mime-version :user-agent:message-id:content-transfer-encoding; bh=9sBGIzm9ylNzKM26qvIsmygRmgXGtSeK+LabRxCs73I=; b=cPSkG/G/djXMLedXxs+x8CaoPpaMSjdf8BJnCsyYp4GQPUGnq3kOuV3r6JxdiRtGTC m48XwaBcCc0XQ3r7F/yGh/Bop/u1s7770yf4W8MkBgxdFjS6hkCqJa5ghHYhfTiMon0I /CHsIGZ8I7Zebo5fh+TXBluUP51VIh5pS+whTWnrF++V3En7rpMmTHW0vh4kpU8K4AnE AQCuAWHpRRzYWd3YWFr8/6MXjg93Xc62tRZWlolL2LIAsPHutc4tFPvevLvvhHn/ArtF Wb+/nVh8FRDEDc1wA7SnpoFIm3QY8nFJsOCpI2iSE08rzbDPIj2mEK3zn25Fu5hjkQWm D9AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:user-agent:message-id:content-transfer-encoding; bh=9sBGIzm9ylNzKM26qvIsmygRmgXGtSeK+LabRxCs73I=; b=q9HxKsM8fUpZfbnlVLAsbdQWXSYxfpx8DgBXWEZUjK/3S4i39/63KJBK5nP2o1tfj5 tMBWAXLxaGMqDehhxBtzrImYhutg/bb/fGVTXoNxYJDfIWOLi11KB8AFMGfCRIhTP0/c 0i84yHkSHNAxfiEGdN601Fg10IN1uPSZQ04JwH5ji0Qc4ztthJjzxR2V5MvuM2hZF8th Lv/8vrU3Jk8K7CSELdMplOeHReXrnl6gXVHuieVf9X8FyWL1OIA6IlSz7xjeUhPhzx7F Qe+r1vSVeN8qcgT/WGRt9jABonOM8IrtGFRwO5hQVn7HxRGk+Y2zJIyT/WFUxrYBcjxa NxWQ== X-Gm-Message-State: AElRT7HDDK13n2saXMDD1eaDshAanfPKP1j7AQQKEbAbwyTlAvHTr13Y kR+dPqawgRTuuHUpSXdXFLMurg== X-Received: by 10.98.14.79 with SMTP id w76mr8898036pfi.1.1520879145523; Mon, 12 Mar 2018 11:25:45 -0700 (PDT) Received: from localhost ([2605:e000:151d:96f:f8c7:bc4a:fffa:b473]) by smtp.gmail.com with ESMTPSA id c7sm18486031pfg.36.2018.03.12.11.25.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 11:25:44 -0700 (PDT) Date: Sun, 11 Mar 2018 22:54:08 -0700 From: Michael Turquette Subject: Re: [PATCH v2 4/8] clk: migrate the count of orphaned clocks at init To: Heiko =?iso-8859-1?q?St=FCbner?= , Jerome Brunet Cc: Dong Aisheng , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Stephen Boyd , Stephen Boyd , Shawn Guo References: <20180214134340.17242-1-jbrunet@baylibre.com> <20180214134340.17242-5-jbrunet@baylibre.com> <1970074.VYjjbDuVRv@diego> In-Reply-To: <1970074.VYjjbDuVRv@diego> MIME-Version: 1.0 User-Agent: astroid/8ea8c2a3 (https://github.com/astroidmail/astroid) Message-Id: <1520834013.z6bypcssbs.astroid@resonance.none> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Heiko St=C3=BCbner's message of February 15, 2018 1:01 pm: > Am Mittwoch, 14. Februar 2018, 14:43:36 CET schrieb Jerome Brunet: >> The orphan clocks reparents should migrate any existing count from the >> orphan clock to its new acestor clocks, otherwise we may have >> inconsistent counts in the tree and end-up with gated critical clocks >>=20 >> Assuming we have two clocks, A and B. >> * Clock A has CLK_IS_CRITICAL flag set. >> * Clock B is an ancestor of A which can gate. Clock B gate is left >> enabled by the bootloader. >>=20 >> Step 1: Clock A is registered. Since it is a critical clock, it is >> enabled. The clock being still an orphan, no parent are enabled. >>=20 >> Step 2: Clock B is registered and reparented to clock A (potentially >> through several other clocks). We are now in situation where the enable >> count of clock A is 1 while the enable count of its ancestors is 0, whic= h >> is not good. >>=20 >> Step 3: in lateinit, clk_disable_unused() is called, the enable_count of >> clock B being 0, clock B is gated and and critical clock A actually gets >> disabled. >>=20 >> This situation was found while adding fdiv_clk gates to the meson8b >> platform. These clocks parent clk81 critical clock, which is the mother >> of all peripheral clocks in this system. Because of the issue described >> here, the system is crashing when clk_disable_unused() is called. >>=20 >> The situation is solved by reverting >> commit f8f8f1d04494 ("clk: Don't touch hardware when reparenting during >> registration"). To avoid breaking again the situation described in this >> commit >> description, enabling critical clock should be done before walking the >> orphan list. This way, a parent critical clock may not be accidentally >> disabled due to the CLK_OPS_PARENT_ENABLE mechanism. >>=20 >> Fixes: f8f8f1d04494 ("clk: Don't touch hardware when reparenting during >> registration") Cc: Stephen Boyd >> Cc: Shawn Guo >> Cc: Dong Aisheng >> Signed-off-by: Jerome Brunet >=20 > On a rk3288-veyron Chromebook > Tested-by: Heiko Stuebner >=20 > This made the hdmi on the machine work again with 4.16-rc1 . > (hdmi-cec clock is sourced from the i2c connected pmic which provides > the 32kHz clock needed) >=20 > So it would be really cool if this could make it into 4.16-rc :-) I separated this patch out into clk-fixes to be set for -rc5 or -rc6. Regards, Mike >=20 >=20 > Heiko >=20 =