From nobody Sun Nov 24 22:36:28 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 5DBEB1AC445 for ; Sat, 2 Nov 2024 17:51:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730569888; cv=none; b=a5qDv9uLp/2MpY1cZo+eF1SvaEUcn8p5UjvkdfUNay9sJnH+wVGyrlEkZcbfHXRBrrkFn6USt8BZGFdXb1VQ4GELjxE9vp37BHk0w4g2hi7gfqUpu80xa0BdUWiLhTs8mPikw3beJRGa81SmFG1NtsYqMfbsptknHuMiSiSOYmg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730569888; c=relaxed/simple; bh=JvxcRd6YmtrCl+GZCGplZl/ZNrWqWevvQT1yH4/zYYQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=uEG8tRz5Mz6vUM+6TnkFerU81hbB1Z2VyMtWYge+psyd+ZXuuyAQwWODdjSsvQnKUODX/vT+NQ0qYu0nJNOZZGz1k7pncsX/J6Lfl0qVESHKxP1HZTLbnQdJfzJKsPsw2Gj4MV2JeyPgKdS6IDmFCe3OkkZjMPMPj75a/7DO3jQ= 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=mZmJnN9G; arc=none smtp.client-ip=209.85.128.202 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mZmJnN9G" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e3c638cc27so59379307b3.0 for ; Sat, 02 Nov 2024 10:51:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1730569885; x=1731174685; 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=aocsS2GBm0tKtUkt4oMs70MBTwqe0y0WT7ej9bCD6/M=; b=mZmJnN9GGA30xBmN35vC76m/MU+qH8wbwBTf16NQnIRUd42SPz9QMvKKv6gxvOTLAb 94coG8a68BAC1//deCbT6PpB45NU25pE3e7spZqyVUjsLuPv+jiSLgzctzipxAhMK2lz 8z5hyDov2Ma8LwD7QPmzt56vBa1LeKaDl93ee0RNZu2TF8ABYDUDVIHNvK0a6GXBFhxb oCZV/3xqh7f0Q3NT4EUWjHjO0BlXdw5K62IhxTzVTfvO5DvO55BEdpH0OxH+Pny/8vsY eBsWC6tmE4qoH+qSaug/e0YwM/L/BkQLIO+hgL8vmyS+aGX20syHaA0pjHExZb7WjdWe pCSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730569885; x=1731174685; 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=aocsS2GBm0tKtUkt4oMs70MBTwqe0y0WT7ej9bCD6/M=; b=hKXRNgthBdrsswiwY2MHHRVULUwiaEJw/tOJ+36NJloMT/qMJw+pkBKez6jnmiYoXN mO26BwLi4KMyqRUHjUPfgGnjD2MHbP5yEKARNm5XM1+OtrCamLhu3IIfLpKDa5BsUART wOpkc54nmw0MBaQhEglZN3P3OHJMXJtSE7VElpiiAkO1GxUEqRHqYd24J5FHupnfvvTr y8q0HkLO9E2E0Sp+IEss41HpsKZTfL1r1/C0aZqsnGIKJt7MyJ5JY9NCL2x+bng1Et/A Doz/xhvgQ3GqG+AJDVJdipzTAfnNb1pNPonXmTmB+O9ABTVaEUya+PAJLwvTptS3N3qo nyWQ== X-Forwarded-Encrypted: i=1; AJvYcCXJMI/QaIA8RSi5ayzKlQqjUDM9VwHMPcpBcHSMgxmAJWFsbGeJbdWKSu0TYiNjxYsltRZZHJ3Lbp7BZJ8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz7exhn/jFQjdwnO4zRFk0UaNdb3p/OPpL5JuUFSprfWJH1hp8N Z6d5WgbK1UJFrODRaNCQ2vLcTca1VZ07SG8QsIetwGNrAripo9ImE/1B5MqGrt2dvg== X-Google-Smtp-Source: AGHT+IHgnJ0YhCd1EkSEz+tdwpvNNsyp+LcO1wOdC/OUzSn1flY0X31/t3eGDeD9oP/MyR4nmcAVYVE= X-Received: from xur.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:2330]) (user=xur job=sendgmr) by 2002:a5b:f0f:0:b0:e2e:2cba:ac1f with SMTP id 3f1490d57ef6-e3087bd5414mr138970276.6.1730569885221; Sat, 02 Nov 2024 10:51:25 -0700 (PDT) Date: Sat, 2 Nov 2024 10:51:11 -0700 In-Reply-To: <20241102175115.1769468-1-xur@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241102175115.1769468-1-xur@google.com> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog Message-ID: <20241102175115.1769468-5-xur@google.com> Subject: [PATCH v7 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 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 Tested-by: Nathan Chancellor 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/vmlinu= x.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 =3D .; \ __noinstr_text_end =3D .; =20 +#define TEXT_UNLIKELY \ + __unlikely_text_start =3D .; \ + *(.text.unlikely .text.unlikely.*) \ + __unlikely_text_end =3D .; + +#define TEXT_HOT \ + __hot_text_start =3D .; \ + *(.text.hot .text.hot.*) \ + __hot_text_end =3D .; + /* * .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 \ . =3D ALIGN(PAGE_SIZE); \ - *(.text.hot .text.hot.*) \ + TEXT_HOT \ *(TEXT_MAIN .text.fixup) \ NOINSTR_TEXT \ *(.ref.text) --=20 2.47.0.163.g1226f6d8fa-goog