From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Yicong Yang <yangyicong@huawei.com>
Cc: <will@kernel.org>, <mark.rutland@arm.com>, <Frank.li@nxp.com>,
<shawnguo@kernel.org>, <s.hauer@pengutronix.de>,
<kernel@pengutronix.de>, <festevam@gmail.com>,
<linux-imx@nxp.com>, <zhangshaokun@hisilicon.com>,
<agross@kernel.org>, <bjorn.andersson@linaro.org>,
<konrad.dybcio@somainline.org>, <khuong@os.amperecomputing.com>,
<john.garry@huawei.com>, <yangyicong@hisilicon.com>,
<gregkh@linuxfoundation.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>
Subject: Re: [PATCH] drivers/perf: Change WARN_ON() to dev_err() on irq_set_affinity() failure
Date: Mon, 15 Aug 2022 10:39:58 +0100 [thread overview]
Message-ID: <20220815103958.000016c9@huawei.com> (raw)
In-Reply-To: <20220815092815.11597-1-yangyicong@huawei.com>
On Mon, 15 Aug 2022 17:28:15 +0800
Yicong Yang <yangyicong@huawei.com> wrote:
> From: Yicong Yang <yangyicong@hisilicon.com>
>
> The WARN_ON() on irq_set_affinity() failure is misused according to the [1]
> and may crash people's box unintentionally. This may also be redundant since
> in the failure case we may also trigger the WARN and dump the stack in the
> perf core[2] for a second time.
>
> So change the WARN_ON() to dev_err() to just print the failure message.
>
> [1] https://github.com/torvalds/linux/blob/master/include/asm-generic/bug.h#L74
> [2] https://github.com/torvalds/linux/blob/master/kernel/events/core.c#L313
>
> Suggested-by: Greg KH <gregkh@linuxfoundation.org>
> [https://lore.kernel.org/lkml/YuOi3i0XHV++z1YI@kroah.com/]
> Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Looks like progress in a sensible direction to me.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Kind of unrelated question inline.
>
> diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
> index 00d4c45a8017..05e1b3e274d7 100644
> --- a/drivers/perf/arm_smmuv3_pmu.c
> +++ b/drivers/perf/arm_smmuv3_pmu.c
> @@ -646,7 +646,8 @@ static int smmu_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
>
> perf_pmu_migrate_context(&smmu_pmu->pmu, cpu, target);
> smmu_pmu->on_cpu = target;
> - WARN_ON(irq_set_affinity(smmu_pmu->irq, cpumask_of(target)));
> + if (irq_set_affinity(smmu_pmu->irq, cpumask_of(target)))
> + dev_err(smmu_pmu->dev, "Failed to set interrupt affinity\n");
>
> return 0;
> }
> @@ -892,7 +893,8 @@ static int smmu_pmu_probe(struct platform_device *pdev)
>
> /* Pick one CPU to be the preferred one to use */
> smmu_pmu->on_cpu = raw_smp_processor_id();
> - WARN_ON(irq_set_affinity(smmu_pmu->irq, cpumask_of(smmu_pmu->on_cpu)));
> + if (irq_set_affinity(smmu_pmu->irq, cpumask_of(smmu_pmu->on_cpu)))
> + dev_err(dev, "Failed to set interrupt affinity\n");
In this case we have the option to fail probe. Failing to set affinity means
we are broken anyway, so perhaps that is cleaner than carrying on.
As a side note, I wonder if other drivers could benefit from what I think
is a micro optimization to short cut calling the hp handlers when the
decision of which CPU is easy...
>
> err = cpuhp_state_add_instance_nocalls(cpuhp_state_num,
> &smmu_pmu->node);
next prev parent reply other threads:[~2022-08-15 9:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-15 9:28 [PATCH] drivers/perf: Change WARN_ON() to dev_err() on irq_set_affinity() failure Yicong Yang
2022-08-15 9:39 ` Jonathan Cameron [this message]
2022-08-16 6:22 ` Yicong Yang
2022-08-15 10:47 ` Greg KH
2022-08-16 6:26 ` Yicong Yang
2022-08-15 11:25 ` Mark Rutland
2022-08-15 12:25 ` Barry Song
2022-08-16 7:37 ` Yicong Yang
2022-08-16 10:26 ` Mark Rutland
2022-08-16 15:20 ` Yicong Yang
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=20220815103958.000016c9@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=Frank.li@nxp.com \
--cc=agross@kernel.org \
--cc=bjorn.andersson@linaro.org \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.garry@huawei.com \
--cc=kernel@pengutronix.de \
--cc=khuong@os.amperecomputing.com \
--cc=konrad.dybcio@somainline.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=mark.rutland@arm.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=will@kernel.org \
--cc=yangyicong@hisilicon.com \
--cc=yangyicong@huawei.com \
--cc=zhangshaokun@hisilicon.com \
/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).