From patchwork Fri Jun 7 22:31:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 249859 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 90F472C00B8 for ; Sat, 8 Jun 2013 08:32:13 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756051Ab3FGWbn (ORCPT ); Fri, 7 Jun 2013 18:31:43 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:51342 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756072Ab3FGWbl (ORCPT ); Fri, 7 Jun 2013 18:31:41 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r57MVJf8018072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 7 Jun 2013 22:31:20 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r57MVLpu019512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 7 Jun 2013 22:31:21 GMT Received: from abhmt103.oracle.com (abhmt103.oracle.com [141.146.116.55]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r57MVKbm008369; Fri, 7 Jun 2013 22:31:20 GMT Received: from linux-siqj.site (/10.132.126.191) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 07 Jun 2013 15:31:20 -0700 From: Yinghai Lu To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Bjorn Helgaas , "Rafael J. Wysocki" Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v3 17/27] genirq: Bail out early in free_desc() Date: Fri, 7 Jun 2013 15:31:03 -0700 Message-Id: <1370644273-10495-18-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1370644273-10495-1-git-send-email-yinghai@kernel.org> References: <1370644273-10495-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org We pre-reserve irq range for hot-added ioapic, and later only some are used via realloc. So during hot-remove, we need to clear bits in allocated_irqs for both case. Check if the irq_desc is there at first, and bail out early if irq_desc is not allocated yet. We can use irq_free_descs to clear allocated_irqs bits for preserved irqs only. Signed-off-by: Yinghai Lu --- kernel/irq/irqdesc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index b48f65b..32f099e 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c @@ -170,6 +170,9 @@ static void free_desc(unsigned int irq) { struct irq_desc *desc = irq_to_desc(irq); + if (!desc) + return; + unregister_irq_proc(irq, desc); mutex_lock(&sparse_irq_lock);