From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) (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 58767241CB7 for ; Thu, 9 Oct 2025 04:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=172.105.4.254 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759982698; cv=none; b=V6qU511T6PMoAPzoKJGg7/7jJCxBeFf2DGlyg74o9yZTp6X0hJ2kX6k4FzHVTL+02xQGPHnZiCV4fyfwBgR+7RShbYj9VfQj+G0ErcTGgKvPqlfS4TsGO3mRMGHSrJQgerDgttxe+Osy8h6sTjHxuCDLYwdESVwIyh4e9t4t34I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759982698; c=relaxed/simple; bh=DCmW1Fy9ep6190H7tU2v5kS2XIm6raDoEW/DHR1Vjjg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=Z6Mz+0nrcZ2i5HDJA08MEe4tXVIUkHlglS2M8J/rY3SM2RHqr5qeeb/Mnnuz4Xit7QH8l51JtVNhY1YV03sklkMWk/79Ypw1E0wxETbeGDk8KChLfStmw3v8osZW1wIHlxtxHGpaEObEEtIkvMlugmGg4teRx5C3PJpSOMYxFyw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org; spf=pass smtp.mailfrom=linux-foundation.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=nIUztAZJ; arc=none smtp.client-ip=172.105.4.254 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux-foundation.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="nIUztAZJ" Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id F3CC1604A9; Thu, 9 Oct 2025 04:04:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E35D1C4CEE7; Thu, 9 Oct 2025 04:04:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1759982694; bh=DCmW1Fy9ep6190H7tU2v5kS2XIm6raDoEW/DHR1Vjjg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nIUztAZJruIzIDci75GQZX+SEixhge4TpK1eNqOb/hlvMQJFOaZTX2zEx1gcgBklJ oEzDbhGwzqUsxOaZE6o64JYS4LapPFhGlquXTm5JJNaZB3G3vqHEBvJGh9agHawsud f46csRYJjvknKBzXG25HGsS1kJoMjo7iE+A8M1l0= Date: Wed, 8 Oct 2025 21:04:53 -0700 From: Andrew Morton To: Lance Yang Cc: Geert Uytterhoeven , Eero Tamminen , Kent Overstreet , amaindex@outlook.com, anna.schumaker@oracle.com, boqun.feng@gmail.com, ioworker0@gmail.com, joel.granados@kernel.org, jstultz@google.com, leonylgao@tencent.com, linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org, longman@redhat.com, mhiramat@kernel.org, mingo@redhat.com, mingzhe.yang@ly.com, peterz@infradead.org, rostedt@goodmis.org, Finn Thain , senozhatsky@chromium.org, tfiga@chromium.org, will@kernel.org, stable@vger.kernel.org Subject: Re: [PATCH v2 1/1] hung_task: fix warnings caused by unaligned lock pointers Message-Id: <20251008210453.71ba81a635fc99ce9262be7e@linux-foundation.org> In-Reply-To: <3e0b7551-698f-4ef6-919b-ff4cbe3aa11c@linux.dev> References: <20250909145243.17119-1-lance.yang@linux.dev> <99410857-0e72-23e4-c60f-dea96427b85a@linux-m68k.org> <20251007135600.6fc4a031c60b1384dffaead1@linux-foundation.org> <56784853-b653-4587-b850-b03359306366@linux.dev> <693a62e0-a2b5-113b-d5d9-ffb7f2521d6c@linux-m68k.org> <23b67f9d-20ff-4302-810c-bf2d77c52c63@linux.dev> <2bd2c4a8-456e-426a-aece-6d21afe80643@linux.dev> <3fa8182f-0195-43ee-b163-f908a9e2cba3@linux.dev> <3e0b7551-698f-4ef6-919b-ff4cbe3aa11c@linux.dev> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-m68k@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 9 Oct 2025 10:01:18 +0800 Lance Yang wrote: > I think we fundamentally disagree on whether this fix for known > false-positive warnings is needed for -stable. Having the kernel send scary warnings to our users is really bad behavior. And if we don't fix it, people will keep reporting it. And removing a WARN_ON is a perfectly good way of fixing it. The kernel has 19,000 WARNs, probably seven of which are useful :( From: Lance Yang Subject: hung_task: fix warnings caused by unaligned lock pointers Date: Tue, 9 Sep 2025 22:52:43 +0800 From: Lance Yang The blocker tracking mechanism assumes that lock pointers are at least 4-byte aligned to use their lower bits for type encoding. However, as reported by Eero Tamminen, some architectures like m68k only guarantee 2-byte alignment of 32-bit values. This breaks the assumption and causes two related WARN_ON_ONCE checks to trigger. To fix this, the runtime checks are adjusted to silently ignore any lock that is not 4-byte aligned, effectively disabling the feature in such cases and avoiding the related warnings. Thanks to Geert Uytterhoeven for bisecting! Link: https://lkml.kernel.org/r/20250909145243.17119-1-lance.yang@linux.dev Fixes: e711faaafbe5 ("hung_task: replace blocker_mutex with encoded blocker") Signed-off-by: Lance Yang Reported-by: Eero Tamminen Closes: https://lore.kernel.org/lkml/CAMuHMdW7Ab13DdGs2acMQcix5ObJK0O2dG_Fxzr8_g58Rc1_0g@mail.gmail.com Reviewed-by: Masami Hiramatsu (Google) Cc: John Paul Adrian Glaubitz Cc: Anna Schumaker Cc: Boqun Feng Cc: Finn Thain Cc: Geert Uytterhoeven Cc: Ingo Molnar Cc: Joel Granados Cc: John Stultz Cc: Kent Overstreet Cc: Lance Yang Cc: Mingzhe Yang Cc: Peter Zijlstra Cc: Sergey Senozhatsky Cc: Steven Rostedt Cc: Tomasz Figa Cc: Waiman Long Cc: Will Deacon Cc: Yongliang Gao Cc: Signed-off-by: Andrew Morton --- include/linux/hung_task.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/include/linux/hung_task.h~hung_task-fix-warnings-caused-by-unaligned-lock-pointers +++ a/include/linux/hung_task.h @@ -20,6 +20,10 @@ * always zero. So we can use these bits to encode the specific blocking * type. * + * Note that on architectures where this is not guaranteed, or for any + * unaligned lock, this tracking mechanism is silently skipped for that + * lock. + * * Type encoding: * 00 - Blocked on mutex (BLOCKER_TYPE_MUTEX) * 01 - Blocked on semaphore (BLOCKER_TYPE_SEM) @@ -45,7 +49,7 @@ static inline void hung_task_set_blocker * 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 +57,6 @@ static inline void hung_task_set_blocker static inline void hung_task_clear_blocker(void) { - WARN_ON_ONCE(!READ_ONCE(current->blocker)); - WRITE_ONCE(current->blocker, 0UL); } _