Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp965686ybf; Thu, 27 Feb 2020 02:49:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwNei+ti2yrSVm/BJtK3sb5Lw76Dy4lmNnfkNe0jEbNQtcW1/MN+HbCrATV7TXJMjbBjCQS X-Received: by 2002:a9d:7356:: with SMTP id l22mr2666707otk.335.1582800593242; Thu, 27 Feb 2020 02:49:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582800593; cv=none; d=google.com; s=arc-20160816; b=AL46PXUS2OMlNm4heWyubLPbp0XelpTC+c7Jx0SbA/NIFVcIBQswr7TD/KN/nRYMSH oj64Qp2fpTS0lb/aZq+UXrjE5j2B+tUPRfVv/QrBBwbCNse8pGuTjxc9Ok6lkZa5qgiZ wP7x+YvwHW0cEAqTLa1tW3hxGlX8GUMufUcBRgKb4GWJU1lOvERmuj+Dd+Qjuuunv0oC YY1Tw4nwr/17ctcHdzVr3fviMY72W/Z38SIH9SMRS2y5C79ROezqIeaGBHVijj6t0ngD OGoHIxWPdQ0dV4jJTU+WpRMI3ZsDQtD0w0p75gMj8QfTeYAxot8i8RaTKOpsJa7OOp5H dk9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=jQj5blnCQx3WlXPjRunI4cTXJHQ46AGZFdO/XZbLvck=; b=k9S2xZhf1UiWZ7S7of3MaVdIy3PdZtHZpbCBLqBzo+ox/s9uwCx9Zay1ngyJtA132k y7/GPpZHxzSx9v6qtTJAi3zfMpXMVrFnojdUF5ievcmH5AbJO3ihSQuLTdVvtSLupOSF XEiiXfBTZJxLYAF5F6khiOpMuj5S6WArzcFTX+Sjnmhc+BDOI6H38iNt42kxCAGZXiaK G/ffQUrY5w0O5yAC8NYI6LIBpNYUfRfbb1ihFyhAopnFKee617wsYMVg4jma5cf/VomR Gu50HvE2iAcHl7F1YZ7pnP3sT/fJZCq2ccluFXQnvfh/utJqWRkQMXHJWup/SWCqDkhl Mfew== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i9si1245549otp.139.2020.02.27.02.49.40; Thu, 27 Feb 2020 02:49:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728753AbgB0Ktb (ORCPT + 99 others); Thu, 27 Feb 2020 05:49:31 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:33953 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728680AbgB0Ktb (ORCPT ); Thu, 27 Feb 2020 05:49:31 -0500 Received: from p5de0bf0b.dip0.t-ipconnect.de ([93.224.191.11] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1j7GjJ-0007f9-7N; Thu, 27 Feb 2020 11:49:21 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id 8DC7C10409C; Thu, 27 Feb 2020 11:49:20 +0100 (CET) From: Thomas Gleixner To: afzal mohammed , linux-kernel@vger.kernel.org, x86@kernel.org Cc: Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Juergen Gross , Josh Poimboeuf , Masami Hiramatsu , Peter Zijlstra Subject: Re: [PATCH 14/18] x86: Replace setup_irq() by request_irq() In-Reply-To: References: Date: Thu, 27 Feb 2020 11:49:20 +0100 Message-ID: <87v9nsmhjj.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org afzal mohammed writes: > request_irq() is preferred over setup_irq(). Existing callers of > setup_irq() reached mostly via 'init_IRQ()' & '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(). Please do not copy the irrelevant parts of your boilerplate text into individual changelogs. Changelogs should have the information which is relevant to the patch they describe. > @@ -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("request_irq() on %s failed\n", "cascade"); What's the purpose of the %s indirection here? Also that error message is not really helpful: request_irq() on cascade failed Something like: Failed to request irq 2 (cascade). Hmm? > + } > } > 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)) This is realy ugly. unsigned long flags = IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER; .... if (request_irq(0, timer_interrupt, flags, "timer", NULL)) .... takes the same amount of lines, but is readable. Thanks, tglx