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 X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 C711BC433ED for ; Tue, 18 May 2021 09:33:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABF5B61350 for ; Tue, 18 May 2021 09:33:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347985AbhERJej (ORCPT ); Tue, 18 May 2021 05:34:39 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:58948 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347949AbhERJee (ORCPT ); Tue, 18 May 2021 05:34:34 -0400 Message-Id: <20210518093118.395086573@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621330395; 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=V/bDG9qNgIKyZrOc6/zeyVIGnDKc6AhtxpbL8tdrgEg=; b=nTMhrM2cWjxRO31M1UWVX24nzEnK2DOZaPrMex1tUmUEEtWVHbqHAeKl2m3kNE4TZdls7m ObFZanUcSWItBDDWqYjAIbw8VxCi4GLRs7BgljMgc1rYKWbgXXvw9WCH4br8XfYSswCvfh AqMYqWbQ4CXK2SGYh9LshwR3sFOvUcbsc2ePaFM7pKrwbt7lqXZBtaF/dww+iIydCYoyOQ qDXBMtx0SYQ7ISf41e+ck5mKeF6NVsrNZByCichqSepZjmAQH3X0sOG/r5NScjFaOKSWGI gEjx5k3oVtlU5851Z/cwT0P/3zBPz5y38fTZd90EvxVsOGg602WZGMRTLEzE7A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621330395; 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=V/bDG9qNgIKyZrOc6/zeyVIGnDKc6AhtxpbL8tdrgEg=; b=cup5q3qN59BJFgsZj64XE9K5e0LBYILUgKCeyX0o6J8VORqCPT8vfavNXt4QZxdcW89soH G8M2ZIME4scHuzDg== Date: Tue, 18 May 2021 11:17:29 +0200 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Robin Murphy , Nitesh Lal , Jesse Brandeburg , Marc Zyngier , Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org, Frank Li , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Shaokun Zhang Subject: [patch 4/8] perf/arm-dmc620: Use irq_set_affinity() References: <20210518091725.046774792@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org --- drivers/perf/arm_dmc620_pmu.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) --- a/drivers/perf/arm_dmc620_pmu.c +++ b/drivers/perf/arm_dmc620_pmu.c @@ -421,7 +421,7 @@ static struct dmc620_pmu_irq *__dmc620_p if (ret) goto out_free_aff; - ret = irq_set_affinity_hint(irq_num, cpumask_of(irq->cpu)); + ret = irq_set_affinity(irq_num, cpumask_of(irq->cpu)); if (ret) goto out_free_irq; @@ -475,7 +475,6 @@ static void dmc620_pmu_put_irq(struct dm list_del(&irq->irqs_node); mutex_unlock(&dmc620_pmu_irqs_lock); - WARN_ON(irq_set_affinity_hint(irq->irq_num, NULL)); free_irq(irq->irq_num, irq); cpuhp_state_remove_instance_nocalls(cpuhp_state_num, &irq->node); kfree(irq); @@ -622,7 +621,7 @@ static int dmc620_pmu_cpu_teardown(unsig perf_pmu_migrate_context(&dmc620_pmu->pmu, irq->cpu, target); mutex_unlock(&dmc620_pmu_irqs_lock); - WARN_ON(irq_set_affinity_hint(irq->irq_num, cpumask_of(target))); + WARN_ON(irq_set_affinity(irq->irq_num, cpumask_of(target))); irq->cpu = target; return 0;