From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8ED91C27C79 for ; Thu, 20 Jun 2024 06:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OrOguSW1xSBikrPxVle5u+auw5xGxdyhVPIRfQxuybU=; b=hPdjExhQu9nutQ9r6MwZ7AcL1Z 5ZK8ALKG86Kawp09/2yJS880rt7gXnjQ4y0g3XuPDmQnR6UTrQFBMW7dSmdtWgjv5aiTDWjWHPpez T0Q8ExS2QD7V+/Yu3INUyVBs4aurFTC2njnKo7I1Zq1m+xXu3yraqoK+sCqXykOgEqfR7TGhVRFEI r0U8PtxhIbJxeoEmGzJAwokURxF26Wj+Q/vodAiiTtFnvbRdsdYP5VmH4KPFeavSe0XhFR08JEeWp RzjZiqyibrdZvJGtkG2kMiLQEXLn4HbOe94WozAgrLraGmAu6wJg/Gdg8uWLqppB53rqJ8C2Aul8c 0uENl0sA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKBIH-00000003ng1-0kOQ; Thu, 20 Jun 2024 06:29:13 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sKBIE-00000003nfQ-0vyt for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2024 06:29:12 +0000 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-2c72becd4fdso508624a91.0 for ; Wed, 19 Jun 2024 23:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718864947; x=1719469747; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=OrOguSW1xSBikrPxVle5u+auw5xGxdyhVPIRfQxuybU=; b=Kk0hqVoJmQRjumKY6+LNcd0uAz8cEn1Mm5kX7syIIj11QQuauJc5cuKFbh4NP5eSEs jUSQD17UQ+LUWQJCVMo+PvC1t/yK8lBp0p63LtGq1y5Pw1qKYM1Wfu5sJMHpahg628zo l1zy+tAlZhbzsCOYnw4sHXL9gtHOUAWY/8e2rArHHbt9lJMZaLfieZLsssUgjvDtzx5J ZUHOh3c5NeOSZbBSgDYSQZLxxSd+vgezTvkZQ1VQ86ZO9l2XvjyH3BVbiqo8CDgDGsvo FiYSiHs686h8oPKVj1HoDYrD7ZF+If98hKge1PI6yuRL/EcQ8WlpcS5KCas0M0EEiAs6 Jx6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718864947; x=1719469747; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=OrOguSW1xSBikrPxVle5u+auw5xGxdyhVPIRfQxuybU=; b=K9exOJbARJXD06INDp1q8viorXujPr8b3Pkc87SHiGslZ1AA5d7krSWzU4vkJu7K3B zDfpYR6RZddLnLQ8UNoS4BiQdSHBjB8PwIEJit5wrF3BfSK8yy+hWowsF8nrITF299fQ Y+83sxfhoWb6JvZT8FM9n3yOTwFAvQ+hUvq59GL/XZ3+xx0DJTaqCSq7nzERhVSPSE70 VEVR6n5ACnzTFwt8//cYOnGRl2cYAATJhFq8KMAOheZwljVShugZSj+IP8ZfSBcRQoW2 ekq+fWRvebRg8u6Db2UCMZLl4+TIaELMsH78SLd5INyXZ8lXKwanK3mYthTUFeEsY8BH gR4A== X-Forwarded-Encrypted: i=1; AJvYcCVBsgkmWxnOwjWD5j5UIACZoe3uJiwGU14EGdc7gIni9sYKNetBNFTrFH1XSyslBeAimYO/BOduuCZ3ve6xJhYbFplpCSBZwyuS48pB5nqRp4zhY5Q= X-Gm-Message-State: AOJu0Yy7OsDG5bLcnmD8rid0FHmeBEsJtJ27VQ6jaSnRyWj6bBSZZqGr bCvy5fl9SdRQtWrigjJgbJcxpi9fx6MZ4FwdWMYAJHZQ+H7lbvTqZ8QF5hB00w== X-Google-Smtp-Source: AGHT+IGhBLmT7J5yTVsjH+i1UCXjrqy1tsA6XXF04aIkSu369kHLPXXzz3maS23iBc759WeKfIKRQg== X-Received: by 2002:a17:90a:2f43:b0:2c7:bade:25be with SMTP id 98e67ed59e1d1-2c7bade2676mr3877809a91.14.1718864947153; Wed, 19 Jun 2024 23:29:07 -0700 (PDT) Received: from thinkpad ([120.60.54.81]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2c7e53ea57fsm837788a91.14.2024.06.19.23.29.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 23:29:06 -0700 (PDT) Date: Thu, 20 Jun 2024 11:58:53 +0530 From: Manivannan Sadhasivam To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Andrew Lunn , Gregory Clement , Thomas Petazzoni , Rob Herring , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marc Zyngier Subject: Re: [PATCH] PCI: mvebu: Dispose INTx irqs prior to removing INTx domain Message-ID: <20240620062853.GA15813@thinkpad> References: <20240619142829.2804-1-kabel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240619142829.2804-1-kabel@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240619_232910_457198_2FB48C55 X-CRM114-Status: GOOD ( 27.89 ) 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 + Marc On Wed, Jun 19, 2024 at 04:28:29PM +0200, Marek Behún wrote: > From: Pali Rohár > > Documentation for irq_domain_remove() says that all mapping within the > domain must be disposed prior to domain remove. > > Currently INTx irqs are not disposed in pci-mvebu.c device unbind callback > which cause that kernel crashes after unloading driver and trying to read > /sys/kernel/debug/irq/irqs/ or /proc/interrupts. > Thanks a lot for respinning this patch. It is indeed fixing a real problem since this driver can be unloaded runtime. It is always a debate on whether an irqchip controller should be allowed to be removed runtime or not, but I hope Marc will provide some inputs here. > Fixes: ec075262648f ("PCI: mvebu: Implement support for legacy INTx interrupts") > Reported-by: Hajo Noerenberg > Signed-off-by: Pali Rohár > Reviewed-by: Marek Behún > [ refactored a little ] > Signed-off-by: Marek Behún But this patch looks good to me. I hope that we should be able to use this patch as a precedent for other drivers as well. Reviewed-by: Manivannan Sadhasivam - Mani > --- > This was discussed back in 2022 > https://lore.kernel.org/linux-arm-kernel/20220709161858.15031-1-pali@kernel.org/ > IMO Pali gave good arguments about why it should be applied, and Lorenzo > agreed. > > Can we get this applied? > --- > drivers/pci/controller/pci-mvebu.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c > index 29fe09c99e7d..91a02b23aeb1 100644 > --- a/drivers/pci/controller/pci-mvebu.c > +++ b/drivers/pci/controller/pci-mvebu.c > @@ -1683,8 +1683,15 @@ static void mvebu_pcie_remove(struct platform_device *pdev) > irq_set_chained_handler_and_data(irq, NULL, NULL); > > /* Remove IRQ domains. */ > - if (port->intx_irq_domain) > + if (port->intx_irq_domain) { > + for (int j = 0; j < PCI_NUM_INTX; j++) { > + int virq = irq_find_mapping(port->intx_irq_domain, j); > + > + if (virq > 0) > + irq_dispose_mapping(virq); > + } > irq_domain_remove(port->intx_irq_domain); > + } > > /* Free config space for emulated root bridge. */ > pci_bridge_emul_cleanup(&port->bridge); > -- > 2.44.2 > > -- மணிவண்ணன் சதாசிவம்