Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1132661pxj; Sat, 15 May 2021 05:00:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGOLj3Un/1DYUZi/k6E8sgf3ikMqxNdZLqEgE6hwj4p3k9mouK8lzrftaf6Syq/HkAwXo9 X-Received: by 2002:a17:906:31c6:: with SMTP id f6mr53199071ejf.446.1621080031381; Sat, 15 May 2021 05:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621080031; cv=none; d=google.com; s=arc-20160816; b=CGQ2sFaazyhrE6iy+mV4Uj/T6eTIcYfFY9LC5ETtXgfShkxfN4QYPevCeKX07RiCtn p/Q/B2u9hnQUBza6NiPlwuFtu23tXg0szhxGP9J4mxkJePAcJcO+sBqM4eXe0XCsRYDH VPy33GGfaXGIR3e0iN7t+lmIca+WdkeA+p0xm2bgFfBWS9FHBs6bQHdSJecF02kEjEwf rt156kgKbFxZpjwU9dTkGd5NyiCUIofZiqHPobwNf3aJ7iMkevfSc78Mts2vIR4ZklzI RB/Ep2ZEHqQyaj37XTAg04oOSHK9nJTXveJDOpRy+sIAUVw3bHuk0Cck5PdUoln1Btja DYOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=mYIyPbWt416077Ac95zHgIkOiIsfWRZri0qtmd+e6g8=; b=aylTeeJ5pULz3VeOaT9ZN//GWYsq++L+dW3uwYR+g2oCd2KSl8GHhF9B5aouozpZRj u7mo4lNGCYcA9IVmWbusy62LOxTH6v5M6DBx9PQZ03iArnRxXGc4cxwL9zx30Pz8qQ0n WTCvRkcAIcUqsMDlEO3F1ApXEtfaG/7pXjNkb8Az8oWkvIY9barx35FmdgsB2J8lhzaI sSZ0D1LiNNizxUkI4wb2dO2obv7cl4xEEIXLA5As7PLCYCULNRy/hW6Tntx34ZjBDISu 35p0ldhGDeylU4LP1BKiKb+hz9MsujlEGiYqikAXFQXIlniw65zunB2PuwkES961KF/B Uiug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021042801 header.b=kmOL0K2a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dh22si8124161edb.330.2021.05.15.05.00.07; Sat, 15 May 2021 05:00:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2021042801 header.b=kmOL0K2a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232503AbhEOKAu (ORCPT + 99 others); Sat, 15 May 2021 06:00:50 -0400 Received: from terminus.zytor.com ([198.137.202.136]:48941 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbhEOKAt (ORCPT ); Sat, 15 May 2021 06:00:49 -0400 Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8602:8be0:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 14F9xGu43273647 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 15 May 2021 02:59:24 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 14F9xGu43273647 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021042801; t=1621072764; bh=mYIyPbWt416077Ac95zHgIkOiIsfWRZri0qtmd+e6g8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kmOL0K2aTK4gBI8e+1/YkGjKEhGrJS+ZtZDeUd1iiAYFA4MsmymXfiQ0YwB4ocqb7 ostzm1myMnTGENQwgykJt0Bqjw+8RUTU6CHpHwhtW3ZZ/C7jvKeC+9gSAsdT8ZkCuX j2dfCHv+0HjnjlEtFpwMxQPFur9Dm+imUX3Y+dyJPGE48S26iGkanPKF+mAl36yUrB ySSjKb9yGFX5OBWkVz+7lgBbRBwC7aLwYynyJUa4fMB4tK8f5wzvdov9oWKQL0BkyU B/eimkU34YGXtsuFJIHqc1zNVIBA+zhBzY+Ej4gPs2s1MmT4jUv9GErcN/cbV9G6Q4 NTBPVQECJxM2g== From: "H. Peter Anvin" To: Thomas Gleixner , Ingo Molnar , Andy Lutomirski , Borislav Petkov , "H. Peter Anvin" Cc: Linux Kernel Mailing List Subject: [PATCH v2.1 7/8] x86/irq: WARN_ONCE() if irq_move_cleanup is called on a pending interrupt Date: Sat, 15 May 2021 02:59:07 -0700 Message-Id: <20210515095907.3020486-1-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210515014400.2999028-8-hpa@zytor.com> References: <20210515014400.2999028-8-hpa@zytor.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "H. Peter Anvin (Intel)" The current IRQ vector allocation code should be "clean" and never issue a IRQ_MOVE_CLEANUP_VECTOR IPI for an interrupt that could still be pending. This should make it possible to move it to the "normal" system IRQ vector range. This should probably be a three-step process: 1. Introduce this WARN_ONCE() on this event ever occurring. 2. Remove the self-IPI hack. 3. Move the IRQ_MOVE_CLEANUP_VECTOR to the sysvec range. This implements step 1. [ Previous versions of this patch had steps 2 and 3 reversed. ] Suggested-by: Thomas Gleixner Signed-off-by: H. Peter Anvin (Intel) --- arch/x86/kernel/apic/vector.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index 6dbdc7c22bb7..7ba2982a3585 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@ -939,9 +939,14 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_irq_move_cleanup) * to this CPU. IRQ_MOVE_CLEANUP_VECTOR is the lowest * priority external vector, so on return from this * interrupt the device interrupt will happen first. + * + * *** This should never happen with the current IRQ + * cleanup code, so WARN_ONCE() for now, and + * eventually get rid of this hack. */ irr = apic_read(APIC_IRR + (vector / 32 * 0x10)); if (irr & (1U << (vector % 32))) { + WARN_ONCE(1, "irq_move_cleanup called on still pending interrupt\n"); apic->send_IPI_self(IRQ_MOVE_CLEANUP_VECTOR); continue; } -- 2.31.1