From nobody Fri Oct 2 12:24:36 2026 Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (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 627A53446C3 for ; Fri, 31 Jul 2026 20:15:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785528926; cv=none; b=SrBTaiCKETzG4AxVAAnqbWf2fRQ45DUKhhe8M3mY1K3vv5xVGELM4kIEcZMSN98rjNybhLZAmb+acFUzWwaw8JglFq9+U1qP4PThQwiNds32Z2dHTQUD6r3vL/PYI9cvWakHGIE4C9Vf4p1gfOz7zybZKyatJ9fsuYCpToKfE0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785528926; c=relaxed/simple; bh=bdSmeAMghggTuA1J0I4rgleE0BB2q98NNwRi2/CqdhY=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=fZ5uP22Up4I6kX2CRy1sA4UAzTplrmScX10RErBTaWkqUOw0IkaD7aBSxBZ1epDo5o9UePLHZ8ZWF3KACxCfshpHlAejKIRvr5Ijivt/tPtYXPEy/AFYyHSlx2tipM7BzbDVEmG5O/HUG0MCoZ91PpA6SDkva4DIu23befdKewc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ajordanr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=iXxqJ4kn; arc=none smtp.client-ip=209.85.214.200 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ajordanr.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="iXxqJ4kn" Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2cee894b3d8so24713395ad.2 for ; Fri, 31 Jul 2026 13:15:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785528925; x=1786133725; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=AO9QVWaVHimnIgZbX5i/5mXX0JfsDFQlH7AOjqJnjH0=; b=iXxqJ4knUGS09e+6Qim7uZepqAMqtZ3YziV3ffXQcE+Ll6/DPy8pOTWXu9Vyp2jPVt pakaQ442qJkDe+3+tph9HkjQ7s8MVDo50acNuaB2UqMfqghhLwsddS9EfzvH7sqTskBw cyOBj/GQdtu2xY2PP0aCj0AIH9XYfkDhRWN3bonjVtF4w6//Nq+Od+Hr2lFnidOjMhJP hrozPeEuRw66qKtLqY5YKTaDT1GEM2+iMT2wbzWyAWwuSekEkYw89t/bQ9cefXKPp/cN QysgGGwwcJAadF/QWfWZjprqXUmyKzNAizPekL1fYmHFDxoU8pT0oz/8yed8oRNjJMIM kv+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785528925; x=1786133725; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=AO9QVWaVHimnIgZbX5i/5mXX0JfsDFQlH7AOjqJnjH0=; b=cyMQ0MnlQJl8DRk5yaEikGvy9bvw08ByGrEZta96iA93h8jB5ygq9LICtTFgS5JUIb NZIptwni/Rnq7eAdSw4u4QJq3zxiiUcWA5navGcXxmildFyq6QTyNgfWtbV+imUAXHRd B0/K69ZxRDOrzAI5+NPvEyvguyXfMkFXh0ELUsIrYaTTpCv7syhrjyQMu4BhkVEsqNhI xHb2LpBa3hzqf3np5jEPXk0a0CwUORQfgc652XdU4o2/6ulz0laIRNLqEXuVCsclUVv4 XrpKucspFX/BBPN6UdH8+MUe3q4uVfFPl13t3tBWEPR4VioGGZWeAZReBmaLYlahwXho VIhw== X-Forwarded-Encrypted: i=1; AHgh+RpLfVpCynSGDsSA0GCT6kXHjgTNYPdmG7l5PVlU+w9xik141S7tJOr6qF6T/kbUdGyaDlAWFYwJsfYL6wI=@vger.kernel.org X-Gm-Message-State: AOJu0YzRyx4MLdiKAyA5utgWUnH6/g38nlYsyAxn5j7vASM0UY+g7mDn lmnLv3YA+LbRCY4vFywrBV4BrrMklzDoIzOmLzvuKEmsoiufwFzLYanmtD42PxGSxsQCv/AX3l7 W9MUSXeENCZMUSQ== X-Received: from plbjw24.prod.google.com ([2002:a17:903:2798:b0:2cb:3f5b:b116]) (user=ajordanr job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:41c4:b0:2cf:4c0f:5116 with SMTP id d9443c01a7336-2d052298addmr11061545ad.28.1785528924439; Fri, 31 Jul 2026 13:15:24 -0700 (PDT) Date: Fri, 31 Jul 2026 20:15:19 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAFYCbWoC/x2MSQqAMAwAvyI5G6gVIvoV8VBs1ECp0ogL4t8tM qc5zDygnIQVuuKBxIeorDFLVRYwLi7OjOKzgzWWTFMbdOF0t6LEIJExiO7ovMeaMi0ZYkuQ4y3 xJNc/7of3/QBeqPtgaAAAAA== X-Change-Id: 20260730-always-inline-list-add-363639606e26 X-Developer-Key: i=ajordanr@google.com; a=ed25519; pk=ww5nbO3/Pd5R/873sdlbeNqCoUeIjBqvP3Bhcapjd/Y= X-Developer-Signature: v=1; a=ed25519-sha256; t=1785528923; l=3418; i=ajordanr@google.com; s=20260730; h=from:subject:message-id; bh=bdSmeAMghggTuA1J0I4rgleE0BB2q98NNwRi2/CqdhY=; b=HS0GsaKcoa6PpiObSnjKc6Pp62XSbm0Pq9OnfKXu3X9DVEzRQr5yhrNwBK/V8G48MTQVBKq9h hIYbr6sKDy7B7kG+7zHi0MApYm4WStRPOfotkX3Y4TIZcs/Vrm/5ph6 X-Mailer: b4 0.14.3 Message-ID: <20260731-always-inline-list-add-v1-1-d29f54ce5477@google.com> Subject: [PATCH] Mark list_add and __list_add as __always_inline From: Jordan R Abrahams-Whitehead To: Andrew Morton Cc: Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Jordan R Abrahams-Whitehead , Eric Dumazet Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable This commit resolves an issue where modpost section verification fails due to section mismatches between list_add and its callers. At present, list_add (and its internal __list_add) are called from both .text and .init code sections. Since inlining can vary per call site, list_add can be 4 different states: list_add in text with arguments to non-.init.data values list_add in init with arguments to static .init.data values list_add in init with arguments to non-.init.data values list_add in text with arguments to static .init.data values It is last instance that ends up causing the section mismatch caused by constant propagation of the address of static libs inside the `dir_add` as seen below (with the dir_list being defined statically in initramfs.c, resting in .init.data). WARNING: modpost: vmlinux.o: section mismatch in reference: __list_add (section: .text.unlikely.) -> dir_list (section: .init.data) Because of these section matching requirements, semantically, __list_add and list_add MUST be inlined. This will then ensure callers inside .init will receive a list_add that exists and refers to only .init data, and list_add code in .text sections will only refer to non-init data. This issue manifests predominently in AutoFDO with clang, which is very hesitant to inline cold functions such as list_add even when marked `inline`. Marking them as `__always_inline` therefore matches the existing semantic constraints imposed by modpost's section mismatch checks. Closes: https://github.com/ClangBuiltLinux/linux/issues/2173 Signed-off-by: Jordan R Abrahams-Whitehead Suggested-by: Nathan Chancellor Suggested-by: Eric Dumazet Link: https://lore.kernel.org/all/CANn89iJVQe=3DwedLheJmjZjOTJsWHijT0jZs=3D= iRxKssJZbjAxHw@mail.gmail.com/ Reported-by: Giuliano Procida Reported-by: Yabin Cui Reviewed-by: Nick Desaulniers Tested-by: Nick Desaulniers --- include/linux/list.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/include/linux/list.h b/include/linux/list.h index 09d979976b3b..59f8aa0905d3 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -150,10 +150,13 @@ static inline bool __list_del_entry_valid(struct list= _head *entry) * * This is only for internal list manipulation where we know * the prev/next entries already! + * + * Must be inlined to ensure it can be safely called + * with initdata arguments. */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) +static __always_inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) { if (!__list_add_valid(new, prev, next)) return; @@ -171,8 +174,12 @@ static inline void __list_add(struct list_head *new, * * Insert a new entry after the specified head. * This is good for implementing stacks. + * + * Must be inlined to ensure it can be safely called + * with initdata arguments. */ -static inline void list_add(struct list_head *new, struct list_head *head) +static __always_inline void list_add(struct list_head *new, + struct list_head *head) { __list_add(new, head, head->next); } --- base-commit: fc46aed51f6280801f43a2cf4b5060cc33b572f9 change-id: 20260730-always-inline-list-add-363639606e26 Best regards, --=20 Jordan R Abrahams-Whitehead