From patchwork Tue May 18 09:17:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12264359 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 D3911C433ED for ; Tue, 18 May 2021 09:36:52 +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 611C36109F for ; Tue, 18 May 2021 09:36:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 611C36109F 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=vXonzlcqVMwgU4kVaSU2sTYFo6KpcHYQ9Aq3e6IBIEc=; b=VxytYsLamThhMb6bzPTca/7Zt 6qyflZitkqaJo268IzdBPl9uFZYQ8QjMxg6cp+uskyNL/jZeDiPwTyfbp5OMYTNxC5bufrzXfdzBB TDHEh5VgBiI841vShgTNwO3X8hnuiwH63OjQAyme/cYsRRfjRMYYwG4HDH8vIEVr60T57vv8KQvvS sKqIzufuoIhnw6GFIq4aerTEo4noxjgYrhNHig/ay5rPW4yWnCGofxz9JWpG6dUdWhF8+Cgaf+vQt /4kwbGtDIyuPoEZXdQspM+0brTzj2VcE/9PZIMKhdcE3wb8CcgMH09EcVRSRnSDWxpZh03BE24Oet mpz1PymvQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liw80-0009gu-1L; Tue, 18 May 2021 09:35:04 +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 1liw6O-0009Cm-Df 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=QqG76h/Zci9cwUUh2Wp3E6jP7nye6WKjTjjUQ/ncg4E=; b=QZBFPftC8nPuJyFnJN0e1ORoYD bsBbwo0XO1PJx5tWKJYMcZsliBXsw/MSyHp4iOZXrM75bOg/++rz74AiA1V0vG+BYW3aLcghbexQR laEWeKSKuAzjoXYa5KyhQviKCcfX8aE8xmdGVdadaUriSQSenpJ/UNrYbqBe7sfknIY0FOlFqkmwE RkeMIOBZROnlJg9v39r/3pRhBrbvd11jJBjZI/89zu+vg47d+9EBaM1xxMRkV+7HKSTcqmCJ/V6s3 sQwhuKXH36mM311I+pdo55gu130PbMcJTF6//C7ELFiOgANDd79ljxg2GpkgP7WEEFyU3ZsKtLsO+ J9TFjGiw==; 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 1liw6L-00EVpI-DC for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:33:23 +0000 Message-Id: <20210518093118.813375875@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621330400; 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=QqG76h/Zci9cwUUh2Wp3E6jP7nye6WKjTjjUQ/ncg4E=; b=oTbxvY6m5tSxVH9aJGcTgY2+nr4OSMnYvHyN87wNjKFWyeKrHd4aSGsmI2UJPWy7b46gUj bVkzWON99BsgcTLoxrxfks7e63g99dLGHcRusYD9xPgoOD32Jv66S6LYWFasLwf/vCaTCZ 6clqlpHFpIohwIt9s84Dx5ypMVYBVhljQYGgJRHrFpdMdqk9I276wyww+Om62yQeS1NLVY hYfnlQjp4fpwUXddDAonH8TtlRvfjW+hdNxCcz8MAFj+HBpV9wmuDWaOa8fr2P/bQJEpYH GVlbiO475MRLI//yT1/pfIxU8qT1ddfpZCyE6tHoNIYwlXbaP65jckl5RgUs3w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621330400; 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=QqG76h/Zci9cwUUh2Wp3E6jP7nye6WKjTjjUQ/ncg4E=; b=+NspJCeUOiY1S0smlg/ldI84M2Fto/3KQbXGD6Hl4/X88iYgX5WqozhxICac7B0k/KXfmo liChmOEownTb+FBQ== Date: Tue, 18 May 2021 11:17:33 +0200 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Robin Murphy , Nitesh Lal , Jesse Brandeburg , Marc Zyngier , Shaokun Zhang , Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org, Frank Li , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [patch 8/8] perf/hisi: 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_023321_761385_D0872208 X-CRM114-Status: GOOD ( 15.36 ) 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 These drivers use 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: Shaokun Zhang Cc: Will Deacon Cc: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org --- drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 3 --- drivers/perf/hisilicon/hisi_uncore_hha_pmu.c | 3 --- drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c | 3 --- drivers/perf/hisilicon/hisi_uncore_pa_pmu.c | 3 --- drivers/perf/hisilicon/hisi_uncore_pmu.c | 4 ++-- drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c | 3 --- 6 files changed, 2 insertions(+), 17 deletions(-) --- a/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c @@ -537,7 +537,6 @@ static int hisi_ddrc_pmu_probe(struct pl dev_err(ddrc_pmu->dev, "DDRC PMU register failed!\n"); cpuhp_state_remove_instance_nocalls( CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE, &ddrc_pmu->node); - irq_set_affinity_hint(ddrc_pmu->irq, NULL); } return ret; @@ -550,8 +549,6 @@ static int hisi_ddrc_pmu_remove(struct p perf_pmu_unregister(&ddrc_pmu->pmu); cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_DDRC_ONLINE, &ddrc_pmu->node); - irq_set_affinity_hint(ddrc_pmu->irq, NULL); - return 0; } --- a/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_hha_pmu.c @@ -540,7 +540,6 @@ static int hisi_hha_pmu_probe(struct pla dev_err(hha_pmu->dev, "HHA PMU register failed!\n"); cpuhp_state_remove_instance_nocalls( CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE, &hha_pmu->node); - irq_set_affinity_hint(hha_pmu->irq, NULL); } return ret; @@ -553,8 +552,6 @@ static int hisi_hha_pmu_remove(struct pl perf_pmu_unregister(&hha_pmu->pmu); cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_HHA_ONLINE, &hha_pmu->node); - irq_set_affinity_hint(hha_pmu->irq, NULL); - return 0; } --- a/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c @@ -578,7 +578,6 @@ static int hisi_l3c_pmu_probe(struct pla dev_err(l3c_pmu->dev, "L3C PMU register failed!\n"); cpuhp_state_remove_instance_nocalls( CPUHP_AP_PERF_ARM_HISI_L3_ONLINE, &l3c_pmu->node); - irq_set_affinity_hint(l3c_pmu->irq, NULL); } return ret; @@ -591,8 +590,6 @@ static int hisi_l3c_pmu_remove(struct pl perf_pmu_unregister(&l3c_pmu->pmu); cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_L3_ONLINE, &l3c_pmu->node); - irq_set_affinity_hint(l3c_pmu->irq, NULL); - return 0; } --- a/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pa_pmu.c @@ -436,7 +436,6 @@ static int hisi_pa_pmu_probe(struct plat dev_err(pa_pmu->dev, "PMU register failed, ret = %d\n", ret); cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_PA_ONLINE, &pa_pmu->node); - irq_set_affinity_hint(pa_pmu->irq, NULL); return ret; } @@ -451,8 +450,6 @@ static int hisi_pa_pmu_remove(struct pla perf_pmu_unregister(&pa_pmu->pmu); cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_PA_ONLINE, &pa_pmu->node); - irq_set_affinity_hint(pa_pmu->irq, NULL); - return 0; } --- a/drivers/perf/hisilicon/hisi_uncore_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_pmu.c @@ -488,7 +488,7 @@ int hisi_uncore_pmu_online_cpu(unsigned hisi_pmu->on_cpu = cpu; /* Overflow interrupt also should use the same CPU */ - WARN_ON(irq_set_affinity_hint(hisi_pmu->irq, cpumask_of(cpu))); + WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(cpu))); return 0; } @@ -521,7 +521,7 @@ int hisi_uncore_pmu_offline_cpu(unsigned perf_pmu_migrate_context(&hisi_pmu->pmu, cpu, target); /* Use this CPU for event counting */ hisi_pmu->on_cpu = target; - WARN_ON(irq_set_affinity_hint(hisi_pmu->irq, cpumask_of(target))); + WARN_ON(irq_set_affinity(hisi_pmu->irq, cpumask_of(target))); return 0; } --- a/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c +++ b/drivers/perf/hisilicon/hisi_uncore_sllc_pmu.c @@ -465,7 +465,6 @@ static int hisi_sllc_pmu_probe(struct pl dev_err(sllc_pmu->dev, "PMU register failed, ret = %d\n", ret); cpuhp_state_remove_instance(CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE, &sllc_pmu->node); - irq_set_affinity_hint(sllc_pmu->irq, NULL); return ret; } @@ -481,8 +480,6 @@ static int hisi_sllc_pmu_remove(struct p perf_pmu_unregister(&sllc_pmu->pmu); cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_HISI_SLLC_ONLINE, &sllc_pmu->node); - irq_set_affinity_hint(sllc_pmu->irq, NULL); - return 0; }