From patchwork Sat Oct 26 05:14:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rong Xu X-Patchwork-Id: 2002702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=tV8Tmlu+; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org; envelope-from=srs0=1lwh=rw=vger.kernel.org=sparclinux+bounces-2494-patchwork-incoming=ozlabs.org@ozlabs.org; receiver=patchwork.ozlabs.org) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Xb7BT0fHjz1xw0 for ; Sat, 26 Oct 2024 16:14:57 +1100 (AEDT) Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4Xb7BR3Fsjz4x3J for ; Sat, 26 Oct 2024 16:14:55 +1100 (AEDT) Received: by gandalf.ozlabs.org (Postfix) id 4Xb7BR3D8nz4x6n; Sat, 26 Oct 2024 16:14:55 +1100 (AEDT) Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: gandalf.ozlabs.org; arc=pass smtp.remote-ip="2604:1380:40f1:3f00::1" arc.chain=subspace.kernel.org ARC-Seal: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1729919695; cv=pass; b=LXBHheypFeT1/D+g5vbDXrYxDxWI7Po74eATwtrhFNpZjBOrL1/zFVhyQB2J08/0lTrq6v4qNyK4W2yAI3lMhm/nWoLQ6Qic6qMVYyxPAZz0uwR5CEKB0WwVpDKlqnuaRSNHMS77IgOV3cAvhOpvpJfdHlLl+hKQvcTt/byGgioAcLiDcg3Gyx3/BGc4jXj4raXPLJ13T7Z7M2DenTVGRf9F1sfNJuUrj7S/aqEhLyUPaFA539QUoCsXK9Hq5Dt3Ki4oyMzxMUFs6e6JF+BCwJ/Xa3jiu2c1kQOO9+Mun4vq/IfOxe+1FNGqCgdF4xzGxdzkgyRgSDIXcrF0HXnQYA== ARC-Message-Signature: i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1729919695; c=relaxed/relaxed; bh=u2CNgeIiMQMsQ3BQwy/JhDpCL0QGG7OlUJ2Ao2DLrpQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WnwoS3wt7nYUJROJDiyrfx1slH+9RdiYnZwUrQcfdSTaSzc+HeRwv4uiqaaQdK0dIusWMd3lSjHaawoxyABG6jTkWtw8vSZ2TPemL3CSPB4r6/RTS8eQzFU+rpMDuuXruO9/ksl8ZFHzwlvqumCHyQoVPP0XT6oRjqyxrp2GEbAM2BhEmArdRRrgi/HRlGy8HSTqzSmjfWwZPfavES+jzgjw8RWpG3MtKvkjYDuRGKLpeHQjZma33gKByL6ZEtl1bpoMC1hEa7VqiK0r9b3I86J6szAl8g5AVV0wjfK3BHIUEjMJquhu0S6M6zSybCGNqwNh1b6LKrAwsGPRJ0abAg== ARC-Authentication-Results: i=2; gandalf.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=tV8Tmlu+; dkim-atps=neutral; spf=pass (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=sparclinux+bounces-2494-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org Authentication-Results: gandalf.ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: gandalf.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20230601 header.b=tV8Tmlu+; dkim-atps=neutral Authentication-Results: gandalf.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=sparclinux+bounces-2494-patchwork-incoming=ozlabs.org@vger.kernel.org; receiver=ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by gandalf.ozlabs.org (Postfix) with ESMTPS id 4Xb7BR36Xgz4x3J for ; Sat, 26 Oct 2024 16:14:55 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9032DB21659 for ; Sat, 26 Oct 2024 05:14:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 702B818D633; Sat, 26 Oct 2024 05:14:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="tV8Tmlu+" X-Original-To: sparclinux@vger.kernel.org Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 9229017D8A9 for ; Sat, 26 Oct 2024 05:14:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729919665; cv=none; b=UXo8z9vFXp4yA+WRyDSlY3NVxz0SkOYr2xHxX/JYl/GdbGiRsoqA0HTd3YQfE+EZiIlHyHZB52wt3rEIcSoy9pFWh36D4KAInEXj2ip43ZbuchVY5YBsptX0m+9Jd2y7bMyXgoK1ZTEoiMVW7dGy18iow8mwVlZp8cZ8qZ9T3yk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729919665; c=relaxed/simple; bh=tzMXMzN/wgMUOmEGyjDqmLEvBh2AhaCjj6RzEgw1Vr0=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=PeryVLxnXuTVQGrSl5TAkGdW7hPjJ7fi7v2brjmvaxj6S8mEFtM7yqph8hzLZrisowY4INziEyqhflxZwyniHKCG5eFgHDAZnak8DYZ7AzUubx38YAl64m//X5/2GPCThf6EPaIsJwkvAof0ty2gprfQpHfBtGOFKT6T5fjdvlQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--xur.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=tV8Tmlu+; arc=none smtp.client-ip=209.85.128.201 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--xur.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e3497c8eb0so33689987b3.0 for ; Fri, 25 Oct 2024 22:14:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729919661; x=1730524461; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=u2CNgeIiMQMsQ3BQwy/JhDpCL0QGG7OlUJ2Ao2DLrpQ=; b=tV8Tmlu++RiNzMQDeOZFi1Hl/KAkGycV8oaWMAKribDkXYXF95YLFFjmvCRxxYj0c7 /AfBeD8rL3Ka125fCGaVFI+RTc1hJ6tqpWtNtk4tnPZogwtnRqch9cIc8x3UORE+gxS8 ceki0B53vmE6b3wDv7GklO3oRM/UlN3xdpXwfm9xAEIUikhnsCoud9CYM1tk4pTrcdgU tO8luHCp+D0+8OfaQWGzgs4YZOvN58C+YDbBpSdwE9w4XvJ+CrD6wRdfk4SJ3TnHP0MH U23T80G1BzFimn8qyVP6K7JrJUH2lV1OZtVyiDtkZbxepI6RvliFsOBsZ5BhaUX7OjyM BAxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729919661; x=1730524461; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=u2CNgeIiMQMsQ3BQwy/JhDpCL0QGG7OlUJ2Ao2DLrpQ=; b=YQG4l7PXK8ER0g4wF2L/1yWbdk14sWJBrgcYH1YbKjWj3tJ8iD1grY//DH+kKDLpdS VzZX+ZxAqJfXCV1c7akNxWdtrQpd5kxLQGTGgVKu7VA1R44VJIlBd9cVCpYsbqhxgBXt +x2GFIpzdzGubev+1SwRDFchsTGqfgrBMWZpTvRHKOQyGcI6nYI6KUAVZit0bIZAJ1o4 Zc//8REx8kIdoSOGqbUncoiQDSdX4ghh/RGPdNQZ1gDxbgw2bjjc7wOu4v9xfCYsDHNN G+fHSDSS7GvWqjS2OXxYBdrArv0rtY9DVo2JMA241h0UlnsOVVMHn1+eqC7jL2COVS4x QxzQ== X-Forwarded-Encrypted: i=1; AJvYcCV3kmFvic2dsvvIq63kQlkklNFDQ7wqrxFucG1cYdJO3b+KQE00pRdWzvxEKT0zJYsTsgXZAOMj+6nq@vger.kernel.org X-Gm-Message-State: AOJu0YxEbihcReEcCVIc31vSFkgbpZHaiVCdcHDp6L17uk+oKyh//4oW Zc+pXoMGBhUJFnS+LVtzYbQOzliADwNUJgoE8vlQKgutD1u6GUYQcORm7a76XQJoLQ== X-Google-Smtp-Source: AGHT+IG4wzkxOGVXqJpc/NqCJl7J1Bo+g7i9iACOlnzSbC72EPPc9/I9m6FoCmV9xT7sOQL/GxBtQGI= X-Received: from xur.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:2330]) (user=xur job=sendgmr) by 2002:a05:690c:82c:b0:620:32ea:e1d4 with SMTP id 00721157ae682-6e9d870c0e4mr333647b3.0.1729919661525; Fri, 25 Oct 2024 22:14:21 -0700 (PDT) Date: Fri, 25 Oct 2024 22:14:06 -0700 In-Reply-To: <20241026051410.2819338-1-xur@google.com> Precedence: bulk X-Mailing-List: sparclinux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241026051410.2819338-1-xur@google.com> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog Message-ID: <20241026051410.2819338-5-xur@google.com> Subject: [PATCH v6 4/7] Add markers for text_unlikely and text_hot sections From: Rong Xu To: Alice Ryhl , Andrew Morton , Arnd Bergmann , Bill Wendling , Borislav Petkov , Breno Leitao , Brian Gerst , Dave Hansen , David Li , Han Shen , Heiko Carstens , "H. Peter Anvin" , Ingo Molnar , Jann Horn , Jonathan Corbet , Josh Poimboeuf , Juergen Gross , Justin Stitt , Kees Cook , Masahiro Yamada , "Mike Rapoport (IBM)" , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , "Paul E. McKenney" , Peter Zijlstra , Rong Xu , Sami Tolvanen , Thomas Gleixner , Wei Yang , workflows@vger.kernel.org, Miguel Ojeda , Maksim Panchenko , "David S. Miller" , Andreas Larsson , Yonghong Song , Yabin Cui , Krzysztof Pszeniczny , Sriraman Tallam , Stephane Eranian Cc: x86@kernel.org, linux-arch@vger.kernel.org, sparclinux@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Add markers like __hot_text_start, __hot_text_end, __unlikely_text_start, and __unlikely_text_end which will be included in System.map. These markers indicate how the compiler groups functions, providing valuable information to developers about the layout and optimization of the code. Co-developed-by: Han Shen Signed-off-by: Han Shen Signed-off-by: Rong Xu Suggested-by: Sriraman Tallam Tested-by: Yonghong Song Tested-by: Yabin Cui Change-Id: Ie7688587adf89a14661ceca108680903b546d5d9 Reviewed-by: Kees Cook Reviewed-by: Kees Cook --- include/asm-generic/vmlinux.lds.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index fd901951549c0..e02973f3b4189 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -549,6 +549,16 @@ __cpuidle_text_end = .; \ __noinstr_text_end = .; +#define TEXT_UNLIKELY \ + __unlikely_text_start = .; \ + *(.text.unlikely .text.unlikely.*) \ + __unlikely_text_end = .; + +#define TEXT_HOT \ + __hot_text_start = .; \ + *(.text.hot .text.hot.*) \ + __hot_text_end = .; + /* * .text section. Map to function alignment to avoid address changes * during second ld run in second ld pass when generating System.map @@ -565,9 +575,9 @@ ALIGN_FUNCTION(); \ *(.text.asan.* .text.tsan.*) \ *(.text.unknown .text.unknown.*) \ - *(.text.unlikely .text.unlikely.*) \ + TEXT_UNLIKELY \ . = ALIGN(PAGE_SIZE); \ - *(.text.hot .text.hot.*) \ + TEXT_HOT \ *(TEXT_MAIN .text.fixup) \ NOINSTR_TEXT \ *(.ref.text)