From patchwork Tue May 18 09:17:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12264343 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=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 0CF4EC433B4 for ; Tue, 18 May 2021 09:36:16 +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 87B6961350 for ; Tue, 18 May 2021 09:36:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87B6961350 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=5u6+Aucq8rC2HMKVnXfhbWa5Y5PRVyoDviOcR7UEzqM=; b=WDgcw9WtZOXHfuV3ykNGNt3Cb lQ88NWM6YrXHXzagE2gvf9OGuJ1xindcQubmstDrH8MLgW1tV+tQr+IrTuG7kTVpPS/Lb0oyEFldP 7RbAUW9VOdp23Pk2E+2uoe1Xhtmeji7lVGkN59Cbk9gvOkpgToaGOtW/DcVlKKiK+YfYTsLBvVcHX ZPD5bKpQensi7fKBeAq8oRrBQl7mOY8daMXcl/EOhMjh52LyaWy7ObBwPMNOYRUzMEZcWg5DAMXVI 5M3KQD/Ck7JIGPArGpWQl+cVLAjpVjcEa1nEdIDLVNgS3n+lrl+EZmNm8+N9fdQt/sj5M7acBErJw +WbbNvurQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liw7D-0009Og-Bj; Tue, 18 May 2021 09:34:15 +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 1liw6J-0009Bd-Ei for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 09:33:19 +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=V/bDG9qNgIKyZrOc6/zeyVIGnDKc6AhtxpbL8tdrgEg=; b=TvlY8jbozne0G+RLqVtBSZ6pml aXNESomKbJIHM+LD5p6R0WBir8kn28rPR+h9HT8T012MQRn9OkHFVwZ/b0Z1k511+NyvN0kJKKICy /3rUUEckGbCFtwgZbGcVhifuBypfJ4HZzLEu9pHGtEiiAB90pWNFQohkpcAL6c15bxXvVEtK6MK2b Mp+BVxDhV970DBTHIe8lEXVsz5Al7oDOaox9+oFniU0PYrupjUBoEe5ziK84qMPoTowastYoVMMY6 YxlsQlZ36YER9g158GeuEQLJFH5VKBSyVpgOXov5LqB622DkOHJiZTPXSjB604KPEdKKmvirMh63T FNpE9p1g==; Received: from galois.linutronix.de ([193.142.43.55]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liw6G-00EVmc-Sn for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:33:18 +0000 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_023317_099179_4F4305DD X-CRM114-Status: GOOD ( 14.78 ) 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: 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;