From patchwork Tue May 18 09:17:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 12264339 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 B8282C43460 for ; Tue, 18 May 2021 09:35:53 +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 45DBE61073 for ; Tue, 18 May 2021 09:35:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45DBE61073 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=yA+RWQB/O+nGd+pj2NL72CSZLSnfKG/jdUHe/AbfE2U=; b=pxYIgnW4wpilQhkwU1w+hnl3c FI+4zkkqfRcWXm14MyCn9xLio2d5WopHntPyYqHLfosqrneKvoIc2E2I41i751ZAfPcs6+t4xkvM0 icp1WQNDXihwvRCso2vwKg9aJIoU9YfFm8WnC4/57GI9vl6eo63MaoZ8YWeYxCazdAV2ozqD00VO+ uhqnZsn9cAjcMr5yJfkHt7AdYzLHlXC7bL73dd815xt8NkbcX18ZxzKWxsk/WH+1DHkP627lzCEJc es+XTxtX91u3XcKhnAzv+/tfdR2woU6/nGjYHtM4oJ8yWE2+kIGfhO/Magrg71n57wNLDlArWzfCc sep8FYt1g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liw6o-0009HJ-3k; Tue, 18 May 2021 09:33:50 +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-0009B3-3d 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=xgxWrmDeDwFcZVosRdGu2aXTryt71ywlqfvU/UpOvTE=; b=M3MGwI5b3rAm/VLyAfmcZ5TZ/k bs8p9ovMPPKgwq7pKT+0inf8w1pcYeOlsYOQ+Qly0he46RjXEiwFNYzhDif5mI/krcHSXoI4t9UU3 Peo5V3RLPB2F8RFRQc5vDgQaqfT/dARn9VNy44egwWLLM+/BlATpuBnHreicaVY7aXw4LsgvaNk9g NdDcu5JNDDS1LnSxVMnIIB5IOPQsnFK7RVA+0PEozJFlezqeiGCq3mCAyf243OJLosGH7VfCXDoio a1KuRV5d0HSuYgCeYMLRsprpGv/CU0J1BAl0l38O83V+Dr+LMMk7L36F/4Dc/zcNanyn8IJifwUlg NxuoBEow==; Received: from galois.linutronix.de ([193.142.43.55]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liw6E-00EVkK-0w for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 09:33:15 +0000 Message-Id: <20210518093118.128250213@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621330392; 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=xgxWrmDeDwFcZVosRdGu2aXTryt71ywlqfvU/UpOvTE=; b=lmUWDic0xKRoYIFopWB7A5EyT7AMa3perXn0V85VCgBB73ufYcJ/Yf+/54p+dH/0pvTxtI TKkCRirJG8MnweUAwIaEtGZI43VM9X6VGJQZxHIZ+K+ntMWkSaXMj2BxrgQ1pL4lLo/F5B u+rKiXKD2RBdlxFEhuAWqQsHKkmCow/4D0R/nnnf29NXWH2sIFyuHzYb5rdqmPJL+HmQW+ wEm6xwK3y/9R9c8b/Xvzocj9+8wZVYTds68/GU+DQPevBWytHE+2xJqmtZDq+iMRLfqp1W h/GsxctofoVUccyFxL58Q/YhKmzBXYdxT/Byzwzj5Dtnr3bYkEr17BfMSabQ3Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621330392; 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=xgxWrmDeDwFcZVosRdGu2aXTryt71ywlqfvU/UpOvTE=; b=fL0TTVh71wwKJteJdTCRD0y/xcTIiGkv9htd38SnVIvvPjjjrMBXdS440T5gGl0PYVPS2h KCEYGC15Tb77QuDw== Date: Tue, 18 May 2021 11:17:27 +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 2/8] perf/arm-ccn: 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_023314_232259_7872EA9C X-CRM114-Status: GOOD ( 16.09 ) 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-ccn.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/perf/arm-ccn.c +++ b/drivers/perf/arm-ccn.c @@ -1211,7 +1211,7 @@ static int arm_ccn_pmu_offline_cpu(unsig perf_pmu_migrate_context(&dt->pmu, cpu, target); dt->cpu = target; if (ccn->irq) - WARN_ON(irq_set_affinity_hint(ccn->irq, cpumask_of(dt->cpu))); + WARN_ON(irq_set_affinity(ccn->irq, cpumask_of(dt->cpu))); return 0; } @@ -1291,7 +1291,7 @@ static int arm_ccn_pmu_init(struct arm_c /* Also make sure that the overflow interrupt is handled by this CPU */ if (ccn->irq) { - err = irq_set_affinity_hint(ccn->irq, cpumask_of(ccn->dt.cpu)); + err = irq_set_affinity(ccn->irq, cpumask_of(ccn->dt.cpu)); if (err) { dev_err(ccn->dev, "Failed to set interrupt affinity!\n"); goto error_set_affinity; @@ -1325,8 +1325,6 @@ static void arm_ccn_pmu_cleanup(struct a cpuhp_state_remove_instance_nocalls(CPUHP_AP_PERF_ARM_CCN_ONLINE, &ccn->dt.node); - if (ccn->irq) - irq_set_affinity_hint(ccn->irq, NULL); for (i = 0; i < ccn->num_xps; i++) writel(0, ccn->xp[i].base + CCN_XP_DT_CONTROL); writel(0, ccn->dt.base + CCN_DT_PMCR);