public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Feng Tang <feng.tang@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@intel.com>,
	"H . Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Denys Vlasenko <dvlasenk@redhat.com>
Subject: Re: [PATCH v2] x86, vmlinux.lds: Add debug option to force all data sections aligned
Date: Mon, 25 Apr 2022 09:53:35 +0200	[thread overview]
Message-ID: <20220425075335.GZ2731@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220424122533.27590-1-feng.tang@intel.com>

On Sun, Apr 24, 2022 at 08:25:33PM +0800, Feng Tang wrote:

> diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
> index d3a6f74a94bd..7b8cfe9717f2 100644
> --- a/arch/x86/Kconfig.debug
> +++ b/arch/x86/Kconfig.debug
> @@ -225,6 +225,19 @@ config PUNIT_ATOM_DEBUG
>  	  The current power state can be read from
>  	  /sys/kernel/debug/punit_atom/dev_power_state
> 
> +config DEBUG_FORCE_DATA_SECTION_ALIGNED
> +	bool "Force all data sections to be THREAD_SIZE aligned"

s/THREAD_SIZE/PAGE_SIZE/ as that seems to be what the actual patch does.

> +	depends on EXPERT && !DYNAMIC_DEBUG
> +	help
> +	  There are cases that a commit from one kernel domain changes
> +	  data sections' alignment of other domains, as they are all
> +	  linked together compactly, and cause magic performance bump
> +	  (regression or improvement), which is hard to debug. Enable
> +	  this option will help to verify if the bump is caused by
> +	  data alignment changes.
> +
> +	  It is mainly for debug and performance tuning use.
> +
>  choice
>  	prompt "Choose kernel unwinder"
>  	default UNWINDER_ORC if X86_64
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index 7fda7f27e762..6add703de45f 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -155,7 +155,17 @@ SECTIONS
>  	X86_ALIGN_RODATA_END
> 
>  	/* Data */
> -	.data : AT(ADDR(.data) - LOAD_OFFSET) {
> +	.data : AT(ADDR(.data) - LOAD_OFFSET)
> +#ifdef CONFIG_DEBUG_FORCE_DATA_SECTION_ALIGNED
> +	/*
> +	 * In theroy, THREAD_SIZE as the biggest alignment of below sections

I think the more common spelling is: 'theory' :-)

> +	 * should be picked, but since upper 'X86_ALIGN_RODATA_END' can
> +	 * ganrantees the alignment of 'INIT_TASK_DATA', PAGE_SIZE is picked
> +	 * instead to reduce size of kernel binary
> +	 */
> +	SUBALIGN(PAGE_SIZE)
> +#endif
> +	{
>  		/* Start of data section */
>  		_sdata = .;
> 
> --
> 2.27.0
> 

  reply	other threads:[~2022-04-25  7:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-24 12:25 [PATCH v2] x86, vmlinux.lds: Add debug option to force all data sections aligned Feng Tang
2022-04-25  7:53 ` Peter Zijlstra [this message]
2022-04-25  8:01   ` Feng Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220425075335.GZ2731@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=dvlasenk@redhat.com \
    --cc=feng.tang@intel.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox