From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f173.google.com (mail-yw1-f173.google.com [209.85.128.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C269429CD7 for ; Mon, 10 Aug 2026 20:28:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786393721; cv=none; b=sXgmrnEq3Lv3sB5Z8JEIZeGi5/UxQ3cu+E2QA7OYsscXjOJe2qoYIKA5J8CLACesXNVLmnZB8ThWd5p2hwgtr6vRZxvG0PXWGh23cTvr26Ui6dbFJNdY7+6Pz7CSTS8iVNT9v8pTsLJIQBH7dZt2I8AbLO5/eR/BW1sB+ofJBIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786393721; c=relaxed/simple; bh=vtv1tMWdbKnZqo0yWrkZYjCGs36Cnpyg0x9FhtFbTT0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DLpt/4L5CxjJLZ/IvakdiXHqWeL8pi1wfFPoTbtDjrh3zGFgLOas9zP3crsjzoy/xv4EiC9w1ZEIJnn4xbGwiXYWXnO9nckGBWtPWZa2Vq+nR5xMHHHT/E/KD6uVHi0aLak8QAgGOK7x6JI16Aoli3ZLRs2YpYqYJhAyfTj0Q5Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OevLOEju; arc=none smtp.client-ip=209.85.128.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OevLOEju" Received: by mail-yw1-f173.google.com with SMTP id 00721157ae682-80e2cfe6918so26007387b3.0 for ; Mon, 10 Aug 2026 13:28:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786393719; x=1786998519; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=H1xlNC4igzw4eN/fnv+cxxiQQoIssMMJKb2EEAIS/7g=; b=OevLOEjuMXUTMAauFayUmHVg0vIjy8LygAoVQh5HrQi30e5yfDW8iOdrMYbcBfKqlz UFPXSnB4abu8CsKP9eJjoc8Rqtaznc+GOy0+pp64Kfcv/UiW7h0DArwPqX1hYIw6Kham nmkDCJhECvvf/d3TPsoDJTKUGQW7iF+6DezHUmEqotSskZI2mvlC4lYSBfb3lkqFur9r KlQubtiohYZlXetsCFylkB2dJEUEpoxQHF6ReV9G9ClU2JOg+tWo4AsVe3OF4Jeh7rCm /9D7yEDO+ngpqLuSydUOiEf1uOBcgbMoSLzBkPysH3qrkFi2i5olXXSCS8QboF1fQ4HK opgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786393719; x=1786998519; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=H1xlNC4igzw4eN/fnv+cxxiQQoIssMMJKb2EEAIS/7g=; b=Df5puBoALGqB8aZiN+aCgp2FEgXVYpJvWXsjTI3x7wIHAJN1L+huhzgRTtOpMnC8Ez YdNt+1VDSW7Rt7ZJNrKL9GbTy1FcZUSoJWj99TeG53nQeow0Ld5X7kSlm1LSVEpEz2Ax i/abzVor8qGNOFQwd6OnUsO7e4r77gG5QlUWfmaC2HNpXdswYm8+pxL3AEdOJLW2XJeR lDtqIMCPCMhfbHqIlo+CZW0FpfacbMKPbI1SpzclGXU780iZ+KOgEtC1N4/TUNXaLni4 CRd2S2WyXFYy3YFliun0gKs6y0VIts+2N/rwr57H8VdH7TWr7TdztTQ+HbPOzVPfptA5 Q0qw== X-Forwarded-Encrypted: i=1; AHgh+RrblYekKDw1R/kPsE3T3zMjmvrBf8hDwQclR/Lk+5TlEESX0PaRh/lK98O0mF0OdgrUBsBkTZ/fvcMxBYE=@vger.kernel.org X-Gm-Message-State: AOJu0YwUwaVJS09r/jBiONux+rwkS0TDKLiEYeKUl7aLgTIbOJKLeTUV URQi1e16+FSngxK0+cTqjldTJep/7/zta5cTSBB0prLW2de4QBSOJxZz X-Gm-Gg: AR+sD13QIadiOcQAW4v6GLASOsdBJDif8l20GMKsd4CVrXYQiMiu8g8DhsHjvV0g3ny HMk7/Z6jTrKfuBzj6LcmCbugOKw7r35/KXABMFu1zxQw4wcGIDR15K3svtmG9MwtnVADdpLjgTV sHM27Tk3gVMYYRx7BP02aEhhmslG1O/hOk0UKxWIDuVOZAhQ3dehQ/Bii/9xq26uht7VHauRBIF Z7thtbhdYuQTkabam6X4ogEHXuXEinggvDL5XKFjVZLw9FL3o48AXtRBfK4F0nDPQmoqxSvcuie NbP61rYarZQ7fDJCXSa1e77r+6WAIJlJOMH2V+1XOOeZonGjKTPGQGIZYQDaxRr+ZmAqyBfWigX VBTS82oyCaSUHlZWSXkahGL21siY16GZM0KjEKxFQGvSPUg8pXPSvAt7lS5wcMfiDL2KgFucFZU n856QIqDl7BLDhwQ63Qki2+rFCoaGDUn4YrT2SthyQll57GmG6j5ebUfCATrwrd9mgMew= X-Received: by 2002:a05:690c:6f02:b0:820:dd2:3c84 with SMTP id 00721157ae682-825778a524fmr162684357b3.22.1786393719227; Mon, 10 Aug 2026 13:28:39 -0700 (PDT) Received: from localhost ([67.197.119.189]) by smtp.gmail.com with ESMTPSA id 00721157ae682-823f577de2esm62738577b3.31.2026.08.10.13.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 13:28:38 -0700 (PDT) From: Matt Turner To: linux-alpha@vger.kernel.org Cc: Richard Henderson , Magnus Lindholm , Matt Turner , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] alpha: annotate hardirqs-off on IPL 7 interrupt entry Date: Mon, 10 Aug 2026 16:28:35 -0400 Message-ID: <20260810202835.3592833-2-mattst88@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260810202835.3592833-1-mattst88@gmail.com> References: <20260810202835.3592833-1-mattst88@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit do_entInt() opens with local_irq_disable(), which with CONFIG_TRACE_IRQFLAGS only calls trace_hardirqs_off() if interrupts were not already off: #define local_irq_disable() \ do { \ bool was_disabled = raw_irqs_disabled();\ raw_local_irq_disable(); \ if (!was_disabled) \ trace_hardirqs_off(); \ } while (0) On alpha raw_irqs_disabled() is (rdps() & 7) == IPL_MAX, i.e. IPL 7. PALcode raises PS.IPL to the level of the interrupt before entInt runs, so for an IPL 7 entry - a processor machine check (vector 0x660) or a system event (vector 0x680), both IPL_MCHECK == IPL_MAX - the gate is already true and the annotation is skipped. lockdep keeps whatever hardirq state the interrupted context had. If that context had interrupts enabled, lockdep believes they are still enabled for the duration of the handler, and every lockdep_assert_irqs_disabled() in the interrupt path fires: WARNING: kernel/context_tracking.c:346 at ct_irq_enter+0xc4/0xd0, CPU#0: swapper/0/0 [...] [] ct_irq_enter+0xc4/0xd0 [] irq_enter+0x20/0x50 [] do_entInt+0x1dc/0x2e0 [] ret_from_exception+0x0/0x10 irq event stamp: 735356346 hardirqs last enabled at (735356346): trace_hardirqs_on+0x68/0x220 hardirqs last disabled at (735356345): do_idle+0xf0/0x270 The stamps show the problem directly: the most recent event is the enable from the interrupted idle loop, and do_entInt() recorded no disable at all. ct_irq_exit() warns the same way on the way out. Ordinary device interrupts arrive at IPL 3-5 and IPIs and performance counter interrupts at IPL 6, so was_disabled is false for them and the annotation happens normally. Only the two IPL 7 vectors are affected, which is why this needs an environmental event to show up. Take the hardware IPL out of the decision and drive the annotation from lockdep's own state instead. This corrects the annotation only. An IPL 7 event can also interrupt a region that has legitimately disabled interrupts, where irq_enter() and irq_exit() are not the right primitives and NMI semantics are needed; that is a larger change and is left alone here. Tested on an AlphaServer ES47 (Marvel/EV7) by injecting system events through the system management path: fifteen injections, idle and under load, with no splat. The same injection on a freshly booted kernel without this change reproduces both warnings. Signed-off-by: Matt Turner --- arch/alpha/kernel/irq_alpha.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c index cb4d58079d83..014c1e98e922 100644 --- a/arch/alpha/kernel/irq_alpha.c +++ b/arch/alpha/kernel/irq_alpha.c @@ -52,8 +52,19 @@ do_entInt(unsigned long type, unsigned long vector, * Note that there is no matching local_irq_enable() due to * severe problems with RTI at IPL0 and some MILO PALcode * (namely LX164). + * + * PALcode has already raised PS.IPL to the level of the interrupt + * being delivered. For an IPL 7 entry - a machine check or a system + * event - that is IPL_MAX, which is what arch_irqs_disabled() tests + * for, so local_irq_disable() would decide interrupts were already + * off and skip trace_hardirqs_off(). lockdep would then spend the + * whole handler believing interrupts are enabled. Drive the + * annotation from lockdep's own state rather than the hardware IPL. */ - local_irq_disable(); + raw_local_irq_disable(); + if (lockdep_hardirqs_enabled()) + trace_hardirqs_off(); + old_regs = set_irq_regs(regs); switch (type) { -- 2.54.0