From patchwork Tue May 18 09:17:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12264341 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 E0CFDC433ED for ; Tue, 18 May 2021 09:36:00 +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 711D661073 for ; Tue, 18 May 2021 09:36:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 711D661073 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=4AehV8CL3VbJc07CZSwi3znMAJA6Cxa+ApzWHOoYYmY=; b=oDkdmwk8zhLVvYz10h2VpWMWj eQcwsA/VSg1Q6Cosd9u/0sVBSp7G5tfCa1jqxBMl8eLsq899rgGvfdRRLZOHx08cJWUowwPef01j2 A59h9xFCtKa2ODyfyNFQvBrlsOkdfuHAAkxZvdSYosa0G4/LQ3zi+XAz7XI/Ou/2oWXi/A90LFyXk yL0d5Tme2ZIxuA4XftWplHfjjePVGddWnjmdTsALh51exUgcFJ7nH7k1aiBLmJTSjyqpEeu73xAY4 ONvpPNI25s00bV8g5VyBG9ADPijRYLkNNNU/K5FRLKe8VTIrKifqgnTz90fm7hiceJtqX1Ok8Buk6 /xRSfXzNQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liw71-0009Lf-FG; Tue, 18 May 2021 09:34:03 +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 1liw6H-0009B5-RS for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 09:33:17 +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=0u7O17lOlO7a60AQ00/ZHxfxJ4t1mHRtYZeKj7baKX0=; b=GczVm6ZfgBm3AlZwwcbCU1Xtau x8wNE77n4lTPF0KYIQ3IrPG3GPe27DZQa+Z1LJf2WexKz+5yW8c3Cev5ojDnNtmv3WWUeR8FvVqdq gf/SXeyLUjHQhzG6gshIroXKRobAXvm4X3FpxtR8I1TczOq1nb8s0M/9F1O1hkvQeoaBFsIgNbG4k 1B92x6oPB2EYvurui9MTKge1VaF9l2HF8UcDK83N9kUMiUSbRBslB19XrABeUYAYFXwOHMiwbJzTn Frj1HxaB5pf9bgEr6O6YyDDgsrhEyygTYCASLNFSJvQTTIMZD0jq3Vox4KUBJ70seTerV8qb81lXT naemwoYw==; 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 1liw6F-00EVld-7u for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:33:16 +0000 Message-Id: <20210518093118.277228577@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621330394; 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=0u7O17lOlO7a60AQ00/ZHxfxJ4t1mHRtYZeKj7baKX0=; b=RXK/Bhnu0T+YSoFk6r2VQA+DFKrq23LtpsAd10sMCLHsMUkLPdkFC2UnwFuslnIljlix12 q+ZkMkCBGdvsOgvWdHhFXpHzixACkKYxvXBvjhtCpuIkO2gu6/AtyilmDS0Fc6A1alRvPg K81PV8fDvuTU1Urd4J7NZSfyvi53nXB4YTGjBwYBX7/BdBvTNvwIU522pdoDVsIegGbRT+ TmNFC9gqHIJeaDKtdNGODLNN8faiGyEPz5k+cvbpHR+mnJooBPUkUwtJxk3IhDYHZzrx0R pDfHr0aIktY4tgiJ95g7MZg47Pclv/GsNui6gYn8pOXZm5eKOkg20FPOKh4IEA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621330394; 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=0u7O17lOlO7a60AQ00/ZHxfxJ4t1mHRtYZeKj7baKX0=; b=iWvw/RKda4AV095lztmg4ZYtY46kua4IG2iJNaPQF35qaFiKjzPP9qdJKbrTf/W5m0ZDhL wduuumExnovrInCQ== Date: Tue, 18 May 2021 11:17:28 +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 3/8] perf/arm-cmn: 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_023315_445027_6BB80D31 X-CRM114-Status: GOOD ( 16.11 ) 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-cmn.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -1162,7 +1162,7 @@ static int arm_cmn_pmu_offline_cpu(unsig perf_pmu_migrate_context(&cmn->pmu, cpu, target); for (i = 0; i < cmn->num_dtcs; i++) - irq_set_affinity_hint(cmn->dtc[i].irq, cpumask_of(target)); + irq_set_affinity(cmn->dtc[i].irq, cpumask_of(target)); cmn->cpu = target; return 0; } @@ -1222,7 +1222,7 @@ static int arm_cmn_init_irqs(struct arm_ if (err) return err; - err = irq_set_affinity_hint(irq, cpumask_of(cmn->cpu)); + err = irq_set_affinity(irq, cpumask_of(cmn->cpu)); if (err) return err; next: @@ -1568,16 +1568,11 @@ static int arm_cmn_probe(struct platform static int arm_cmn_remove(struct platform_device *pdev) { struct arm_cmn *cmn = platform_get_drvdata(pdev); - int i; writel_relaxed(0, cmn->dtc[0].base + CMN_DT_DTC_CTL); perf_pmu_unregister(&cmn->pmu); cpuhp_state_remove_instance(arm_cmn_hp_state, &cmn->cpuhp_node); - - for (i = 0; i < cmn->num_dtcs; i++) - irq_set_affinity_hint(cmn->dtc[i].irq, NULL); - return 0; }