From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (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 002FF1CACCA for ; Wed, 23 Oct 2024 16:24:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729700670; cv=none; b=kHRlMAkcD2L52r5dGctReXh5BtoUmZ3pkf4QyrdkPQeqOa6ybvboRMKg6Fl9aTHZcCv1ILHFyIZ4iJqjDzHbGV0nlzjLn7v28ZbZJboWfIzOXdAvE/+3uO0ZhPlwQE50086WgcGB43HogChi+VQLvvuk1WVRiicwIxR4hJcNT6o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729700670; c=relaxed/simple; bh=pVwawjEv+bQna+TOyVmWLFrZU2pYiQZj6lUOy1p+DLA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=mZNpRHaFSRRoE+WS/Zvkl2kv2qvJqSU2xemTuXEF8XDgOWl/nwAQdxrT/1NIoq3sMqaVEn/v0sVfI5eKuKjihyAir4qxzM2NqLsFrcImyu169Z+92V1UOjD0fHGCRCqj00s7XUjwmGfKjGii5d7ZTLfSIPANB9jq1pnZwgUJJkY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=kQPEtFQl; arc=none smtp.client-ip=209.85.160.169 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kQPEtFQl" Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-460a8d1a9b7so276551cf.1 for ; Wed, 23 Oct 2024 09:24:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729700668; x=1730305468; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3K3v255rwxrb6Xkn/WhIR8L6tyWLq3uTtuFWFOaL4e4=; b=kQPEtFQl8SVSZOUnfG5nuxQ4FRWblcF9Li/GR4dlNwmIggc4Spvn2H5hUJ8Qlp2tPE a/vYjA6ItZZknrkxTivK6qnM5ehJSw5OmKLkWiNM6KYW151lVRDDjFZ/2woJLJv+x7p2 idAcUHirNNCEMW8wC5YutkquXsN02K5BPx5SKiI1ukolxSp8yPkOUstmeT4bqckG+5dx TKYPFhAeLalIvPJVqEetPLXovB6+hYR/1oxDVd+4A7COaogF2l3uwQ/udLV0y564pSmi g2Q/wY8TUuXs5hvJ2ZPFLjIa38T646MDsnmMWPQ0lZWgMQ4uJO767Ms2mtw1mEQh5rPD QzvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729700668; x=1730305468; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3K3v255rwxrb6Xkn/WhIR8L6tyWLq3uTtuFWFOaL4e4=; b=iOZu7S5pKCFpTqnhS3X4ZD3axcsDA1Feq8JPaONivflnQ3dsrPGuUbJijOmds+9tZf WRw/uJSQcH0UOCSpwEXMO9j02w+AAviPdESsiK2rPkSheLyZno2L2cM6L9WY0zQffb4e Vv0vPPszgrfMSYJOckgZx5RkgiWCfU+3xboh9ALWjCT7yYBcA+8iSDOETtFeFa0Cq8kl pjPOklRMhU5Aa+QOwRYBBh4KjkNAG2PeNdWw+tE1dmIg4KrCjlCqz9cB/tRzuHagD5/X e9ZBgdzZ+wsKe9wEfmwmnHiGZQ2ce2I6ixZa49+HrBOvJBZIGyORR3N9r2l1sLWfLeGs LSug== X-Forwarded-Encrypted: i=1; AJvYcCUZwmc/gxA3+y9puB0wl1ZrtJ89rWP3ShmdvCclUT9aFQCKTytY4hUOeyM9NI9/RjSOiaxm2nYu68A=@vger.kernel.org X-Gm-Message-State: AOJu0YyFkXSpwdlyXGmaRGub+P+1XHpDPji3SfAUgH3l9NZnFnrTMCSI r/cgn2NKf4QtdN/Ejm5hkcW5obcccg9vxf9rjTFXidKKWgl49YAvuN6badwt2oXTwNxPYt49jpC 75nQM8yz0uKjy6h5hHJ2+flQMmBpPXlAgNhHV X-Google-Smtp-Source: AGHT+IH2imFVE/wFvhmVSrl3gRKWK7JMCBWJZCpQm7LLKLkfCbOmNxarfGKGqSg3+1hZSos8edhUHSKaLAIboEsXkAs= X-Received: by 2002:a05:622a:56:b0:460:49fd:6db0 with SMTP id d75a77b69052e-4612220c175mr534981cf.29.1729700667272; Wed, 23 Oct 2024 09:24:27 -0700 (PDT) Precedence: bulk X-Mailing-List: workflows@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20241014213342.1480681-1-xur@google.com> <20241014213342.1480681-6-xur@google.com> In-Reply-To: From: Rong Xu Date: Wed, 23 Oct 2024 09:24:15 -0700 Message-ID: Subject: Re: [PATCH v4 5/6] AutoFDO: Enable machine function split optimization for AutoFDO To: Masahiro Yamada Cc: 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 , "Mike Rapoport (IBM)" , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , "Paul E. McKenney" , Peter Zijlstra , Sami Tolvanen , Thomas Gleixner , Wei Yang , workflows@vger.kernel.org, Miguel Ojeda , Maksim Panchenko , x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Sriraman Tallam , Krzysztof Pszeniczny Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Oct 22, 2024 at 11:50=E2=80=AFPM Masahiro Yamada wrote: > > On Tue, Oct 22, 2024 at 8:28=E2=80=AFAM Rong Xu wrote: > > > > On Sun, Oct 20, 2024 at 8:18=E2=80=AFPM Masahiro Yamada wrote: > > > > > > On Tue, Oct 15, 2024 at 6:33=E2=80=AFAM Rong Xu wrot= e: > > > > > > > > Enable the machine function split optimization for AutoFDO in Clang= . > > > > > > > > Machine function split (MFS) is a pass in the Clang compiler that > > > > splits a function into hot and cold parts. The linker groups all > > > > cold blocks across functions together. This decreases hot code > > > > fragmentation and improves iCache and iTLB utilization. > > > > > > > > MFS requires a profile so this is enabled only for the AutoFDO buil= ds. > > > > > > > > Co-developed-by: Han Shen > > > > Signed-off-by: Han Shen > > > > Signed-off-by: Rong Xu > > > > Suggested-by: Sriraman Tallam > > > > Suggested-by: Krzysztof Pszeniczny > > > > --- > > > > include/asm-generic/vmlinux.lds.h | 6 ++++++ > > > > scripts/Makefile.autofdo | 2 ++ > > > > 2 files changed, 8 insertions(+) > > > > > > > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generi= c/vmlinux.lds.h > > > > index ace617d1af9b..20e46c0917db 100644 > > > > --- a/include/asm-generic/vmlinux.lds.h > > > > +++ b/include/asm-generic/vmlinux.lds.h > > > > @@ -565,9 +565,14 @@ defined(CONFIG_AUTOFDO_CLANG) > > > > __unlikely_text_start =3D .; = \ > > > > *(.text.unlikely .text.unlikely.*) = \ > > > > __unlikely_text_end =3D .; > > > > +#define TEXT_SPLIT = \ > > > > + __split_text_start =3D .; = \ > > > > + *(.text.split .text.split.[0-9a-zA-Z_]*) = \ > > > > + __split_text_end =3D .; > > > > #else > > > > #define TEXT_HOT *(.text.hot .text.hot.*) > > > > #define TEXT_UNLIKELY *(.text.unlikely .text.unlikely.*) > > > > +#define TEXT_SPLIT > > > > #endif > > > > > > > > > Why conditional? > > > > The condition is to ensure that we don't change the default kernel > > build by any means. > > The new code will introduce a few new symbols. > > > Same. > > Adding two __split_text_start and __split_text_end markers > do not affect anything. It just increases the kallsyms table slightly. > > You can do it unconditionally. Got it. > > > > > > > > > > > > > > Where are __unlikely_text_start and __unlikely_text_end used? > > > > These new symbols are currently unreferenced within the kernel source t= ree. > > However, they provide a valuable means of identifying hot and cold > > sections of text, > > and how large they are. I think they are useful information. > > > Should be explained in the commit description. Will explain the commit message. > > > > -- > Best Regards > Masahiro Yamada