Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp281979pxa; Tue, 4 Aug 2020 05:38:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI4asrhIklDzwnB/bIMv2mcIg7XAk0wDKj8PlfI8JJkooxznN0qTKyXVGXPAvbbrsl5Ej+ X-Received: by 2002:aa7:cdd2:: with SMTP id h18mr20306880edw.387.1596544727964; Tue, 04 Aug 2020 05:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596544727; cv=none; d=google.com; s=arc-20160816; b=bHXwTZl6qntt5hATk5Tftk481esZLt8KIAl1aaXQZOlVpmYcA6aU1FiO4dIGoaH6Mc u8cYayADK9Ii6+Uiatm/Z3iaApsVB/WiV52OP4k7tEGNYVFK2BEylv3MPooRzZLny/75 jLHDYHEh/orrUhzjZQ6hoA5hNoMo563vaIjEqz2SGZ4XKmdW5+LNcCmyaFA41+PNvel8 xoTZ1BApIfD/3uVORy9K1W1mrxq5IybhiYg6p7YZAy5YZppHkBYgAT8infKrhMS+mhQ/ mg3S9NriK+mcuDJ02dgnLrimF7hOwhE3MzYJTf2xp7IIo05Xr5YVuinewNE3iIOdL6GN OgKg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=skrffL1Oe6Zl6GsSBXsUGm3VgoD6/D4/1aVv+vD+KLQ=; b=RhFz1WIx6AOIMku89oLOsCFj6iWZAsSd/8ahuadtclYiXN/VPu3GpwrCqLeRqLd/iF OkWxYQm7xgCm8ffHXWWbf3VeMU5Jj0b0ZVAyHv9C2BNPCzvyEi2QsQGzAzS3dDIj8hdQ q4FyKzCV5FHQYQVYDOAxYoI3wvDylhVyZh7KOu3Z0BVXdQRSM/thT/xVj/48R2p2Fqsd pDbpqrXSQ70yu9WkmJ7sRbFqaNPa/0fQuL0CPWyPvt96WlGA8JILnbUgo0KvRpjfOUSN hdw6bHLsUXwaC7/TITZ9Og2YY8LO3uv7XetFrORySiJl/FBhTDBIR8ie3HlEyhGtDnRc bT8w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g21si9916568edr.544.2020.08.04.05.38.25; Tue, 04 Aug 2020 05:38:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727813AbgHDMiR (ORCPT + 99 others); Tue, 4 Aug 2020 08:38:17 -0400 Received: from foss.arm.com ([217.140.110.172]:43436 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726724AbgHDMiQ (ORCPT ); Tue, 4 Aug 2020 08:38:16 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A242F30E; Tue, 4 Aug 2020 05:38:15 -0700 (PDT) Received: from [10.37.12.45] (unknown [10.37.12.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 010543F71F; Tue, 4 Aug 2020 05:38:13 -0700 (PDT) Subject: Re: [PATCH] memory: samsung: exynos5422-dmc: propagate error from exynos5_counters_get() To: Marek Szyprowski , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, Chanwoo Choi References: <20200804061210.5415-1-m.szyprowski@samsung.com> <24675559-b807-5b80-1318-805c1530ffb3@arm.com> <78c95f58-8142-7607-6d74-5cfa6a7ffb77@samsung.com> From: Lukasz Luba Message-ID: Date: Tue, 4 Aug 2020 13:38:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <78c95f58-8142-7607-6d74-5cfa6a7ffb77@samsung.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/4/20 1:19 PM, Marek Szyprowski wrote: > Hi Lukasz, > > On 04.08.2020 11:11, Lukasz Luba wrote: >> Hi Marek, >> >> On 8/4/20 7:12 AM, Marek Szyprowski wrote: >>> exynos5_counters_get() might fail with -EPROBE_DEFER if the driver for >>> devfreq event counter is not yet probed. Propagate that error value to >>> the caller to ensure that the exynos5422-dmc driver will be probed again >>> when devfreq event contuner is available. >>> >>> This fixes boot hang if both exynos5422-dmc and exynos-ppmu drivers are >>> compiled as modules. >>> >>> Signed-off-by: Marek Szyprowski >>> --- >>>   drivers/memory/samsung/exynos5422-dmc.c | 2 +- >>>   1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/memory/samsung/exynos5422-dmc.c >>> b/drivers/memory/samsung/exynos5422-dmc.c >>> index b9c7956e5031..639811a3eecb 100644 >>> --- a/drivers/memory/samsung/exynos5422-dmc.c >>> +++ b/drivers/memory/samsung/exynos5422-dmc.c >>> @@ -914,7 +914,7 @@ static int exynos5_dmc_get_status(struct device >>> *dev, >>>       } else { >>>           ret = exynos5_counters_get(dmc, &load, &total); >>>           if (ret < 0) >>> -            return -EINVAL; >>> +            return ret; >>>             /* To protect from overflow, divide by 1024 */ >>>           stat->busy_time = load >> 10; >>> >> >> Thank you for the patch, LGTM. >> Some questions are still there, though. The function >> exynos5_performance_counters_init() should capture that the counters >> couldn't be enabled or set. So the functions: >> exynos5_counters_enable_edev() and exynos5_counters_set_event() >> must pass gently because devfreq device is registered. >> Then devfreq checks device status, and reaches the state when >> counters 'get' function returns that they are not ready... >> >> If that is a kind of 2-stage initialization, maybe we should add >> another 'check' in the exynos5_performance_counters_init() and call >> the devfreq_event_get_event() to make sure that we are ready to go, >> otherwise return ret from that function (which is probably EPROBE_DEFER) >> and not register the devfreq device. > > I've finally investigated this further and it turned out that the issue > is elsewhere. The $subject patch can be discarded, as it doesn't fix > anything. The -EPROBE_DEFER is properly returned by > exynos5_performance_counters_init(), which redirects exynos5_dmc_probe() > to remove_clocks label. This causes disabling mout_bpll/fout_bpll clocks > what in turn *sometimes* causes boot hang. This random behavior mislead > me that the $subject patch fixes the issue, but then longer tests > revealed that it didn't change anything. Really good investigation, great work Marek! > > It looks that the proper fix would be to keep fout_bpll enabled all the > time. Yes, I agree. I am looking for your next patch to test it then. > >> >> Marek do want to submit such patch or I should bake it and submit on top >> of this patch? >> >> Could you tell me how I can reproduce this? Do you simply load one >> module after another (exynos-ppmu than exynos5422-dmc) or in parallel? > > I've just boot zImage built from multi_v7_defconfig with modules > installed. Modules are automatically loaded by udev during boot. Thank you sharing this test procedure. Regards, Lukasz