Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1850057ybv; Sun, 23 Feb 2020 16:53:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzhNgmBpayqhfbBCK6Uz8MFDTWBHcrgX7Ss2zJFdjwfQ8LrpAZnjImusopuvXJC46EX+kSq X-Received: by 2002:a9d:1c96:: with SMTP id l22mr38566867ota.322.1582505616088; Sun, 23 Feb 2020 16:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582505616; cv=none; d=google.com; s=arc-20160816; b=SG+hCjkxr0q05UIfYRshh3hClLsrnLpXOBDKibDk9V1xgcIRXbkErDhd1UxUzzdAGE RXQSOBp5n+LkmF16z2/cu/TAXTkydxNf7aYixR76A5R6a5EA1AamJ9jGG/8ulM81JJoI 2lI/51L4KyFQO/qd6q+PTYfalrq9D/sstkzkU7gko908HYnqL5+QQV2NwfFQq++PFF2K 4Pm5nnYrTXpXgTv4aMWTrjKLGthvVGS+r6qZvQpdSKiF68GEPJRqhItQgQUYcTYYzYAU cnOYoxOxCn3b5YhUXT12JFq50Mr6MbKDgCf2jNPfKinBPToTL7agSUz2HskASXgVXlwb X61Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=txZN9KmbopBmkJvhdnoVNctn9VXaIF+Ey3OgfvgPR7Q=; b=wIFr1pr9kSJOnztOYw/Dv2kqQfiQOHV+0IzEJBBd17p81e36zBq+nL/S9dmF6+69Eu TzEWMh4OZORoaUt07E6iMJw8mcDIEm0Rg+wtSxZKuReg/5wKni8KjM9HC9tkncxZjOn6 j4q45WMVPlFDFO8zMAX8auQUWmGRz5lgLqQ8Go4vho/T8hNUjxvDLMtyetWHoU4gVSGK pgaciagzh6QUDI3jUUnB7nuYmWFl9oHQKlO2Ki6REsj1SvuaaxlW1KE+qGnWdyQ4lfUL +sAMSeIb4IrmkMzD1gLo4yVFzCwLqcLl60rWzCYyqnWXi2q0qwKvgo35frkUEWjRge5g YOQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fle8tjwU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x2si4386524oie.56.2020.02.23.16.53.24; Sun, 23 Feb 2020 16:53:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fle8tjwU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727238AbgBXAw3 (ORCPT + 99 others); Sun, 23 Feb 2020 19:52:29 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:40299 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727156AbgBXAw2 (ORCPT ); Sun, 23 Feb 2020 19:52:28 -0500 Received: by mail-pg1-f193.google.com with SMTP id z7so4221192pgk.7 for ; Sun, 23 Feb 2020 16:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=txZN9KmbopBmkJvhdnoVNctn9VXaIF+Ey3OgfvgPR7Q=; b=fle8tjwUST5X9j1a+XqgJteR20V7X6mekReAIZZPD9M5tJ3N/SjAGPhDKj+VrEUj6h GW8XOL1HYWP3TxxqdMRK3NhfWrGWfk3bT+/wbeKXFML7LP8JvG78mNfbLvjPS/SFJht1 tMkql4cE54iggSShOGFX58N1YU0mrYlkPzgEfmEZ/+QIVcAKY4n76WPkR+qvbOlnXPez JYcdxAF721ZOxl2SVmp6xanxEdMPv5kkxL2CfNp3/5s5qt72IN/WsvqbJ+GD9+E/KIA/ tuta6SMAllfu6XZt4AL4MgLIikw6JrwPDlhGi3s+w0qYhSN3E343d44WOt9aQTspKEGz G9Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=txZN9KmbopBmkJvhdnoVNctn9VXaIF+Ey3OgfvgPR7Q=; b=IkKG4AwpZC59htCtUxjJzJzuV6ZMPO/ZVKMhjHOOXksqoISKXp9dXwP1AAycMXdV7M H/lJOpEQkfXEfjQvPSGGS3Pz9iW0pscY3Wva1JkD59lHoBpcPjsfO1UyBzAedeexe/MA wAHwNTfuex6a7bsyjOXtasK2ahHz2ylLxd4BsApR1l0kGyGu9rx8L+XM23kUNxJHETXy YMA8KmFTy44VmHjTDBiGpN1elnYjF0OYMpccQc8m2xJjkVmFhdt7aGYtu+5a4QENuG92 3wYHQ/he2xE3jFLSV9Wysmq+fDx2NYUTz1bWItmTNyWkL+oedA+aWCTiLqbkJywWhOMc pYHg== X-Gm-Message-State: APjAAAWlJk1yDqzv2gAV18oXGpnczFv3GpdDvpicu+A+H9Srxiadx3jT rB0rZzeAuWC2GfYKfQa1MpDKXwxKOck= X-Received: by 2002:a63:ad0c:: with SMTP id g12mr49696757pgf.228.1582505547974; Sun, 23 Feb 2020 16:52:27 -0800 (PST) Received: from localhost ([106.51.232.35]) by smtp.gmail.com with ESMTPSA id e7sm10367215pfj.114.2020.02.23.16.52.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Feb 2020 16:52:27 -0800 (PST) Date: Mon, 24 Feb 2020 06:22:26 +0530 From: afzal mohammed To: linux-kernel@vger.kernel.org, x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Juergen Gross , Josh Poimboeuf , Masami Hiramatsu , Peter Zijlstra Subject: [PATCH v2 14/18] x86: Replace setup_irq() by request_irq() Message-ID: <17f85021f6877650a5b09e0212d88323e6a30fd0.1582471508.git.afzal.mohd.ma@gmail.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org request_irq() is preferred over setup_irq(). The early boot setup_irq() invocations happen either via 'init_IRQ()' or 'time_init()', while memory allocators are ready by 'mm_init()'. Per tglx[1], setup_irq() existed in olden days when allocators were not ready by the time early interrupts were initialized. Hence replace setup_irq() by request_irq(). Seldom remove_irq() usage has been observed coupled with setup_irq(), wherever that has been found, it too has been replaced by free_irq(). [1] https://lkml.kernel.org/r/alpine.DEB.2.20.1710191609480.1971@nanos Signed-off-by: afzal mohammed --- v2: * Replace pr_err("request_irq() on %s failed" by pr_err("%s: request_irq() failed" * Commit message massage arch/x86/kernel/irqinit.c | 18 +++++++----------- arch/x86/kernel/time.c | 10 +++------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c index 16919a9671fa..8b5ee03d3e25 100644 --- a/arch/x86/kernel/irqinit.c +++ b/arch/x86/kernel/irqinit.c @@ -44,15 +44,6 @@ * (these are usually mapped into the 0x30-0xff vector range) */ -/* - * IRQ2 is cascade interrupt to second interrupt controller - */ -static struct irqaction irq2 = { - .handler = no_action, - .name = "cascade", - .flags = IRQF_NO_THREAD, -}; - DEFINE_PER_CPU(vector_irq_t, vector_irq) = { [0 ... NR_VECTORS - 1] = VECTOR_UNUSED, }; @@ -104,6 +95,11 @@ void __init native_init_IRQ(void) idt_setup_apic_and_irq_gates(); lapic_assign_system_vectors(); - if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) - setup_irq(2, &irq2); + if (!acpi_ioapic && !of_ioapic && nr_legacy_irqs()) { + /* + * IRQ2 is cascade interrupt to second interrupt controller + */ + if (request_irq(2, no_action, IRQF_NO_THREAD, "cascade", NULL)) + pr_err("%s: request_irq() failed\n", "cascade"); + } } diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c index d8673d8a779b..0f9cb386d71f 100644 --- a/arch/x86/kernel/time.c +++ b/arch/x86/kernel/time.c @@ -62,19 +62,15 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static struct irqaction irq0 = { - .handler = timer_interrupt, - .flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, - .name = "timer" -}; - static void __init setup_default_timer_irq(void) { /* * Unconditionally register the legacy timer; even without legacy * PIC/PIT we need this for the HPET0 in legacy replacement mode. */ - if (setup_irq(0, &irq0)) + if (request_irq(0, timer_interrupt, + IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER, "timer", + NULL)) pr_info("Failed to register legacy timer interrupt\n"); } -- 2.25.1