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 3EBDBC00140 for ; Mon, 15 Aug 2022 09:56:31 +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:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uGtOpxFj0iGDSpE4ZJPxnkz+5q+mia+u+PbSnX+d1WM=; b=PLPn0KtzIqyxb+ vI8ZgyM8cUs61BWGY80D8g0tS13F/4cyP6U3OgfTLFU10uNwJt4B7G0R5V69d8cptJLcRvNA2Q0Gg NA4rPtpu0Igl/S0+3ktHgXhahFny58aZ+a7fDPCV2tHFlXm76hY/7VPsMDabipZobEGEdbAYvWYVb HsNrvdb1lnySNRRsR9jSyverLMfWIEXIl6w41rfm/WyAuV/TznHOAC4QoVKfrzAn9o0D4Gv5yetdE 6AAOORMFNDeSKK26nbA2yh6C1awZgL1hltdwYzVXCFrcXFy5VkRvYi/NltOnObhtzAtYTkTCAl9wR yc3yGKg2CV3BfkXzJXjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNWoi-00EECu-8Y; Mon, 15 Aug 2022 09:55:28 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNWZu-00Dzjn-S1 for linux-arm-kernel@lists.infradead.org; Mon, 15 Aug 2022 09:40:16 +0000 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4M5q1V1fVHz67yfJ; Mon, 15 Aug 2022 17:37:02 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 15 Aug 2022 11:40:00 +0200 Received: from localhost (10.202.226.42) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 15 Aug 2022 10:40:00 +0100 Date: Mon, 15 Aug 2022 10:39:58 +0100 From: Jonathan Cameron To: Yicong Yang CC: , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH] drivers/perf: Change WARN_ON() to dev_err() on irq_set_affinity() failure Message-ID: <20220815103958.000016c9@huawei.com> In-Reply-To: <20220815092815.11597-1-yangyicong@huawei.com> References: <20220815092815.11597-1-yangyicong@huawei.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.226.42] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220815_024011_935494_300887ED X-CRM114-Status: GOOD ( 19.21 ) 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 Mon, 15 Aug 2022 17:28:15 +0800 Yicong Yang wrote: > From: Yicong Yang > > 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 > [https://lore.kernel.org/lkml/YuOi3i0XHV++z1YI@kroah.com/] > Signed-off-by: Yicong Yang Looks like progress in a sensible direction to me. Reviewed-by: Jonathan Cameron 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); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel