From: Lance Yang <lance.yang@linux.dev>
To: Finn Thain <fthain@linux-m68k.org>
Cc: akpm@linux-foundation.org, geert@linux-m68k.org,
linux-kernel@vger.kernel.org, mhiramat@kernel.org,
oak@helsinkinet.fi, peterz@infradead.org, stable@vger.kernel.org,
will@kernel.org, Lance Yang <ioworker0@gmail.com>
Subject: Re: [PATCH] atomic: Specify natural alignment for atomic_t
Date: Mon, 25 Aug 2025 13:00:06 +0800 [thread overview]
Message-ID: <96ae7afc-c882-4c3d-9dea-3e2ae2789caf@linux.dev> (raw)
In-Reply-To: <c8851682-25f1-f594-e30f-5b62e019d37b@linux-m68k.org>
On 2025/8/25 12:07, Finn Thain wrote:
>
> On Mon, 25 Aug 2025, Lance Yang wrote:
>
>>
>> Perhaps we should also apply the follwoing?
>>
>> diff --git a/include/linux/hung_task.h b/include/linux/hung_task.h
>> index 34e615c76ca5..940f8f3558f6 100644
>> --- a/include/linux/hung_task.h
>> +++ b/include/linux/hung_task.h
>> @@ -45,7 +45,7 @@ static inline void hung_task_set_blocker(void *lock, unsigned long type)
>> * If the lock pointer matches the BLOCKER_TYPE_MASK, return
>> * without writing anything.
>> */
>> - if (WARN_ON_ONCE(lock_ptr & BLOCKER_TYPE_MASK))
>> + if (lock_ptr & BLOCKER_TYPE_MASK)
>> return;
>>
>> WRITE_ONCE(current->blocker, lock_ptr | type);
>> @@ -53,8 +53,6 @@ static inline void hung_task_set_blocker(void *lock, unsigned long type)
>>
>> static inline void hung_task_clear_blocker(void)
>> {
>> - WARN_ON_ONCE(!READ_ONCE(current->blocker));
>> -
>> WRITE_ONCE(current->blocker, 0UL);
>> }
>>
>> Let the feature gracefully do nothing on that ;)
>>
>
> This is poor style indeed.
Thanks for the lesson!
>
> The conditional you've added to the hung task code has no real relevance
> to hung tasks. It doesn't belong there.
You're right! The original pointer-encoding was a deliberate trade-off to
save a field in task_struct, but as we're seeing now, that assumption is
fragile and causing issues :(
>
> Of course, nobody wants that sort of logic to get duplicated at each site
> affected by the architectural quirk in question. Try to imagine if the
> whole kernel followed your example, and such unrelated conditionals were
> scattered across code base for a few decades. Now imagine trying to work
> on that code.
I agree with you completely: scattering more alignment checks into core
logic
isn't the right long-term solution. It's not a clean design :(
>
> You can see special cases for architectural quirks in drivers, but we do
> try to avoid them. And this is not a driver.
So, how about this?
What if we squash the runtime check fix into your patch? That would create a
single, complete fix that can be cleanly backported to stop all the spurious
warnings at once.
Then, as a follow-up, we can work on the proper long-term solution: changing
the pointer-encoding and re-introducing a dedicated field for the
blocker type.
next prev parent reply other threads:[~2025-08-25 5:00 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 2:03 [PATCH] atomic: Specify natural alignment for atomic_t Finn Thain
2025-08-25 2:03 ` Finn Thain
2025-08-25 3:27 ` Lance Yang
2025-08-25 3:59 ` Finn Thain
2025-08-25 4:22 ` Lance Yang
2025-08-25 4:07 ` Finn Thain
2025-08-25 5:00 ` Lance Yang [this message]
2025-08-25 6:17 ` Finn Thain
2025-08-25 7:46 ` Lance Yang
2025-08-25 10:49 ` Finn Thain
2025-08-25 11:19 ` Lance Yang
2025-08-25 11:36 ` Lance Yang
2025-08-27 23:43 ` Finn Thain
2025-08-28 2:05 ` Lance Yang
2025-09-01 8:45 ` Geert Uytterhoeven
2025-09-02 13:30 ` Lance Yang
2025-09-02 14:14 ` Geert Uytterhoeven
2025-09-06 11:43 ` David Laight
2025-08-25 12:07 ` David Laight
2025-08-25 12:33 ` Lance Yang
2025-08-27 8:00 ` Finn Thain
2025-08-27 9:34 ` Lance Yang
2025-09-01 8:48 ` Geert Uytterhoeven
2025-08-25 7:12 ` Peter Zijlstra
2025-08-25 8:03 ` Finn Thain
2025-08-25 11:41 ` Peter Zijlstra
2025-08-27 7:17 ` Finn Thain
2025-08-27 11:54 ` Peter Zijlstra
2025-08-28 9:53 ` Finn Thain
2025-09-01 9:36 ` Peter Zijlstra
2025-09-01 9:40 ` Peter Zijlstra
2025-09-08 1:30 ` Finn Thain
2025-08-26 15:22 ` Eero Tamminen
2025-08-26 17:33 ` Lance Yang
2025-09-01 8:51 ` Geert Uytterhoeven
2025-09-01 15:12 ` Eero Tamminen
2025-09-06 11:50 ` David Laight
2025-08-27 2:45 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=96ae7afc-c882-4c3d-9dea-3e2ae2789caf@linux.dev \
--to=lance.yang@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=fthain@linux-m68k.org \
--cc=geert@linux-m68k.org \
--cc=ioworker0@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=oak@helsinkinet.fi \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.