linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Yangtao Li" <frank.li@vivo.com>
Cc: miquel.raynal@bootlin.com, rafael@kernel.org,
	daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com,
	mmayer@broadcom.com, bcm-kernel-feedback-list@broadcom.com,
	florian.fainelli@broadcom.com, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de,
	festevam@gmail.com, linux-imx@nxp.com, agross@kernel.org,
	andersson@kernel.org, konrad.dybcio@linaro.org,
	thara.gopinath@gmail.com, heiko@sntech.de,
	mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com,
	thierry.reding@gmail.com, jonathanh@nvidia.com,
	matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
	srinivas.pandruvada@linux.intel.com,
	DLG-Adam.Ward.opensource@dm.renesas.com,
	shangxiaojing@huawei.com, bchihi@baylibre.com,
	wenst@chromium.org, hayashi.kunihiko@socionext.com,
	niklas.soderlund+renesas@ragnatech.se, chi.minghao@zte.com.cn,
	johan+linaro@kernel.org, jernej.skrabec@gmail.com,
	linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-tegra@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq()
Date: Fri, 30 Jun 2023 13:11:46 +0200	[thread overview]
Message-ID: <87h6qpyzkd.ffs@tglx> (raw)
In-Reply-To: <20230627110025.vgtplc6nluiiuvoh@pengutronix.de>

On Tue, Jun 27 2023 at 13:00, Uwe Kleine-König wrote:
> On Tue, Jun 27, 2023 at 06:12:01PM +0800, Yangtao Li wrote:
>
> While I assume changing to dev_err_probe is a result of my concern that
> no error should be printed when rc=-EPROBEDEFER, my other concern that
> adding an error message to a generic allocation function is a bad idea
> still stands.

I agree in general, but if you actually look at the call sites of
devm_request_threaded_irq() then the vast majority of them print more or
less lousy error messages. A quick grep/sed/awk/sort/uniq revealed

     519 messages total (there are probably more)

     352 unique messages

     323 unique messages after lower casing

         Those 323 are mostly just variants of the same patterns with slight
         modifications in formatting and information provided.

     186 of these messages do not deliver any useful information,
         e.g. "no irq", "

     The most useful one of all is: "could request wakeup irq: %d"

So there is certainly an argument to be made that this particular
function should print a well formatted and informative error message.

It's not a general allocator like kmalloc(). It's specialized and in the
vast majority of cases failing to request the interrupt causes the
device probe to fail. So having proper and consistent information why
the device cannot be used _is_ useful.

Yangtao: The way how this is attempted is not useful at all.

    1) The changelog is word salad and provides 0 rationale

       Also such series require a cover letter...

    2) The dev_err() which is added is not informative at all and cannot
       replace actually useful error messages. It's not that hard to
       make it useful.

    2) Adding the printks unconditionally first will emit two messages
       with different content.

       This is not how such changes are done.

       The proper approach is to create a wrapper function which emits
       the error message:

       wrapper(....., const char *info)
       {
            ret = devm_request_threaded_irq(....);
            if (ret < 0) {
               dev_err(dev, "Failed to request %sinterrupt %u %s %s: %d\n,
                       thread_fn ? "threaded " : "",
                       irq, devname, info ? : "", ret);
            }
            return ret;
       }

       Then convert the callsites over one by one with proper
       changelogs and justification.

       See?

Thanks,

        tglx

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-06-30 11:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 10:12 [PATCH v2 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Yangtao Li
2023-06-27 10:12 ` [PATCH v2 02/15] thermal/drivers/armada: remove redundant msg Yangtao Li
2023-06-27 10:12 ` [PATCH v2 03/15] thermal/drivers/brcmstb_thermal: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 04/15] thermal/drivers/db8500: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 05/15] thermal/drivers/hisi: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 06/15] thermal/drivers/imx: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 07/15] thermal/drivers/qcom: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 08/15] thermal/drivers/tegra-soctherm: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 09/15] thermal/drivers/maxim: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 10/15] thermal/drivers/int340x: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 11/15] thermal/drivers/intel: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 12/15] thermal/drivers/stm: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 13/15] thermal/drivers/rockchip: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 14/15] thermal/drivers/tegra: " Yangtao Li
2023-06-27 10:12 ` [PATCH v2 15/15] thermal/drivers/mediatek/lvts_thermal: " Yangtao Li
2023-06-27 10:28 ` [PATCH v2 01/15] genirq/devres: Add error information printing for devm_request_threaded_irq() Krzysztof Kozlowski
2023-06-27 11:00 ` Uwe Kleine-König
2023-06-30 11:11   ` Thomas Gleixner [this message]
2023-07-03  9:13     ` Yangtao Li
2023-07-03  9:53       ` Uwe Kleine-König
2023-07-03 11:37         ` Yangtao Li
2023-07-03 12:15     ` Yangtao Li
2023-07-03 12:19     ` Yangtao Li
     [not found]     ` <247a8166-f131-2d07-ec2b-479a4c19297f@vivo.com>
2023-07-03 12:28       ` Krzysztof Kozlowski
2023-07-03 16:07 ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h6qpyzkd.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=DLG-Adam.Ward.opensource@dm.renesas.com \
    --cc=agross@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=amitk@kernel.org \
    --cc=andersson@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=bchihi@baylibre.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=chi.minghao@zte.com.cn \
    --cc=daniel.lezcano@linaro.org \
    --cc=festevam@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=frank.li@vivo.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=heiko@sntech.de \
    --cc=jernej.skrabec@gmail.com \
    --cc=johan+linaro@kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kernel@pengutronix.de \
    --cc=konrad.dybcio@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mmayer@broadcom.com \
    --cc=niklas.soderlund+renesas@ragnatech.se \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shangxiaojing@huawei.com \
    --cc=shawnguo@kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=thara.gopinath@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).