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 2D97C1804A for ; Mon, 12 May 2025 07:32:42 +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=1747035163; cv=none; b=CnRosoJK3k9iO+TLbl7NyMgyPgFPEG6PI8Z2pN8oEXzW/BlxtCIgnWgxbASIaWEf+reM+i+agLMTa/zk39quoJXRFCmpNDbQ72o2zZo56FWVVQF7iTkUvyWDKuV3KlM+N8paQzsuctlkK7J5ERNEMkLaam12Vi43uyfJpeKrZhw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747035163; c=relaxed/simple; bh=eHtSj0FUtMrhaZjC47W23Q2ypqHTChWB6DGrplPg9pw=; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:References: In-Reply-To:Content-Type; b=GwZeZwOdPt37nW814WOLs+2aHls6NT4GLJ8GVu4J3HBPs3nSTqo6ijSj6l4nFDiZXpAYcFSfCHwsHpeh3FThGsZbfSJKUFueEbuTq7wd8qzVkaaeEITFVqDL+nIoLUfXIMZhWzYV8Jw3qtBbCGNBtwOO7FaVmF84PcR4zDD0gBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CXi0lhyH; 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="CXi0lhyH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C449C4CEE7; Mon, 12 May 2025 07:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1747035162; bh=eHtSj0FUtMrhaZjC47W23Q2ypqHTChWB6DGrplPg9pw=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=CXi0lhyHgDFq/F+KbdIICEoKYeMkLYRf8uFpAU+tP50MDrcXdHoXyMsZk1CBURgwt U2KJRiu5R4mx5ENG/gYU6TZsK5WFtye1dwJXQYRHB731+MToUsILFkKZX7lxryQZ8C cUKvfRG9ft2a0LD7bvu1cti3UyMOnrylGx0zt0OmkMFMgjsecR+bqGX5cvBAl0XwU9 xF2GIyT0dkRiHySKpoFn/NrWzzlze8iETRwhTXXGaAX/U95QZ8Uwd9xA/D70ZJNKe3 J7vueboVeQiBXaUlzOOcWC0rKjwYy5Pz+WniJf6+vDuUZBf4mPZ0tQEwVtEWfnyTFl YV6tArJTHnZwQ== Message-ID: <5e9a3cd4-402c-49ac-a79b-80ea81a163c0@kernel.org> Date: Mon, 12 May 2025 09:32:39 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch V2 26/45] genirq/chip: Rework irq_set_handler() variants From: Jiri Slaby To: Nathan Chancellor , Miguel Ojeda Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de References: <20250509132211.GA3618294@ax162> <20250511172911.1008109-1-ojeda@kernel.org> <20250511174923.GA3193067@ax162> <0a61672b-1782-43ea-bf10-b6088a1fd2fd@kernel.org> Content-Language: en-US Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ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ANgcg0AS429Mq0taaWKkAjkkGAT7mD1Q5PiLr06Y/+Kzdr 90eUVneqM2TUQQbK+Kh7JwmGVrRGNqQrDk+gRNvKnGwFNeTkTKtJ0P8jYd7P1gZb9Fwj9YLx jhn/sVIhNmEBLBoI7PL+9fbILqJPHgAwW35rpnq4f/EYTykbk1sa13Tav6btJ+4QOgbcezWI wZ5w/JVfEJW9JXp3BFAVzRQ5nVrrLDAJZ8Y5ioWcm99JtSIIxXxt9FJaGc1Bgsi5K/+dyTKL wLMJgiBzbVx8G+fCJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <0a61672b-1782-43ea-bf10-b6088a1fd2fd@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12. 05. 25, 9:25, Jiri Slaby wrote: > On 11. 05. 25, 19:49, Nathan Chancellor wrote: >> On Sun, May 11, 2025 at 07:29:11PM +0200, Miguel Ojeda wrote: >>> On Fri, 09 May 2025 14:22:11 +0100 Nathan Chancellor >>> wrote: >>>> >>>> I am investigating some cases where >>>> >>>> WARN(!irqs_disabled(), "Interrupts were enabled early\n"); >>>> >>>> in start_kernel() in init/main.c is triggered in certain builds with >>>> clang after patch 23 of this series (very bizarre since the conversion >>>> seems to be correct) and I happened to notice that this conversion >>>> seems >>>> to be incorrect? Should this be scoped_irqdesc_get_and_buslock() like >>>> below? >>> >>> Yeah, I am also seeing this in next-20250509 in a LLVM=1 arm64 >>> defconfig + Rust >>> build under QEMU. >> >> I noticed that the warning was reproducible with just the first patch of >> the series that adds the lock guards and patch 23 but also several other >> individual patches within the series, as I could not just revert patch >> 23 on next-20250509 to fix it. I have no idea why yet because I have not >> had the chance to actually sit down and dig into it but this diff fixes >> every instance of the warning that I saw in my tests... :/ could be a >> compiler bug or just some difference in behavior between compilers. >> >> diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h >> index bd2db6ebb98e..94f463de8f26 100644 >> --- a/kernel/irq/internals.h >> +++ b/kernel/irq/internals.h >> @@ -176,10 +176,9 @@ __DEFINE_UNLOCK_GUARD(irqdesc_lock, struct irq_desc, >>   static inline class_irqdesc_lock_t >> class_irqdesc_lock_constructor(unsigned int irq, bool bus, >>                                     unsigned int check) >>   { >> -    class_irqdesc_lock_t _t = { >> -        .bus    = bus, >> -        .lock    = __irq_get_desc_lock(irq, &_t.flags, bus, check), > > I assume the value stored by __irq_get_desc_lock() to &_t.flags is > overwritten by 0 by the initializer. class_irqdesc_lock_t::flags is > later than ::lock in the structure, so __irq_get_desc_lock() should be > called, setting ::flags, then the initializer should set flags to 0. > >> -    }; >> +    class_irqdesc_lock_t _t = {}; >> +    _t.bus    = bus; >> +    _t.lock    = __irq_get_desc_lock(irq, &_t.flags, bus, check); > > That's why this works ^^. In fact, this should work around the issue too: --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -178,6 +178,7 @@ static inline class_irqdesc_lock_t class_irqdesc_lock_constructor(unsigned int i { class_irqdesc_lock_t _t = { .bus = bus, + .flags = 0, .lock = __irq_get_desc_lock(irq, &_t.flags, bus, check), }; return _t; -- js suse labs