From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A878C25B74 for ; Thu, 16 May 2024 07:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mGZWrvsiYdc/N2Z+CnoTEOUCLAVeECY15RxBTJ8WMYU=; b=lVZRURZwpVWgdW Jz+GTjx7XHjeuEINCcKpxe7Q13IFoQtqDbT6Joh7fJejYeBq3jYPk7bwgre6FfmR0H559eeMvF1Tc ztaF3a1wJyLvQhRdToanUM6mG1Q2t9vp+znm3Paq6KsSxwZU5iiMCUCYh1cx5H3icDmx+P06K3SaP LtROErolZa49/ORAvWGuZ22qAEjepnTVTlJM0WOg6G9ZXhkjXGFtb43sJsT2z72lKlPt+viVZuw+e ZFtbODkpSt3JIQs4pa8+/v55V3ddyy0QXzmbcqUwF9W2wWQp0Q/Xt0ut6DGr3yM0/mzNm3FkhyuIf VGtYwOwjaEsOiHC97RqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7VnF-000000041hW-2gJs; Thu, 16 May 2024 07:44:49 +0000 Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7VnB-000000041fW-19oE for linux-arm-kernel@lists.infradead.org; Thu, 16 May 2024 07:44:47 +0000 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44FLuDT2005399; Thu, 16 May 2024 09:43:59 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= selector1; bh=fGbR8sYV9QIn7SFPWuDEizW7wFbyJ157IMhZGWfECk8=; b=oY qfZv8rDdRNbMc7CuGM5totYTdN9MafA0OvTOD5Bg8sANV7hrr5gE+FzkxDU36Waj GZgSqPWrLU9QEO0tgCZh9XoJSVUXHGvM4veRgE+AphbOHcaWPUr46euV2l67MbY3 79iR7SfUEbRcjoNwffonPiTxIhlRchgK3KbHRHkINnZeOcIYYKRAVfbZR0BSBZ7H OC7hJx5YYF/kslkbMKZfXNw8OSEFmLEg4mlJzvOX/1hq4zjC8LdgMs6ClFejYjMd mqX3Uxp6rN62bL09ZKrBStE0nXilBa5dETimsczq3HDcs2fuJuk6ugVHm07GaVhO PiS051HwTsAgndN36Wkg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3y4symc615-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 09:43:59 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 494D140046; Thu, 16 May 2024 09:43:51 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1F791211958; Thu, 16 May 2024 09:42:57 +0200 (CEST) Received: from [10.48.87.204] (10.48.87.204) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 16 May 2024 09:42:55 +0200 Message-ID: <5b39b5b6-7008-4362-a578-3faab87cd23b@foss.st.com> Date: Thu, 16 May 2024 09:42:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [RFC] clk: stm32mp1: Keep RNG1 clock always running To: Marek Vasut , CC: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Alexandre Torgue , Gabriel Fernandez , Herbert Xu , Maxime Coquelin , Michael Turquette , Olivia Mackall , Rob Herring , Stephen Boyd , Yang Yingliang , , , References: <20240513220349.183568-1-marex@denx.de> <51951dd4-8e8c-4e67-89f6-6a710022e34f@foss.st.com> <3257e8f8-5bb0-4c75-a3a3-e5685b65de2a@denx.de> Content-Language: en-US From: Gatien CHEVALLIER In-Reply-To: <3257e8f8-5bb0-4c75-a3a3-e5685b65de2a@denx.de> X-Originating-IP: [10.48.87.204] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_03,2024-05-15_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240516_004445_648208_F706828C X-CRM114-Status: GOOD ( 26.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Marek On 5/16/24 03:06, Marek Vasut wrote: > On 5/15/24 11:16 AM, Gatien CHEVALLIER wrote: > > Hi, > >>>> What if you add a trace in a random generation function in random.c? >>> >>> Do you have a function name or line number for me ? >> >> I put a trace in _get_random_bytes() in drivers/char/random.c. I'm not >> 100% sure but this should be the entry point when getting a random >> number. > > You're right, there is a read attempt right before the hang, and > __clk_is_enabled() returns 0 in stm32_read_rng() . In fact, it is the > pm_runtime_get_sync() which is returning -EACCES instead of zero, and > this is currently not checked so the failure is not detected before > register access takes place, to register file with clock disabled, which > triggers a hard hang. > > I'll be sending a patch shortly, thanks for this hint ! > Great news, indeed the return code isn't checked. Let's use pm_runtime_resume_and_get(). >>>> After this, I'll try to reproduce the issue. >>> >>> If you have a minute to test it on some ST MP15 board, that would be >>> real nice. Thanks ! >> >> I tried to reproduce the issue you're facing on a STM32MP157C-DK2 no >> SCMI on the 6.9-rc7 kernel tag. I uses OP-TEE and TF-A in the bootchain >> but this should not have an impact here. >> >> How did you manage to test using "echo core > /sys/power/pm_test"? >> In kernel/power/suspend.c, enter_state(). If the pm_test_level is core, >> then an error is fired with the following trace: >> "Unsupported test mode for suspend to idle, please choose >> none/freezer/devices/platform." > > Could this be firmware related ? > >> I've tried using "echo devices > /sys/power/pm_test" so that I can at >> least test that the driver is put to sleep then wakes up. I do not >> reproduce your issue. > > Can you try 'processors' ? > Given this: #ifdef CONFIG_PM_DEBUG if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) { pr_warn("Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform.\n"); return -EAGAIN; } #endif and this static const char * const pm_tests[__TEST_AFTER_LAST] = { [TEST_NONE] = "none", [TEST_CORE] = "core", [TEST_CPUS] = "processors", [TEST_PLATFORM] = "platform", [TEST_DEVICES] = "devices", [TEST_FREEZER] = "freezer", }; I'm getting the error as well. > I did also notice it sometimes takes much longer than a minute to hang, > but eventually it does hang. Maybe let it cycle for an hour or a few ? > I'll let it loop for some time then for device pm state. > [...] > Thanks for investigating this. Cheers, Gatien _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel