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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD262C6FD1C for ; Wed, 22 Mar 2023 14:54:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229799AbjCVOy4 (ORCPT ); Wed, 22 Mar 2023 10:54:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230195AbjCVOyi (ORCPT ); Wed, 22 Mar 2023 10:54:38 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4FA4C6F2 for ; Wed, 22 Mar 2023 07:53:24 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id i5so27168423eda.0 for ; Wed, 22 Mar 2023 07:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679496803; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qB6CqrQG0O85iIeK2/9UU3y3s70XZTORdp66X0QLG10=; b=t2QtOEPQITEAqrfcEMg5f8r2igPACmc/vitkqzn60BElrRIc3DLc7yCaj3Gm9ADi36 v4iM6OEHFLCEH5d5QdZPXWkwsgD6A2A77sC4eLKs1VYbGJCS5Ia5rlUgFNGA6RE4SDlw SE3wsOICE+9kqcqVoMB6r3L/hFAFoOZzBpxOh8hqfq81dRDHUqfKeIxGAUo9zt4X+5gj GPJqZY+dwI6kkvrvV93H+2YdPANNt5T/XuwpcKUCVYfUWseX6faUpX/iNxwMki91bXiw fMBmREapmRuKV97mc7itsbJ6NCQoznnXNoH/iMi5MwBv0ivoquT6+A1xcQGKCzdMIcDD ZQbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679496803; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qB6CqrQG0O85iIeK2/9UU3y3s70XZTORdp66X0QLG10=; b=g5/Qn7ASHo9RWGMLPfptCNIvkbOhBaX3Rcl8MZcAH/oNUSCy58XKzQsldVhH1r4iTh y4QbY6aCk9VEmH/RAnTJUdTopeRNnqWeMt5oRV3N8QfG4AY7C2+AvqekNs1g1+Zn4Km7 XbHk9c0szqwDqKPWhB/UlyDjm/x3ZRigJ9EYbLxaFS7CFaFRc2oyD8nsrBF2X7a4vGZe d1Lg3oHyKvOgLwa8M0lSPg4K0mayvhzTkfIdogEKVuAslxhZoSlIk7GMpeR1jT0719j3 aMWCXeAmRqIsT4UgyNHrDed98F+vrP4b9hVX10q0TurI3LvQww8tUt2/jAlkYXZu6mvp We/Q== X-Gm-Message-State: AO0yUKXIToqAN/QC79ldcGm6Csm3jMEG9InDNqPOr1+jtI2QQE3YrRAC NUH+G7byUquNdHcFCOdDBaWzCc/c+xMelJeL6mI= X-Google-Smtp-Source: AK7set/TvLlLhJWVyQQ7HaqKCpn6yL1O/38sfD9/Gd/9HSGELN0CjCbVEupJw+wrerGH1y0xouZvEw== X-Received: by 2002:a17:906:f8db:b0:8b1:7ae8:ba6f with SMTP id lh27-20020a170906f8db00b008b17ae8ba6fmr7152751ejb.16.1679496803408; Wed, 22 Mar 2023 07:53:23 -0700 (PDT) Received: from ?IPV6:2a02:810d:15c0:828:5050:151b:e755:1c6? ([2a02:810d:15c0:828:5050:151b:e755:1c6]) by smtp.gmail.com with ESMTPSA id s26-20020a170906169a00b009200601ea12sm7224670ejd.208.2023.03.22.07.53.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Mar 2023 07:53:23 -0700 (PDT) Message-ID: <7b939818-993a-e849-e7e0-ae9ea74ea52b@linaro.org> Date: Wed, 22 Mar 2023 15:53:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats Content-Language: en-US To: Souradeep Chowdhury , Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Sibi Sankar , Rajendra Nayak References: <3f385562845ae26d519940ca8098fde89282991b.1679403696.git.quic_schowdhu@quicinc.com> <611ea918-64a6-f306-b5ec-db55e41abda2@linaro.org> <321005fc-1bfd-c04d-b2b5-d85d213ac00a@quicinc.com> From: Krzysztof Kozlowski In-Reply-To: <321005fc-1bfd-c04d-b2b5-d85d213ac00a@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On 22/03/2023 14:54, Souradeep Chowdhury wrote: > > > On 3/21/2023 11:07 PM, Krzysztof Kozlowski wrote: >> On 21/03/2023 14:51, Souradeep Chowdhury wrote: >>> All of Qualcomm's proprietary Android boot-loaders capture boot time >>> stats, like the time when the bootloader started execution and at what >>> point the bootloader handed over control to the kernel etc. in the IMEM >>> region. This information is captured in a specific format by this driver >>> by mapping a structure to the IMEM memory region and then accessing the >>> members of the structure to print the information. This information is >>> useful in verifying if the existing boot KPIs have regre >> >> >>> +/** >>> + * struct boot_stats - timestamp information related to boot stats >>> + * @bootloader_start: Time for the starting point of the abl bootloader >>> + * @bootloader_end: Time when the kernel starts loading from abl bootloader >>> + */ >>> +struct boot_stats { >>> + u32 bootloader_start; >>> + u32 bootloader_end; >>> +} __packed; >>> + >>> +static struct boot_stats __iomem *boot_stats; >>> +static void __iomem *mpm_counter_base; >>> +static u32 mpm_counter_freq; >> >> No file-scope variables. Does not scale, not easy for review and >> maintenance. Avoid such code. > > Ack >> >>> + >>> +static int mpm_parse_dt(void) >>> +{ >>> + struct device_node *np_imem, *np_mpm2; >>> + >>> + np_imem = of_find_compatible_node(NULL, NULL, >>> + "qcom,imem-boot_stats"); >>> + if (!np_imem) { >>> + pr_err("can't find qcom,imem node\n"); >> >> So you are printing errors everywhere, on every soc and with compile >> test on every platform there is in the world... sorry, it does not work >> like that. > > Ack >> >>> + return -ENODEV; >>> + } >>> + boot_stats = of_iomap(np_imem, 0); >>> + if (!boot_stats) { >>> + pr_err("boot_stats: Can't map imem\n"); >>> + goto err1; >>> + } >> >> >>> + >>> +static void __exit boot_stats_exit(void) >>> +{ >>> +} >>> +module_exit(boot_stats_exit) >> >> >> I don't think this is some special code which deserves init calls. Make >> it module_platform_driver(). > > Since this just reads some values from the Imem region and prints it to > the user and doesn't have a specific device associated with it, a Which is not really an argument for such antipattern, but okay... > generic module code is written for it and not a module_platform_driver(). ... so how do you handle deferred probe? Best regards, Krzysztof 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 CEAB7C761A6 for ; Wed, 22 Mar 2023 14:54:21 +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-Transfer-Encoding:Content-Type: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=51bSmMllV8SyVpoUGydgEAzCsBVBmtdg7VbGBY2YEHo=; b=228e9QygYhkXTE sURw2CNQQkVT+SmbbbAwcPuVorHaQwtYWvNatOSSo918Ba0yZLzAZlOQCGGsXeDETzxC5jpmSAxhh CD/xtU4CMAizuGNHi81MsWVfk3WzB+xsCnmDRgLDHjdz8/mGUPfKSsGLCTcGOjYKMlt4cT0ntHrpX YwQFwcgWJHUVQp2jwg9hO9yI0S5EQgKu4hEx3R9LZyEJSilfq85ziFSzMewh4xXWbYd1QkNpEXvZg gVFEmc8JY+OLv5cdPzrphGMxKYM4BKUOwhcftae2o7QbjkPmiLu7x8PS+TbMVgBtGe7DZ2OMurHDV //+QxR3R0/rhEngLenwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pezqF-00GO4B-3B; Wed, 22 Mar 2023 14:53:32 +0000 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pezqC-00GO2D-2R for linux-arm-kernel@lists.infradead.org; Wed, 22 Mar 2023 14:53:30 +0000 Received: by mail-ed1-x52e.google.com with SMTP id x3so74008441edb.10 for ; Wed, 22 Mar 2023 07:53:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1679496803; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qB6CqrQG0O85iIeK2/9UU3y3s70XZTORdp66X0QLG10=; b=t2QtOEPQITEAqrfcEMg5f8r2igPACmc/vitkqzn60BElrRIc3DLc7yCaj3Gm9ADi36 v4iM6OEHFLCEH5d5QdZPXWkwsgD6A2A77sC4eLKs1VYbGJCS5Ia5rlUgFNGA6RE4SDlw SE3wsOICE+9kqcqVoMB6r3L/hFAFoOZzBpxOh8hqfq81dRDHUqfKeIxGAUo9zt4X+5gj GPJqZY+dwI6kkvrvV93H+2YdPANNt5T/XuwpcKUCVYfUWseX6faUpX/iNxwMki91bXiw fMBmREapmRuKV97mc7itsbJ6NCQoznnXNoH/iMi5MwBv0ivoquT6+A1xcQGKCzdMIcDD ZQbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679496803; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qB6CqrQG0O85iIeK2/9UU3y3s70XZTORdp66X0QLG10=; b=l4qnrRC1+bKU9nEAH8+Q2hlqcZ5oGTaiyhzTaiQZCfRqjBtZAHrCYpHTQAPRphRq/T V/Q+4TVRlsuMT4v7xvF3Xvql5tBLcqSd6uqBs1TYv/9JITxYwbqAi+MSiYhEueYxGjai KeZJ7v0JGYssspc5lEnoSkv0dt0pcpGKVWhk7fYKDqXtj6qdH1eY56HUNARANSl1Sfmz xrf5Mnxkm+SBh6sM0FQCayBdpE1eYR1aAJtnesjsbcVypMiNo6EZLtvgThhLP6mxLIIi zXTCW0nu03Db6FeQNaBCeMvlS97S3NGwIkz3+E12C+q+c3rLKf1vK2ThvKxqAqGLJpi2 m0sQ== X-Gm-Message-State: AO0yUKXPAWtAxfaDj0GbdFGCz1BnPApNmH8OGDs/1rRiy/3zWOomZi9u jvXYNaKQNJhf7/E6o2nkUqdQTQ== X-Google-Smtp-Source: AK7set/TvLlLhJWVyQQ7HaqKCpn6yL1O/38sfD9/Gd/9HSGELN0CjCbVEupJw+wrerGH1y0xouZvEw== X-Received: by 2002:a17:906:f8db:b0:8b1:7ae8:ba6f with SMTP id lh27-20020a170906f8db00b008b17ae8ba6fmr7152751ejb.16.1679496803408; Wed, 22 Mar 2023 07:53:23 -0700 (PDT) Received: from ?IPV6:2a02:810d:15c0:828:5050:151b:e755:1c6? ([2a02:810d:15c0:828:5050:151b:e755:1c6]) by smtp.gmail.com with ESMTPSA id s26-20020a170906169a00b009200601ea12sm7224670ejd.208.2023.03.22.07.53.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Mar 2023 07:53:23 -0700 (PDT) Message-ID: <7b939818-993a-e849-e7e0-ae9ea74ea52b@linaro.org> Date: Wed, 22 Mar 2023 15:53:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH V1 3/4] soc: qcom: boot_stat: Add Driver Support for Boot Stats Content-Language: en-US To: Souradeep Chowdhury , Andy Gross , Konrad Dybcio , Krzysztof Kozlowski , Bjorn Andersson , Rob Herring Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, Sibi Sankar , Rajendra Nayak References: <3f385562845ae26d519940ca8098fde89282991b.1679403696.git.quic_schowdhu@quicinc.com> <611ea918-64a6-f306-b5ec-db55e41abda2@linaro.org> <321005fc-1bfd-c04d-b2b5-d85d213ac00a@quicinc.com> From: Krzysztof Kozlowski In-Reply-To: <321005fc-1bfd-c04d-b2b5-d85d213ac00a@quicinc.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230322_075328_839283_B7C7F69C X-CRM114-Status: GOOD ( 23.32 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 22/03/2023 14:54, Souradeep Chowdhury wrote: > > > On 3/21/2023 11:07 PM, Krzysztof Kozlowski wrote: >> On 21/03/2023 14:51, Souradeep Chowdhury wrote: >>> All of Qualcomm's proprietary Android boot-loaders capture boot time >>> stats, like the time when the bootloader started execution and at what >>> point the bootloader handed over control to the kernel etc. in the IMEM >>> region. This information is captured in a specific format by this driver >>> by mapping a structure to the IMEM memory region and then accessing the >>> members of the structure to print the information. This information is >>> useful in verifying if the existing boot KPIs have regre >> >> >>> +/** >>> + * struct boot_stats - timestamp information related to boot stats >>> + * @bootloader_start: Time for the starting point of the abl bootloader >>> + * @bootloader_end: Time when the kernel starts loading from abl bootloader >>> + */ >>> +struct boot_stats { >>> + u32 bootloader_start; >>> + u32 bootloader_end; >>> +} __packed; >>> + >>> +static struct boot_stats __iomem *boot_stats; >>> +static void __iomem *mpm_counter_base; >>> +static u32 mpm_counter_freq; >> >> No file-scope variables. Does not scale, not easy for review and >> maintenance. Avoid such code. > > Ack >> >>> + >>> +static int mpm_parse_dt(void) >>> +{ >>> + struct device_node *np_imem, *np_mpm2; >>> + >>> + np_imem = of_find_compatible_node(NULL, NULL, >>> + "qcom,imem-boot_stats"); >>> + if (!np_imem) { >>> + pr_err("can't find qcom,imem node\n"); >> >> So you are printing errors everywhere, on every soc and with compile >> test on every platform there is in the world... sorry, it does not work >> like that. > > Ack >> >>> + return -ENODEV; >>> + } >>> + boot_stats = of_iomap(np_imem, 0); >>> + if (!boot_stats) { >>> + pr_err("boot_stats: Can't map imem\n"); >>> + goto err1; >>> + } >> >> >>> + >>> +static void __exit boot_stats_exit(void) >>> +{ >>> +} >>> +module_exit(boot_stats_exit) >> >> >> I don't think this is some special code which deserves init calls. Make >> it module_platform_driver(). > > Since this just reads some values from the Imem region and prints it to > the user and doesn't have a specific device associated with it, a Which is not really an argument for such antipattern, but okay... > generic module code is written for it and not a module_platform_driver(). ... so how do you handle deferred probe? Best regards, Krzysztof _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel