Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1801406pxj; Wed, 19 May 2021 14:23:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVrVHto2NHifdEk8qgwUEANC8uN4uczM4wJs40Wj8m4OkZf6ayzUyj014U6gtDtKPePhT5 X-Received: by 2002:a02:6c46:: with SMTP id w67mr1386827jab.41.1621459399073; Wed, 19 May 2021 14:23:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621459399; cv=none; d=google.com; s=arc-20160816; b=0j7eZmnwYFuuduwkUZsvVz7ITsN8FPrcOihv+kIhEUbQO8eFU+rmmeuzeC9Jz7VXvr U0csfvyItevz4t+prSr/8Hia30gL9/TemLbF26WQDvA448ErdmnVeYUNYOz4qiDVHCb1 qPZCIhnY06Nru/YahxTSxZ1M2lms1xd9N8+5PsYovgnX7vDe5xkUq+dSxQy6eqAmSPvv mUnVmysIFQKHnMUTl3puZdgxrgOLBnS5DDDvXvixyD6WnOb89+psM+BXWbQh5awnqJTB MXvriwLhW3ajWxTY4VwVgxMUbl/hxRk/pRkn99BN/DI85FRPr5wNbREGT+fdvR6ZDras eKsw== 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=ujz63QycIL3FGDYfe2qlZj8kck+o0vtn6ziqYJfDjzZoG9Ifai8XHQo8J8eFAAlZPx spp6nuKFaLj2uS0vn08MSq8I/KtF5+mXtkuvf9Ja+GQ7MJYdPIbr4eIYRXl/mlQ4Y4OZ eoCBY1weifl3PU6cf0PtFqZK/R5VG7m5A9LwCMPVglwdLpgd44dDtbyP0CFYGMl2nB/j BFlf4lNW6Y6GkIyI/j5I1JiyZSRh+ZNkNoOElHsDNYTxf9vQxdNBTJOvbx1Asq8GWrF4 fI0tz0N07ZNRbFidguKUYutgA56iX2EhQWK5PK7FVRboFmjffIvQVjUuWDWuqWWFEdOV cYxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021042801 header.b=XQNcG2ic; 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 t1si463835jap.32.2021.05.19.14.23.06; Wed, 19 May 2021 14:23:19 -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=XQNcG2ic; 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 S229801AbhESVXs (ORCPT + 99 others); Wed, 19 May 2021 17:23:48 -0400 Received: from terminus.zytor.com ([198.137.202.136]:38407 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbhESVXm (ORCPT ); Wed, 19 May 2021 17:23:42 -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 14JLM1Ef4187848 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 19 May 2021 14:22:13 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 14JLM1Ef4187848 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021042801; t=1621459333; bh=mYIyPbWt416077Ac95zHgIkOiIsfWRZri0qtmd+e6g8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XQNcG2icYyzt5D35Kwww91iLhZvdOk7FAMD6Daq6SpJxThSuVOBggG7kMIaC25oaO BwY/XD5asCWLAbWV0oZazWB5xtmW6kfWS/q7ipRUE/ZRHB/cC8In23PM51H7A1J0du Jgpld0wYtTTaMBWioJ6XYX1BOwQHn55KuFiyMylEVCILodMCw2puWRIgTnZSWCeHhS 9Mp57PZiMtQRF8tuvOlgSnoBSnyPc40RUVcwVvXUG1f+Q3WCXJQ4AG3IaXEcznkwKW CMhYWy/r/iDzcRrpdnc2pfaQshQtukGjid/fMFl2v0jipxYBXRGZfC3nNGiHTCClEg wbOBnkFRRy+kQ== From: "H. Peter Anvin" To: Thomas Gleixner , Ingo Molnar , Andy Lutomirski , Borislav Petkov , "H. Peter Anvin" Cc: Linux Kernel Mailing List Subject: [PATCH v3 7/8] x86/irq: WARN_ONCE() if irq_move_cleanup is called on a pending interrupt Date: Wed, 19 May 2021 14:21:53 -0700 Message-Id: <20210519212154.511983-8-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210519212154.511983-1-hpa@zytor.com> References: <20210519212154.511983-1-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