From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73708274671; Fri, 21 Nov 2025 22:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763762677; cv=none; b=qLP6W1uSqUuvPHZnRuxi/yzd2keyjQaY/HEs/aB6/P4wTLQ2KWFetr/2V5Y9Xn/PTl0B+oX91yrSLHpGX305cQIBPnhKoKXgCNJAwPs9wRP3fwO1CipLlmyFokw8QxiLUwNc6Cyq7iOEkjJm1tesAyogBVdsEn9S3pVt/E6hwdE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763762677; c=relaxed/simple; bh=9xKWBuc1gcHIHSMFYOhH9czYmjSje8Y4RiNQUXP2ezE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f3YKOlxvAWznXNLM/DDrFTuwMtYp4E4IRR18e3kmpdU0PQmWd7bZdBc7rZSTt1Wdcncqtk4zvkjNXw8oA8EmVpBKxxLCAsfq1OO9SQ9sJ5ZPBW6rAa3egwSQrbT8HwrKgJlt4kHP8N8VnKgLqWgm5IcYN+qPsdjS6nfb5Up+h74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FYbbvqoi; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FYbbvqoi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1821C4CEF1; Fri, 21 Nov 2025 22:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763762677; bh=9xKWBuc1gcHIHSMFYOhH9czYmjSje8Y4RiNQUXP2ezE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FYbbvqoitMNBhZHlxFqN1JBEaPMNg9W2nL2hgmocM0qWkMXMliLU+Q/PhKrxKkDXQ 9VJE8+t7qswsZVbKxuULq/3ZcaE4wygjgIw4WB21DOXL3r2grY0NCusoVfwVJ9Y0xo kjgR6cmaLkVUIiJ5vdukmMMNz1xfwXUgvcUM8YKWxWCC3WdKeFiyAxHte05NPg/1FT gZoUb5rLBUuvoiqHtDb2b/yMlfHTLh2muodhP8qGcu75x+aDxSvfzDdtwav0DWncIv X0n6fkGfqBz96l4B5aGAbkONOB0bw53W3u/FYRHKqLCHKpM+plZcLjDo8ftithi0kk U64xc9R20D+WA== Date: Fri, 21 Nov 2025 23:04:34 +0100 From: Frederic Weisbecker To: Thomas Gleixner Cc: LKML , Marek Szyprowski , Marco Crivellari , Waiman Long , cgroups@vger.kernel.org Subject: Re: [PATCH 1/3 v3] genirq: Prevent from early irq thread spurious wake-ups Message-ID: References: <20251121143500.42111-1-frederic@kernel.org> <20251121143500.42111-2-frederic@kernel.org> <878qfzjj2x.ffs@tglx> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <878qfzjj2x.ffs@tglx> Le Fri, Nov 21, 2025 at 08:12:38PM +0100, Thomas Gleixner a écrit : > On Fri, Nov 21 2025 at 15:34, Frederic Weisbecker wrote: > > During initialization, the IRQ thread is created before the IRQ get a > > chance to be enabled. But the IRQ enablement may happen before the first > > official kthread wake up point. As a result, the firing IRQ can perform > > an early wake-up of the IRQ thread before the first official kthread > > wake up point. > > > > Although this has happened to be harmless so far, this uncontrolled > > behaviour is a bug waiting to happen at some point in the future with > > the threaded handler accessing halfway initialized states. > > No. At the point where the first wake up can happen, the state used by > the thread is completely initialized. That's right after setup_irq() > drops the descriptor lock. Even if the hardware raises it immediately on > starting the interrupt up, the handler is stuck on the descriptor lock, > which is not released before everything is ready. > > That kthread_bind() issue is a special case as it makes the assumption > that the thread is still in that UNINTERRUPTIBLE state waiting for the > initial wake up. That assumption is only true, when the thread creator > guarantees that there is no wake up before kthread_bind() is invoked. > > I'll rephrase that a bit. :) Eh, thanks and sorry for the misinterpretation. -- Frederic Weisbecker SUSE Labs