From patchwork Mon Feb 10 07:58:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 13967434 X-Patchwork-Delegate: kw@linux.com Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2313C1BBBF7; Mon, 10 Feb 2025 07:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.248.49.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174305; cv=none; b=CalzTYIyQf3ZTGvuejKkWs7BpDBlD1XhZale2KsC9D+0xNXuX7LoOcdXjqQh73huneCAM6mHV1XV4+0N8GY+W0vpQ1qcdGCv2H9Er/4EyduEQYsBktqfzt9KCbEP7DLSK83Cpu6CQ3YJUcMw1lAw/jB4S++kSqE2Iaw0VNxEtHw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174305; c=relaxed/simple; bh=nHzQIpdsP4IcdpW1dt9ei1+itu2EKrYjxh/aM8W5BSg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=H+Serw1uDluvEz+AilGy2rca1f+pblzOwcTPj5oEt28QIp3xDFA91AIBfzDdh4H+VyhkJXeNOetiWTjOQqAr9xPT9fm4KqUREkEa072tsGRmdGnGFlI+zYJfSnNlTU/xGQqdnLTVH14BnKKKHukHNHK2huaI9xQXMbWsSBVt3kM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com; spf=pass smtp.mailfrom=socionext.com; arc=none smtp.client-ip=202.248.49.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=socionext.com Received: from unknown (HELO iyokan2-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 10 Feb 2025 16:58:21 +0900 Received: from mail.mfilter.local (mail-arc02.css.socionext.com [10.213.46.40]) by iyokan2-ex.css.socionext.com (Postfix) with ESMTP id 9F64320090C1; Mon, 10 Feb 2025 16:58:21 +0900 (JST) Received: from kinkan2.css.socionext.com ([172.31.9.51]) by m-FILTER with ESMTP; Mon, 10 Feb 2025 16:58:21 +0900 Received: from plum.e01.socionext.com (unknown [10.212.245.39]) by kinkan2.css.socionext.com (Postfix) with ESMTP id 4BADC1CDD; Mon, 10 Feb 2025 16:58:21 +0900 (JST) From: Kunihiko Hayashi To: Manivannan Sadhasivam , Krzysztof Wilczynski , Kishon Vijay Abraham I , Arnd Bergmann , Greg Kroah-Hartman , Lorenzo Pieralisi , Gustavo Pimentel , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi , stable@vger.kernel.org Subject: [PATCH v3 1/5] misc: pci_endpoint_test: Avoid issue of interrupts remaining after request_irq error Date: Mon, 10 Feb 2025 16:58:08 +0900 Message-Id: <20250210075812.3900646-2-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> References: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 After devm_request_irq() fails with error in pci_endpoint_test_request_irq(), pci_endpoint_test_free_irq_vectors() is called assuming that all IRQs have been released. However some requested IRQs remain unreleased, so there are still /proc/irq/* entries remaining and we encounters WARN() with the following message: remove_proc_entry: removing non-empty directory 'irq/30', leaking at least 'pci-endpoint-test.0' WARNING: CPU: 0 PID: 202 at fs/proc/generic.c:719 remove_proc_entry +0x190/0x19c And show the call trace that led to this issue: [ 12.050005] Call trace: [ 12.051226] remove_proc_entry+0x190/0x19c (P) [ 12.053448] unregister_irq_proc+0xd0/0x104 [ 12.055541] free_desc+0x4c/0xd0 [ 12.057155] irq_free_descs+0x68/0x90 [ 12.058984] irq_domain_free_irqs+0x15c/0x1bc [ 12.061161] msi_domain_free_locked.part.0+0x184/0x1d4 [ 12.063728] msi_domain_free_irqs_all_locked+0x64/0x8c [ 12.066296] pci_msi_teardown_msi_irqs+0x48/0x54 [ 12.068604] pci_free_msi_irqs+0x18/0x38 [ 12.070564] pci_free_irq_vectors+0x64/0x8c [ 12.072654] pci_endpoint_test_ioctl+0x870/0x1068 [ 12.075006] __arm64_sys_ioctl+0xb0/0xe8 [ 12.076967] invoke_syscall+0x48/0x110 [ 12.078841] el0_svc_common.constprop.0+0x40/0xe8 [ 12.081192] do_el0_svc+0x20/0x2c [ 12.082848] el0_svc+0x30/0xd0 [ 12.084376] el0t_64_sync_handler+0x144/0x168 [ 12.086553] el0t_64_sync+0x198/0x19c [ 12.088383] ---[ end trace 0000000000000000 ]--- To solve this issue, set the number of remaining IRQs to test->num_irqs and release IRQs in advance by calling pci_endpoint_test_release_irq(). Cc: stable@vger.kernel.org Fixes: e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands") Signed-off-by: Kunihiko Hayashi Reviewed-by: Manivannan Sadhasivam --- drivers/misc/pci_endpoint_test.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index d5ac71a49386..bbcccd425700 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -259,6 +259,9 @@ static int pci_endpoint_test_request_irq(struct pci_endpoint_test *test) break; } + test->num_irqs = i; + pci_endpoint_test_release_irq(test); + return ret; } From patchwork Mon Feb 10 07:58:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 13967438 X-Patchwork-Delegate: kw@linux.com Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DED411BE251; Mon, 10 Feb 2025 07:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.248.49.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174308; cv=none; b=qxawv4uTc75kMFIWrde33mOuMPvAGEiZ/ReIGU4/+QWnSOcoVqB9xAF9Pz05cDmW2NbeXDFFQY8biiO30K94U5WtAFJ5NAhhk3o/QY7iNli3YANJP2rXdjbcJwktTj52+AUftqksD+jRKwVLk7VWAWWCMm9O/L8cezNRB2+QEso= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174308; c=relaxed/simple; bh=/Ryx2/B0BD2rHffc0Fha4W4Sr0eXx1nvnHkVyR4nwA8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=lN9wSBpM6lr974NjglD4QkqtCqg9eJppjGPS3HRIztDV6K+UJ12utxVCMMmhlueU5R0arKOzjHzrfmvgkyxsRLSHEZGs927Mw8D07h92FQs0F9c8vwhHnjv1zX2p4P9RdF30mZ8GJ5ZdxRi812sghvLzbDmCoCNvGxGG12XFm04= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com; spf=pass smtp.mailfrom=socionext.com; arc=none smtp.client-ip=202.248.49.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=socionext.com Received: from unknown (HELO kinkan2-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 10 Feb 2025 16:58:22 +0900 Received: from mail.mfilter.local (mail-arc01.css.socionext.com [10.213.46.36]) by kinkan2-ex.css.socionext.com (Postfix) with ESMTP id 6CDB02006EA4; Mon, 10 Feb 2025 16:58:22 +0900 (JST) Received: from kinkan2.css.socionext.com ([172.31.9.51]) by m-FILTER with ESMTP; Mon, 10 Feb 2025 16:58:22 +0900 Received: from plum.e01.socionext.com (unknown [10.212.245.39]) by kinkan2.css.socionext.com (Postfix) with ESMTP id 15B8F1CDD; Mon, 10 Feb 2025 16:58:22 +0900 (JST) From: Kunihiko Hayashi To: Manivannan Sadhasivam , Krzysztof Wilczynski , Kishon Vijay Abraham I , Arnd Bergmann , Greg Kroah-Hartman , Lorenzo Pieralisi , Gustavo Pimentel , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi , stable@vger.kernel.org Subject: [PATCH v3 2/5] misc: pci_endpoint_test: Fix disyplaying irq_type after request_irq error Date: Mon, 10 Feb 2025 16:58:09 +0900 Message-Id: <20250210075812.3900646-3-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> References: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are two variables that indicate the interrupt type to be used in the next test execution, global "irq_type" and test->irq_type. The former is referenced from pci_endpoint_test_get_irq() to preserve the current type for ioctl(PCITEST_GET_IRQTYPE). In pci_endpoint_test_request_irq(), since this global variable is referenced when an error occurs, the unintended error message is displayed. For example, the following message shows "MSI 3" even if the current irq type becomes "MSI-X". # pcitest -i 2 pci-endpoint-test 0000:01:00.0: Failed to request IRQ 30 for MSI 3 SET IRQ TYPE TO MSI-X: NOT OKAY Fix this issue by using test->irq_type instead of global "irq_type". Cc: stable@vger.kernel.org Fixes: b2ba9225e031 ("misc: pci_endpoint_test: Avoid using module parameter to determine irqtype") Reviewed-by: Manivannan Sadhasivam Signed-off-by: Kunihiko Hayashi --- drivers/misc/pci_endpoint_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index bbcccd425700..f13fa32ef91a 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -242,7 +242,7 @@ static int pci_endpoint_test_request_irq(struct pci_endpoint_test *test) return 0; fail: - switch (irq_type) { + switch (test->irq_type) { case IRQ_TYPE_INTX: dev_err(dev, "Failed to request IRQ %d for Legacy\n", pci_irq_vector(pdev, i)); From patchwork Mon Feb 10 07:58:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 13967435 X-Patchwork-Delegate: kw@linux.com Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 824E91BCA0F; Mon, 10 Feb 2025 07:58:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.248.49.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174306; cv=none; b=f9eiDDgArA224p3nLqVSDAaKgxTr9y8DccE8K5XW3Eu0Roj7PeUggkFk8ItLwk8BnglVjW4WELpzUs94EFtdHRNLv7y9hj0WPeNVM3Th0/yXKjmgIIFyoXNVY5Vsyyuk0dzG11M+dt7EJ0IAn58ihQXHFU2Xvov8hQ9XjwG7Qus= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174306; c=relaxed/simple; bh=sWNOI2uoT7I2pQ45KuU15VwsIF8Tkr6Kp38yOtdv0C0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sZ6kVaR68i0Qa51LtvypELM0hqHhyQpfTkvZKiNI8zGiWnjJgFW3lCveOWnMSHTtQHoWQ4b43cIw+M91H/yxLaA/kB+HUKd0lhnRoLYCpFzFAkVw2oBfSNn9nhOrD4FOXkGLodzX2AKnE7SkjZEvRibjDu7zWCSgU5yRTTSbH+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com; spf=pass smtp.mailfrom=socionext.com; arc=none smtp.client-ip=202.248.49.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=socionext.com Received: from unknown (HELO iyokan2-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 10 Feb 2025 16:58:23 +0900 Received: from mail.mfilter.local (mail-arc02.css.socionext.com [10.213.46.40]) by iyokan2-ex.css.socionext.com (Postfix) with ESMTP id 9949C20090C1; Mon, 10 Feb 2025 16:58:23 +0900 (JST) Received: from kinkan2.css.socionext.com ([172.31.9.51]) by m-FILTER with ESMTP; Mon, 10 Feb 2025 16:58:23 +0900 Received: from plum.e01.socionext.com (unknown [10.212.245.39]) by kinkan2.css.socionext.com (Postfix) with ESMTP id D56211CDD; Mon, 10 Feb 2025 16:58:22 +0900 (JST) From: Kunihiko Hayashi To: Manivannan Sadhasivam , Krzysztof Wilczynski , Kishon Vijay Abraham I , Arnd Bergmann , Greg Kroah-Hartman , Lorenzo Pieralisi , Gustavo Pimentel , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi , stable@vger.kernel.org Subject: [PATCH v3 3/5] misc: pci_endpoint_test: Fix irq_type to convey the correct type Date: Mon, 10 Feb 2025 16:58:10 +0900 Message-Id: <20250210075812.3900646-4-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> References: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are two variables that indicate the interrupt type to be used in the next test execution, "irq_type" as global and test->irq_type. The global is referenced from pci_endpoint_test_get_irq() to preserve the current type for ioctl(PCITEST_GET_IRQTYPE). The type set in this function isn't reflected in the global "irq_type", so ioctl(PCITEST_GET_IRQTYPE) returns the previous type. As a result, the wrong type will be displayed in "pcitest" as follows: # pcitest -i 0 SET IRQ TYPE TO LEGACY: OKAY # pcitest -I GET IRQ TYPE: MSI Fix this issue by propagating the current type to the global "irq_type". Cc: stable@vger.kernel.org Fixes: b2ba9225e031 ("misc: pci_endpoint_test: Avoid using module parameter to determine irqtype") Signed-off-by: Kunihiko Hayashi Reviewed-by: Niklas Cassel --- drivers/misc/pci_endpoint_test.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index f13fa32ef91a..6a0972e7674f 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -829,6 +829,7 @@ static int pci_endpoint_test_set_irq(struct pci_endpoint_test *test, return ret; } + irq_type = test->irq_type; return 0; } From patchwork Mon Feb 10 07:58:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 13967436 X-Patchwork-Delegate: kw@linux.com Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E763B1BD4E4; Mon, 10 Feb 2025 07:58:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.248.49.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174306; cv=none; b=IPi9HLYqZ+rkT3tnU+DlPwIWe82EuE8uj9VWVbuMaTwajaWZyUQDzHGrYW6QRN32tA0e6FMIxXIdHEkScSGGnZifCce6tvNldcu4s7z27EX77suV98lc3d6F+T8cK0hMu/zyP2h5fEFYi3EzrPucbsRS9DceQmtP4ImsbmGeLFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174306; c=relaxed/simple; bh=ntdFh32/lfRw2nQvhlkL6tVguSwGZ4bh/tTdhq8w+N0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E2ggn+XyY6yOtG5Y0GML6JDPOrOCqcnwCY01DCDaRWUDqHtF8p8XJqxpcrCwk4zNJzgrMe1V44hahYf4ndlsVmcwcIEMEhIVtm2C+4/cbSh/cFYdMf7/ghGYh6N9kKSpv2QQeJZhXja+FQi642kV/8Tf8Cg6QwCmUR3QVkcssLg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com; spf=pass smtp.mailfrom=socionext.com; arc=none smtp.client-ip=202.248.49.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=socionext.com Received: from unknown (HELO kinkan2-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 10 Feb 2025 16:58:24 +0900 Received: from mail.mfilter.local (mail-arc02.css.socionext.com [10.213.46.40]) by kinkan2-ex.css.socionext.com (Postfix) with ESMTP id 209312006EA4; Mon, 10 Feb 2025 16:58:24 +0900 (JST) Received: from kinkan2.css.socionext.com ([172.31.9.51]) by m-FILTER with ESMTP; Mon, 10 Feb 2025 16:58:24 +0900 Received: from plum.e01.socionext.com (unknown [10.212.245.39]) by kinkan2.css.socionext.com (Postfix) with ESMTP id 717281CDD; Mon, 10 Feb 2025 16:58:23 +0900 (JST) From: Kunihiko Hayashi To: Manivannan Sadhasivam , Krzysztof Wilczynski , Kishon Vijay Abraham I , Arnd Bergmann , Greg Kroah-Hartman , Lorenzo Pieralisi , Gustavo Pimentel , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi , Niklas Cassel Subject: [PATCH v3 4/5] misc: pci_endpoint_test: Remove global irq_type Date: Mon, 10 Feb 2025 16:58:11 +0900 Message-Id: <20250210075812.3900646-5-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> References: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The global variable "irq_type" preserves the current value of ioctl(GET_IRQTYPE), however, it's enough to use test->irq_type. Remove the variable, and replace with test->irq_type. The ioctl(GET_IRQTYPE) returns an error if test->irq_type has IRQ_TYPE_UNDEFINED. Suggested-by: Niklas Cassel Suggested-by: Manivannan Sadhasivam Signed-off-by: Kunihiko Hayashi --- drivers/misc/pci_endpoint_test.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 6a0972e7674f..8d98cd18634d 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -100,10 +100,6 @@ static bool no_msi; module_param(no_msi, bool, 0444); MODULE_PARM_DESC(no_msi, "Disable MSI interrupt in pci_endpoint_test"); -static int irq_type = IRQ_TYPE_MSI; -module_param(irq_type, int, 0444); -MODULE_PARM_DESC(irq_type, "IRQ mode selection in pci_endpoint_test (0 - Legacy, 1 - MSI, 2 - MSI-X)"); - enum pci_barno { BAR_0, BAR_1, @@ -829,7 +825,6 @@ static int pci_endpoint_test_set_irq(struct pci_endpoint_test *test, return ret; } - irq_type = test->irq_type; return 0; } @@ -878,7 +873,7 @@ static long pci_endpoint_test_ioctl(struct file *file, unsigned int cmd, ret = pci_endpoint_test_set_irq(test, arg); break; case PCITEST_GET_IRQTYPE: - ret = irq_type; + ret = test->irq_type; break; case PCITEST_CLEAR_IRQ: ret = pci_endpoint_test_clear_irq(test); @@ -936,14 +931,14 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, test->irq_type = IRQ_TYPE_UNDEFINED; if (no_msi) - irq_type = IRQ_TYPE_INTX; + test->irq_type = IRQ_TYPE_INTX; data = (struct pci_endpoint_test_data *)ent->driver_data; if (data) { test_reg_bar = data->test_reg_bar; test->test_reg_bar = test_reg_bar; test->alignment = data->alignment; - irq_type = data->irq_type; + test->irq_type = data->irq_type; } init_completion(&test->irq_raised); @@ -965,7 +960,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev, pci_set_master(pdev); - ret = pci_endpoint_test_alloc_irq_vectors(test, irq_type); + ret = pci_endpoint_test_alloc_irq_vectors(test, test->irq_type); if (ret) goto err_disable_irq; From patchwork Mon Feb 10 07:58:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 13967437 X-Patchwork-Delegate: kw@linux.com Received: from mx.socionext.com (mx.socionext.com [202.248.49.38]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BB1C1BEF6F; Mon, 10 Feb 2025 07:58:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.248.49.38 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174307; cv=none; b=TiFgD7oBTC4qGLlogSmrHlQ6xhpU79HDQB3jgNIwsNypkaOLDZgjaIBV+q6pCGqPGVh7YVvUalDNKXE+pGL2OzIcYJlaDc7U7AKwcoJxbolgz13sjf/N4aF1gVVmuSiMQLYdE9sBYWLgweDxrxuJSERFsk55xsI4mdNpvNVuaC0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739174307; c=relaxed/simple; bh=1/idm9AJ+1pOB6k9pyLer3mBBTzxI9dHzyA4ixoFR/I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BDw+BXAbAPMM4mE/C+pnGQKkP/JZxZwUf5BWEPrxm+KumoywAiFqteEZAxaWK4C0M7k7taZJUZHz5R4Mfbv1Vne81v8z9XHRbQ2XNVgzE7nU3bNflVIHakNH6hUkX6BBy0Ryd5+DjEWQffBFKHroto99xbr5K7CUn5aDHwNAqOk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com; spf=pass smtp.mailfrom=socionext.com; arc=none smtp.client-ip=202.248.49.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=socionext.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=socionext.com Received: from unknown (HELO kinkan2-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 10 Feb 2025 16:58:24 +0900 Received: from mail.mfilter.local (mail-arc01.css.socionext.com [10.213.46.36]) by kinkan2-ex.css.socionext.com (Postfix) with ESMTP id 6EFBC2006EA4; Mon, 10 Feb 2025 16:58:24 +0900 (JST) Received: from kinkan2.css.socionext.com ([172.31.9.51]) by m-FILTER with ESMTP; Mon, 10 Feb 2025 16:58:24 +0900 Received: from plum.e01.socionext.com (unknown [10.212.245.39]) by kinkan2.css.socionext.com (Postfix) with ESMTP id 1621C1CDD; Mon, 10 Feb 2025 16:58:24 +0900 (JST) From: Kunihiko Hayashi To: Manivannan Sadhasivam , Krzysztof Wilczynski , Kishon Vijay Abraham I , Arnd Bergmann , Greg Kroah-Hartman , Lorenzo Pieralisi , Gustavo Pimentel , Bjorn Helgaas Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi Subject: [PATCH v3 5/5] misc: pci_endpoint_test: Do not use managed irq functions Date: Mon, 10 Feb 2025 16:58:12 +0900 Message-Id: <20250210075812.3900646-6-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> References: <20250210075812.3900646-1-hayashi.kunihiko@socionext.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The pci_endpoint_test_request_irq() and pci_endpoint_test_release_irq() are called repeatedly by the users through pci_endpoint_test_set_irq(). So using the managed version of IRQ functions within these functions has no effect. Suggested-by: Manivannan Sadhasivam Signed-off-by: Kunihiko Hayashi Reviewed-by: Manivannan Sadhasivam --- drivers/misc/pci_endpoint_test.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c index 8d98cd18634d..9465d2ab259a 100644 --- a/drivers/misc/pci_endpoint_test.c +++ b/drivers/misc/pci_endpoint_test.c @@ -212,10 +212,9 @@ static void pci_endpoint_test_release_irq(struct pci_endpoint_test *test) { int i; struct pci_dev *pdev = test->pdev; - struct device *dev = &pdev->dev; for (i = 0; i < test->num_irqs; i++) - devm_free_irq(dev, pci_irq_vector(pdev, i), test); + free_irq(pci_irq_vector(pdev, i), test); test->num_irqs = 0; } @@ -228,9 +227,9 @@ static int pci_endpoint_test_request_irq(struct pci_endpoint_test *test) struct device *dev = &pdev->dev; for (i = 0; i < test->num_irqs; i++) { - ret = devm_request_irq(dev, pci_irq_vector(pdev, i), - pci_endpoint_test_irqhandler, - IRQF_SHARED, test->name, test); + ret = request_irq(pci_irq_vector(pdev, i), + pci_endpoint_test_irqhandler, IRQF_SHARED, + test->name, test); if (ret) goto fail; }