Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2788405ybd; Mon, 24 Jun 2019 12:41:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkkD9WzIrSB1fkSKsNcIZ348wQWDMOp8eHWVLNnbkGAMGoKK/JUVe4nFOY5XWzjzRnViP3 X-Received: by 2002:a17:902:a60b:: with SMTP id u11mr32474213plq.9.1561405284177; Mon, 24 Jun 2019 12:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561405284; cv=none; d=google.com; s=arc-20160816; b=yJPV21Dk28q/+jtbaJF/7EfEHJahVc2sL52DwIEVPG5Kyhh7k0knUu3RA6IG7Rss/N OVMjDXTnoOsZ2ZUw1fTZ8ZbyhAhg+y9ToBVQ77SNODcl6FXwLOawxFcCe5t4P53G0FJI WO+70emZ41rC80CfzBQ1dgnUkVZcVvblTTwrHVMCZswcJDtPbKjprHZT/hsWSMf0yuE0 L/KPY71wfPElvHSmr3F50NEqWI4vggoPSjHXTBfSfccuDhTa56sShqoE8XV2sFtDJAwy T/eOmODq/ZQQ0z32f8W1OFVdenaafjNs1njMjLOuZQvMGmkIpxuvE4GrFvtwHGlkR1yb BTMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=SrJCS7zygMuJSIiTZG0SvM9mqsqIX9e1kz/0EM72ubY=; b=dd5OgG6YrXStijxT/f+uqXeck/Jl1HgVJ/93nt6Gq5o7z79lUEEB2TYM6sd1wCaNWP pg4QoCYsb3gWKyfhoSNkKctvCWFG3GgwWI9adYLLSVrHydS08VreyDrEv7X1f7qEoI7l aVDqS1SyZoza4z/iavHJYElzW8bRB7gwyGHFDf+kPK7E5jQlqq/0m1bZYo2HrcevsGD7 ifP3778miBmjpCM3bnN+fmwLdWuM8j4o87O8jp/kLutIVSM6SaZ+jU2QW4piL3Ax4VYc 1wCWES7AvIsD6PRGqGfHpUJYZCCJoOCa25CMGLD6gOeQ4TL0ZFXuw/NWgCA3+eo/tqz7 ZUyg== 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 z7si2830165pgi.257.2019.06.24.12.41.08; Mon, 24 Jun 2019 12:41:24 -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 S1729411AbfFXP1A (ORCPT + 99 others); Mon, 24 Jun 2019 11:27:00 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:38438 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727979AbfFXP07 (ORCPT ); Mon, 24 Jun 2019 11:26:59 -0400 Received: from p5b06daab.dip0.t-ipconnect.de ([91.6.218.171] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hfQrW-0007ym-Eo; Mon, 24 Jun 2019 17:26:30 +0200 Date: Mon, 24 Jun 2019 17:26:29 +0200 (CEST) From: Thomas Gleixner To: Jan Kiszka cc: Ingo Molnar , Borislav Petkov , x86@kernel.org, Linux Kernel Mailing List , Jan Beulich Subject: Re: x86: Spurious vectors not handled robustly In-Reply-To: Message-ID: References: <1565f016-4e3b-fa89-62e5-fc77594ee5aa@siemens.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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 On Mon, 24 Jun 2019, Thomas Gleixner wrote: > > +#ifdef CONFIG_X86_LOCAL_APIC > + .align 8 > +ENTRY(spurious_entries_start) > + vector=FIRST_SYSTEM_VECTOR > + .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR) > + pushl $(~vector+0x80) /* Note: always in signed byte range */ > + vector=vector+1 > + jmp common_spurious_vector Moo. Not syncing the compile machine and the laptop! That should obviously be + jmp common_spurious > + .align 8 > + .endr > +END(spurious_entries_start) > + > +common_spurious: > + ASM_CLAC > + addl $-0x80, (%esp) /* Adjust vector into the [-256, -1] range */ > + SAVE_ALL switch_stacks=1 > + ENCODE_FRAME_POINTER > + TRACE_IRQS_OFF > + movl %esp, %eax > + call smp_spurious_interrupt > + jmp ret_from_intr > +ENDPROC(common_interrupt) > +#endif > + > /* > * the CPU automatically disables interrupts when executing an IRQ vector, > * so IRQ-flags tracing has to follow that: > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -375,6 +375,18 @@ ENTRY(irq_entries_start) > .endr > END(irq_entries_start) > > + .align 8 > +ENTRY(spurious_entries_start) > + vector=FIRST_SYSTEM_VECTOR > + .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR) > + UNWIND_HINT_IRET_REGS > + pushq $(~vector+0x80) /* Note: always in signed byte range */ > + jmp common_spurious > + .align 8 > + vector=vector+1 > + .endr > +END(spurious_entries_start) > + > .macro DEBUG_ENTRY_ASSERT_IRQS_OFF > #ifdef CONFIG_DEBUG_ENTRY > pushq %rax > @@ -571,10 +583,20 @@ END(interrupt_entry) > > /* Interrupt entry/exit. */ > > - /* > - * The interrupt stubs push (~vector+0x80) onto the stack and > - * then jump to common_interrupt. > - */ > +/* > + * The interrupt stubs push (~vector+0x80) onto the stack and > + * then jump to common_spurious/interrupt. > + */ > +common_spurious: > + addq $-0x80, (%rsp) /* Adjust vector to [-256, -1] range */ > + call interrupt_entry > + UNWIND_HINT_REGS indirect=1 > + call smp_spurious_interrupt /* rdi points to pt_regs */ > + jmp ret_from_intr > +END(common_spurious) > +_ASM_NOKPROBE(common_spurious) > + > +/* common_interrupt is a hotpath. Align it */ > .p2align CONFIG_X86_L1_CACHE_SHIFT > common_interrupt: > addq $-0x80, (%rsp) /* Adjust vector to [-256, -1] range */ > --- a/arch/x86/include/asm/hw_irq.h > +++ b/arch/x86/include/asm/hw_irq.h > @@ -150,6 +150,8 @@ extern char irq_entries_start[]; > #define trace_irq_entries_start irq_entries_start > #endif > > +extern char spurious_entries_start[]; > + > #define VECTOR_UNUSED NULL > #define VECTOR_RETRIGGERED ((void *)~0UL) > > --- a/arch/x86/kernel/idt.c > +++ b/arch/x86/kernel/idt.c > @@ -319,7 +319,8 @@ void __init idt_setup_apic_and_irq_gates > #ifdef CONFIG_X86_LOCAL_APIC > for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { > set_bit(i, system_vectors); > - set_intr_gate(i, spurious_interrupt); > + entry = spurious_entries_start + 8 * (i - FIRST_SYSTEM_VECTOR); > + set_intr_gate(i, entry); > } > #endif > } >