From patchwork Wed May 7 08:32:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime COQUELIN X-Patchwork-Id: 29751 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB201208CF for ; Wed, 7 May 2014 08:35:18 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id m1sf3474710oag.6 for ; Wed, 07 May 2014 01:35:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:subject:references:in-reply-to:cc:precedence :list-id:list-unsubscribe:list-archive:list-post:list-help :list-subscribe:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list :content-transfer-encoding:content-type; bh=r0baKUJohlxEPlp13JcN1m8omBZ1YmfR5DRvrwbH/zM=; b=b4+J6foUluWdmI/3KOCNoUM4rR/Si0dGOtsE/IENdjHHxPm+JB+nl6k172Ts5r+Bel CSRnbuMMagZw0x5Ki4K8Ifsi/azjHTdKgQHOyb1uzb7EY4xnu+wKgbOiKuXTIQ0DvPZw uVY8EG3CmDTXZju4pt0z0/kawpa/cOXsPQEKebY/6qwC7vGbA6zIzdXv12QXlw+5sKdQ h30wafUuu25yDv7pb61DYBrGYqZfdXJyPpr9C/T3aRxqKmEroNRsVkKFA7xexVt3Bn7n wlq1NNZceBl8dXA+Z+XWY7EuRCSR81ICaslTsomiLbY1pQk5evMvqrjJpCY7/cuCNDu2 1i0Q== X-Gm-Message-State: ALoCoQnNIX2cuJXwpbSmlJuBsf7ZV2gqeO5+HtHi1hkGJcIVCMarDoX9Z+RM22pUoit+q8SiY4sD X-Received: by 10.43.117.71 with SMTP id fl7mr871078icc.24.1399451718322; Wed, 07 May 2014 01:35:18 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.38 with SMTP id 35ls3261900qgw.77.gmail; Wed, 07 May 2014 01:35:18 -0700 (PDT) X-Received: by 10.58.65.10 with SMTP id t10mr5600139ves.34.1399451718179; Wed, 07 May 2014 01:35:18 -0700 (PDT) Received: from mail-ve0-f172.google.com (mail-ve0-f172.google.com [209.85.128.172]) by mx.google.com with ESMTPS id uv3si2482201vdc.5.2014.05.07.01.35.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 07 May 2014 01:35:18 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.172; Received: by mail-ve0-f172.google.com with SMTP id oz11so823016veb.17 for ; Wed, 07 May 2014 01:35:18 -0700 (PDT) X-Received: by 10.52.153.229 with SMTP id vj5mr9277047vdb.34.1399451718109; Wed, 07 May 2014 01:35:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp289909vcb; Wed, 7 May 2014 01:35:17 -0700 (PDT) X-Received: by 10.140.22.209 with SMTP id 75mr57718898qgn.4.1399451717448; Wed, 07 May 2014 01:35:17 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id v5si6351207qab.268.2014.05.07.01.35.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 May 2014 01:35:17 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhxID-0004vG-Km; Wed, 07 May 2014 08:33:33 +0000 Received: from mx07-00178001.pphosted.com ([62.209.51.94]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhxIB-0004tp-67 for linux-arm-kernel@lists.infradead.org; Wed, 07 May 2014 08:33:32 +0000 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id s478MfYR010876; Wed, 7 May 2014 10:32:56 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 1kq7j3a13y-1 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Wed, 07 May 2014 10:32:56 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8B5BE5B; Wed, 7 May 2014 08:32:37 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 369A31621B; Wed, 7 May 2014 08:32:37 +0000 (GMT) Received: from [10.129.6.55] (10.129.6.55) by Webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.123.3; Wed, 7 May 2014 10:32:36 +0200 Message-ID: <5369EFA3.8070908@st.com> Date: Wed, 7 May 2014 10:32:35 +0200 From: Maxime Coquelin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: Shawn Guo , Sascha Hauer Subject: Re: mx6qsabresd hangs on linux-next References: <20140506141310.GA2794@dragon> <5369081D.5030400@st.com> <20140506200029.GD5858@pengutronix.de> <20140507020950.GB2794@dragon> <20140507033223.GB2798@dragon> In-Reply-To: <20140507033223.GB2798@dragon> X-Originating-IP: [10.129.6.55] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.11.96, 1.0.14, 0.0.0000 definitions=2014-05-07_02:2014-05-06, 2014-05-07, 1970-01-01 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140507_013331_628836_55249B37 X-CRM114-Status: GOOD ( 14.55 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [62.209.51.94 listed in list.dnswl.org] Cc: Mike Turquette , Fabio Estevam , Russell King , "linux-arm-kernel@lists.infradead.org" , Sascha Hauer X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxime.coquelin@st.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Hi Shawn, On 05/07/2014 05:32 AM, Shawn Guo wrote: ... >>> >>> Here when a table entry matches the input div this function will return >>> exactly the input div. This means _next_div() will always return the >>> same value and clk_divider_bestdiv() has an infinite loop: >>> >>> for (i = 1; i <= maxdiv; i = _next_div(divider, i)) { >>> ... >>> } >> >> Hmmm, isn't the first thing that _next_div() does to increment the input >> div? > > I think the infinite loop happens in this case because "i" will never > exceed maxdiv for a table divider. You are right. Sorry for the regression. I thought I tested it, as I had some table-based dividers in my test setup. After checking again, it appears that I didn't had the CLK_SET_RATE_PARENT flag set on these clocks, so I didn't entered the for loop... Could the fix be to initialize "up" variable to INT_MAX in _round_up_table (see below)? I can send the patch if you are fine with it. I have no hardware to test on this week, I only have compiled this patch, not tested it. Thanks, Maxime > > Shawn > if (clkt->div == div) Tested-by: Fabio Estevam diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index b3c8396..cf9114a 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -158,7 +158,7 @@ static bool _is_valid_div(struct clk_divider *divider, unsigned int div) static int _round_up_table(const struct clk_div_table *table, int div) { const struct clk_div_table *clkt; - int up = _get_table_maxdiv(table); + int up = INT_MAX; for (clkt = table; clkt->div; clkt++) {