From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1j7jpU-0001Nf-72 for linux-um@lists.infradead.org; Fri, 28 Feb 2020 17:53:41 +0000 Received: by mail-qk1-x741.google.com with SMTP id q18so3760095qki.10 for ; Fri, 28 Feb 2020 09:53:37 -0800 (PST) MIME-Version: 1.0 References: <20200228012036.15682-1-brendanhiggins@google.com> <20200228012036.15682-2-brendanhiggins@google.com> In-Reply-To: From: Iurii Zaikin Date: Fri, 28 Feb 2020 09:53:00 -0800 Message-ID: Subject: Re: [PATCH v3 1/7] vmlinux.lds.h: add linker section for KUnit test suites List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: Brendan Higgins Cc: linux-arch@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , Kees Cook , Arnd Bergmann , Greg KH , Stephen Boyd , Richard Weinberger , Jeff Dike , "open list:DOCUMENTATION" , linux-um , Frank Rowand , rppt@linux.ibm.com, Logan Gunthorpe , Luis Chamberlain , David Gow , Shuah Khan , Andrew Morton , KUnit Development , Alan Maguire , Linux Kernel Mailing List , Anton Ivanov We went with this alignment precisely because it's the largest that any supported arch may possibly need. The problem as I understood it was that the compiler, seeing a bunch of pointers decided to put them at the memory-access efficient alignment rather than at the section start. Remember that the section start used to be unaligned for some reason. Note that the alignment that is a multiple of smaller alignment is still aligned wrt the smaller alignment, so the compiler shouldn't need to put the pointers elsewhere. I wonder if there's a more robust way of forcing the compiler to put the pointers right at the section start and insert no gaps between them than playing with alignment. On Thu, Feb 27, 2020 at 11:22 PM Brendan Higgins wrote: > > On Thu, Feb 27, 2020 at 5:20 PM Brendan Higgins > wrote: > > > > Add a linker section where KUnit can put references to its test suites. > > This patch is the first step in transitioning to dispatching all KUnit > > tests from a centralized executor rather than having each as its own > > separate late_initcall. > > > > Co-developed-by: Iurii Zaikin > > Signed-off-by: Iurii Zaikin > > Signed-off-by: Brendan Higgins > > Reviewed-by: Stephen Boyd > > --- > > include/asm-generic/vmlinux.lds.h | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h > > index e00f41aa8ec4f..99a866f49cb3d 100644 > > --- a/include/asm-generic/vmlinux.lds.h > > +++ b/include/asm-generic/vmlinux.lds.h > > @@ -856,6 +856,13 @@ > > KEEP(*(.con_initcall.init)) \ > > __con_initcall_end = .; > > > > +/* Alignment must be consistent with (kunit_suite *) in include/kunit/test.h */ > > +#define KUNIT_TEST_SUITES \ > > + . = ALIGN(8); \ > > After posting this, I saw I had gotten an email from 0day[1]. After > some investigation, I discovered that this 8 byte alignment works for > x86 64 bit fine, but only *sometimes* for 32 bit. 4 byte alignment > seems to work in all cases (so far). I am not sure why we went with > such a large alignment in hindsight. In any case, I should have a > fixed revision out pretty soon. > > > + __kunit_suites_start = .; \ > > + KEEP(*(.kunit_test_suites)) \ > > + __kunit_suites_end = .; > > + > > #ifdef CONFIG_BLK_DEV_INITRD > > #define INIT_RAM_FS \ > > . = ALIGN(4); \ > > @@ -1024,6 +1031,7 @@ > > INIT_CALLS \ > > CON_INITCALL \ > > INIT_RAM_FS \ > > + KUNIT_TEST_SUITES \ > > } > > > > #define BSS_SECTION(sbss_align, bss_align, stop_align) \ > > -- > > [1] https://lists.01.org/hyperkitty/list/lkp@lists.01.org/thread/4I4UW4OAT63ETMIEUJQTOF3BFTMO6ROD/ _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um