Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp569416pxa; Tue, 11 Aug 2020 09:37:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTRoWhV660E5ibGQl84L6UFT8Nl03EDOLpAYEwYKcNBKeOTMx57AgxLwRMvVd4b2Y3Orb9 X-Received: by 2002:a50:dac6:: with SMTP id s6mr26828403edj.378.1597163857659; Tue, 11 Aug 2020 09:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597163857; cv=none; d=google.com; s=arc-20160816; b=WyPPtmXrcw0vu6YtzjnN82tEpa2VpaF2f83tDOCb9dsjUqOpzgyX/FnDOIAzzfNs3u Yz7IWDld9z1RhV4e1bvb/GUCro3IRtUc+wL0u64diQhi4dFD6LHYn7zGPSpfd+YaOBru v48Gj6X4ZFmN4x0IVGp4RclM6iK6d58lwuj2xqI3eUKrkduedmWCyPgUy+D95MuMMT8L xqciA9mJKbYruE0UKnH7Q+WGAaHoqeBnRFXUAMF7jkYU2QUPxEi9177YOBmB4XgtWdbc Avbh8sz2ISx3lcjjSlTRKRrBI2PLj4Cq6cRXlOyVheJJG8yPxY3y2s0lEIXwRpIwD9JX 93pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=1WQmRI9+lNgqJsEbP27zsmx43oYH+tnyCDsFQGRNIuk=; b=MSBBhmimk11ZjCFxIXnoJqTQYGyRrSiAEp+h4hOoN2ztzIwPUuOnsEqMJHlHZprX5K 6YG1JCRmxTo2uSoXxXkvfclE1Pv3gXXQRpS0qACl8sIrfdQTj1w9N0T3kU5t0kyugs8N ujQpfovOlQsAJoAhMxCPK6MMNxQ5XW/VqPRkmPMVrYLKedFMJ0sralWK8seArRxdeLjZ B3z26fNgijH9fS2E9Pbw1h00t+fIwPQS//jxu/TUMhfJ8ol114/2oBWqOf1tyU/kap/h WQL2vHf5q4pB8VM0rfUp0zMmaSXluC+hd9yOb63KDz8T+0YKqns8rVq+eUgb87c5JNjS PJOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z20si12815741ejb.359.2020.08.11.09.37.14; Tue, 11 Aug 2020 09:37:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729151AbgHKQee convert rfc822-to-8bit (ORCPT + 99 others); Tue, 11 Aug 2020 12:34:34 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33572 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728969AbgHKQed (ORCPT ); Tue, 11 Aug 2020 12:34:33 -0400 Received: by mail-wr1-f68.google.com with SMTP id p20so12078865wrf.0; Tue, 11 Aug 2020 09:34:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=WA8/uq9qyQrCKNou4NrEBKiSZTsOfyBYRvbV3dkHbXw=; b=g2S/a67aXmSyv8iWxyvhAIBtPnYZI0/7GaxMhsVmMn6ILY8I/iM8vRWXdxgtFwqngR 3vimIztZ0TQf2SPW1VhoRuIwZFrG4xdz36wG+3kufIDwz89xhRaL/SSy5W89vPPtTzFV 9ynQ53CMCXdgptEeRE4m1XMS0YLIODeIi7tSupXetPby/Toz22CAfA8lj7Ax+iQHxoqb 4ftZ7nIfNM9y36E2c4OWrNIZdi4TTLkEwiDKOAfn5E/7/Q/DlFG+JHzYFdD3UQV/gl5m UYToYLQml4I9rgF96hX9arU+cP5WO7PGITY2/fbsSI70xBTmKeJWcYsyABE3fTvWNsuI nN3w== X-Gm-Message-State: AOAM531RDl8N2KoJNBUKiEjCbIwKTf8zLekxiic561t/tJ8fDVrzwe89 QHjqAiqYrbuQ4+t1W6x7QgM= X-Received: by 2002:adf:b352:: with SMTP id k18mr31171523wrd.386.1597163671405; Tue, 11 Aug 2020 09:34:31 -0700 (PDT) Received: from kozik-lap ([194.230.155.117]) by smtp.googlemail.com with ESMTPSA id s8sm5886575wmc.1.2020.08.11.09.34.30 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Aug 2020 09:34:30 -0700 (PDT) Date: Tue, 11 Aug 2020 18:34:28 +0200 From: Krzysztof Kozlowski To: Tomasz Figa Cc: Sylwester Nawrocki , "open list:COMMON CLK FRAMEWORK" , Chanwoo Choi , Stephen Boyd , Mike Turquette , "moderated list:SAMSUNG SOC CLOCK DRIVERS" , linux-kernel , Bartlomiej Zolnierkiewicz , Marek Szyprowski Subject: Re: [PATCH v2] clk: samsung: Prevent potential endless loop in the PLL set_rate ops Message-ID: <20200811163428.GA7590@kozik-lap> References: <20200811112507.24418-1-s.nawrocki@samsung.com> <20200811162358.GA7169@kozik-lap> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 11, 2020 at 06:28:18PM +0200, Tomasz Figa wrote: > 2020年8月11日(火) 18:24 Krzysztof Kozlowski : > > > > On Tue, Aug 11, 2020 at 02:59:07PM +0200, Tomasz Figa wrote: > > > Hi Sylwester, > > > > > > 2020年8月11日(火) 13:25 Sylwester Nawrocki : > > > > > > > > In the .set_rate callback for some PLLs there is a loop polling state > > > > of the PLL lock bit and it may become an endless loop when something > > > > goes wrong with the PLL. For some PLLs there is already (a duplicated) > > > > code for polling with timeout. This patch replaces that code with > > > > the readl_relaxed_poll_timeout_atomic() macro and moves it to a common > > > > helper function, which is then used for all the PLLs. The downside > > > > of switching to the common macro is that we drop the cpu_relax() call. > > > > > > Tbh. I'm not sure what effect was exactly expected from cpu_relax() in > > > the functions which already had timeout handling. Could someone shed > > > some light on this? > > > > For us, it should not matter much, except: > > 1. when on A9 with ARM_ERRATA_754327, but we do not enable it on our > > platforms, > > 2. it is a generic pattern for busy loops. > > > > On other architectures it could mean something (e.g. yield to other > > hyper-threading CPU). > > Okay, thanks for confirming that it doesn't matter for us. > > Now, I wonder if the readx_poll_*() helpers are supposed to take all > of those into account or on systems which would benefit from such > operations, it would be the caller's responsibility. That's a very good point. In case of ARM_ERRATA_754327, busy waiting should have a barrier thus cpu_relax() is desired. I guess the generic macro for busy waiting therefore should use them. Best regards, Krzysztof