Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp118721ybg; Mon, 8 Jun 2020 18:07:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyaCZr9IwaqYTczcv77NpoAPWLXZt8izMI9fJGF1D9BtqOz3zKWJDi6W5U+/HAfVrTKy5nc X-Received: by 2002:a17:906:344e:: with SMTP id d14mr23119696ejb.53.1591664870625; Mon, 08 Jun 2020 18:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591664870; cv=none; d=google.com; s=arc-20160816; b=nQewjIRuQKWnoL50bdfcvgRdsN38BkcgDQUWaI+Z6qC/ugECDF8KXtJ3mLOKvsNRtn gn8jl4oLtZ96GiK0FCkhw3mL8FibP9BWDztNklrldTRvTwHcFmGyhaaYxAoGozmDErjG FJ5w37SXWQ6Enh4k106cDj/rw9qOyzyyKQbIBVwiWIupObBiB7ZQ/MZwU0WpvlXXF3LM mJR5RVSqFY7cgJiWJbLyd6OWF0gdiLO+EqU4w59Y/OqGKux+9s3XmaLkFTTThrKg65FT 2ZyiYucXAoTlmIJXmaVvHVUYMhP0fCagQbm0T60B9U07lyto3yrikqv0EAdBjzIfqCdQ /F/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fV6wr4GRkebfVt2NdazfY1LHJW7zWBpXQu1n0Ej/EQk=; b=Mqx+VKsdTGsrA7H1vjfO7i7jigYYbRn2As/YHTSd3bQ2bcTWVnxThE6uIcny1P2LwQ BSPFEyQYlUFGPLM8mu1/6l6QWHik4VmRkmRvmlRXjOu2ZJSW8/FOfw9+tqwL+SVj6csx i1fEvejDQsHnkWi8jljcff3fJMtW4g1g0JFXvn5Pqno7hqiW7WOp6BrPxxac/27bnEcL Yx84STXjRZMyNY3qUDDmJqKae3qhi82hus8QwSTK0uiHygUgRgwFt4SHeEUlgXJ6AjIu R1QfOLdSasVA6EQjNlc860EjziXSQ/nEVDvjFjhJatAYC6ExbLVFXhnXQmQdBlIftFRM iZCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="WbgJ/i4s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si9341387ejn.265.2020.06.08.18.07.27; Mon, 08 Jun 2020 18:07:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="WbgJ/i4s"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728004AbgFIBFO (ORCPT + 99 others); Mon, 8 Jun 2020 21:05:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:51208 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727799AbgFHXHT (ORCPT ); Mon, 8 Jun 2020 19:07:19 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DFD862087E; Mon, 8 Jun 2020 23:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657639; bh=KeY6RO9Q9yvF6MpjhhdIDXm5QTdCoMZ8/UAisDVoSoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbgJ/i4sg4h8Y0wZ+arhDFkzAolxdi//qOflGTRZ87/9CJ3TkxA8Ju4nsTs9fdgVr gHnLOTex3yxdm4kvm8LAgfAfDWfZXImVluJFfr/w9BqxBGUvjN2ZDP0ljGyCFnNfr0 HOhCHwuhvUJY+okaxINPSgaTw6feoTQ8DwVLLIeI= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Jean-Philippe Brucker , Will Deacon , Sasha Levin , linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.7 057/274] pmu/smmuv3: Clear IRQ affinity hint on device removal Date: Mon, 8 Jun 2020 19:02:30 -0400 Message-Id: <20200608230607.3361041-57-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jean-Philippe Brucker [ Upstream commit 10f6cd2af21bb44faab31a50ec3361d7649e5a39 ] Currently when trying to remove the SMMUv3 PMU module we get a WARN_ON_ONCE from free_irq(), because the affinity hint set during probe hasn't been properly cleared. [ 238.878383] WARNING: CPU: 0 PID: 175 at kernel/irq/manage.c:1744 free_irq+0x324/0x358 ... [ 238.897263] Call trace: [ 238.897998] free_irq+0x324/0x358 [ 238.898792] devm_irq_release+0x18/0x28 [ 238.899189] release_nodes+0x1b0/0x228 [ 238.899984] devres_release_all+0x38/0x60 [ 238.900779] device_release_driver_internal+0x10c/0x1d0 [ 238.901574] driver_detach+0x50/0xe0 [ 238.902368] bus_remove_driver+0x5c/0xd8 [ 238.903448] driver_unregister+0x30/0x60 [ 238.903958] platform_driver_unregister+0x14/0x20 [ 238.905075] arm_smmu_pmu_exit+0x1c/0xecc [arm_smmuv3_pmu] [ 238.905547] __arm64_sys_delete_module+0x14c/0x260 [ 238.906342] el0_svc_common.constprop.0+0x74/0x178 [ 238.907355] do_el0_svc+0x24/0x90 [ 238.907932] el0_sync_handler+0x11c/0x198 [ 238.908979] el0_sync+0x158/0x180 Just like the other perf drivers, clear the affinity hint before releasing the device. Fixes: 7d839b4b9e00 ("perf/smmuv3: Add arm64 smmuv3 pmu driver") Signed-off-by: Jean-Philippe Brucker Link: https://lore.kernel.org/r/20200422084805.237738-1-jean-philippe@linaro.org Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- drivers/perf/arm_smmuv3_pmu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c index f01a57e5a5f3..48e28ef93a70 100644 --- a/drivers/perf/arm_smmuv3_pmu.c +++ b/drivers/perf/arm_smmuv3_pmu.c @@ -814,7 +814,7 @@ static int smmu_pmu_probe(struct platform_device *pdev) if (err) { dev_err(dev, "Error %d registering hotplug, PMU @%pa\n", err, &res_0->start); - return err; + goto out_clear_affinity; } err = perf_pmu_register(&smmu_pmu->pmu, name, -1); @@ -833,6 +833,8 @@ static int smmu_pmu_probe(struct platform_device *pdev) out_unregister: cpuhp_state_remove_instance_nocalls(cpuhp_state_num, &smmu_pmu->node); +out_clear_affinity: + irq_set_affinity_hint(smmu_pmu->irq, NULL); return err; } @@ -842,6 +844,7 @@ static int smmu_pmu_remove(struct platform_device *pdev) perf_pmu_unregister(&smmu_pmu->pmu); cpuhp_state_remove_instance_nocalls(cpuhp_state_num, &smmu_pmu->node); + irq_set_affinity_hint(smmu_pmu->irq, NULL); return 0; } -- 2.25.1