Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3804681imm; Mon, 4 Jun 2018 09:30:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIhUEDS7pJ2MnDm3VTAKnyqrN14Aem6npSS2H0+4Fo8176ASL5WxxJgy6tJOQrcCafAQHGH X-Received: by 2002:a62:9e88:: with SMTP id f8-v6mr21892181pfk.206.1528129814912; Mon, 04 Jun 2018 09:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528129814; cv=none; d=google.com; s=arc-20160816; b=LQX8McYuhx0lSF/oj3w6rh2gkxJmCnB68LmTloKpSSK9srz3bGhgLHLiVVJi3/qzdr MUM0NwC1n4FxfO9iYz1EvyTheB5axEY4wh2dptFq2dcbHgn+SoEls/V6kx7e3KuCnSzy Ssg508Flj/TCwUVmUmA4lhxHwstlajOq+I+Q+MH1vqjo8tWLHigQKz+lEkQLgzq7t+Ki gS3QDrq5iJ7BvhJqLIjM5ZGDJ+TjJoLLlykI0rpVQ9ehp1CQbyr2jDIf6JY60kWRgO69 7WndB+lOoRDEJr8OZDqioVsxKei+n9OusGEoIJRcdzrma/yESwxLKk9H2hfd7E7xJim8 wgUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version:subject :cc:to:from:date:user-agent:message-id:arc-authentication-results; bh=vFkVvH/fXw2b1inQSn4v3SIsuUSlvp+yQX4K4n6WG9Q=; b=J9lUR5LAxSoLhjoL69oPHue5OGx0S8Omqv3OzX8aWR7pjj85T5aJ1RKkGrBwzEnOAx cgVCKrFma/7k87xkhdD9eMRU5XunOPU0S9Z7DpjColM+lA+BsmjMFFbJDRk/wov9bony FFy1OVmvTvN3xPftXDwFC1HOX+Fue94KHdfwTuFnNRXbxDRPfz7nW3OOF6KLXhZzfhKB 7vdRscxajfsiXrA8WQjYpxHVcqUxKHHh4OHa6oHiT7vcvV3MHUa5aukTef/5eT6y8IqA nbLnfKbYjItWm1T13qvYP4w/2ojp7fKJiSkS2l7O7ZdsfTmOT7hkjjI11lfljk1H1auO p1aw== 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 a19-v6si17624065pgv.47.2018.06.04.09.30.00; Mon, 04 Jun 2018 09:30:14 -0700 (PDT) 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 S1751402AbeFDQ1o (ORCPT + 99 others); Mon, 4 Jun 2018 12:27:44 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:40682 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751193AbeFDQ1l (ORCPT ); Mon, 4 Jun 2018 12:27:41 -0400 Received: from localhost ([127.0.0.1] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1fPsKa-00029r-7j; Mon, 04 Jun 2018 18:27:40 +0200 Message-Id: <20180604162224.471925894@linutronix.de> User-Agent: quilt/0.65 Date: Mon, 04 Jun 2018 17:33:55 +0200 From: Thomas Gleixner To: LKML Cc: Ingo Molnar , Peter Zijlstra , Borislav Petkov , Dmitry Safonov <0x7f454c46@gmail.com>, Tariq Toukan , Song Liu , Joerg Roedel , Mike Travis , stable@vger.kernel.org Subject: [patch 3/8] x86/apic: Provide apic_ack_irq() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=x86-apic--Provide-apic_ack-variant.patch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org apic_ack_edge() is explicitely for handling interrupt affinity cleanup when interrupt remapping is not available or disable. Remapped interrupts and also some of the platform specific special interrupts, e.g. UV, invoke ack_APIC_irq() directly. To address the issue of failing an affinity update with -EBUSY the delayed affinity mechanism can be reused, but ack_APIC_irq() does not handle that. Adding this to ack_APIC_irq() is not possible, because that function is also used for exceptions and directly handled interrupts like IPIs. Create a new function, which just contains the conditional invocation of irq_move_irq() and the final ack_APIC_irq(). Making the invocation of irq_move_irq() conditional avoids the out of line call if the pending bit is not set. Reuse the new function in apic_ack_edge(). Preparatory change for the real fix Fixes: dccfe3147b42 ("x86/vector: Simplify vector move cleanup") Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org --- arch/x86/include/asm/apic.h | 2 ++ arch/x86/kernel/apic/vector.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -436,6 +436,8 @@ static inline void apic_set_eoi_write(vo #endif /* CONFIG_X86_LOCAL_APIC */ +extern void apic_ack_irq(struct irq_data *data); + static inline void ack_APIC_irq(void) { /* --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@ -809,11 +809,17 @@ static int apic_retrigger_irq(struct irq return 1; } +void apic_ack_irq(struct irq_data *irqd) +{ + if (unlikely(irqd_is_setaffinity_pending(irqd))) + irq_move_irq(irqd); + ack_APIC_irq(); +} + void apic_ack_edge(struct irq_data *irqd) { irq_complete_move(irqd_cfg(irqd)); - irq_move_irq(irqd); - ack_APIC_irq(); + apic_ack_irq(irqd); } static struct irq_chip lapic_controller = {