From patchwork Tue May 18 09:17:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12264357 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D4CCC433B4 for ; Tue, 18 May 2021 09:36:51 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07D0D6109E for ; Tue, 18 May 2021 09:36:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 07D0D6109E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:Subject:Cc:To:From:Date: Message-Id:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Owner; bh=V44TllBnLiB7vKZGIAaZEzTPko6xPWjpYcMeTUbeiN0=; b=rXmOFwyYfgyUAtx6v53k5ISPr BXyUc8aLqWrWzOH8T/0lLda/cDM2daKgGzaR5XyoLm7Nf8kWcmhUZ+KJO66OwS2ORuH2erb4zfd9/ +Koc9V1qsj7aprXNO0NGT29QnffhEl1XQEEFU9IW1JQra9axa+RUFIOpC3qtPaF/lRh+a2y+EQTL8 4bMrGu6grxan7NKyo49fHHUBnImHO81HKdvz9R8AyNw78i+t0EkoBRuT2mDWfcQIVTZd7ei+UgjHs jXhke1jAecW35XbkpCBT82/q/qS4+ZgbFirx+IErCJpvDLUYCZw0d55OPd5u87TaUBVawU7j0ueBq 50R2Q5V8A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liw7m-0009bm-JT; Tue, 18 May 2021 09:34:50 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liw6M-0009Cg-Vi for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 09:33:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-transfer-encoding: Content-Type:MIME-Version:References:Subject:Cc:To:From:Date:Message-Id: Sender:Reply-To:Content-ID:Content-Description:In-Reply-To; bh=TxzviiHdKr5GcZxP2Hy06b5VhRlYn5Pd4CPUH0jcSHw=; b=xjrPUpGs/4kGiJkNE++xZ/vYwK jx158zUXkVKkQYW8MXUwcVkkHgV9UFJqmVxLK0TeQ2pirXXlUd6lTHRQqtpkljiI6gqT6zwhY+aER cH3FmuUKztDddHLdK9Hy9RVLKxnTrLTOo3AFpY+wXqhp8CKbmF7/2gETe4KPmdhLvRfORyxVp8L2k jpRUFU0YW0eTk0mO5IfDyfNaFHSzGyLfWnUIfBDGR7AnwA77+oRUvneL66zcAbgPnEQfinnd3mZWE B2DggdHqgYxLejOVNTN2DoOSUNpaBe/xI12gCgIkorP8BiUlePZ0CmAAEnaSv0xABZz6zBwKxn+V4 jTj6eRNw==; Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liw6K-00EVoj-5y for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:33:21 +0000 Message-Id: <20210518093118.699566062@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621330398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=TxzviiHdKr5GcZxP2Hy06b5VhRlYn5Pd4CPUH0jcSHw=; b=q1uMFjL8Pp+jo+EY1h1Yn7RO9uCKR6RGG2bmNfrqJX9zRjZnzxExgNfvmO54KtoODpHbPl 8efOcmDYQyxHBm6OAuwnsJVSoGZ86UXz3SYMRotLuFhPvd0sqc+y+15gUWUXheMYGywgEK w3jukRi/Nf228gyLb1uKicWnsDqJrk/ctM2BrFGMXwNI0s1OQfuftRi9YVCK75dV5eRQwZ H9Wey70e0l12Q9yVxTIgS71mx76v8E4nSu+6uhpL9EX2NJI1foaX339OKZd7/q43jeHbyJ vmoLlouzMR2O5hNLmUbCFjzbIJRxWpDUim2vFGZSLZvUM/jBBH8s6rdMmiA8Nw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621330398; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=TxzviiHdKr5GcZxP2Hy06b5VhRlYn5Pd4CPUH0jcSHw=; b=ZtwtvuZER4Wm1N0oYn1RTnBbDn9aB3aZp1G26MqOM90/mqw0gmH0fnM98R0tprPGMebwrA Hm46mfRcuf5+zrAQ== Date: Tue, 18 May 2021 11:17:32 +0200 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Robin Murphy , Nitesh Lal , Jesse Brandeburg , Marc Zyngier , Frank Li , Will Deacon , Mark Rutland , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, Shaokun Zhang Subject: [patch 7/8] perf/imx_ddr: Use irq_set_affinity() References: <20210518091725.046774792@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_023320_386538_8A55B8FE X-CRM114-Status: GOOD ( 14.46 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver uses irq_set_affinity_hint() to set the affinity for the PMU interrupts, which relies on the undocumented side effect that this function actually sets the affinity under the hood. Setting an hint is clearly not a guarantee and for these PMU interrupts an affinity hint, which is supposed to guide userspace for setting affinity, is beyond pointless, because the affinity of these interrupts cannot be modified from user space. Aside of that the error checks are bogus because the only error which is returned from irq_set_affinity_hint() is when there is no irq descriptor for the interrupt number, but not when the affinity set fails. That's on purpose because the hint can point to an offline CPU. Replace the mindless abuse with irq_set_affinity(). Signed-off-by: Thomas Gleixner Cc: Frank Li Cc: Will Deacon Cc: Mark Rutland Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: linux-arm-kernel@lists.infradead.org --- drivers/perf/fsl_imx8_ddr_perf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/perf/fsl_imx8_ddr_perf.c +++ b/drivers/perf/fsl_imx8_ddr_perf.c @@ -674,7 +674,7 @@ static int ddr_perf_offline_cpu(unsigned perf_pmu_migrate_context(&pmu->pmu, cpu, target); pmu->cpu = target; - WARN_ON(irq_set_affinity_hint(pmu->irq, cpumask_of(pmu->cpu))); + WARN_ON(irq_set_affinity(pmu->irq, cpumask_of(pmu->cpu))); return 0; } @@ -749,7 +749,7 @@ static int ddr_perf_probe(struct platfor } pmu->irq = irq; - ret = irq_set_affinity_hint(pmu->irq, cpumask_of(pmu->cpu)); + ret = irq_set_affinity(pmu->irq, cpumask_of(pmu->cpu)); if (ret) { dev_err(pmu->dev, "Failed to set interrupt affinity!\n"); goto ddr_perf_err; @@ -777,7 +777,6 @@ static int ddr_perf_remove(struct platfo cpuhp_state_remove_instance_nocalls(pmu->cpuhp_state, &pmu->node); cpuhp_remove_multi_state(pmu->cpuhp_state); - irq_set_affinity_hint(pmu->irq, NULL); perf_pmu_unregister(&pmu->pmu);