From patchwork Tue Feb 25 01:31:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 3712471 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3D145BF13A for ; Tue, 25 Feb 2014 01:31:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6EE3F20163 for ; Tue, 25 Feb 2014 01:31:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 887672017E for ; Tue, 25 Feb 2014 01:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752675AbaBYBbq (ORCPT ); Mon, 24 Feb 2014 20:31:46 -0500 Received: from mail-oa0-f52.google.com ([209.85.219.52]:43416 "EHLO mail-oa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752555AbaBYBbo (ORCPT ); Mon, 24 Feb 2014 20:31:44 -0500 Received: by mail-oa0-f52.google.com with SMTP id i4so8058311oah.11 for ; Mon, 24 Feb 2014 17:31:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=X7cyPOyKjP+zHLPErSDtvX+YPeoeuEL9IwtHPMwq2WU=; b=IRcboGI/HFZ9qqtWBDM/cTYsuwsBceZtQOxLcm/DHqX5puhIIP+rpn5fUglsIHYEPk f8jt8irm+6u+UyubQ4FVdPWLDT9HhJ01yHC6JhI/snPMx+WmeRORL0T8OFBVBNg5ahxM hqsN8ang/xcSaGH0Ts8uE++4tO04rKGHq19MxL+oc6jWef+CRoYIdKxggZhc+eRlggjy 2GF2mZtyKqwXqy7dMvkXV/Qd+YMsgSMOyP0f5aWTmRFmUMmMpfeBHbQ/DqzvF0lYAsR9 IWCwItHITsoYiRk0BcAbhEh86ws97dHMk6UxIyaQw8Bs+G0Kzp2nDlas71mFWYfvJ4cQ RXWg== MIME-Version: 1.0 X-Received: by 10.60.159.137 with SMTP id xc9mr3380175oeb.31.1393291904224; Mon, 24 Feb 2014 17:31:44 -0800 (PST) Received: by 10.76.153.136 with HTTP; Mon, 24 Feb 2014 17:31:43 -0800 (PST) In-Reply-To: References: <1388707565-16535-1-git-send-email-yinghai@kernel.org> <1388707565-16535-3-git-send-email-yinghai@kernel.org> Date: Mon, 24 Feb 2014 17:31:43 -0800 X-Google-Sender-Auth: Hbgrhu4FKK9OD7bljOJxsFbDCBU Message-ID: Subject: Re: [PATCH v5 02/33] genirq: Add irq_alloc_reserved_desc() From: Yinghai Lu To: Thomas Gleixner Cc: Ingo Molnar , "H. Peter Anvin" , Tony Luck , Bjorn Helgaas , "Rafael J. Wysocki" , "linux-pci@vger.kernel.org" , Linux Kernel Mailing List , ACPI Devel Maling List , Joerg Roedel , Konrad Rzeszutek Wilk , Sebastian Andrzej Siewior , Andrew Morton , Linus Torvalds Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sat, Feb 22, 2014 at 3:38 PM, Thomas Gleixner wrote: > > OMG, you really mean that: > > +++ b/arch/alpha/kernel/irq_i8259.c > @@ -92,6 +92,7 @@ init_i8259a_irqs(void) > outb(0xff, 0xA1); /* mask all of 8259A-2 */ > > for (i = 0; i < 16; i++) { > + irq_alloc_desc_at(i, 0); > irq_set_chip_and_handler(i, &i8259a_irq_type, handle_level_irq); > } > > You can't be serious about that. There are tons of ways to call into > the core and access an irq descriptor aside of irq_set_chip* before it > is potentially allocated. > > Are you going to analyze all of them and add an irq_alloc_desc_at() > before that call? > > HELL, NO! > > I'm really tired of that. > > Stay away from kernel/irq/* and wait for people who are competent > enough and willing to spend the extra thoughts to come up with > solutions which are not completely ass backwards. oh, no, sorry for annoying you again. In the irq_alloc_desc_at() path for !SPARSE_IRQ, it should not touch anything except setting that bit in allocated_irqs bitmap. Or could just replace irq_reserve_irq in irq_set_chip(), in that way will avoid touching arch codes. like --- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index dc04c16..02d6ad0 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -28,8 +28,13 @@ int irq_set_chip(unsigned int irq, struct irq_chip *chip) { unsigned long flags; - struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0); + struct irq_desc *desc; + +#ifndef CONFIG_SPARSE_IRQ + irq_alloc_desc_at(irq, 0); +#endif + desc = irq_get_desc_lock(irq, &flags, 0); if (!desc) return -EINVAL; @@ -38,12 +43,7 @@ int irq_set_chip(unsigned int irq, struct irq_chip *chip) desc->irq_data.chip = chip; irq_put_desc_unlock(desc, flags); - /* - * For !CONFIG_SPARSE_IRQ make the irq show up in - * allocated_irqs. For the CONFIG_SPARSE_IRQ case, it is - * already marked, and this call is harmless. - */ - irq_reserve_irq(irq); + return 0; } EXPORT_SYMBOL(irq_set_chip);