From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 658AB33B6D6 for ; Fri, 9 Oct 2026 17:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791565483; cv=none; b=cpN8s99xvS8lykVPNxIrYibfeT90AaHf6TtnwJafrf2wYmff8dAjnBFq5Xq9ICoXME3d9aYi+FZGvqBfVE4oWt5f8hCqd333KyHqP9QXaD6f9Y6qQvnbKkcA6OsTQVbp2aZffuMO9IUEKnWfCDV/RSAabp4/dd3EhOLBRFWN+qc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791565483; c=relaxed/simple; bh=TPMxjHFy6NAhtBScqVVzIjOVVdFD4MHNL/+9nutj5ZQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=k/VwmGl44TUBxPTiLub5TsBMYUnIVm9qaXzjOnih7++ODHSSMyjnxGOUeUOMWCSngtzjQ4sHOth9oFpH252aNVOXi8t0IIpsc+GWbuwPXeftV5ETFL/KnCtGBsRo64VTmoRE522xydG/OFkyuCJncWKlxugRDljvfdW+q82tsxI= 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=IpApobz7; arc=none smtp.client-ip=209.85.128.41 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="IpApobz7" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4a16c399641so749695e9.2 for ; Fri, 09 Oct 2026 10:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791565481; x=1792170281; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=LrMC70e9+PTh4RX8wSyKvGIWWB/E2Z8AYGozH2Gp3A4=; b=IpApobz7oEYPOFXQQOFL6XNDduMUo6DtWoId0MOwl4Wvt0fl8dwd+nnkKFN4iyb/uG RL1gd4Ztv/Lmx+oQowvcNarJPW49S1i5l6sVrM4cqAxbAhB2p7JQ7fFF9fCv99UZllza eVgQwuy+BhrW2UiklSq5nSVErLyzmXuLb5cbwGhQmGscyFgzrxxeHMeVV1B8WZGBL11O dtllavpcPP1pLmJk/uAlHm1aKK0f+OLrIm8YhRJnMzdPypx3Ffz+nq38s4yHbogJ+7pH +pJnRQG9ikXgoKlyTrVKkE90z2bB8uYBStnDQF3gicC2Gx1T3S4tTYVQJSZWLSIeUEiK y6Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791565481; x=1792170281; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=LrMC70e9+PTh4RX8wSyKvGIWWB/E2Z8AYGozH2Gp3A4=; b=LguFe/+KCh4HYn9ts961drvHI1G+NXH2HJT97oX2iFDS0MQ9jiGnHNMoIyPuXm/iwz UF8UVUfTWiU0SBvRWOOJS1LX3qVqYqgpMr6Z6o49YbDy8itkMIx2jtnzNpWpsNimri8g UtLC/Hp1l2hlpNKr/srDHiuSCCkZPEvs+eOByIbdeHAR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c0TWKArxQ2B3qlA = X-Received: by 2002:a05:600c:3e0a:b0:4a0:1c10:1372 with SMTP id 5b1f17b1804b1-4a18e4aa206mr51409345e9.27.1791565480423; Fri, 09 Oct 2026 10:04:40 -0700 (PDT) Received: from unknown748F3CBA5068 (dynamic-2a02-3100-a128-aa01-297a-7094-853e-a20c.310.pool.telefonica.de. [2a02:3100:a128:aa01:297a:7094:853e:a20c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48db9abce2fsm4945670f8f.33.2026.10.09.10.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2026 10:04:39 -0700 (PDT) Date: Fri, 9 Oct 2026 19:04:38 +0200 From: Karl Mehltretter To: Frederic Weisbecker Cc: Peter Zijlstra , Thomas Gleixner , Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt , Boqun Feng , Lyude Paul , Joel Fernandes , Alexander Potapenko , Marco Elver , Jonathan Corbet , Bradley Morgan , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev Subject: Re: [PATCH v5] softirq: Preserve interrupt context during IRQ exit Message-ID: References: <20260930191432.62760-1-kmehltretter@gmail.com> Precedence: bulk X-Mailing-List: linux-doc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Hi Frederic, Thanks for the review! On Tue, Oct 06, 2026 at 12:00:51PM +0200, Frederic Weisbecker wrote: > > +static inline bool softirq_handle_begin(void) > > { > > - __local_bh_disable_ip(_RET_IP_, SOFTIRQ_OFFSET); > > + bool from_irq_exit = in_hardirq(); > > + > > + if (!from_irq_exit) { > > Is this variable necessary? No. I'll drop it. > > + /* > > + * Wake the timer thread even if the interrupt hit a softirq or a > > + * section with BHs disabled. Only nested interrupts and NMIs are > > + * excluded. > > + */ > > if (IS_ENABLED(CONFIG_IRQ_FORCED_THREADING) && force_irqthreads() && > > - local_timers_pending_force_th() && !(in_nmi() | in_hardirq())) > > + local_timers_pending_force_th() && > > + (in_nmi() | hardirq_count()) == HARDIRQ_OFFSET) > > NMIs shouldn't ever take this path, right? Good catch. I'll drop the in_nmi() test. > > + /* > > + * tick_irq_exit() relies on in_hardirq() being false for the > > + * outermost interrupt. > > + */ > > + preempt_count_sub(HARDIRQ_OFFSET); > > tick_irq_exit(); > > Can we also extend the HARDIRQ_OFFSET context coverage to tick_irq_exit() ? > From a quick look I haven't found anything that would prevent from that. You just need > to turn the "if (!in_hardirq())" test to "if hardirq_count()) == HARDIRQ_OFFSET" Yes. I checked the rest of the tick-exit path and found no other dependency on HARDIRQ_OFFSET being clear. I'll make that change. Karl