From patchwork Tue May 18 09:17:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12264345 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 69787C433ED 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 F2B2461353 for ; Tue, 18 May 2021 09:36:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2B2461353 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=C02uFkZC9YpTDWvohPaUMAhssMZpFtG6GenprcAMcdQ=; b=aGXdlId31PKqBjL7sThbOErtM 2ATNcBkBpfzR020xJ4BgosvGvVrQOyT26JHE+QnxnFE52AF9x1nbLPFYsUgegQBT3BGIxgy6G5yAW c4q0hwW61xjCWyAgUOrcWQRFgnlnGABpoagtGi9QsTgdwRLQm30zOGQtD+fVxt2+Ngj1GJkynx/cp u+9SqlVsJCKHnVH+xc7JENIvnjkonjFIRceW1yhecuP1a8TTEQkXDvtuZ57O/w+JTyrqMVSKjwrc3 7Av0gpkQm03wtctfsz0kkLsagMCn7XEcqz4cdZ9qBkHebIQldi5rTOB7/tIJzzJXIqAgCkMymRjSF PL1ZUQ+MQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liw7O-0009T4-Kd; Tue, 18 May 2021 09:34:26 +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 1liw6K-0009CC-Dt for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 09:33:20 +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=b90nAbK3k34HRbQdysTkS+rhjrqZti7oDbJBBGxuaqQ=; b=eNOhfhG0Lvo4iHsNlS0dWamghg vBA5481HNo/OsuD8QfKVe5s4hokdmRqFf7G1XXZCFt2541ucEWW9gxVIpHWlSoOm1+D7GvZcNMllw 80YQGPsLaA1YBKlZLl9xug0tNhxvT7FrOmB2XsQFx1uEujNyYx86u/eiDlMku4vseotpCW+wI1woi GgCHygD9jbQPJ9pISOIZMn6gi0VbmIPhzFzBrH/3WwOgdgE64K8CDRhjf/PZs5dc3xbEc5gvKeeuB v7RsDF0Qui/8RR/xl5hU+mXz7pWgXCxbu+YyKJ3m+Inj2TYDjIGudCFXZh3ld1TGGHgrSKbKx6TRu iuhdvqDg==; Received: from galois.linutronix.de ([193.142.43.55]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liw6H-00EVmk-Nt for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:33:19 +0000 Message-Id: <20210518093118.505110632@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621330396; 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=b90nAbK3k34HRbQdysTkS+rhjrqZti7oDbJBBGxuaqQ=; b=yr6O4dW4S4G3cbaz5ArdzyFx8YFFGxQwLHqbkXHEudPgeKL/9b6rhieARNz8hD/1Kt+ctE 3InNUuinKLGd8H8uFdB8b8P1JnUpuum513+NGCXn0jAlRJ6K8ebKrfjbUaq0A+rQZh3OLh 99uBASD3/oOZhdhq/LYSASRZhLzXPBhdQNyTUSgT7ZnoPbmw94jLozCkN4QoV+owwACAXW xVqGfEuZmvTygx5Vpt06GUryDeT0tnJLI+w/jcfhSOKrsGceGhn90Hn/KX9pIZoXQ64ekN Ix+AJ6ybkvmyG3lCx7B0+VXSxdPJWo/6qrEp07Zf+yueW1BNkPftwXczlP93qQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621330396; 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=b90nAbK3k34HRbQdysTkS+rhjrqZti7oDbJBBGxuaqQ=; b=0EEEwQglpRuWfTVVpNXrIb7wKLg6twfA8+Umf09EkeIwowpCOd332t/fHLCSXhKcz0mKBZ 6oRPVquysbQmDqBQ== Date: Tue, 18 May 2021 11:17:30 +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 5/8] perf/arm-dsu: 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_947984_58941179 X-CRM114-Status: GOOD ( 15.31 ) 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_dsu_pmu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/drivers/perf/arm_dsu_pmu.c +++ b/drivers/perf/arm_dsu_pmu.c @@ -687,7 +687,7 @@ static void dsu_pmu_probe_pmu(struct dsu static void dsu_pmu_set_active_cpu(int cpu, struct dsu_pmu *dsu_pmu) { cpumask_set_cpu(cpu, &dsu_pmu->active_cpu); - if (irq_set_affinity_hint(dsu_pmu->irq, &dsu_pmu->active_cpu)) + if (irq_set_affinity(dsu_pmu->irq, &dsu_pmu->active_cpu)) pr_warn("Failed to set irq affinity to %d\n", cpu); } @@ -769,7 +769,6 @@ static int dsu_pmu_device_probe(struct p if (rc) { cpuhp_state_remove_instance(dsu_pmu_cpuhp_state, &dsu_pmu->cpuhp_node); - irq_set_affinity_hint(dsu_pmu->irq, NULL); } return rc; @@ -781,7 +780,6 @@ static int dsu_pmu_device_remove(struct perf_pmu_unregister(&dsu_pmu->pmu); cpuhp_state_remove_instance(dsu_pmu_cpuhp_state, &dsu_pmu->cpuhp_node); - irq_set_affinity_hint(dsu_pmu->irq, NULL); return 0; } @@ -840,10 +838,8 @@ static int dsu_pmu_cpu_teardown(unsigned dst = dsu_pmu_get_online_cpu_any_but(dsu_pmu, cpu); /* If there are no active CPUs in the DSU, leave IRQ disabled */ - if (dst >= nr_cpu_ids) { - irq_set_affinity_hint(dsu_pmu->irq, NULL); + if (dst >= nr_cpu_ids) return 0; - } perf_pmu_migrate_context(&dsu_pmu->pmu, cpu, dst); dsu_pmu_set_active_cpu(dst, dsu_pmu);