Received: by 2002:a05:6512:3a82:0:0:0:0 with SMTP id q2csp541989lfu; Mon, 25 Apr 2022 04:21:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOv6ZS5PmSRC9zNkdvdn+u19GMr1FZFjqrvgSLLAkgodC0tWMV82ZZqkus0r8jEtkWV44P X-Received: by 2002:a17:907:7e9f:b0:6f3:888a:d064 with SMTP id qb31-20020a1709077e9f00b006f3888ad064mr6779543ejc.430.1650885694062; Mon, 25 Apr 2022 04:21:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650885694; cv=none; d=google.com; s=arc-20160816; b=LV6KRlC4klqS46TWpoYME0PXpwERX3/2H9LtU8IJ/qEzidW3BxysczF1bG2ZwcneZU v2AB2KtAaCOhyLxzGvOlGfqylk7eoMKA+iuu7Uusgc6aeybz1gVIzSVWuxXIytOLem67 QFjbHpo0dxvlTkmI2XJ/L0Pjc/ynbZplPalh4FprFvNWZTZ7ci0gV9bGIAMAqUtPedps INUjdFVj15eBRSNB5Ku2HIbZLCsCtubL8XqGavExzuu3UEpb4hv5RqIgB13sJP9PkFzI W0bFRvZxTkV3+rdPy3RejyZbvwWd0+KJfD5xoOv+6opdWP2WnygustHN8t7ReDSVRhAG Otmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GRc/u2VY9j2J1+X39lc63KFsRB/jvBEkfMYe0ddJlyg=; b=alctA4puU8qssxsr1Rq1wnpmxEvL0ELwgOFDd8/Xl9zSpST+8DR+t/fIWbSMGAE0dX r2GcT7F4XBqbLTHwhksZYlUCJ3UoruuU3CEpXjyS7OE8HSk12qN8E90FGhjln07UO9Fe rZBzMzkJUTtusyjBvFjzTF/UjoEyiSI0N+iXJ86+YD6ATn1N8yDm7X/YwkGev4aJlRVF SSs/IIcH4OqWTSJB489XCKXrbdpcgb5GSbO0yVqntl/VcJC3YaMDk3RMzY/zIXlbU1HA bpIA0jcRBcCu3KJNgKcj/YLohxR0RTtg4NwWZQ0HJHfhE7/9+qud9m8G1I8flwU/Jlb1 s4Ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=CiFWcvcs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a056402090c00b00423d5e26a5asi15082826edz.576.2022.04.25.04.21.06; Mon, 25 Apr 2022 04:21:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=CiFWcvcs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231446AbiDYH6r (ORCPT + 99 others); Mon, 25 Apr 2022 03:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234283AbiDYH5D (ORCPT ); Mon, 25 Apr 2022 03:57:03 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A203BCF5 for ; Mon, 25 Apr 2022 00:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=GRc/u2VY9j2J1+X39lc63KFsRB/jvBEkfMYe0ddJlyg=; b=CiFWcvcs+5lKGEQ3/31C2xjRMq GU/6NvG7ToDQgZTdsEwcJdhiANFRnxUGvDD0uOkC58W8oOH6ceAqIp4nFm+agX7WyviL9YEjC6ysc 41iRjMXAadNj9Tg3nBOA7f7yzZQr8LV3ZV3Exam11Xqz9/nmaC0LW8dNVPSUsi/NjuSuYiyXCXCbC ympNVeC6nMYONHt1sdHDfywIfhFp42EXzpX63e4Tu8Qei4EvyeJpTOiNc4N54uYjZ5z5GJzfInAV6 PUZR4xUky5sP/UxyiPJ20An9L8hgAh9w5KqhZblQQ1T8nbaNg1mrSDljCSbzY4DY/mdurOz+NXC7G 0TOchEew==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nitXO-008WQ7-FX; Mon, 25 Apr 2022 07:53:38 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id B1CF8986167; Mon, 25 Apr 2022 09:53:35 +0200 (CEST) Date: Mon, 25 Apr 2022 09:53:35 +0200 From: Peter Zijlstra To: Feng Tang Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H . Peter Anvin" , x86@kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , Denys Vlasenko Subject: Re: [PATCH v2] x86, vmlinux.lds: Add debug option to force all data sections aligned Message-ID: <20220425075335.GZ2731@worktop.programming.kicks-ass.net> References: <20220424122533.27590-1-feng.tang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220424122533.27590-1-feng.tang@intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >