Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2271427ybd; Mon, 24 Jun 2019 03:40:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxjz2yYOau0WE1q0Mr8Hu5CnrM/CuwocM9X2DpQAt+LCgEkIZK8OiC9GbvZ+xpMUiV/aH4 X-Received: by 2002:a17:902:846:: with SMTP id 64mr22209647plk.265.1561372832076; Mon, 24 Jun 2019 03:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561372832; cv=none; d=google.com; s=arc-20160816; b=eYppCdEYCM1wd1rwV57sdmGhLx5CNX5N5agORdAy8uA4dg9WPG2UskeyR8QVIYqAhC 6SpaFJfJyWzx0fSORAGnhIQ9jNnsp7REsvBwBdft/9Ev+NbkL94to7VBHgSDushQwYjr pl0DaNFv7uKByRYCMEF7qbLnBXf+lRqSJBYs1J35uoLgJW+p22udS+tuD1qHp3v11ZBl LziJrW29HLYCW/b/vYehzJRmVxQyBvCVfEieIiimGq01C1kWBbe3RpxLOuGpHviGAjy7 Yg0SlHxFVawi+09X1LiEwcmLwAhYiuOiKIAoSdRxKHp2dAyKVSMzzY+VFBM83lgwwpsy +Guw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=PsceMoVxdoC04Oih5bnCRlWuvjXNVS6yu85LKiT6S/4=; b=Csi7/kjjfkvswfKWukDhq5msB4k56fBm86XBLglYvRDHKvLJZDoxCZFXUiJVmwg4K/ oF1qbXu6IpsFtK2Qi2QIkJ3EGwEuMQ4rfTP6CbyzIj/OlJOOgUCBsnu1yv69xqrEt37j ZC7guvWWKNvwfMf2QuP76XXYYZMfogigtFU66F3OkLap/X/UgUmgMALacyQ4ReTc2qny Opvg57JuyO/vZ6y0hSDFwKul1HtNVHDAhU9DQXpWBDfZrKLjv9YP3ERSlKShztlNQL05 efNG8WERI1YXEl22/MGqMXYe4saoznkLxnkNnVRQtaqThIGzjJe5GctBmvmTai8JJiyb HHUA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14si9886005pgh.98.2019.06.24.03.40.16; Mon, 24 Jun 2019 03:40:32 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728876AbfFXKjI (ORCPT + 99 others); Mon, 24 Jun 2019 06:39:08 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:58913 "EHLO lizzard.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727101AbfFXKjH (ORCPT ); Mon, 24 Jun 2019 06:39:07 -0400 X-Greylist: delayed 1024 seconds by postgrey-1.27 at vger.kernel.org; Mon, 24 Jun 2019 06:39:06 EDT Received: from mail2.sbs.de (mail2.sbs.de [192.129.41.66]) by lizzard.sbs.de (8.15.2/8.15.2) with ESMTPS id x5OALUnS029575 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 24 Jun 2019 12:21:30 +0200 Received: from [139.25.68.37] (md1q0hnc.ad001.siemens.net [139.25.68.37] (may be forged)) by mail2.sbs.de (8.15.2/8.15.2) with ESMTP id x5OALSmM010254; Mon, 24 Jun 2019 12:21:28 +0200 Subject: Re: x86: Spurious vectors not handled robustly To: Thomas Gleixner Cc: Ingo Molnar , Borislav Petkov , x86@kernel.org, Linux Kernel Mailing List References: From: Jan Kiszka Message-ID: <1565f016-4e3b-fa89-62e5-fc77594ee5aa@siemens.com> Date: Mon, 24 Jun 2019 12:21:27 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24.06.19 12:09, Thomas Gleixner wrote: > Jan, > > On Mon, 24 Jun 2019, Jan Kiszka wrote: >> probably since "x86: Avoid building unused IRQ entry stubs" (2414e021ac8d), >> the kernel can no longer tell spurious IRQs by the APIC apart from spuriously >> triggered unused vectors. > > Err. It does. > >> We've managed to trigger such a cause with the Jailhouse hypervisor >> (incorrectly injected MANAGED_IRQ_SHUTDOWN_VECTOR), and the result was >> not only a misreport of the vector number (0xff instead of 0xef - took me >> a while...), but also stalled interrupts of equal and lower priority >> because a spurious interrupt is not (and must not be) acknowledged. > > That does not make sense. > > __visible void __irq_entry smp_spurious_interrupt(struct pt_regs *regs) > { > u8 vector = ~regs->orig_ax; > u32 v; > > entering_irq(); > trace_spurious_apic_entry(vector); > /* > * Check if this really is a spurious interrupt and ACK it > * if it is a vectored one. Just in case... > */ > v = apic_read(APIC_ISR + ((vector & ~0x1f) >> 1)); > if (v & (1 << (vector & 0x1f))) > ack_APIC_irq(); > > If it is a vectored one it _IS_ acked. > > inc_irq_stat(irq_spurious_count); > > /* see sw-dev-man vol 3, chapter 7.4.13.5 */ > pr_info("spurious APIC interrupt through vector %02x on CPU#%d, " > "should never happen.\n", vector, smp_processor_id()); > > and the vector through which that comes is printed correctly, unless > regs->orig_ax is hosed. ...which is exactly the case: Since that commit, all unused vectors share the same entry point, spurious_interrupt, see idt_setup_apic_and_irq_gates(). And that entry point sets orig_ax to ~0xff. Jan -- Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux