From patchwork Mon Nov 14 11:42:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19729 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097390wru; Mon, 14 Nov 2022 03:46:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf72+pkWjcDGhZWwizdaEicHxIwrjxFJTk+asKLXFFQNCwpIWNN8StqlDeIluv5uF2szrPDa X-Received: by 2002:a17:906:f113:b0:78d:addf:67c1 with SMTP id gv19-20020a170906f11300b0078daddf67c1mr9883669ejb.272.1668426414263; Mon, 14 Nov 2022 03:46:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426414; cv=none; d=google.com; s=arc-20160816; b=q6rjLfFsdNYLGl4ugSEgJ88vWIXVAQd4m3mfYekFhWWQPHOJZVz1XwhhmO0wWPjYSB 8mrJzgVl8+tRQWVy5FJ+Brmh47PLnSSOSFuzdmReEUu4ifw7bhEoorr2TgUpuesUV9Y0 iy+gEn2vg67wDQhXYwWKiAd8LL8HiimMxh9ozQ3GlBnpqJpfAhlUT+ExZM9tR0IVRMna VjUCEwj/XhGMwQOlfep+VuY5p2Imq7oQlnwCFkOEze6Nu4PgJ1EV6ZphwG3SonIpSx95 cqKlAJHAP0xXR3XImhAiuec2Hgbh3w385FZ0m9GcFl0LeKLnZZgu+PHgJEo/XwWgN3P/ +wGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pwRtMTW/cMsNrwOaEJNRqcQwhfTo++nqYqURmvWraV4=; b=EMxRyfJou31R/vVgQE+iTCY5zYi0iOMiSNipGW+d0btksdwoW8x4JeqNuQ6puqE79h 2m5oYgFYWR42ruCmWTqQUbD0hcw+Gv4otD/g+4iAQgeu8UyE2GoZWk9MrMbhUlGY2oFX VYGKimO30G67y8bzoZepEAPQuqvPe7yFrrxxgCXrG0W6Ok7LU/Z9IxhyMN/Q6BR8Ux8J 565A//OQCPSagecjMH0yBlTdpd4n6FkVt92eqevWEz9jBKkOnhDx4PzO2ikV7WAXUASv lBHIs+3A+6X0RmClsuHzEpwTR33OZdcVfrrv7OU84An6PQwh/w1XLUzK+IVaDO67dK2R murw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X+HiDymi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ba15-20020a0564021acf00b0045fd458991fsi8085976edb.428.2022.11.14.03.46.30; Mon, 14 Nov 2022 03:46:54 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=X+HiDymi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236320AbiKNLoE (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236427AbiKNLoB (ORCPT ); Mon, 14 Nov 2022 06:44:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05EA317079 for ; Mon, 14 Nov 2022 03:44:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9867D61029 for ; Mon, 14 Nov 2022 11:44:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15CD5C4314F; Mon, 14 Nov 2022 11:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426240; bh=fqd76LHS4zm9yigkSD8GcXuhYRdtL6d9jVg6IEleNpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X+HiDymiRneMmutFCHHvvrzFAnxG9Dq0+mCVxsufGjfUTGM/YEFWmQkgjxDWf1mL6 ShTjzuG7e9ij94oNB8sexozmUuT8PeNan6720Nwi3Zrf9bY/g3p+aITf2OEv0IBwBR ninnop3pWqIQ1ZcNpA+PrmSMAY4lx9rE3hIPHzl4zfWhsQ2Rnt9EL3OJXqef9aut72 V/YMZP1R0ltq3rg9sJABcAgRfxwQA+UhVteLabRAlscyHksSeRVfxVNa/Xu6zy+6vr jKv25Vh7nS+lZp8KqvAbUdVw/M3iorTIGV0Ch4ydgD6tULMsb1fh7DXvMF9gmuNvhF UwqHB7wWMMNWg== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Alexander Lobakin , Jiri Slaby Subject: [PATCH 01/46] x86/boot: robustify calling startup_{32,64}() from the decompressor code Date: Mon, 14 Nov 2022 12:42:59 +0100 Message-Id: <20221114114344.18650-2-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471895815220562?= X-GMAIL-MSGID: =?utf-8?q?1749471895815220562?= From: Alexander Lobakin After commit ce697ccee1a8 ("kbuild: remove head-y syntax"), I started digging whether x86 is ready for removing this old cruft. Removing its objects from the list makes the kernel unbootable. This applies only to bzImage, vmlinux still works correctly. The reason is that with no strict object order determined by the linker arguments, not the linker script, startup_64 can be placed not right at the beginning of the kernel. Here's vmlinux.map's beginning before removing: ffffffff81000000 vmlinux.o:(.head.text) ffffffff81000000 startup_64 ffffffff81000070 secondary_startup_64 ffffffff81000075 secondary_startup_64_no_verify ffffffff81000160 verify_cpu and after: ffffffff81000000 vmlinux.o:(.head.text) ffffffff81000000 pvh_start_xen ffffffff81000080 startup_64 ffffffff810000f0 secondary_startup_64 ffffffff810000f5 secondary_startup_64_no_verify Not a problem itself, but the self-extractor code has the address of that function hardcoded the beginning, not looking onto the ELF header, which always contains the address of startup_{32,64}(). So, instead of doing an "act of blind faith", just take the address from the ELF header and extract a relative offset to the entry point. The decompressor function already returns a pointer to the beginning of the kernel to the Asm code, which then jumps to it, so add that offset to the return value. This doesn't change anything for now, but allows to resign from the "head object list" for x86 and makes sure valid Kbuild or any other improvements won't break anything here in general. Tested-by: Jiri Slaby Signed-off-by: Alexander Lobakin Reviewed-by: Jiri Slaby Signed-off-by: Jiri Slaby (SUSE) --- arch/x86/boot/compressed/head_32.S | 2 +- arch/x86/boot/compressed/head_64.S | 2 +- arch/x86/boot/compressed/misc.c | 16 ++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S index 3b354eb9516d..56f9847e208b 100644 --- a/arch/x86/boot/compressed/head_32.S +++ b/arch/x86/boot/compressed/head_32.S @@ -187,7 +187,7 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated) leal boot_heap@GOTOFF(%ebx), %eax pushl %eax /* heap area */ pushl %esi /* real mode pointer */ - call extract_kernel /* returns kernel location in %eax */ + call extract_kernel /* returns kernel entry point in %eax */ addl $24, %esp /* diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S index d33f060900d2..aeba5aa3d26c 100644 --- a/arch/x86/boot/compressed/head_64.S +++ b/arch/x86/boot/compressed/head_64.S @@ -593,7 +593,7 @@ SYM_FUNC_START_LOCAL_NOALIGN(.Lrelocated) movl input_len(%rip), %ecx /* input_len */ movq %rbp, %r8 /* output target address */ movl output_len(%rip), %r9d /* decompressed length, end of relocs */ - call extract_kernel /* returns kernel location in %rax */ + call extract_kernel /* returns kernel entry point in %rax */ popq %rsi /* diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index cf690d8712f4..2548d7fb243e 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -277,7 +277,7 @@ static inline void handle_relocations(void *output, unsigned long output_len, { } #endif -static void parse_elf(void *output) +static size_t parse_elf(void *output) { #ifdef CONFIG_X86_64 Elf64_Ehdr ehdr; @@ -287,16 +287,15 @@ static void parse_elf(void *output) Elf32_Phdr *phdrs, *phdr; #endif void *dest; + size_t off; int i; memcpy(&ehdr, output, sizeof(ehdr)); if (ehdr.e_ident[EI_MAG0] != ELFMAG0 || ehdr.e_ident[EI_MAG1] != ELFMAG1 || ehdr.e_ident[EI_MAG2] != ELFMAG2 || - ehdr.e_ident[EI_MAG3] != ELFMAG3) { + ehdr.e_ident[EI_MAG3] != ELFMAG3) error("Kernel is not a valid ELF file"); - return; - } debug_putstr("Parsing ELF... "); @@ -305,6 +304,7 @@ static void parse_elf(void *output) error("Failed to allocate space for phdrs"); memcpy(phdrs, output + ehdr.e_phoff, sizeof(*phdrs) * ehdr.e_phnum); + off = ehdr.e_entry - phdrs->p_paddr; for (i = 0; i < ehdr.e_phnum; i++) { phdr = &phdrs[i]; @@ -328,6 +328,8 @@ static void parse_elf(void *output) } free(phdrs); + + return off; } /* @@ -356,6 +358,7 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap, const unsigned long kernel_total_size = VO__end - VO__text; unsigned long virt_addr = LOAD_PHYSICAL_ADDR; unsigned long needed_size; + size_t off; /* Retain x86 boot parameters pointer passed from startup_32/64. */ boot_params = rmode; @@ -456,14 +459,15 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap, debug_putstr("\nDecompressing Linux... "); __decompress(input_data, input_len, NULL, NULL, output, output_len, NULL, error); - parse_elf(output); + off = parse_elf(output); + debug_putaddr(off); handle_relocations(output, output_len, virt_addr); debug_putstr("done.\nBooting the kernel.\n"); /* Disable exception handling before booting the kernel */ cleanup_exception_handling(); - return output; + return output + off; } void fortify_panic(const char *name) From patchwork Mon Nov 14 11:43:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19737 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097698wru; Mon, 14 Nov 2022 03:47:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6giyHxWwudEy2Ui+qjB9AQ+FHMC4jlaII3Fkp0I1XQybE63BV3KFTsvhUVuLWhXinN6HYl X-Received: by 2002:a17:906:a2d4:b0:7ac:db70:2f90 with SMTP id by20-20020a170906a2d400b007acdb702f90mr9773200ejb.297.1668426475106; Mon, 14 Nov 2022 03:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426475; cv=none; d=google.com; s=arc-20160816; b=wUgK//s86kgtnRL6MTWIa3cw7+mmcMw2Q0sq0VpJtZ1ppa0G5hEMbRSf8TPJcSRqKk pvklqH7KGGcVHZ9FnP7Y6nNq7AcAW4ugzhDcqZ1trjYiMXHqx1Sg/2+XWsnQ8ZJWgQ4D BLiqiIxRxZZVVzV4zmaysOvkDptiOIgoXVr6cHUpP+XUZXYL+RP3czDn6ElIcXBQ9M6l jZNJFTCw72nuMV0H+Z3CtLvl3gGdPYO1bYG1MQernOzEZneLYrR2aEpPflEu3cfetTld KG9p8ahA1nR6SXjaTRoPQvZ0RvODYmCOhoT0VcK5c/lCBdxUCsy8GKI66R9qTCZ0yEQO 5Xsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Ncp8sAKGG21enbcw3f5zdgqCv0BDEWlrT0sjYjf1gNM=; b=J6ycsFDl7lVOyrLuSICxVa1JL6b5XnD3pV3OUisqtgKNc3YquuzN4jDGtNGYGalWXw pgmCy7QgpSY6cCq+QxsBV8658fM51Nw7fFqNNRTV9ZNYFNmrICMqt3qFr0DHAZ8FL0T5 PORkQzj+uBrC7J70Otx/mlqMsx+VZCgjAXygv+lM6MuKdSw2EYDUpays5CdIMrFJVnz3 TTI0a+wN1RSnbpFOw5lpZX7Z7wOOvDPvuGg/snRjhCuevx0rES3wMBZMEycKNSKNPl9x Yo0empKHHMxO062jMvWQ8Q0A6QTz2LZ5TIYaotqByCGahtatxh1VXek//CeHykjqyKlv ziVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PXOb2fLu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h1-20020a170906584100b007ae61d89b4bsi6526855ejs.283.2022.11.14.03.47.31; Mon, 14 Nov 2022 03:47:55 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=PXOb2fLu; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236477AbiKNLoH (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236453AbiKNLoF (ORCPT ); Mon, 14 Nov 2022 06:44:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD60615713 for ; Mon, 14 Nov 2022 03:44:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 656C6B80E72 for ; Mon, 14 Nov 2022 11:44:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6ABCFC433C1; Mon, 14 Nov 2022 11:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426242; bh=t+kVodx/FyufZNDsyZR/TwnYyg/ybb2UIRRgGwwP+eU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PXOb2fLuZw/2J8Qd9Ved8cY7hYxzzQuae6NEGFIpy9dPRy+cozgBPKXVlAB2uLWOy dXU04R/FNA0em0A0rfrKr4uL80Gcm8yAYgJUlUHpjUNFICoq+Sam/mPP/qN31VQ+ie 6yt+twlhe/DAmiD1WfWogfoTOcFMyKv2iZw5UoI8821X7FE6tsFPpUjDDqGDhRNFzm LjhsqrZEHZPdBviitzbEz5nw0VltGJ6e8HRBWmdl/J4c7ADc7wwtOzk5WFVTOPFC33 vBq2yv1AQkbHnqZrx6ES0Pc2Z542HkVxcds5k64rFEXIPkvduVn49AGCtvTkL4L++u d2RYjtNihgHRw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Jiri Slaby , Sedat Dilek , Masahiro Yamada , Michal Marek , Nick Desaulniers , Martin Liska Subject: [PATCH 02/46] kbuild: pass jobserver to cmd_ld_vmlinux.o Date: Mon, 14 Nov 2022 12:43:00 +0100 Message-Id: <20221114114344.18650-3-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471959813974450?= X-GMAIL-MSGID: =?utf-8?q?1749471959813974450?= From: Jiri Slaby Until the link-vmlinux.sh split (cf. the commit below), the linker was run with jobserver set in MAKEFLAGS. After the split, the command in Makefile.vmlinux_o is not prefixed by "+" anymore, so this information is lost. Restore it as linkers working in parallel (namely gcc LTO) make a use of it. Actually, they complain, if jobserver is not set: lto-wrapper: warning: jobserver is not available: '--jobserver-auth=' is not present in 'MAKEFLAGS' Fixes: 5d45950dfbb1 (kbuild: move vmlinux.o link to scripts/Makefile.vmlinux_o) Cc: Sedat Dilek Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: Martin Liska Signed-off-by: Jiri Slaby --- scripts/Makefile.vmlinux_o | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o index 0edfdb40364b..1c86895cfcf8 100644 --- a/scripts/Makefile.vmlinux_o +++ b/scripts/Makefile.vmlinux_o @@ -58,7 +58,7 @@ define rule_ld_vmlinux.o endef vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE - $(call if_changed_rule,ld_vmlinux.o) + +$(call if_changed_rule,ld_vmlinux.o) targets += vmlinux.o From patchwork Mon Nov 14 11:43:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097850wru; Mon, 14 Nov 2022 03:48:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf7FrlprS4FdIt3T3uLjJK/iSmB559myFunDPV/p+CwLjKF0FJRW5I2xoy6f8V2bWHdfBgOW X-Received: by 2002:a17:906:f88d:b0:7ad:a2e9:a48c with SMTP id lg13-20020a170906f88d00b007ada2e9a48cmr9834215ejb.77.1668426502216; Mon, 14 Nov 2022 03:48:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426502; cv=none; d=google.com; s=arc-20160816; b=hD/4uYNklnqmusR8H0dK8IjXPFzK+q0F6SF0+mKg6Ba881WM/+c8yfMzdqdOego9+W ajMAm/IuPNcUJGG4BHlkUii2LIm+2Qd7fBYOP1giy22/YyBTNjhbwauioTXZoDRFWsIG Gohv+Uzv6ZgDcCAAh/43L14XNqDnms5mBcZH0/RpYr0R+iPvRRJU9o11PPfbkG08gT27 h+z0Tebzq2wjIzVKwo/wvvRoE/D94kCKUoKQGjMvGRNJouLycfG+ZI+tgLSmc3lKPbit fkkoKYNnu4oiS4YiCNwWu3ZTWnB0VgotKrPgRqteuLKi2Ikqx6+OMd/jqhJDppHwZLtB h2eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fRF0XX79HqcioF8G2zx7vBak/qR43XEIHM134dW7RpM=; b=OXKlFZL//1BhMoewxE5//lwE5YhlrDeQjasH6xCD0H6aP4rNloS/F5m6nBqlyUOW6+ AliEES/goov3JfZ4Wz+MMTLIMBKK2mYRaLYIR/idUI1WcD5iv9MsZRQ+3p2+aVvVOoMD lpobVDvoxfNJIlS3xFwsYZE6BfsXPypytMXH+EcM7W0PBGWvze3ckdtItJ1ojBq+p9tz LG6nfgsXhD1VhL0yDA7pr9DCKu1uVkmsHL1uu2cngjswe4f6gcwTAH1roGRMOGy4sBv3 NACQBqEQCbD/HZP3BihbfoAh3K+SnDZL+LVBxrQpdkZciXnofZ7aopc7dGT7OrHwtQhC c1dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eSBrtsJN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cm25-20020a0564020c9900b004608b4f28b7si6895320edb.106.2022.11.14.03.47.58; Mon, 14 Nov 2022 03:48:22 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=eSBrtsJN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236630AbiKNLo1 (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236510AbiKNLoU (ORCPT ); Mon, 14 Nov 2022 06:44:20 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F74205DF for ; Mon, 14 Nov 2022 03:44:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 66D05CE0F83 for ; Mon, 14 Nov 2022 11:44:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B9D6C433D7; Mon, 14 Nov 2022 11:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426244; bh=S5+Vjw62CK/36i3RI1mn6pcWVLxg3IPGXbTDUNKDC2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eSBrtsJNbV7mx/uYXhf/OJyIsU9u7PgTvCICKkflE2XI2csPou0mZP7Pi27BYngn9 +yQx9p84YQVkeV7Ov/s01QLKfsFfahTQsDQbzIdMsMop8MFZ37BKq2I1lg0Q2la2UR 8YJIqjsObAn0uW8D74eFzf6niKzwFzhy2mQNkourORcLvu1WjeeLAk5RY+mF8tcc8t lEjiO/IRWRVqGj1jiEwiFShnpdDDy03imjUjm2l8IMlfpiWWDurGW6WIw44neWmXzs qXkTfIwc5OnZxBD5gFvDeZEXOI949yKpYX5O2+IO51+9DJ6W/zo0Kjxhll2D4eaMeT K8iHsI/vRsmkQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Martin Liska , Sedat Dilek , Masahiro Yamada , Michal Marek , Nick Desaulniers , Jiri Slaby Subject: [PATCH 03/46] kbuild: lto: preserve MAKEFLAGS for module linking Date: Mon, 14 Nov 2022 12:43:01 +0100 Message-Id: <20221114114344.18650-4-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471988221525457?= X-GMAIL-MSGID: =?utf-8?q?1749471988221525457?= From: Martin Liska Prefix cc_o_c and ld_multi_m commands in makefile in order to preserve access to jobserver. This is needed for gcc LTO at least (enabled in later patches in this series). Note that both commands can invoke the linker (ld_single_m in the former case). Fixes this warning: lto-wrapper: warning: jobserver is not available: ‘--jobserver-auth=’ is not present in ‘MAKEFLAGS’ Cc: Sedat Dilek Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Fixes: 5d45950dfbb1 (kbuild: move vmlinux.o link to scripts/Makefile.vmlinux_o) Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- scripts/Makefile.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 41f3602fc8de..564a20ce2667 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -247,7 +247,7 @@ endef # Built-in and composite module parts $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE - $(call if_changed_rule,cc_o_c) + +$(call if_changed_rule,cc_o_c) $(call cmd,force_checksrc) # To make this rule robust against "Argument list too long" error, @@ -457,7 +457,7 @@ endef $(multi-obj-m): objtool-enabled := $(delay-objtool) $(multi-obj-m): part-of-module := y $(multi-obj-m): %.o: %.mod FORCE - $(call if_changed_rule,ld_multi_m) + +$(call if_changed_rule,ld_multi_m) $(call multi_depend, $(multi-obj-m), .o, -objs -y -m) # Add intermediate targets: From patchwork Mon Nov 14 11:43:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19736 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097696wru; Mon, 14 Nov 2022 03:47:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Qtu3XtNFLpUzV0hyR+J8tKsDQ337S/tYptuwA7lGuZWI9XxM/Tlzox+PxZ2pFBrYJ4Vc9 X-Received: by 2002:a17:906:3c14:b0:7ae:c9d4:7073 with SMTP id h20-20020a1709063c1400b007aec9d47073mr9418049ejg.711.1668426474840; Mon, 14 Nov 2022 03:47:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426474; cv=none; d=google.com; s=arc-20160816; b=V7AymUk8JMfUIeYzZVhifX2tG1P1/R6kOQqR8tvTvuK0YPt0KqP38gch/3HfCPmcvC UfCdXLpAmazBjlIoBfC/rHh+HKNve3zNlpTtsvSqXX8/WVMZxexc7IHPx57m95stPF5G Bdvhz/Y1MqKOQoH9sgONYso+kmiDhVQlNivMaCRmbzH4Vty3EUv7eOF3KtXJZ2IsBLdA JSePIr7p5U9G22Va6FkeY8yW44v8UbGNTfqunTfocoOKrmEzKQc7xipLv7hl3j1htKC1 k4BKH1jSthRc9KP9mSw8Hc7/VyoTBrOZZ6xMZoXpAKf3hot6Yi8uSRygHlUR6oBP525b fWkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WTDOweGU4aet5fsFYBmH+tq2jJgsZIj5FRrMM1R4Qnk=; b=0DBim3KzefARk3zVxKgUlvOKRjRCdj+YyzCTa6k2EpZ2UeEmVxreHIZWdwep798/JR vbCNqtOngxJ6DfgoKw6YjpMYbtm++SeLJoT3QbgcTLY5lONJEPRl76VKTJEw5sBxehY8 SB8edOLK4Z/4IxpF6s87DA2nG7jOhTr1I1Q/ulTt4T9cSQ/fNCZ1gcnQd+y+tASlQUsu at0RX4OlnNjXiLvADXzrprCKVh/Fmid85V1R1mbBGXNe2NeljugsyqJTjMRKh9+/+Zpm ATMzbkDhxiPRzMUdxXM7rZS8BNJkyvarbGtI2BC2s553npwrg8HnHOADigPkKbNSYiGn p8kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gcb0VhWK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k15-20020a50ce4f000000b0045d5cf18d4bsi7488930edj.583.2022.11.14.03.47.31; Mon, 14 Nov 2022 03:47:54 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Gcb0VhWK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236503AbiKNLoW (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236464AbiKNLoH (ORCPT ); Mon, 14 Nov 2022 06:44:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9963C1570A for ; Mon, 14 Nov 2022 03:44:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 35E4461029 for ; Mon, 14 Nov 2022 11:44:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 891A3C433C1; Mon, 14 Nov 2022 11:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426245; bh=/bPckjdOvaLL9aYvpMmz9nRldK/d5QG2/4Y6OavRec0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gcb0VhWKCt/rxScfhWiVX2zbIqOoDNuBGwnZITiBSXj3+tR6NlcaR/m4+URYXcqMJ s642tIz5alNfcOpJ0C/ELdyJEhT+nX64teeD/LtSyD7ePpsrExKkdt/YI9C3NfsBSc BzWk8i5kc31SotvFZZTIfE/VMK6URsbWVEgpSS06xhe1J4tVNywoOjRgEJhwprz/No m5CfY4XAm7qrakrw59iD+BRedBO3DWBHqibzakvPvRNzGj54WyuL9au6+vRgXAwUq6 c96wd6J89lijmExSkF7PHu4/33ZirEUQCGcR0/JD2qMjgEYFf4CRlg/XAoLCbpx1QM E5qhr5gmBhK5A== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Jiri Slaby , kernel test robot , Martin Liska Subject: [PATCH 04/46] compiler.h: introduce __visible_on_lto Date: Mon, 14 Nov 2022 12:43:02 +0100 Message-Id: <20221114114344.18650-5-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471959147823620?= X-GMAIL-MSGID: =?utf-8?q?1749471959147823620?= From: Jiri Slaby __visible_on_lto is defined as "__visible" when gcc LTO is turned on (see later patches), and "static" otherwise. It is needed for top-level symbols which are referenced in assembly. It is because the assembly and the symbol can each end up in a different file with gcc LTO. And that leads to linker errors. So the symbols have to be visible when gcc LTO is in charge. On the contrary, they have to be static on non-gcc-LTO builds. Otherwise a warning about missing declaration occurs. Reported-by: kernel test robot Cc: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/compiler.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 973a1bfd7ef5..2305a3cbe99c 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -133,6 +133,12 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, #define __annotate_jump_table #endif /* CONFIG_OBJTOOL */ +#ifdef CONFIG_LTO_GCC +# define __visible_on_lto __visible +#else +# define __visible_on_lto static +#endif + #ifndef unreachable # define unreachable() do { \ annotate_unreachable(); \ From patchwork Mon Nov 14 11:43:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19731 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097417wru; Mon, 14 Nov 2022 03:47:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf6duBkiQwYengceJx94vFxpXnCYkYZVsdThBLBXXF9GqtN8UtxnhFcLGlhRIawdxtpNuJC/ X-Received: by 2002:a17:906:c7c8:b0:78d:e7c0:a2b with SMTP id dc8-20020a170906c7c800b0078de7c00a2bmr10068354ejb.273.1668426421403; Mon, 14 Nov 2022 03:47:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426421; cv=none; d=google.com; s=arc-20160816; b=xVgonshGByfQkDECS27yJjlblqa6utdNSgxJzxlwrYsbVt6JzqhK7E25M1VXpAtSba FdXCzEeJWnDFcEYbTV/0tNvck/am6EgGlxHS+jBFkqcmIYCd8RhiYZxpSK6j1vvslmHg ZLSNKcHU8A2Nd2WaUE5BHrkcHImh7/Eqk93fX4RF/8X3gNOFCXr1cfbFiWXaGCgXnLIE cLPQ5Ov+Gu9IClvFWOA/OcyO8cwpYzLPmAzScIYclDSfl9u7lv4mKkf/sp3htqAVEz+u +2WrrwU4crgp8VPHWqqZSrAM0xVlt6fMO/FYIPMwl/MD1HCGkNnfEt+LpUiR8uCrl/4I xy5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ELkyRF6TGPqmn4G6ouWytUXn7gtIL1VB9fkRYURslh4=; b=XnBUO7SwcxVmVeIboGuNxDpvpkb7OerUctYSO3tjqy5nNl/I/c1bfAbNKwPGwAzo71 tj7+ISjePlD5e5Zhat8QWeM1VjTa0/uSwFHhHDYTwFcEB6gBBp5K7vv7iuwQta0xQof7 CQNpzNhOzmr1SpxPwbzDPY1oODnLVynDJ51MBQAMyc8dkMvUEdSPl4f8abdrLS7/Dl5q p/JkFqOr3/GqQm1Ah/ud50HsD+kRv5MNB6+I4moFaRRIpKD9dL3NXZ71bIJqfs4GMU3H 7g0YXNs47P76R4gN5RsXdk63XeFrkkzhN33IPXnXeyMqIetzLzDXqeN/TkXnfSiItr9T Nr/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DK4Z5dms; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp34-20020a1709071b2200b007adb868f102si9973669ejc.476.2022.11.14.03.46.37; Mon, 14 Nov 2022 03:47:01 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=DK4Z5dms; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236627AbiKNLoZ (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236489AbiKNLoT (ORCPT ); Mon, 14 Nov 2022 06:44:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA701F2E0 for ; Mon, 14 Nov 2022 03:44:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C556B80E76 for ; Mon, 14 Nov 2022 11:44:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13334C433B5; Mon, 14 Nov 2022 11:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426246; bh=Kzg4cZoweNmjL16Z27jdyhSbNXbJfBWwbmh5FgksE4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DK4Z5dmsCCFNhlyXArZQesbHiS2bgahYRLOSN31NemV/F4+JLy9FW61lL3aPTJU08 ztNEYSFk/h8nQTukpozOw1OJA6azx2QRns8q64k0//yv3tIfJI2Dr5mPh4E/EM9DW4 EE67HZn5MhxxKJR6NjSVwNc6xIb0cZPO94fgAHh+rZxb42s2wM5ThzjPZ2f2cqvIzq RVpYj8edO6P6Ybl9IEzWG3R+delTThTe0Nap4N9Jbf3WCwHKnnO4+cDefEltib9TJo 1klr2NSQpW/v73V7ETanqEBpbiRJoxampbh8Emrhbm6XPccRBXc3I07Bj4mvoCx+9b 3DvXEcgM20hGQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Jiri Slaby , Martin Liska Subject: [PATCH 05/46] compiler.h: introduce __global_on_lto Date: Mon, 14 Nov 2022 12:43:03 +0100 Message-Id: <20221114114344.18650-6-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471903278994630?= X-GMAIL-MSGID: =?utf-8?q?1749471903278994630?= From: Jiri Slaby __global_on_lto is defined as "globl" when gcc LTO is turned on (see later patches), and "local" otherwise. It is needed for top-level symbols which are referenced in assembly. It is because the assembly and the symbol can each end up in a different file with gcc LTO. And that leads to linker errors. So the symbols have to be global when gcc LTO is in charge. On the contrary, they can remain local on non-gcc-LTO builds. Cc: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/compiler.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 2305a3cbe99c..16e4c1de14c4 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -135,8 +135,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, #ifdef CONFIG_LTO_GCC # define __visible_on_lto __visible +# define __global_on_lto "globl" #else # define __visible_on_lto static +# define __global_on_lto "local" #endif #ifndef unreachable From patchwork Mon Nov 14 11:43:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19730 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097414wru; Mon, 14 Nov 2022 03:47:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf7MxYt0lndaoUE70CFfG0EC6aWcx82KJ6JLhqhuok0BmSe9YIEAB0zbxmwuc+AN/iqA79ah X-Received: by 2002:a17:902:c651:b0:187:3bc8:fc56 with SMTP id s17-20020a170902c65100b001873bc8fc56mr13004738pls.83.1668426420554; Mon, 14 Nov 2022 03:47:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426420; cv=none; d=google.com; s=arc-20160816; b=EqEFd3VIt8j8Lx1zjwdDFb8tV706gTyUMMH9Ft4Uk3xr7LViL6RY3dh2P1xB/ZzCjl 6GOeHG8a0xIl9cWUlf0VkOZqCsO+KA+RLhhoPaW31MfQBdOiRctXmUui9hxckAZnQZeA UnRC8NWYs98nUVCNcCQa4pnzG60Byy+npUNAH7zEA2F3a1mCqaBAPcHWNlaUmqsJ4mYQ wYrB7qUT05TqASYFN6LdSzpuesZb56Ud6W40CZZq+R6T51BGpFCPdNydAuLNNFYLQSvp RB3qND6QTJm+YWgvj8rctTbYkbnqV6h25F/HwaS66A2SO7AKGEtVicckPtk+xGOv+Z08 F7Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0sl3DtyrwtbE2n1SlanHpQ8r6NCycAWWitRpjr2y/TY=; b=phi1tEkoHPAX2UTpha8+H1r6X5qOhpp1eDy4XMJJ6VOjW+gJY+yda+OVX/IKyxTocv /XS0DGi03+0na7N4wUcj9atz1wI3E0yL0NfZsoPn4bb5qBs6MNcB+7B0s2MIlojRHBTP EJiGGD6SRswHsJ6thgJh/V3Adgp+xiTaakYBWtTq2ANIjV5s9gCDkrmcSqswncf3jff/ 3T5nZvKQjUPUObG9XG82an0ucUkJ1wJ4JBtlbNxpZt/1U5C/reZCvFXDPATYVAy+c9H0 K/izksEyuOBgMxKS261kgBnXCQ3o2gNAPsEIBysHOrF3+qoR3H8rbimavuNRD9FHYYyK bUsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=H8yVQASE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t33-20020a056a0013a100b00571ae24c5a0si9499654pfg.146.2022.11.14.03.46.47; Mon, 14 Nov 2022 03:47:00 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=H8yVQASE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236579AbiKNLob (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236546AbiKNLoU (ORCPT ); Mon, 14 Nov 2022 06:44:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A58E20BF6 for ; Mon, 14 Nov 2022 03:44:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1DF7B80E71 for ; Mon, 14 Nov 2022 11:44:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65B2DC433D6; Mon, 14 Nov 2022 11:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426248; bh=Rea/9roCehb335b4DrtNyO/qn+jvaXcltDXAFPr/hzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H8yVQASEluCLaERJpcSWhON6r9oiDC8MsZ+Rt7B3r1AKkiAJ3QxkRhuNixXl+qo0v QdA7o5Dm2km8G9OuVEm3SVR12K62zYowYqplqlcgLLH0BRsvtpYFhmcIYioXbnfmdi waVVX09VuL1vSaewNv7dDS5csLa6iw7QztUYz3r6h5luKI9BtowSILSaeeJPBvDyIY KBlxDouQRMK0aqRAHNIwGTQZfSB5yoMgWhZzFpDoU4Ixv8CiyihQA8dcge//f+vPY9 /gtFJVPKbIyLp/SXFtg4S4/aiw/m0IXY2FdhsmilqJT+Js5owP+EX/IGNrCVtheuRF UJwMzbFhUsfQw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 06/46] Compiler Attributes, lto: introduce __noreorder Date: Mon, 14 Nov 2022 12:43:04 +0100 Message-Id: <20221114114344.18650-7-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471902045342747?= X-GMAIL-MSGID: =?utf-8?q?1749471902045342747?= From: Andi Kleen gcc 5 has a new no_reorder attribute that prevents top level reordering only for that symbol. So add a new __noreorder wrapper for the no_reorder attribute. This will be used in the next patches to support gcc LTO. [js] split this to introduction & use Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/compiler_attributes.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h index 898b3458b24a..be6c71fd5ebb 100644 --- a/include/linux/compiler_attributes.h +++ b/include/linux/compiler_attributes.h @@ -379,4 +379,14 @@ */ #define __fix_address noinline __noclone +/* + * https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes + */ + +#if __has_attribute(__no_reorder__) +#define __noreorder __attribute__((no_reorder)) +#else +#define __noreorder +#endif + #endif /* __LINUX_COMPILER_ATTRIBUTES_H */ From patchwork Mon Nov 14 11:43:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19732 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097427wru; Mon, 14 Nov 2022 03:47:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6EdaLYFZo1QMaNOviw+qenjoHXcq7MvC0BpTZ0EIJC7rFC0AH78YPkTxYKVJJcWQPKxDiP X-Received: by 2002:a65:6094:0:b0:458:6f51:ff7b with SMTP id t20-20020a656094000000b004586f51ff7bmr11473461pgu.153.1668426422882; Mon, 14 Nov 2022 03:47:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426422; cv=none; d=google.com; s=arc-20160816; b=xMu8JQuWqe204WKxS/0juzEctgx1WOZwmEZ7CEcnchxh+uJuEuHy4HPExPvA++qMHF OE4awsAuR030tnrRl4WBrKxShmW1OQjET9XtFEyL9WhUH8+NxrOKoC+3OKgDHi96d0dy 164U70xb61XJ0saOSIeb4FeKwgXWtsNRfav/GZxkRSNMvwHvNTaFPVcKB2KJiiWWTviW 72lIz8mGYnRS5W7I9Dsva8XPSd+6egbrlFcb2/lPC15wN7xQ5spQq8CmdEOkEXIVH6xg /mkLUixcimmvT39CdTymh4r2Km8ZtuEiUYm2/4RNFRwY4EGIDhfsn1uaStFX8FUc8uDr zx2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/C1rRht6cpUrGqbWw+Iz8rrX370K6XaYob5EjEQdAik=; b=v/5wb/kFEnjq3CnGi1z2WPi1S0J7e953VJYrV7OScKz2l9s9ZZRAPunZxE1wes7AbX 0lTIOVcW7qjdekGL+Td7V/4EzPeE/ja5ltkep1gkcckG+Uo/WsP9ZQd3AOevK7yTzzXw US+e7S9O2QLLU5CgeigeFhBd4qIRS6e0CV0gkCTbY6DGv/wBz4b/QgG1Mnflr9lPxFay j8ZB8FjXJSkfXtQmTLatjxpmiX4G3LuoRN76Sz386vSa+Ce2eCgn5z/a4YnE8eMtvn4R CUhcMVHsao1gQWuRtm7DuFdKi8N0urwOO2OVz1MqomEEnxXFY2eZesXfOMtZvf4BfXf/ J4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JsQd0SZ8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a1709026ac500b00174de06d92csi8542759plt.74.2022.11.14.03.46.49; Mon, 14 Nov 2022 03:47:02 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=JsQd0SZ8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236659AbiKNLoe (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236588AbiKNLoV (ORCPT ); Mon, 14 Nov 2022 06:44:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1DCA21244 for ; Mon, 14 Nov 2022 03:44:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78241B80E70 for ; Mon, 14 Nov 2022 11:44:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6323C433D7; Mon, 14 Nov 2022 11:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426250; bh=E3kz6aXy90ssypKzOgGT2am24tCg/w/PReJqhb9mnbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JsQd0SZ89H+7uMm60Tc7tgzG1ECnHpVa1m0rVKPMJwrQEil5TJFTb3j8QOczdAPMM NuHOLOE6InURkI0wviASS+aOoF2WuPyQj3KInhC6tHVQIRD03GSOtPRI75eawVMtJx xYDKTeF+gV/KeI1drOd0JIOky/k7ubR/oiMfWhQk2I5tGVQ1uUYslfqXky7YbFk0Ip WlIioBSrWtDHo46wCcdfJjsqnMdU4udcLBgneN3qlda/CZw+fu8zNENse9T8yOoGK0 n4sPxu3c6d/mL2n/ldgK/VCjvGJpTPm+QsFM6mSmNg8BuOqAyirBtjEHM5KZM5CoOw I1BEVn7weUpGw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Steven Rostedt , Martin Liska , Jiri Slaby Subject: [PATCH 07/46] tracepoint, lto: Mark static call functions as __visible Date: Mon, 14 Nov 2022 12:43:05 +0100 Message-Id: <20221114114344.18650-8-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471905153790088?= X-GMAIL-MSGID: =?utf-8?q?1749471905153790088?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark static call functions as __visible, namely tracepoints here. [js] unify the __visible placement Cc: Steven Rostedt Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/tracepoint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 4b33b95eb8be..1ce0655f0c9c 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -239,7 +239,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) * poking RCU a bit. */ #define __DECLARE_TRACE(name, proto, args, cond, data_proto) \ - extern int __traceiter_##name(data_proto); \ + extern __visible int __traceiter_##name(data_proto); \ DECLARE_STATIC_CALL(tp_func_##name, __traceiter_##name); \ extern struct tracepoint __tracepoint_##name; \ static inline void trace_##name(proto) \ @@ -306,7 +306,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) .unregfunc = _unreg, \ .funcs = NULL }; \ __TRACEPOINT_ENTRY(_name); \ - int __traceiter_##_name(void *__data, proto) \ + __visible int __traceiter_##_name(void *__data, proto) \ { \ struct tracepoint_func *it_func_ptr; \ void *it_func; \ From patchwork Mon Nov 14 11:43:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19733 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097480wru; Mon, 14 Nov 2022 03:47:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4MQDxIme5fLOO3bXFr3IKZPDI8+WXow/cpJcwHBt1kN8Y3H7wPUBzEFUrT1TPp+9+uiqpH X-Received: by 2002:a17:906:8556:b0:7ad:e518:13fd with SMTP id h22-20020a170906855600b007ade51813fdmr9832389ejy.323.1668426434545; Mon, 14 Nov 2022 03:47:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426434; cv=none; d=google.com; s=arc-20160816; b=fngdi0j8Bkr5aBS0jlF68Cb+9cNyREkHNo8c4qQTpdH7PPZe3RVBHvtLNoXQXNlxbk fr1H5RNIHCfqVS0TAj7eJlNosXe5fJkTEnqmZ3Sr3edUCi4FnlriMQPVNT6hiOPJ+QWo Tg5dA0he+NVoo55w+Gh1XK3vkFIN5rj+X73EhsMfKbprWBk+jU2cDeZeLv1Z62S/Mqg6 EBFxJHtbuuxsSg4XeyjBjlOOc4rdfBThHgZ7/77VOIWA6ukxSbTAskI4ABu7IBCQhD4l OuUHn0br65x1tSkz3R7HQgX6NMsiHV/1gTqsHnnmJIXg5ZjD/JYjBmyrMg7IT44Sj6h3 /fkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1CxlOcKzQ0vxdHUvxkgIa7B/Q9F+YJOBlGe2kn/lJ7g=; b=CDlOEStMfF1nEh+IEiitUYv3jVXxifJpTzD9h91JY69h55EuuRKnrVVux0jBbPO3gV pUqfV9mJrs2GmghIKB0155rv/TB1toHV+tucXIWiLhEILW5cd8E1iwSdljF1aVb1sx6c S/MgsbMaRqWcazwil4Ka2/sbLkuRqSCw0/uPHxNJSxAbi0Kp4pn593GUhHmy7IOqg9T4 LqBKwYdVTnMKtsobk+F9yClICrJ2akgWWMkxU+n5rdh98A0MA8G9Re6y+rjXl5dnSVAs 0/79iOwqKNLQIy9yY+E2/nKpJn8jzhbJTK1Ktu6Mu7sutoYlHorfLQlOoye5797PfuEE nfww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SihAYQgv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw6-20020a170906478600b007ada03062e9si9657709ejc.415.2022.11.14.03.46.51; Mon, 14 Nov 2022 03:47:14 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=SihAYQgv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236520AbiKNLor (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236609AbiKNLoX (ORCPT ); Mon, 14 Nov 2022 06:44:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9408521805 for ; Mon, 14 Nov 2022 03:44:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3008361046 for ; Mon, 14 Nov 2022 11:44:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F554C433D6; Mon, 14 Nov 2022 11:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426252; bh=S8zV5neWzdzrlGujgojwhqUti56G0WJU8dL7d971SiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SihAYQgv52omW1PHZ7cmu4VDkPbbFO0lMbLv/yfk8erdeDjAQyjrBr3yGTTwox7IF Ez9f5u2OzS1qjPZx2X4xADHcbceCYo8rGgROF9gCcRzQEhv9EypZxQ6bU4rBaFwd75 HlCpTRlUj3Mi4Y6o/m1lQWqlhCJiPGjKyyDG0opL7PI3mksDmV+Lg1p6F/PELxh62b n70ERWMmGlZ8Gif7c+RgN3L4z/OXk41zToHMprzJX4ncClKV1QV3+ZLkKp0Apa4x3+ 9v1G3ZTOrimok0l0MzFd/dh2NaoW7PY5Md7wnJQYAq8Y1azQg0B3p2vfVrJ+Wd48RS EEDp7zxbepynw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Martin Liska , Jiri Slaby Subject: [PATCH 08/46] static_call, lto: Mark static keys as __visible Date: Mon, 14 Nov 2022 12:43:06 +0100 Message-Id: <20221114114344.18650-9-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471916772413037?= X-GMAIL-MSGID: =?utf-8?q?1749471916772413037?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark static call functions as __visible, namely static keys here. Cc: Peter Zijlstra Cc: Josh Poimboeuf Cc: Jason Baron Cc: Steven Rostedt Cc: Ard Biesheuvel Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/static_call.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/static_call.h b/include/linux/static_call.h index df53bed9d71f..e629ab0c4ca3 100644 --- a/include/linux/static_call.h +++ b/include/linux/static_call.h @@ -182,7 +182,7 @@ extern long __static_call_return0(void); #define DEFINE_STATIC_CALL(name, _func) \ DECLARE_STATIC_CALL(name, _func); \ - struct static_call_key STATIC_CALL_KEY(name) = { \ + __visible struct static_call_key STATIC_CALL_KEY(name) = { \ .func = _func, \ .type = 1, \ }; \ @@ -190,7 +190,7 @@ extern long __static_call_return0(void); #define DEFINE_STATIC_CALL_NULL(name, _func) \ DECLARE_STATIC_CALL(name, _func); \ - struct static_call_key STATIC_CALL_KEY(name) = { \ + __visible struct static_call_key STATIC_CALL_KEY(name) = { \ .func = NULL, \ .type = 1, \ }; \ @@ -198,7 +198,7 @@ extern long __static_call_return0(void); #define DEFINE_STATIC_CALL_RET0(name, _func) \ DECLARE_STATIC_CALL(name, _func); \ - struct static_call_key STATIC_CALL_KEY(name) = { \ + __visible struct static_call_key STATIC_CALL_KEY(name) = { \ .func = __static_call_return0, \ .type = 1, \ }; \ @@ -227,14 +227,14 @@ static inline int static_call_init(void) { return 0; } #define DEFINE_STATIC_CALL(name, _func) \ DECLARE_STATIC_CALL(name, _func); \ - struct static_call_key STATIC_CALL_KEY(name) = { \ + __visible struct static_call_key STATIC_CALL_KEY(name) = { \ .func = _func, \ }; \ ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func) #define DEFINE_STATIC_CALL_NULL(name, _func) \ DECLARE_STATIC_CALL(name, _func); \ - struct static_call_key STATIC_CALL_KEY(name) = { \ + __visible struct static_call_key STATIC_CALL_KEY(name) = { \ .func = NULL, \ }; \ ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name) @@ -288,7 +288,7 @@ static inline long __static_call_return0(void) #define __DEFINE_STATIC_CALL(name, _func, _func_init) \ DECLARE_STATIC_CALL(name, _func); \ - struct static_call_key STATIC_CALL_KEY(name) = { \ + __visible struct static_call_key STATIC_CALL_KEY(name) = { \ .func = _func_init, \ } From patchwork Mon Nov 14 11:43:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097638wru; Mon, 14 Nov 2022 03:47:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf5UHAFv65Bpnuvg6eHNjSXBIF5wiY7q1ZlxnBIjuCiEG9m5zbh5T8T3WvY9kB9mj9cWrba/ X-Received: by 2002:a17:903:1306:b0:186:85c3:98af with SMTP id iy6-20020a170903130600b0018685c398afmr13543480plb.101.1668426464353; Mon, 14 Nov 2022 03:47:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426464; cv=none; d=google.com; s=arc-20160816; b=uFKO8ONuE9XylzfxXzI7CZhoNXeS0T0y17jx0dPwfy6ttrSoNjIuI7wdKDgITNxwbo tN5/dPkOWpe54MSoPbfBkfvxf8h80+M0cF5rc2g4ySdXtCb/bKkL+tgBJgscSHPZ23Gv NJpIHHbFwzwgXmL7ye6KEANqHXfbaQYnVtlmkB7b4imDjqQPgp9yic5mt4kjiu6AxUsq srmZykqEWKnQ+ElzLa+epICWxeR4a7kf10yL/dqFhj02nhpuCDKJ3skuj12iK/72ZZBJ alxZX8Pi77OsB7UoYFBIhmIqPWZDn/LlYrULqICaS26RdpTkZHbD5ynkoT+sa6NA4aAl ms2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=G3dcUGrqFUNYr+g3SOOFTJ0AQSjhDA9a5VuVOPYNJ1A=; b=F0InZwVsvL0WOVzkQe54w+fIs7T2L6TD8Vj9sii4bNo16+mhypjiLlDazLda2qnl5K 1qVqgqHQ/LZFNS4onCt0Vvl2csGxID0ZMdfb+OMmz7svEET4cSELzxWfFvYnCv0qtJ4/ +Ahvez7oFdDD0jXioSqOPeZMloda3uQkbVpBueE9oTB4AImGgybDZrJOTg0Ce7cIDvKy 1XzjrmFI+hthWCI4Qw/WzJc+m30BUTvE771De9JNTtp0LIW9zjk6pMVjAZWOBB9o36Ha iuTca3YQAD/eDeIBU8mHnH/h7KFMQYXKbXT2cby2G63hmv4G6ISWTOVoXT0xFFQBAoRH B4yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="pQCj9Bl/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a17090322ca00b00186e114bedfsi10690518plg.126.2022.11.14.03.47.31; Mon, 14 Nov 2022 03:47:44 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="pQCj9Bl/"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236453AbiKNLo5 (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236634AbiKNLo3 (ORCPT ); Mon, 14 Nov 2022 06:44:29 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DB09F59C for ; Mon, 14 Nov 2022 03:44:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5E980B80E6C for ; Mon, 14 Nov 2022 11:44:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A04BC433C1; Mon, 14 Nov 2022 11:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426255; bh=b5Apr9ljbPWXptKX2Y7oDbgatIEtz07LMj4Vds3jeiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pQCj9Bl/KCEzOwGmBs7/yB++JsW34aqew8j6gYUQ5Kt736lR1XZqCE8OHv/HBtIqm +Hylb+ZnLUG8vo+93hauKmemG/BIuRN9R8oG15YbQ6Y0tW7gQbwKVr4ch0Ps6rC+WS 6N6tqZBRzgDyQEZ+DQMlBam1XDYzFf0h2RrfputJVlpXjFsVsPau0r7kJL158UCmeE 2OJ0Iz0OWPYpfKqqnErjLr1tOfG5a9hlIcDGpwUpmN7YLxuwVYH1/X+oYuXda40NWF DK50WjQLbBBP3Wl9U5Sn1fNthDyc1ptIdhp79x2liWt9Tr5DCqZ501qDHuPRPDSi2G uNg9OxmKfTRtQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Martin Liska , Jiri Slaby Subject: [PATCH 09/46] static_call, lto: Mark static_call_return0() as __visible Date: Mon, 14 Nov 2022 12:43:07 +0100 Message-Id: <20221114114344.18650-10-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471948259783943?= X-GMAIL-MSGID: =?utf-8?q?1749471948259783943?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark static_call_return0() as __visible. Cc: Peter Zijlstra Cc: Josh Poimboeuf Cc: Jason Baron Cc: Steven Rostedt Cc: Ard Biesheuvel Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- kernel/static_call.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/static_call.c b/kernel/static_call.c index e9c3e69f3837..9197fe86d8bd 100644 --- a/kernel/static_call.c +++ b/kernel/static_call.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include -long __static_call_return0(void) +__visible long __static_call_return0(void) { return 0; } From patchwork Mon Nov 14 11:43:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19734 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097509wru; Mon, 14 Nov 2022 03:47:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf73j1hwlC5+D72Hr2PjDs330JkWZdf2oBl0fGvmNUixF9xNXcLu7eu7ABDfjmRJVGu352os X-Received: by 2002:a17:906:29d6:b0:7ad:b284:1357 with SMTP id y22-20020a17090629d600b007adb2841357mr10242153eje.149.1668426438903; Mon, 14 Nov 2022 03:47:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426438; cv=none; d=google.com; s=arc-20160816; b=IaqJLAZX0lci2FJ0jRbnHO0JP1JCg08UQxCvOO9wPeGEMgG7FYJabJvwKa5w+MImcB PfhQjVSHXyfOa9XDQTMzHEjO8W0Tg/EwQP8EhHzvC/Jk4wPDBii6GFbLgSg65qXCVHFi Rsli6rlurnmb2fEdfYS487pV/VV0z3uh+f0dYQzLFJtIpHOAJIY4Av6V2CKzgM+OM5GL QDG6xBu1RZaS5ZqDee6BKCvadHtmW5OgpfvYGTPkmqPm7TRGwrRNjWo9iopX8tGUX725 OuqxlWlbbiBH/aEnL5aHenZhbGKC/IIxdcHsD2qkUBF337HvkO6kVo3IMoXQNqzBnhhY s2XQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=l9itMAHWD+AmLhvdGvFlrmw7rsop1qK9OCe8z9z2xZQ=; b=wyfkmkb+IVrTFKbBU6qBOA46IjfpaiI4eSnj4Nb+KGviVS4ZS97VA19gnTLpt33KHY 89PbDwUeKNLoR9BU2qmmOh0VrliD/JzXlNT1JUibPePbNCD3Hu09Q3+If+ofEmOGCaFV l3yXp6NgkNh9R7ond11E+9t5/HuTVLawM/8xn+N9eXC3NzBrEU4OQifu3SF3H1nwEYFr YfMD6ZXUItGA8+P7c4GpmttKbt4cfYXOvLylGbQOQ1iWG7BYuRJnpzmalKZRFo4N2OVc iIOJKhSQRqP/SdxKvxIhqy08k6owhELmEWXVPCs+E98+wmMTiR2mkmZe7TfYMjUz8HGw ISMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NVMO3KRk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a056402430e00b004675aeea9c5si8091671edc.553.2022.11.14.03.46.55; Mon, 14 Nov 2022 03:47:18 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=NVMO3KRk; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236700AbiKNLoy (ORCPT + 99 others); Mon, 14 Nov 2022 06:44:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236626AbiKNLoZ (ORCPT ); Mon, 14 Nov 2022 06:44:25 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E87821807 for ; Mon, 14 Nov 2022 03:44:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 170CC6106D for ; Mon, 14 Nov 2022 11:44:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8743BC433D7; Mon, 14 Nov 2022 11:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426257; bh=rN/KT1Epf0fvqNeXEc1oWJfGIaRJw5s06AqXjEWOiHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NVMO3KRkZoQJ0VQ15+L8MX3UIZgB6LL180PhW7aAbxYsAXZOM3YZXmueMCaXNu3FE +tC8/fnpZwvQGQxMGr2LWQHorJ2d8P5C79kfc2FIlVi0md18cXDAZSyLuSvXEyQxcZ OaFpogWZTE0C+CdZ9ef90IfWCESKNhhnYrbRlQuYrRYCy5v3ggm2jwQ0eoXJ0m0AbP d+rNs7VkLxZwEjOfDXy6mJrLBxvZWtnM1gyERvo387/zZK/OcLiTH5DikylrNCXtgg fKxZsBnUGs90tFM0PiNwCscaye2ymTpjnLRT690iTuiLZDm7lcAw2CPEY1kV5jKzR/ JMxzRXbASSaEw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Martin Liska , Jiri Slaby Subject: [PATCH 10/46] static_call, lto: Mark func_a() as __visible_on_lto Date: Mon, 14 Nov 2022 12:43:08 +0100 Message-Id: <20221114114344.18650-11-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471921699286335?= X-GMAIL-MSGID: =?utf-8?q?1749471921699286335?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark func_a() as __visible_on_lto as it was static. [js] use __visible_on_lto Cc: Peter Zijlstra Cc: Josh Poimboeuf Cc: Jason Baron Cc: Steven Rostedt Cc: Ard Biesheuvel Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- kernel/static_call_inline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/static_call_inline.c b/kernel/static_call_inline.c index dc5665b62814..6933b4437597 100644 --- a/kernel/static_call_inline.c +++ b/kernel/static_call_inline.c @@ -501,7 +501,7 @@ early_initcall(static_call_init); #ifdef CONFIG_STATIC_CALL_SELFTEST -static int func_a(int x) +__visible_on_lto int sc_func_a(int x) { return x+1; } @@ -511,7 +511,7 @@ static int func_b(int x) return x+2; } -DEFINE_STATIC_CALL(sc_selftest, func_a); +DEFINE_STATIC_CALL(sc_selftest, sc_func_a); static struct static_call_data { int (*func)(int); @@ -520,7 +520,7 @@ static struct static_call_data { } static_call_data [] __initdata = { { NULL, 2, 3 }, { func_b, 2, 4 }, - { func_a, 2, 3 } + { sc_func_a, 2, 3 } }; static int __init test_static_call_init(void) From patchwork Mon Nov 14 11:43:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19739 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097701wru; Mon, 14 Nov 2022 03:47:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf55FQUzNnSvfMtyQSi+HuwGgkofxV8IzfHCgqjOr6TVQ0OYtuuUOatg56dk36ax8/7Q9zeq X-Received: by 2002:a17:906:a896:b0:7ab:afd4:d7ed with SMTP id ha22-20020a170906a89600b007abafd4d7edmr9817019ejb.228.1668426475443; Mon, 14 Nov 2022 03:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426475; cv=none; d=google.com; s=arc-20160816; b=PuDC7xqQhXSTOsj0Kz34u1hBPx3qFmw3zw2RuGisChyW6yKLiN61lfg8rZqFU0dqIB vWNlVkFvwrJEf7jckMzbmJ0D+fJQRb9kvCYjfE1VnIhHUI51IArK9pxaPRlCWYpEwKvh xGRsEbOMt1r1NJHQAd/CrHxNSGt6BmrQh3njdz6SgGS+ZEH0pUS5mqRMixL+YhRZGWCT T5IzXHRs723YHJrUIuN/nkHcOAd+6tbCgf5SUQrSBvuZVezABSw/tWKKwoWovyO9N+YV 5RBG6sMdAj2+MupJxW5NTQ3e97DOb5XgSDFxk0zPbzLcGDcW0WKw/lrAD2VbDa0pmGvk YXQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sO/Boqy8h96nAJpY/pijxc+R1C7C8zn75T+KfteTp0k=; b=Hdhbt6h/rtRryYzBL7lr7vA8nFKF7QJA2wntsIazLsLhdekyNZAlKpheNYLZPPzigm Gx+jUAT0oXF9X7wugaJHWfreoNzCPghrzf1/Mi1jHWjhSPUnuNOOvzYyNY5bZT9RPtfx okqbPYKPPcYlejnCD/zj+gKWSjsNnuJiwiKK6OO9PdN8o5GM2gwNL+6sMSmWCIOFmRip B3D9uCzTJHPi/cu/3jUaBKviu+j00NcqibgUWSYxgEoDY2n1qE8xOtEI1BLW7Winfc5C tPoqLE/7m4aLdmAwBhsU9KCjdMYeLDFxNJ8N7sRPkUKtGNdvZ8eOrJR/1j4I/S3SXeAL sW8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fPJIeLVK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q26-20020a50cc9a000000b0045c3f6adb7csi8266318edi.215.2022.11.14.03.47.31; Mon, 14 Nov 2022 03:47:55 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=fPJIeLVK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236444AbiKNLpD (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236642AbiKNLo3 (ORCPT ); Mon, 14 Nov 2022 06:44:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A42FA443 for ; Mon, 14 Nov 2022 03:44:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B278D61045 for ; Mon, 14 Nov 2022 11:44:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F37ABC433D6; Mon, 14 Nov 2022 11:44:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426260; bh=IHoKQKrRrTt+P5k/IAfDdtfWsTsoL9pAz/rh5KwFgsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fPJIeLVKEPphF5Jd/ZBtMLYLlwXq2jNC6yM/rnlSjD/oEDQPHp1ZE7kCqMJrdANgg OYx54IDoHISHcJxw3pc63Qs2tcOYxTtRHcTJ4W9F7HcoW5/trhw8vxeyyBHq+m/Pis eVp7HVYPXPjZu/8kvjDRf+wsLTPWpFOJXSIB9ygDzr+QGCKYC9YzaiJGp+oM9zBEML XaRGFyOztx/UxUgwt2iThXV+acWKlYmMWdcI+N5dtWuxNIMlKfJRSY9V6c/13B3Uj9 OBttxZPrsD3xy5aYX5kXeCwCk+/s7m658Lv3c+TMu6DYODrLIFZWoGZ5JMdKyP8xcJ WYpEU/+a4AW3w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 11/46] x86/alternative, lto: Mark int3_*() as global and __visible Date: Mon, 14 Nov 2022 12:43:09 +0100 Message-Id: <20221114114344.18650-12-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471959689196391?= X-GMAIL-MSGID: =?utf-8?q?1749471959689196391?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark int3_magic() and int3_selftest_ip() as global and __visible. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/kernel/alternative.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 5cadcea035e0..05e5eb9cbd51 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -823,11 +823,12 @@ extern struct paravirt_patch_site __start_parainstructions[], * convention such that we can 'call' it from assembly. */ -extern void int3_magic(unsigned int *ptr); /* defined in asm */ +extern __visible void int3_magic(unsigned int *ptr); /* defined in asm */ asm ( " .pushsection .init.text, \"ax\", @progbits\n" " .type int3_magic, @function\n" +" .globl int3_magic\n" "int3_magic:\n" ANNOTATE_NOENDBR " movl $1, (%" _ASM_ARG1 ")\n" @@ -836,7 +837,7 @@ asm ( " .popsection\n" ); -extern void int3_selftest_ip(void); /* defined in asm below */ +extern __visible void int3_selftest_ip(void); /* defined in asm below */ static int __init int3_exception_notify(struct notifier_block *self, unsigned long val, void *data) From patchwork Mon Nov 14 11:43:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19738 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097699wru; Mon, 14 Nov 2022 03:47:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6j8RFJX8QuDAIu6O6d3bPqNZ8F/cKTnPxCbw0cadkUcANXOuLd4KDYdm2i91+FVWiNTnLA X-Received: by 2002:a17:906:33da:b0:78d:b046:aaae with SMTP id w26-20020a17090633da00b0078db046aaaemr9593687eja.218.1668426475237; Mon, 14 Nov 2022 03:47:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426475; cv=none; d=google.com; s=arc-20160816; b=q4k+Xdj6mT85b2THe15ofIJGptr17surphKg58KV7IiNCUx3S1JzSlXzmNui2jOSSL vW7lf5sF7vriWJBrifrHSxe6JR4cF4oF90hxwA1jbfHw99DKe5L6NtGv8zHrVJpCuIkr +XEMjhv7OJRJY6w6rv9ILAaLeK/TbTNHorEEzhufpaZA4vAILjzWS73rrPb2cVJ67p7/ LOCb/rOmCb0QOCLvdu1epRxfxCT4Jir5jk2Mt4j3vKL5wT+aSohfEKZWF4jVX0vxh+X4 OHdIJ0IDBJwn5l4xGyq2eQZ9thKdNQBqsLc5BjmRfAVl/mC4ZrWty4maSDrSzwYdP33E 4L3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z5oJZBSWwgnPbQhTtEvZJ4+nelyi+5iof19yfzgCYhc=; b=vmVheKemFilE8luAXy2L2KZCKMI5AlwA2Gu3yewqoHpz4HkJ172z0sgod1gPvbShyL RJReNO2YGkQjx45uV7o33vIUt2vJvXmYi2Kb1onew6Za8WPKi93I51qKThjjVFynMG/6 hCWufcQH6lC6FWbCIgih4whBg6HQcj6ELUBb4Yp/uZsNW4iB+z2uNIxKYywTUsjlv5uI h0ITpmuYFVLCPc4SvRsShtzFHFKoQqomXG4hUuu5JsTfZO2S3lV6WJ1O8trAgCsztTFv fCTABKWE3aRENcUEbfXqk1PPoE8YGtXXJnFBOSKasJhGypx1uPjA/XF0GFHHwKAtrjeG nIiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=iMdFCUcw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jw12-20020a17090776ac00b007ad79c4f58fsi7033173ejc.120.2022.11.14.03.47.31; Mon, 14 Nov 2022 03:47:55 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=iMdFCUcw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236658AbiKNLpI (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236660AbiKNLoe (ORCPT ); Mon, 14 Nov 2022 06:44:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDDBA20BC5 for ; Mon, 14 Nov 2022 03:44:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 905B0B80E6C for ; Mon, 14 Nov 2022 11:44:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 988CDC433C1; Mon, 14 Nov 2022 11:44:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426263; bh=owzR+yZF1fBmG413bQU+FKodqiSnrZRm615nsyA2Qd8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iMdFCUcwcAU0BxJEunp20sguBCmcihaBHzTN2R0laCZjfHpV3wYTLqN8Vo2RZE7iE haT1PNIPMmf++W29BCMx6YNaaDQS8iK2T4P5eJJzru7mrUTlNkwpLyOvP/sVh3ZW7g jVUQmQuZqHtZAIEj4JTTWT7Fml+LW8NRfvsbzTjt4+Ejv/GYDgIi4+nyNlni1tgPdH qhdKHJQ1coiRZPhNytWT8z/3lra+iaMThcXGG5fwaGe7WwfIYSj0GxQSZungNuRLsC 8kdFYo1ocB+NsfrwYgJw3vwGvgr9pTj/vGO7sjkMOOniPt6Bd8ZEa++WhKOr3ySQUf Q0rqE88PdqL1w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Juergen Gross , Alexey Makhalov , VMware PV-Drivers Reviewers , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 12/46] x86/paravirt, lto: Mark native_steal_clock() as __visible_on_lto Date: Mon, 14 Nov 2022 12:43:10 +0100 Message-Id: <20221114114344.18650-13-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471959933885345?= X-GMAIL-MSGID: =?utf-8?q?1749471959933885345?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark native_steal_clock() as __visible_on_lto. [js] use __visible_on_lto Cc: Juergen Gross Cc: "Srivatsa S. Bhat Cc: Alexey Makhalov Cc: VMware PV-Drivers Reviewers Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/kernel/paravirt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 7ca2d46c08cc..27a537cd4b0e 100644 --- a/arch/x86/kernel/paravirt.c +++ b/arch/x86/kernel/paravirt.c @@ -120,7 +120,7 @@ unsigned int paravirt_patch(u8 type, void *insn_buff, unsigned long addr, struct static_key paravirt_steal_enabled; struct static_key paravirt_steal_rq_enabled; -static u64 native_steal_clock(int cpu) +__visible_on_lto u64 native_steal_clock(int cpu) { return 0; } From patchwork Mon Nov 14 11:43:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097717wru; Mon, 14 Nov 2022 03:47:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf49Xjzlt/kMj+rhcihfl/qvUj7An3UnQoThm3jMg1EUyQ724PBZI99I7sPIpEXR3P53Z5u1 X-Received: by 2002:a17:906:fb96:b0:7ad:dcf7:c4f with SMTP id lr22-20020a170906fb9600b007addcf70c4fmr9931234ejb.631.1668426478298; Mon, 14 Nov 2022 03:47:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426478; cv=none; d=google.com; s=arc-20160816; b=YVfelUhSaFXYnmnwOFlN4MTzP6BTSEvkIClPA/BFNurjFNL4nevRORiRLKH0MiaUW8 roGKDr4HYWhSJ/PwtSmCXrXM9rx9VxtKEzbykKDQGSs1eqwElers1LaMWp64npBf60HL WP0ttisEgQvSdlKDflJCmaIbK1E7NJVPyKiwRblgl7NDS7KYSm2pK+mQbt/CK75FgebX GtOHX8UBs3kyu/rJHgx++kvsCCHRI46ecCtEa3/5AW7hOppZpQULAtG8Y+muGHwiZFfL aHsHrEgFaFED14sWH5KOOVpggXWMfhbd7bRsRw3wp4DsnGgtvm/c8eroLG8XuvqksZXG WLbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=k3ZUR2h+mEKL3OZPzUexk63/NgLNzDz87sk4U1h1dpk=; b=RPHz9FR6+vnMZclLzZN78jUvqQLPXhUPX2Re2IfgkQR3Er/GSg0itHgU6pev3F2tQc EcyCpdYbmeEreM8+dbS7ND4VtdQty/itoCFFw1Wlqhw0uctFQFHW0950P0q5xPhmQNFE ru9+gPTx+snZvfBKbZ7xhJEh91y+7j4Nle04yp2nwzTfolRbH2tcm2qVJ6w0DNoSW7sF MfWPDHhngHC60z9Q8/hiEAvBtChvAzgmZuKX0RVDo0HI0Zr8jw6qrNznpGNTz4/NpCmP l4gS4FQXjRLQfDGv6MsndUy6k1C+g1zV5PvXgqiv7Af15aKxAx8pISy8ta4ZXdwor1wt HhDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FPYVlpz3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht8-20020a170907608800b0078dd7383ed8si8523962ejc.414.2022.11.14.03.47.34; Mon, 14 Nov 2022 03:47:58 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=FPYVlpz3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236664AbiKNLpO (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236517AbiKNLoj (ORCPT ); Mon, 14 Nov 2022 06:44:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B053B1D655 for ; Mon, 14 Nov 2022 03:44:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34A71B80E6C for ; Mon, 14 Nov 2022 11:44:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE33AC433D6; Mon, 14 Nov 2022 11:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426265; bh=mZy59RfMp+d1UJJbf+o4C0WWNhptP9zLv0Zp8nxmYqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FPYVlpz368y2BvR4VAyLp0saq8tF6P5Cp+4m0jbJhjQgB9H7x7DfN3vURZR+wYkC/ GBWAYSbKB6NYboPLqd1Rnnwtv6/IoJ4+ARtKrns+0fztif2QW7WsCr5Iw1NFJjmKup y8grnvSS2m/5cppYeNVgrNJETBDHGJSdNjFhE4s0j/dLKVfjdkkTgo7Tqi+pEQfsyf 5In4dDX+Pf1RaDEjZMXsT5w/J3HQBXMZfEWDzorQ8r2uDq8J84W6ev0qhlT9a3whu+ nW1oGTYQdFMtRHOhzEVCWZbJtpOLOTved+3Xr9wXJXB0xL7BBCqPCGFkmylbq6s2f/ D6ZFfLFn8tJyw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 13/46] x86/preempt, lto: Mark preempt_schedule_*thunk() as __visible Date: Mon, 14 Nov 2022 12:43:11 +0100 Message-Id: <20221114114344.18650-14-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471962695515019?= X-GMAIL-MSGID: =?utf-8?q?1749471962695515019?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark preempt_schedule_thunk() and preempt_schedule_notrace_thunk() as __visible. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/include/asm/preempt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/preempt.h b/arch/x86/include/asm/preempt.h index 5f6daea1ee24..c76ec881b23c 100644 --- a/arch/x86/include/asm/preempt.h +++ b/arch/x86/include/asm/preempt.h @@ -106,13 +106,13 @@ static __always_inline bool should_resched(int preempt_offset) #ifdef CONFIG_PREEMPTION extern asmlinkage void preempt_schedule(void); -extern asmlinkage void preempt_schedule_thunk(void); +extern __visible asmlinkage void preempt_schedule_thunk(void); #define preempt_schedule_dynamic_enabled preempt_schedule_thunk #define preempt_schedule_dynamic_disabled NULL extern asmlinkage void preempt_schedule_notrace(void); -extern asmlinkage void preempt_schedule_notrace_thunk(void); +extern __visible asmlinkage void preempt_schedule_notrace_thunk(void); #define preempt_schedule_notrace_dynamic_enabled preempt_schedule_notrace_thunk #define preempt_schedule_notrace_dynamic_disabled NULL From patchwork Mon Nov 14 11:43:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19741 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097745wru; Mon, 14 Nov 2022 03:48:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf6NRNOx+cRp0pdZ5wEoE43GZeoC4SI+33FOT1yANofokzKD20DiDihh5XTnodGj4j/SE83X X-Received: by 2002:a17:906:f8d6:b0:7ad:a0cb:f79e with SMTP id lh22-20020a170906f8d600b007ada0cbf79emr9492673ejb.458.1668426482787; Mon, 14 Nov 2022 03:48:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426482; cv=none; d=google.com; s=arc-20160816; b=vY/q96Jz0H95vSwLWBLGZeS6OkzKbwydhUyKU8VGxMgvrGUU0vE2+245WIhAESDdoL 772Ix8LNbrHEoOqplh8b5WDqy30+Ca6GQD64G8vOWdFvZdzEwwFbdh9Dkp6mtRMDuQNt iTClcnF1t16MyzAuEE07x75YAOzp6ZzufSCYMy+zc6gx0JI0ja4G5BviwlGcrRVW0L8I vxhfWFRVS2N7Mdj1U1NfqyosFW0zsyxwmz8HXQPm6EFI1SxruI/lH7drD8Cptc1uyp9I 1gplUSco4jo6GFQTfCH0HL5EhMdEHTo35rtM77vyelSJBWb09jQevpr7U3o7BsedNXhJ WP6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=avcaAbn+KcTS6R234U15OIZOl7eYOQ/oaTd2IOBdeeE=; b=JC2D2sM4Ow1m1XmNJAPVcbJRq1XBPX347vdxpELQRVhQzlXRxZyZmVyJ4FqZlp4Yal s/x8BzC03kEM7g9a2h6F/8MafrxP8EmVHkEbvEYLB+3fYGeE4VVewhx2Nq7xddBXeD6Z nqzxcvDlCd8R57idbi+/Z9rgL/evJjFb/Q46xINIklCWaL1ZDBq5GR3h6c+qgfjZKI6o I1JBe/wxLOkz55KGMPbpqya+eH5Dde4+cWlBe2GGn0S/cUM64Vc6kn6n8FBOIYnNw4ro VOMStpiqU429JkZSpVnza0r4ixbxMzDe7JhzxslQSrseuYvNMS4FnvypMk5+cRMWRIV5 GRqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=euCEXuDs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh19-20020a1709076e9300b007ae9abf1994si3485588ejc.837.2022.11.14.03.47.39; Mon, 14 Nov 2022 03:48:02 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=euCEXuDs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229816AbiKNLpT (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235943AbiKNLop (ORCPT ); Mon, 14 Nov 2022 06:44:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 581CA20F6A for ; Mon, 14 Nov 2022 03:44:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E8B1261088 for ; Mon, 14 Nov 2022 11:44:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61EC1C433D7; Mon, 14 Nov 2022 11:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426268; bh=HZIastRykGq/xA5rtpb1Bg85h070mlpSsyGBDMBXEYo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=euCEXuDs57Jkz5ICAd7/3gZCT/G6I99Z03/IWwv//Gs5dT1Q7RhHBZKC40XVCMoro S0GZfmJuacnIqqifElnRHBZ9CKJ6WBZbuxtrXV7Fe7JWFm/r+azYpU5QsFeZrd50x3 0Fs9sf9UBFMv6nU68ownp6Zd/CWEKRKp0FoNrO+UP9PIsP9coM+LGVrLFjWwoGfER6 bRQxYHnLBed9kAHfQ4XIxZ4rVSxHohsLn+Soy+WoYhluTx8NlGegiiYacAdk3Kbm8G Q+b9jE3WWQ/dxjeryS/Ry63V0RBudfusZiZoU4djSocIn90a48aRk98o/7vxQCn3S/ N69aEfUo7K0PQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Martin Liska , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Jiri Slaby Subject: [PATCH 14/46] x86/sev, lto: Mark cpuid_table_copy as __visible_on_lto Date: Mon, 14 Nov 2022 12:43:12 +0100 Message-Id: <20221114114344.18650-15-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471967848321131?= X-GMAIL-MSGID: =?utf-8?q?1749471967848321131?= From: Martin Liska Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark cpuid_table_copy as __visible_on_lto. [js] use __visible_on_lto Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/kernel/sev-shared.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/sev-shared.c b/arch/x86/kernel/sev-shared.c index 3a5b0c9c4fcc..554da8aabfc7 100644 --- a/arch/x86/kernel/sev-shared.c +++ b/arch/x86/kernel/sev-shared.c @@ -64,7 +64,7 @@ struct snp_cpuid_table { static u16 ghcb_version __ro_after_init; /* Copy of the SNP firmware's CPUID page. */ -static struct snp_cpuid_table cpuid_table_copy __ro_after_init; +__visible_on_lto struct snp_cpuid_table cpuid_table_copy __ro_after_init; /* * These will be initialized based on CPUID table so that non-present From patchwork Mon Nov 14 11:43:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19742 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097766wru; Mon, 14 Nov 2022 03:48:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Gzn5IIb83m8/83EZd6aplC3dSgLx1ah3quDVsxNDkb5RJQ/9mCTN8Or8NddnN29rzfcv7 X-Received: by 2002:a05:6402:d68:b0:467:b88c:f3af with SMTP id ec40-20020a0564020d6800b00467b88cf3afmr4721177edb.24.1668426488220; Mon, 14 Nov 2022 03:48:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426488; cv=none; d=google.com; s=arc-20160816; b=TberixTO7ri21ogocOeF7RXOzGx4lh+QbpmSVf0PLLSLqL9dOXwEEwDlfAMtlwe59j YjnoitmPeRzup9V8U/W2cEEIWAmrP9pplWebPJxZjugC3doXYPpxqYL9Pl7hjPFgtdxw 7N9FaaOR24z2bn+nRy9dkJES3kjT/0s8VxR8ESJL4wd1t6PxKNclwrGKQYevJVVn7jGs gX9v2vwiyWgy/Pe3Twv3VTbXy7ivwL1uRwSVYVOWCVGqKRVlL6L76W7fzsQtJ7b/Fljc TnG7KUY0d62J49BnxlqfBF9kYILZBqwlobtDNB6PeujtPIbY0H0GfSJlvC9QTNMegukl f9Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bkiIsoWoHn+PFGF8LjmjaJ6LnbhbhUTEZkEWyvaGCaY=; b=x2j+6yV9s/H/LQQqE9BQy1tEiLgOnGT1UZIQpZuwTAnONLqPLB0hIT+lfQ8lpnQQsH BFLyW0PBtPgwzeax9X201H1HSuRapkhS+Ue5cgqymcnvJmK6O2cqMFTgCvOVXgfdLOrE OSyFXEBA7Xq5b19gEk3H+XejMI5kmHcJRTlrsYd3PLRHy1sarzBBH7Zb3c8sNNUJBHBy 7GX0ALNW8VRP0gKqQmej4EvRzNe0DzlGeiQjZUSggk6wwgDXGcbsqcOrlspcW9tw+Mbg BidKAA35qk8odQlkmPQN0TR+6484ZquothXb+IHQe11shWW5mmNqRogQ4jV8XYNBYG/U dKsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oDcoRSsa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb4-20020a1709071c8400b00782a33f2850si9038288ejc.736.2022.11.14.03.47.44; Mon, 14 Nov 2022 03:48:08 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=oDcoRSsa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236614AbiKNLpX (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236609AbiKNLos (ORCPT ); Mon, 14 Nov 2022 06:44:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 412B821E27 for ; Mon, 14 Nov 2022 03:44:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E32FAB80E77 for ; Mon, 14 Nov 2022 11:44:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB5DEC43145; Mon, 14 Nov 2022 11:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426270; bh=wui7Joclil/1Zhbm3X8SG6joq+UGvmdb9Y11/m4UBYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oDcoRSsaEpF5qFmILR9P2mJ5a8lkQVqMz+gUsBuNicjhyBffTPM5tdA/mPGhAiGic b5Wgy7NrKtO74lPiJPFz39XuitjuukIBpJcWmqcaBGCVEmSV9ucqUPWl6gUdl9BQXX a+Ju58arWUNE9xg75AuU4gCyovLx/ItgDUgsr1wBwfbwhZkJPO/4/TJI+qMf2UmfoR QlFdhFWt8ofWnNOWLzvO8u0t1IFU0YF853oowuhb98g1SDgmNnnzJ48rj2v1CL7+R8 AWDAd2XOz2ooKCMSPSbZwiKQ8kngNUK18qlmx+FMIcPKRaS9JrURlWmTDeKaFml2Z4 5lHZGRLILvEUA== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , xen-devel@lists.xenproject.org, Martin Liska , Jiri Slaby Subject: [PATCH 15/46] x86/xen, lto: Mark xen_vcpu_stolen() as __visible Date: Mon, 14 Nov 2022 12:43:13 +0100 Message-Id: <20221114114344.18650-16-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471972901903290?= X-GMAIL-MSGID: =?utf-8?q?1749471972901903290?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark xen_vcpu_stolen() as __visible. Cc: Juergen Gross Cc: Stefano Stabellini Cc: Oleksandr Tyshchenko Cc: Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- drivers/xen/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/xen/time.c b/drivers/xen/time.c index 152dd33bb223..006a04592c8f 100644 --- a/drivers/xen/time.c +++ b/drivers/xen/time.c @@ -145,7 +145,7 @@ void xen_get_runstate_snapshot(struct vcpu_runstate_info *res) } /* return true when a vcpu could run but has no real cpu to run on */ -bool xen_vcpu_stolen(int vcpu) +__visible bool xen_vcpu_stolen(int vcpu) { return per_cpu(xen_runstate, vcpu).state == RUNSTATE_runnable; } From patchwork Mon Nov 14 11:43:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19743 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097829wru; Mon, 14 Nov 2022 03:48:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Xh9UWz+r4k8yP5UK474/qECoRrVYI60Z6aCT5QdGSLw808zWachAjzoylGdm4Qr2ttbV9 X-Received: by 2002:a50:baab:0:b0:461:e2ab:912d with SMTP id x40-20020a50baab000000b00461e2ab912dmr11126741ede.93.1668426499615; Mon, 14 Nov 2022 03:48:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426499; cv=none; d=google.com; s=arc-20160816; b=LDVhkxgveFpA1S8+PXiGkEoKycG3ZD35r7wJ3lUCyC6DJAruKTWKa6FVFjRmJL8O/Q o44LBdzp4MyKai9ohPEiYz/0zd76E3Q/wGoVkwMJTUmwDdU7Oeku4EfsHWzgBCnsDsGC BL4kbrb54UrvVhSgaZghFN1/3n+lXn9Ca1IsjbW38g7DigcrQAQFHbHp26m68LKgQvqc jvAgv1QOl3tA0N5bfPj6stt8hkbTGw2/2blgbGVJf34AgJamEQxo0Z/8UcsWnexoWhDg zBTiaM6571RTUz/ImiGlqJyk85rXOEtZRkO0Xe9PRsLbVFFrvbuDxAHgDBv6y+gVdvsy oRVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vS5VEAYciYx9mTihRI7luLtHs8g4ANdcrOvk0xhwAeY=; b=ymPwhglscOLerFH92hI3u8HpG8f88bDS8B7njIP5Qc5KA2Al79cSggytYZG8S89BTr q8u7C69Y2XaM93h96vM5o4+Civ8gk84lKXHjQSzHE9Nqq6YQ3Vf7VQy+AX0Sl+oE5THb BUF+vUi+mf4Er2ZnJQ30I44x98iMN9tJE/baysAPoBvtOGMry/5V4Zn9qF9H6YQffrgU oEiYb1wHRbtDhyXx1ZON4mbk7hzVE9RUgkMUMWjBtFhGZyXvyrFGvvhdpU3H6HpdkdsT Pm5sIL75jzHQRD+On6/bOJHgR1piy2njDxd6oUzUMWKtJZHzRzXT6EOwnxIxWes4DiSX SqqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="cDe/BWVa"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g10-20020a056402090a00b00461b2c3c4acsi8048766edz.515.2022.11.14.03.47.56; Mon, 14 Nov 2022 03:48:19 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="cDe/BWVa"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236564AbiKNLpa (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236690AbiKNLot (ORCPT ); Mon, 14 Nov 2022 06:44:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 156E422508 for ; Mon, 14 Nov 2022 03:44:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 897A4B80E73 for ; Mon, 14 Nov 2022 11:44:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16C86C433C1; Mon, 14 Nov 2022 11:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426273; bh=ApTSBGC/5zyM3eDvn776xtW4dxkstz2N0HPAS1gCaY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cDe/BWVa7LVUh1wr2YKoKMSQ+DOJlndaHrRFQwyP+4dg9OY5/w6swCuGR3SnvFnFi BYfRYHeK0ukY7PG2tQPtB1s9+EfesgR5S3X9dHy+MTPim1IlxDX0GrSaNFjszroBsM TrLvirzkUBIDy00BvaiFBVSsBdqwYsHhG+x17OwNte7Bb9NTv2dYhU4VLk9oJQwh+N aAZMwV7jrT0HcL+9YZIANQ9pqCm3KzAJJ391EqaSh4Mh0IhTQR8YnAPoXkUzTUs0TW biGP4UaRDZWyvnfkK7Bq6fRa8iPc/MpDnqxBESFp3e7EYS458CvD48vTVoBZHELnde 3Mswaewh+4pPg== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Martin Liska , Jiri Slaby Subject: [PATCH 16/46] x86, lto: Mark gdt_page and native_sched_clock() as __visible Date: Mon, 14 Nov 2022 12:43:14 +0100 Message-Id: <20221114114344.18650-17-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471985496950759?= X-GMAIL-MSGID: =?utf-8?q?1749471985496950759?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark gdt_page and native_sched_clock() as __visible. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: Cc: "H. Peter Anvin" Cc: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/tsc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 3e508f239098..5417a8fd7a45 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -201,7 +201,7 @@ static const struct cpu_dev default_cpu = { static const struct cpu_dev *this_cpu = &default_cpu; -DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { +__visible DEFINE_PER_CPU_PAGE_ALIGNED(struct gdt_page, gdt_page) = { .gdt = { #ifdef CONFIG_X86_64 /* * We need valid kernel segments for data and code in long mode too diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index cafacb2e58cc..df1589482662 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c @@ -215,7 +215,7 @@ static void __init cyc2ns_init_secondary_cpus(void) /* * Scheduler clock - returns current time in nanosec units. */ -u64 native_sched_clock(void) +__visible u64 native_sched_clock(void) { if (static_branch_likely(&__use_tsc)) { u64 tsc_now = rdtsc(); From patchwork Mon Nov 14 11:43:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097890wru; Mon, 14 Nov 2022 03:48:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf5dD3cC2pYk0afJCtz/xj7HoHHkSeJ5UGHWgNYZFaNDbFZxrh3B/95KSyk1hO/S/yeJB6Z2 X-Received: by 2002:a17:906:a106:b0:78d:b371:16d4 with SMTP id t6-20020a170906a10600b0078db37116d4mr9549762ejy.434.1668426508169; Mon, 14 Nov 2022 03:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426508; cv=none; d=google.com; s=arc-20160816; b=xMfC1Ic1jqaY0VOKdNQEuYGh89t/jZsIJ+FVtI4SwqtFoEGC7IePVcx1DAv179fHyb fpggS/sYUA+4wpFPXTDZk07iGaMwfBvoNi5N9sfNhRbe4ddQgMZskFgqZZaqBWtMhTG5 umScDtlwEhOBKKdJPVa3t1sjdPgu3iIpBL/heJ9xOmSrPXTFL4Jz/NCe2FdygHV2TzCv UdVDjzub1bSzH9uQZ6ulFv4T1MlcCzTNXnoO8EdzmGvcpzHkEcctKjarYV5IJNENjUps qsacVdmGt/V1755iqZm/1lOpRaso4480Vo8vKPtmW0M/kxR/i7XK3rNUWjBg0nQb8rnq 7R1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=um6Qx0md4y5BIyJRbUHKwZSXi/6078NVJZag8FazAcs=; b=KtKQPjl3LSWMUV5VkqPY6gi0hMUBOe1SrmWUa3U/xe4EM8flBWzu33NPEe1tppD+Yq w/5MvJkYAMBgv41RUHtqEn8sMPGIo5NdxkvtrZ1cgYWGxG8oq4OCI9BZz1VbQtm6weaY GZOkgvzK1CkU16Ko6IU/H5Q2FzuZeIZs5XGjZPFk6Hzs/kr+YxWksOpAG0QJ2HY37YSv QaV+3ZAkwO1Q+kBovsXTj9tcNeH8YaQJR0Ul5xy2iF8NuypMyLMv1Xl6aRRUqEk4TU/C bcslmPE5x76cQyUouguYDD0wMGa4HetObERbL5jLwc6N4wSMkQcdFWtD1gmyfRhQWWdL Uo9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rFanZoEr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg2-20020a170907204200b007adadff675fsi7013275ejb.313.2022.11.14.03.48.04; Mon, 14 Nov 2022 03:48:28 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=rFanZoEr; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236702AbiKNLpd (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236643AbiKNLo4 (ORCPT ); Mon, 14 Nov 2022 06:44:56 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B97E222A3 for ; Mon, 14 Nov 2022 03:44:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C941AB80E7E for ; Mon, 14 Nov 2022 11:44:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B630CC433D7; Mon, 14 Nov 2022 11:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426277; bh=yzR3ph3tC/ZTtl87MRZiAK+HvN3pbQqI4zL7+OyT63c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rFanZoErjcqgPwNAvJt7PwJs/ly5KORJkrpyeHltMdaoMimDBEyFT7yEHJ7rV4opP yg23KdpMK1C/eVt+Es0jX4d1NodxSIPh/VcYY7/XL5rxjOWAwY7r53gPogJNYd8oUA A4mYwfcd7xiJtCzdQCkDg/CKVCr/iwREjxWIo+osGihbofraaSDpaDMi5+m3E9qpnu 3f/aG5tXJwmOb5j0HJj7hNM18pcA62C/8754bpiN3YNkUfGIyJiHkToYnYoBMlTns/ lkvcOxO9IOBBJlvHIASy1xSTGF/K7rVvisBz/cE8g74RytEow0P7t0qt5vDuYSw5cP zRiSVadxg1McQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Huang Rui , "Rafael J. Wysocki" , Viresh Kumar , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 17/46] amd, lto: Mark amd pmu and pstate functions as __visible_on_lto Date: Mon, 14 Nov 2022 12:43:15 +0100 Message-Id: <20221114114344.18650-18-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471993906720073?= X-GMAIL-MSGID: =?utf-8?q?1749471993906720073?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark amd_pmu_test_overflow_topbit() and all amd pstate functions as __visible_on_lto. Also the pstate ones have to be renamed so that they are unique. [ml] fix amd_pmu_test_overflow_topbit() too [js] use __visible_on_lto Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: Mark Rutland Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: Thomas Gleixner Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Huang Rui Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/events/amd/core.c | 2 +- drivers/cpufreq/amd-pstate.c | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/x86/events/amd/core.c b/arch/x86/events/amd/core.c index 8b70237c33f7..9dfdfd85b493 100644 --- a/arch/x86/events/amd/core.c +++ b/arch/x86/events/amd/core.c @@ -643,7 +643,7 @@ static inline void amd_pmu_ack_global_status(u64 status) wrmsrl(MSR_AMD64_PERF_CNTR_GLOBAL_STATUS_CLR, status); } -static bool amd_pmu_test_overflow_topbit(int idx) +__visible_on_lto bool amd_pmu_test_overflow_topbit(int idx) { u64 counter; diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index ace7d50cf2ac..d0b67a60191d 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -66,7 +66,7 @@ MODULE_PARM_DESC(shared_mem, static struct cpufreq_driver amd_pstate_driver; -static inline int pstate_enable(bool enable) +__visible_on_lto int do_amd_pstate_enable(bool enable) { return wrmsrl_safe(MSR_AMD_CPPC_ENABLE, enable); } @@ -84,14 +84,14 @@ static int cppc_enable(bool enable) return ret; } -DEFINE_STATIC_CALL(amd_pstate_enable, pstate_enable); +DEFINE_STATIC_CALL(amd_pstate_enable, do_amd_pstate_enable); static inline int amd_pstate_enable(bool enable) { return static_call(amd_pstate_enable)(enable); } -static int pstate_init_perf(struct amd_cpudata *cpudata) +__visible_on_lto int do_amd_pstate_init_perf(struct amd_cpudata *cpudata) { u64 cap1; u32 highest_perf; @@ -142,15 +142,16 @@ static int cppc_init_perf(struct amd_cpudata *cpudata) return 0; } -DEFINE_STATIC_CALL(amd_pstate_init_perf, pstate_init_perf); +DEFINE_STATIC_CALL(amd_pstate_init_perf, do_amd_pstate_init_perf); static inline int amd_pstate_init_perf(struct amd_cpudata *cpudata) { return static_call(amd_pstate_init_perf)(cpudata); } -static void pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf, - u32 des_perf, u32 max_perf, bool fast_switch) +__visible_on_lto void do_amd_pstate_update_perf(struct amd_cpudata *cpudata, + u32 min_perf, u32 des_perf, u32 max_perf, + bool fast_switch) { if (fast_switch) wrmsrl(MSR_AMD_CPPC_REQ, READ_ONCE(cpudata->cppc_req_cached)); @@ -172,7 +173,7 @@ static void cppc_update_perf(struct amd_cpudata *cpudata, cppc_set_perf(cpudata->cpu, &perf_ctrls); } -DEFINE_STATIC_CALL(amd_pstate_update_perf, pstate_update_perf); +DEFINE_STATIC_CALL(amd_pstate_update_perf, do_amd_pstate_update_perf); static inline void amd_pstate_update_perf(struct amd_cpudata *cpudata, u32 min_perf, u32 des_perf, From patchwork Mon Nov 14 11:43:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19746 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097905wru; Mon, 14 Nov 2022 03:48:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf4HOIfKbRrQVKAMlfEqi5MfZsYDKgIGMUlkEtQjzvrbzPr04UsRgxHubH4zv6dzaQRy9VcM X-Received: by 2002:a17:906:2782:b0:78d:77b1:a433 with SMTP id j2-20020a170906278200b0078d77b1a433mr10024666ejc.486.1668426511596; Mon, 14 Nov 2022 03:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426511; cv=none; d=google.com; s=arc-20160816; b=CrD85TB3sbWEO8sKigVxIDXdp+BOpf6jdCYb3YBCCFPG2dt61/Z3QcnRUbp813SnQa D05spIlmtSeYnAGfrKgHzQhXekOYM1j/NlEMIoMR+DqfLI1xHY0KXq98xOkhOBjV28Mr LFZH6Ea9RIvGdb0RKNMny+sYLYwR3EQx0keZxTaappBFGksCVB05tRmQde1pO8OdbYxj q1/b1CT67BZrY9TNiF82HpQ/Xc2aokv9gmNIaWr+ezj/4gjgSSRIacV5FNHpoCWtHkD0 n1HOzMcEXD58ZViq8/f/HuR8mUtsDhpggYRDirVZuNpjbD3O8zxhwVoHSncDL09oOJzU TEyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Oukx4wojC0JZk61p77ROqFYgcgaENsiRGwz311lyYA8=; b=iohlNfk5cn2ejyE//rCmetU5CJw/NynXqoIViR+ylSbQPWz15R8h15enbD06hYPRIK JmULCwtNOTJzAY7FU1+AOh4oUZC9nco/UpgwRAXu9JQkgN0TJUHVJS58ko+sd/eezPIv djEObmTdDByF0PwNj8c4j/Qjejz0m8DRP9EYG26Xy31ZEclT5lidJMf36t7KIZ4v2Xtv LQ5Voo0MW3rGWt0/5QeuwYhBZ/LPXU0B6SOFUaU+/Fb7QcuXdg9O8g1Ws+FtOUzn48/v S7vXL26CyCpfRB4lfj0k6RYXTRo0TaY8qlMpKU8CCb3jwUvfPWOuj2t1bcdtwsfZ3t/h wklg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fX5j1IWz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a50870f000000b0046154884604si8789712edb.482.2022.11.14.03.48.07; Mon, 14 Nov 2022 03:48:31 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=fX5j1IWz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236708AbiKNLph (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236654AbiKNLo5 (ORCPT ); Mon, 14 Nov 2022 06:44:57 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960352252F for ; Mon, 14 Nov 2022 03:44:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2CEFC61087 for ; Mon, 14 Nov 2022 11:44:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2887C43155; Mon, 14 Nov 2022 11:44:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426279; bh=dn0CND4Yb3GYabpLwzhF9lVAnJEjbiM0Q87kR0Hih+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fX5j1IWzLpzENINvT3ouVKWBX6XghYPlk3DDKxppfVzJOeJKkj9hg/0dXdZ1JXhl/ 6u8gVzw0+qpl9nTA+F0Wt/w3eTvJi6P6IL+qO9DlwcCJv2eGvC/uLIuuzI69nDjDCv ZfuhOlM+1zxGUc6onbmKi5kozBR4rBaQF0hz4b3GgFA3tp7tSGTxLWmmRDzXjgdmy4 3nO+cg2W9QbHDLphFVrRcX/SHX7LM2zIMdUAwQr5xp3adR7HRkQ0/jyMSFUizPz5d/ KiBtPoGntlu7Pugnuo3qZbej8+X1fuBGoHIJSlbdFAuzn3GBOA5tf5K1edamffE2PV LIqXgGwCvi10A== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Peter Zijlstra , Andy Lutomirski , Martin Liska , Jiri Slaby Subject: [PATCH 18/46] entry, lto: Mark raw_irqentry_exit_cond_resched() as __visible Date: Mon, 14 Nov 2022 12:43:16 +0100 Message-Id: <20221114114344.18650-19-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749471997882516445?= X-GMAIL-MSGID: =?utf-8?q?1749471997882516445?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark raw_irqentry_exit_cond_resched() as __visible. Cc: Thomas Gleixner Cc: Peter Zijlstra Cc: Andy Lutomirski Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- kernel/entry/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 846add8394c4..13c1a7a0e8ce 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -378,7 +378,7 @@ noinstr irqentry_state_t irqentry_enter(struct pt_regs *regs) return ret; } -void raw_irqentry_exit_cond_resched(void) +__visible void raw_irqentry_exit_cond_resched(void) { if (!preempt_count()) { /* Sanity check RCU and thread stack */ From patchwork Mon Nov 14 11:43:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19756 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098226wru; Mon, 14 Nov 2022 03:49:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf7btBFrvjmahrLkQ/D6VudeR2Td2ixpnCgSgKzA3s9Z/jeqH/fdYDrPRwk6fi3Vj7868ZSQ X-Received: by 2002:aa7:d803:0:b0:467:67e1:ca61 with SMTP id v3-20020aa7d803000000b0046767e1ca61mr10188203edq.27.1668426567322; Mon, 14 Nov 2022 03:49:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426567; cv=none; d=google.com; s=arc-20160816; b=UF/RGwvXLKwxsF1KnlvCqvRsZHbZUd++XPTfnZ2yXyuKloF4Wh0wWZ6jogfFHSjq9S KPWHp1NOgRmLSS9nKn3lv57cTc28O/WnfkA8TRw8wyhH/JCEu8OUNP4Xb+BcnHji1lNJ gSFsZLb4AwZrEwDpzMoxXNdiQfRKIZKzJ3zOPXWxVvnZGvcQwdkkKxqpfEEiAMjx8RI1 nsNelukTlmatTyGgl41/Eucz0YjE72KoZ8zamaSCS6sGb4LRfgojnsc/opr9nrcJbm4c F3KVr1zoxA9+yrtwTyml1+538iihHmQUqYn3aWGgqsTSSt+vkLrNNj9963kGR54/ieOw IU5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8y6sOVxlBHMizTVtMSfPfoz1iFFwRdL5g3Bh4Z03K4Y=; b=LVBTNIArtHOtTfSOyfrSt7mkN3ui3vDozSV+aezIJuRpo5QZWEaNtn0eIvMl0Jkt3e RgVrm2sa4AUVkULr5b/JPr93w8t8vZb/XdY7dHLa7XPP+qiyAk37iyvjIQUpXyr+qV16 TcELaGh5nKE//DmSqorSu8p51sQTatCHvtvTkQofmCIYmHUUW0EJqCjIHiGLLVKhaEaE iOOWU/+hpWuxyabKLKzTyngy1VJrUyQeUmq4DyLmVgs6LkGd75WJEl/nkVEGo2Mh0Qpv 8g9RhlZMCdKP2YQfQd7VyeB14XYS98X8M5SBE92V0xaTV6rgvjyGlWABoTgMs/dghhi5 uxOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q0s1lYPl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w10-20020aa7cb4a000000b00463c5c32c65si7937080edt.457.2022.11.14.03.49.04; Mon, 14 Nov 2022 03:49:27 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=q0s1lYPl; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236758AbiKNLpr (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236666AbiKNLpQ (ORCPT ); Mon, 14 Nov 2022 06:45:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F055222BA for ; Mon, 14 Nov 2022 03:44:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD35E61029 for ; Mon, 14 Nov 2022 11:44:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10ED3C433D7; Mon, 14 Nov 2022 11:44:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426281; bh=Vpg6dWTArUNw6H1lp7TcQixC3uvVmofgAH+VJ8M/i8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q0s1lYPlaouNk03bC26jwsoY4uhDQn4c/yiJljQW+qknmxh2wfkw8UMc4xzmdLbwb 8EK/BGDTUVjnZgsMyONGcULwuWqCX3z31MbWTfr51XDNW9qiS3m8STiTX5QB16N2E/ vGQ3IL2EqJ1dc3MJ6AVlp6V/yqwWHyZCn/hTlDsL+x1v9O9ZO6RGXaD6SUr8lX5cwH Qoy/f7mfPdppxhBeD0rz6ra4XwgbgfkzkVaAatAIY7IUdoMD5hruELQaEXTVWdoTQN fC8SpRDcxbqjzrelOgX31DQsloDxNfNW+OWanKD/bo0A1q3yV72l6aAXPdpjh+L4bL JKJd/i3tYjV5Q== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 19/46] export, lto: Mark __kstrtab* in EXPORT_SYMBOL() as global and __visible Date: Mon, 14 Nov 2022 12:43:17 +0100 Message-Id: <20221114114344.18650-20-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472056145384029?= X-GMAIL-MSGID: =?utf-8?q?1749472056145384029?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark __kstrtab_*[] and __kstrtabns_*[] symbols as global and __visible. Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/export.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/export.h b/include/linux/export.h index 3f31ced0d977..3cb5f85327da 100644 --- a/include/linux/export.h +++ b/include/linux/export.h @@ -85,11 +85,13 @@ struct kernel_symbol { */ #define ___EXPORT_SYMBOL(sym, sec, ns) \ extern typeof(sym) sym; \ - extern const char __kstrtab_##sym[]; \ - extern const char __kstrtabns_##sym[]; \ + extern const char __visible __kstrtab_##sym[]; \ + extern const char __visible __kstrtabns_##sym[]; \ asm(" .section \"__ksymtab_strings\",\"aMS\",%progbits,1 \n" \ + " .globl __kstrtab_" #sym " \n" \ "__kstrtab_" #sym ": \n" \ " .asciz \"" #sym "\" \n" \ + " .globl __kstrtabns_" #sym " \n" \ "__kstrtabns_" #sym ": \n" \ " .asciz \"" ns "\" \n" \ " .previous \n"); \ From patchwork Mon Nov 14 11:43:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19747 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097937wru; Mon, 14 Nov 2022 03:48:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf5dcCY6ZN7gIptohW75Q1haAVEzRm/FloZkT/Ur+zQklWFvY1DSEtL5DTg2TsTDCOA13CRx X-Received: by 2002:a50:fc12:0:b0:461:5b2f:2d8f with SMTP id i18-20020a50fc12000000b004615b2f2d8fmr10956196edr.348.1668426519041; Mon, 14 Nov 2022 03:48:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426519; cv=none; d=google.com; s=arc-20160816; b=N9RiOdX/Tz6H9Jbux9EuFTHEuCf+Xa2q1Ms/urobUn7msQg7COKnYJXsL3v8JHfQ4B XIgZss7JMw/fxsf8lSPQwDZWiLNknT4BK+UabkgInIPJ0+URT6+VxT88qN47qELc9NT0 pyGhz0Lj4l3/W3RPWses1+U0mNdnEvZslFJFoZGFrFMLgL1MMDK0qyHJq9zExI8FigT+ Zf+iw9wr+fgN65+iDQPL7xRnGI4Emnw2HST93NYal1YWfPOsWg3NQi51C9gGcNC7X5kH JhFrrjPtxSvcdt/FJaOXjLZ97U3HuD85g+dkXYhe/eOBu0HEqeWPwJrdAt2Qv2IJraqB Qcfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lxIuDLiOInZdsS4/gBo+k/NSAEX6MF27BHlT7LCFwQc=; b=Kag/UZHEI6JvrAL7KrW7pK9J5c6IFvwjTrIhDWVEMhqjsu4/jZCQjjgL+6UuZzlYgW kFvogV8On+FgfX/UZRLCgnB6vD+Coj+jmiR36RpopnwCLZCYppdRnBgHOuoXiHfhzAkj KTXFLUkRmMG1VYhjV+OXx+SBCUmzYHSl7I6gY4asCi03/tESUNKiL2mwFVXcUYJs17wm XaDm/fVYYBuqf6qJmy8fyB88rz8AbVhiMxws+85CL5ijevRJg+VaXTeISVXrPmCCrl+N 6jzF7JNmfugAeI81Q1BQSzbG3LW5oUe5YByXpr8sJ9fCW8zCExnGYKtN6YIQYw/SrI+J o3Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rXbgHJts; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a056402279200b0046762f4cc79si8741405ede.137.2022.11.14.03.48.15; Mon, 14 Nov 2022 03:48:39 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=rXbgHJts; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236536AbiKNLpw (ORCPT + 99 others); Mon, 14 Nov 2022 06:45:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236069AbiKNLpS (ORCPT ); Mon, 14 Nov 2022 06:45:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1C3823158 for ; Mon, 14 Nov 2022 03:44:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A2946106E for ; Mon, 14 Nov 2022 11:44:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FE15C433C1; Mon, 14 Nov 2022 11:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426282; bh=EmZ2uX2gI3bbUDmWCTMpWHApcz7gKOlAwlCJ75sHcrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rXbgHJtsiDuv0sPyHOGdWkcq8w522U/y0OQB4TPexKtwC6oYufrIMP+/qxIDlYWk7 y1TlsjFwRaS2LaJ+1uyhtVefA2TVGcMbApsz8lszDYncpAAkdGAAbGwc8xb0gYl+Hi XAgx5aC86ODFPR6LrCi/vGM9Ms8+wdHeOXhQNXiAvhaBBAeaz4yyONF2qErsOLFJZ8 +PWMTtuOxKG/O09KLA3gBJS3DPdhq+ZmNLPI1wccXLRNAxJ/WfNa7F6pVV+DLIEM6m k/gXsKrOGrMh/KX68S47Z2mr1wnI/NN+epgXaNLFiUkewr5enPvFpD4TYT/dWcmP7i xITP5aobDF4Wg== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 20/46] softirq, lto: Mark irq_enter/exit_rcu() as __visible Date: Mon, 14 Nov 2022 12:43:18 +0100 Message-Id: <20221114114344.18650-21-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472005094485029?= X-GMAIL-MSGID: =?utf-8?q?1749472005094485029?= From: Andi Kleen Symbols referenced from assembler (either directly or e.f. from DEFINE_STATIC_KEY()) need to be global and visible in gcc LTO because they could end up in a different object file than the assembler. This can lead to linker errors without this patch. So mark irq_enter_rcu() and irq_exit_rcu() as __visible. Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- kernel/softirq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/softirq.c b/kernel/softirq.c index c8a6913c067d..9d62e09c9581 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c @@ -604,7 +604,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) /** * irq_enter_rcu - Enter an interrupt context with RCU watching */ -void irq_enter_rcu(void) +__visible void irq_enter_rcu(void) { __irq_enter_raw(); @@ -657,7 +657,7 @@ static inline void __irq_exit_rcu(void) * * Also processes softirqs if needed and possible. */ -void irq_exit_rcu(void) +__visible void irq_exit_rcu(void) { __irq_exit_rcu(); /* must be last! */ From patchwork Mon Nov 14 11:43:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19748 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097968wru; Mon, 14 Nov 2022 03:48:44 -0800 (PST) X-Google-Smtp-Source: AA0mqf501+Dsl/eMM3SHPPTjTLC4MWuLcy/lck870yciTgTFPqViQT4BEEaBy3VY2tsjQ6zqtG8w X-Received: by 2002:a17:907:d68b:b0:7ae:41e6:9076 with SMTP id wf11-20020a170907d68b00b007ae41e69076mr10222930ejc.321.1668426524274; Mon, 14 Nov 2022 03:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426524; cv=none; d=google.com; s=arc-20160816; b=KbdjcvlHSVMjKFjtquKvlimU6AxioLCq//Grfs3sq8UW8haLbAMbtR7zn42HTGGHZl 0H0tknUIOnOE5QeHrKIljqQ1wkr3fMPcS7XwxE99hWhXEs1z/2skHlwPY3x3avTI2B6e hYKRW/G3X5qIWOFogSJ2vQDeGOsE7Z01MealZqmm3DDO0BNHun7/FmR17s0hS+BPLh1D f8TMGBQKrgNI97dNFeiep1OYoaXOBkCir63ksSZMatYs75srFb/OB6LlQUAIJw0Hgpcg e+C6CWZUY/Ai9E8PHEpQtz0ySR9FZxKfjiiHmmPDytFPY1v+GYaMg2Gxz7iBHjX5+jbM pucg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xBNmJBLDVDGdH8+H48/QvaSCZLW72i3AZTvyWsazSeY=; b=WwHLDz1M8ymJ9H6zFs+uBT3cavFmsIw0u8SrfXP7eE2ukdR16Lb3m5TP4+XOga+Ur5 dFu5L3NlKLK06r9xz6c5DLh7iEo42TCxp0F/A5qBzQW8pNjzc9ET/179cHTdWV+YB/xO HEb44eWNjMFF3IX6UK/4J/YZNJ0yJD/qGc6BiMrWMao3uZs65nZVDhREMXLzfSjDG6Yh qfSTrTTDaAwf+va/s6xHvQEya8nNw2qA0x0n4cxKwOPzKzsIMmri7quHQqrXVw6z8LJb 6u8vKmG4e+DMy5s0tfAPEJDNlwnL9F0clklZGsdZuZVn9TOjQ9oB4VVhK4emOE8n3fDt BzBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XtUJF22t; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d14-20020a50fb0e000000b00461d2ed78afsi8114401edq.563.2022.11.14.03.48.20; Mon, 14 Nov 2022 03:48:44 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=XtUJF22t; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236774AbiKNLqF (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236672AbiKNLp2 (ORCPT ); Mon, 14 Nov 2022 06:45:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C1D1222BF; Mon, 14 Nov 2022 03:44:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BDD5C61045; Mon, 14 Nov 2022 11:44:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F566C433D6; Mon, 14 Nov 2022 11:44:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426286; bh=l68sB4NnR3/f4L7VL19WvqH6Dh8yt/aVZ1uJVefQMtI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtUJF22t1vMETfxkDkDoQaLgCdasT1mX3SAV8kKRXx4VF8SppR8kmCPcKMKny+Dbh +R5/4ermD/vAqhbI6Jfl2IqEnpgRKohqOPuvB4Lr0fp79bgVEMQTN7nYEURG2V56sP uAL+oq9za5RvSqWqnegWHtzmApX55dYD+0jXvOKiYAaATRPll3qAZUolXRKuXdwIp3 tZijCM3cQmnJskEoxRP80Y42UARhTetm5DtR4MNQJ6vgwf4jlfGRFsTa01Fyg8IIcV 8YhXFJHgBjabJP8rmmWYRTzNu549Kt7BxT7QTjZNordAq51h+KaB/RMfFHwsvewfck BMu5d6NEToxzA== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Jiri Slaby , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, Martin Liska Subject: [PATCH 21/46] btf, lto: pass scope as strings Date: Mon, 14 Nov 2022 12:43:19 +0100 Message-Id: <20221114114344.18650-22-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472011019551705?= X-GMAIL-MSGID: =?utf-8?q?1749472011019551705?= From: Jiri Slaby gcc LTO can put assembler top level statements into other assembler files. The BTF IDs assumed that they are in the same file. We need to make all BTF IDs global to work around this. This is a preparation for that, as we will pass __global_on_lto as scope. That is macro that expands either to "globl" or "local" depending whether LTO is enabled. That wouldn't work without this patch as we stringify scope at the moment. Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Andrii Nakryiko Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: John Fastabend Cc: KP Singh Cc: Stanislav Fomichev Cc: Hao Luo Cc: Jiri Olsa Cc: bpf@vger.kernel.org Cc: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/btf_ids.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h index 2aea877d644f..3011757a48ef 100644 --- a/include/linux/btf_ids.h +++ b/include/linux/btf_ids.h @@ -83,16 +83,16 @@ word \ #define __BTF_ID_LIST(name, scope) \ asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ -"." #scope " " #name "; \n" \ +"." scope " " #name "; \n" \ #name ":; \n" \ ".popsection; \n"); #define BTF_ID_LIST(name) \ -__BTF_ID_LIST(name, local) \ +__BTF_ID_LIST(name, "local") \ extern u32 name[]; #define BTF_ID_LIST_GLOBAL(name, n) \ -__BTF_ID_LIST(name, globl) +__BTF_ID_LIST(name, "globl") /* The BTF_ID_LIST_SINGLE macro defines a BTF_ID_LIST with * a single entry. @@ -142,18 +142,18 @@ asm( \ #define __BTF_SET_START(name, scope) \ asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ -"." #scope " __BTF_ID__set__" #name "; \n" \ +"." scope " __BTF_ID__set__" #name "; \n" \ "__BTF_ID__set__" #name ":; \n" \ ".zero 4 \n" \ ".popsection; \n"); #define BTF_SET_START(name) \ -__BTF_ID_LIST(name, local) \ -__BTF_SET_START(name, local) +__BTF_ID_LIST(name, "local") \ +__BTF_SET_START(name, "local") #define BTF_SET_START_GLOBAL(name) \ -__BTF_ID_LIST(name, globl) \ -__BTF_SET_START(name, globl) +__BTF_ID_LIST(name, "globl") \ +__BTF_SET_START(name, "globl") #define BTF_SET_END(name) \ asm( \ @@ -186,14 +186,14 @@ extern struct btf_id_set name; #define __BTF_SET8_START(name, scope) \ asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ -"." #scope " __BTF_ID__set8__" #name "; \n" \ +"." scope " __BTF_ID__set8__" #name "; \n" \ "__BTF_ID__set8__" #name ":; \n" \ ".zero 8 \n" \ ".popsection; \n"); #define BTF_SET8_START(name) \ -__BTF_ID_LIST(name, local) \ -__BTF_SET8_START(name, local) +__BTF_ID_LIST(name, "local") \ +__BTF_SET8_START(name, "local") #define BTF_SET8_END(name) \ asm( \ From patchwork Mon Nov 14 11:43:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19749 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2097994wru; Mon, 14 Nov 2022 03:48:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf6PnpkiqkMOd8rUKiRLiwywJMI7ZNwfX2QUIxy1FGU2/34MUQvNVDNSZhAot2oEtCU3bvQS X-Received: by 2002:aa7:dd0a:0:b0:461:524f:a8f4 with SMTP id i10-20020aa7dd0a000000b00461524fa8f4mr11004153edv.260.1668426527664; Mon, 14 Nov 2022 03:48:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426527; cv=none; d=google.com; s=arc-20160816; b=Kc2do08bvLDrPdS2Hp6NyEQPwX3Gm1dBV2CRpfcH9ddbEMXEfQD4P9bXtCLlZVpVvp GwWOMg8EJwjRjTnMZlpYtn8kFBKXR5f34ovSXln2wi6+roa8Z9rhIJjHnPQk+fkCA0sj /drgmJLDNmI0CpxIF7X88ySUpBlT9EZB61UQsnJNmowy9xK3m9YUSpZv02Vt7Cag1OKu DInvsiwuv+EWWQoyRCbsydw19YgzpxH2BSpvuL9u5xVLDIGE40mjvtQbZ9h11xoHNYI+ B/mWw3AUo3QLZH49RvL7PIzhByTv4788G0m4EXe0l7KPbkWzS94/ApQEvMFFqSvZdJc8 99cA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=H0S04krYLx2KXH4u6+qGRitsaEL7u4p3ce4ZbVKP5i8=; b=BKLNMJKvQn0CM5xiIuVIa4EGE7Skh0QpCdd6CcKavCHUA4YeqsL4Ho74tOUgsUNucR thW0NQN8i0a2xvv4WCGnrQffvEHY39ZFkQQmTDlXBWeymMIiBf4YpcO+uB7qrEyYNfv1 JIJxpL8FcrE86h2QDnNor1b0St6M0l8pDt+VAg5ELkO1ncAaprY5bX79tmT0wa+FRYBz mbdSeNPfzNKjDhc7V5jt2geph5pjtPtsQ7MY+drpa7sy/nYrUSeT0LNZnalqcL5TyXVD 64id5EIFFU+ZOvtdk/gGVimuKWLKcvcqQ6hTrijggHmlVyZK/AjcF7az5eDkwItI6N+y rd8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D4l3yS3y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p12-20020a1709066a8c00b007ae40ff2f11si7523558ejr.651.2022.11.14.03.48.24; Mon, 14 Nov 2022 03:48:47 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=D4l3yS3y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236750AbiKNLqP (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236632AbiKNLpa (ORCPT ); Mon, 14 Nov 2022 06:45:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E944B22BF5; Mon, 14 Nov 2022 03:44:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 845D061029; Mon, 14 Nov 2022 11:44:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7258C433D7; Mon, 14 Nov 2022 11:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426289; bh=dM14MOihj97NYzJwhWL5SRRwVL0+QAgx8foCL3a4QiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4l3yS3yBfgD2zeune7JyBhi9yZvfRVo03Vw2CsrpN2qXewu6FVFqX+CycSXiYnE6 YAn/HPAzO2Cv02XdSbbNATOUQXGwpbKZ5GPnCeKpDeTb9ovq7zHgnCYAAEYUBoWZYH PAka5pjed2VwRUgOVwmgAyMDfMAkb6rrVgvHwMeArFlKbhYJroYU6GSwxmzwHMiCXS l6yIxL6P9bKUMzd50lLwvLNgExDTPPDnJ1e/XhAiNZQLil/BH4VFMfm123x4vTyhvY OBs3lehnT+iFHQts+mAjkgNtImz3iicmMM0yJkIo8/AT96ZT+bWqChaGXVh+iH+Ssr PxwwM9K7eJw8w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 22/46] btf, lto: Make all BTF IDs global on LTO Date: Mon, 14 Nov 2022 12:43:20 +0100 Message-Id: <20221114114344.18650-23-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472014474368845?= X-GMAIL-MSGID: =?utf-8?q?1749472014474368845?= From: Andi Kleen gcc LTO can put assembler top level statements into other assembler files. The BTF IDs assumed that they are in the same file. So if we are building with gcc LTO, make all BTF IDs global to work around this. This is done by new __global_on_lto macro. [js] do that for 8B BTF set too (commit ab21d6063c01) [js] do global only in LTO case Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: Andrii Nakryiko Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: John Fastabend Cc: KP Singh Cc: Stanislav Fomichev Cc: Hao Luo Cc: Jiri Olsa Cc: bpf@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/btf_ids.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h index 3011757a48ef..a2bef302e42c 100644 --- a/include/linux/btf_ids.h +++ b/include/linux/btf_ids.h @@ -37,7 +37,7 @@ struct btf_id_set8 { #define ____BTF_ID(symbol, word) \ asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ -".local " #symbol " ; \n" \ +"." __global_on_lto " " #symbol " ; \n" \ ".type " #symbol ", STT_OBJECT; \n" \ ".size " #symbol ", 4; \n" \ #symbol ": \n" \ @@ -88,7 +88,7 @@ asm( \ ".popsection; \n"); #define BTF_ID_LIST(name) \ -__BTF_ID_LIST(name, "local") \ +__BTF_ID_LIST(name, __global_on_lto) \ extern u32 name[]; #define BTF_ID_LIST_GLOBAL(name, n) \ @@ -148,8 +148,8 @@ asm( \ ".popsection; \n"); #define BTF_SET_START(name) \ -__BTF_ID_LIST(name, "local") \ -__BTF_SET_START(name, "local") +__BTF_ID_LIST(name, __global_on_lto) \ +__BTF_SET_START(name, __global_on_lto) #define BTF_SET_START_GLOBAL(name) \ __BTF_ID_LIST(name, "globl") \ @@ -192,8 +192,8 @@ asm( \ ".popsection; \n"); #define BTF_SET8_START(name) \ -__BTF_ID_LIST(name, "local") \ -__BTF_SET8_START(name, "local") +__BTF_ID_LIST(name, __global_on_lto) \ +__BTF_SET8_START(name, __global_on_lto) #define BTF_SET8_END(name) \ asm( \ From patchwork Mon Nov 14 11:43:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19750 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098000wru; Mon, 14 Nov 2022 03:48:50 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Bu4tNqshHnQQaRsdKMX5O0adNfEJhyR3hydTHRHBRoaBEBPV9jFN+YDiqU5oJuOH7RWrH X-Received: by 2002:a63:4d1c:0:b0:462:e0d0:2582 with SMTP id a28-20020a634d1c000000b00462e0d02582mr11305725pgb.48.1668426529831; Mon, 14 Nov 2022 03:48:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426529; cv=none; d=google.com; s=arc-20160816; b=awo1K/8k8YH1rnrH3IXwHaT6li7LUPICs+BANSNKratRTNXazUz6Rup5sYQOs8pukz xHip5Efv7UN/UVgPgwCV4d4FxzgeZnsZb/CiFSaJTTSHzpqcMs7pCZxfHDwRSoudbBJ/ uJfkZq6YOnicWMNSvBIiU/B1JXnS++gbkez8/2FYz/NYxy/98b//EegRefuredziD+21 dynM74R0opSMKfLf71J17sfKBW6X9wNE/QgiqNbJpJ2fz6ez0rT0OL/NJMPXRRIivCLG vJ2RAHyqMFmcWFJIms3O2QtwgUsUAmLHDWW2EfvsHur20Rb+jlnlkEqWIKyst9NMtBRU ovnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TkmRApYodv36oSSYg02FUXrl1bjEACFJUSS/rQ5z5PE=; b=cdWFkZR7YGtH8syciqaNf3Px9Lnbk6HAz6Y1OyghqmBJ8OEXgsG52a2AhY9aSGVTJu UpiswD66lyEelJgU7OrshAwlj6nDKtLMDgYqMKffKE+uLHDTDrn+enG9P5uPlriHFHst lQJEOVF6+LYLnrYoT/y/tNnNQF6U+d0mELGlGwvfnn7r6hiQ2ErlUEzL15Ank06f/jYT xEJIgklqK+lVOihnVAViCgvRVsSnusTB5gJpMXStlT7oMynXeWXMdceLoWuJSzeFtAC+ XcPUVejTJdRBPqg259Hqrj0F3lQCzLQXMmuUAaaqjHzNIIItN1dPr0P76PL6PjRP8NtR aKYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QOe6gD++; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a1709026ac500b00174de06d92csi8542759plt.74.2022.11.14.03.48.35; Mon, 14 Nov 2022 03:48:49 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=QOe6gD++; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236784AbiKNLqT (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235965AbiKNLpb (ORCPT ); Mon, 14 Nov 2022 06:45:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 848DC1570A for ; Mon, 14 Nov 2022 03:44:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 074546108D for ; Mon, 14 Nov 2022 11:44:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6153DC43140; Mon, 14 Nov 2022 11:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426291; bh=/HH4N07B4q93OKd/c3IEVtwZviuWBVpZ7Lrl4/tVzls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOe6gD++KNbRrpH/tH10C/6YEBj1n3J5mggy9+veKODvGhC60VJNojDNuQF0/wSjU A623zDV6xncmUth8UAG/d0CukPjOSCgIvJzELhFve6+UeasNUQ56hpyZoP/TdCqc+X B0S32pILO2Z17YIIhj7l7qhl3P2DXW/k63JJdKovmTldqBM4mBHBxt/K123TlKmZ9T M3IYzuBv2DF8pGr5r2fqEfMyHOa2gMTg6IgltR0c4rp3AEfEaS8KIxfvwSG69CzkXq 5JC++VcI5YEICiiQzcBxgIUEoxQ0g8QE5L2E4LgDADV4VqlUtHuwQTeAv24U96IESN 9oWv1mXsKgP5A== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 23/46] init.h, lto: mark initcalls as __noreorder Date: Mon, 14 Nov 2022 12:43:21 +0100 Message-Id: <20221114114344.18650-24-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472016965287972?= X-GMAIL-MSGID: =?utf-8?q?1749472016965287972?= From: Andi Kleen Kernels don't like any reordering of initcalls between files, as several initcalls depend on each other. LTO is allowed to reorder as it wishes and previously needed to use -fno-toplevel-reordering to prevent boot failures. Now we can use __noreorder per symbol. So mark initcall functions as such. Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/init.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/init.h b/include/linux/init.h index 077d7f93b402..ca827e2fb0da 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -246,7 +246,7 @@ extern bool initcall_debug; static_assert(__same_type(initcall_t, &fn)); #else #define ____define_initcall(fn, __unused, __name, __sec) \ - static initcall_t __name __used \ + static initcall_t __name __used __noreorder \ __attribute__((__section__(__sec))) = fn; #endif From patchwork Mon Nov 14 11:43:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098115wru; Mon, 14 Nov 2022 03:49:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ahwt4WU8Eg4uw2sd/9ZBbjJnmlmRPOWR+JL4X9dvOqJX14CPp8V98XtEu/c0TQ4LHpOH0 X-Received: by 2002:aa7:d716:0:b0:461:cdfb:3072 with SMTP id t22-20020aa7d716000000b00461cdfb3072mr10992368edq.56.1668426550720; Mon, 14 Nov 2022 03:49:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426550; cv=none; d=google.com; s=arc-20160816; b=CsbyxGOBifREOtahF/XbsdOJhS0C1Ilg4EHQG8Wxr+0rP1nanw5IiGQ4sQMZq9875t mUF7Lj/Khn2JMaDauTPuRv8tlaRkWaX/Dfba9JGz+0UJWtXkmSXjrVH77OKhGSVPyT/P gMkNletAGZVcb6eAdgI2SaZ984LuCjpHvoQhX15gEDomUXpae5hWqJXcC1XR/tudWjpI LDvrs3t+sbO0mOs8W/wvMVDs3RnKhzo6/tiKLCg1v42ABtf9UjIPMIK/w8zoSFUJ9IqC t0eXQBTN7NFShXH76FZD8AroUXX326nAPvUgYpl8cjtim2KsMTGU4McGfhxY3ryStI1P /njw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ojgDks7IkuPPdCcP8pjEdKvOlDmtTNpzIa6e09VNpp8=; b=MogzGiawmmsTWN3jqN+W9IuXIF3OnHj0l8jwhTxVI4MMGACRYslWJdxv9n8paJLnSo r8bclm44FoRrwn0LJVSqgwYXzSpstGnFyXwpsMMqEwpK7CEPkPGuWo2LgX5Kf4HJAhjY BoC9EJy/X4LPSqw9cfYHweyZEkpw4Yy4kEW5zGNqlzsDzu13Wt5bxLs/JhZzEEnXdfsS afIPc6huyJ1zNw5UXRPMtGUGYdmQ0i7kTCoVciFAbVSYcwIZs9ADSItMlvN8qjlYfTXM LMYBrKc+5OyNVAxPuuK/DFAR5eaYY+54rrc56mOnslAZDsUGLnoYs/MDBm49yCBYKSXk 2L4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="DJ8z/7Ce"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc33-20020a1709071c2100b0078d9db99f5esi9873245ejc.39.2022.11.14.03.48.45; Mon, 14 Nov 2022 03:49:10 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="DJ8z/7Ce"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236517AbiKNLqa (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236722AbiKNLpp (ORCPT ); Mon, 14 Nov 2022 06:45:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 793FF22B3A; Mon, 14 Nov 2022 03:44:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C5ACC6106E; Mon, 14 Nov 2022 11:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9126C433D7; Mon, 14 Nov 2022 11:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426295; bh=OSbGEYnUhjKa2m71ScF7KvfTEC1ATHNDn1CpUx6Hw/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DJ8z/7CedpLvc+/MF3CZmnF65KarkQtOfm1yX5IFr/LmkkXS8OyiGK5D6LzuK4Mwa XoMpS5SsUhiHN8EntCQVS0aMN3JXNLtGIGn9JmXD9vi5XxwcfKeGIiS4xH7MxNI8t6 vH7kjHjE20tVD8aibkNSy3K52KyjWCH1iFbLzFn+bajePCfLOF8m0ZCazRzy7geM3l IVhKr+7koeeO6NdvAEFD6DO/3P47xTvTqcxey6Tldepdy+3IUwRzfAoFgp+p+ZpuSn FXWWZL6zaWeuMoxWy0bf01evM34QctoIH3I0saRBNn4hX3uT+AVmaq7no+BRMbr/1H tJh/RQSG7pzBA== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 24/46] bpf, lto: mark interpreter jump table as __noreorder Date: Mon, 14 Nov 2022 12:43:22 +0100 Message-Id: <20221114114344.18650-25-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472038795186368?= X-GMAIL-MSGID: =?utf-8?q?1749472038795186368?= From: Andi Kleen gcc LTO has a problem that can cause static variables containing && labels to be put into a different LTO partition and then fail the build. This can happen with the jump table in the BPF interprer. Mark the interpreter function and the jump table as __noreorder, this guarantees they both end up in the first partition. Cc: Alexei Starovoitov Cc: Daniel Borkmann Cc: John Fastabend Cc: Andrii Nakryiko Cc: Martin KaFai Lau Cc: Song Liu Cc: Yonghong Song Cc: KP Singh Cc: Stanislav Fomichev Cc: Hao Luo Cc: Jiri Olsa Cc: bpf@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- kernel/bpf/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index 25a54e04560e..d40ce00622f6 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -1640,7 +1640,7 @@ u64 __weak bpf_probe_read_kernel(void *dst, u32 size, const void *unsafe_ptr) * * Return: whatever value is in %BPF_R0 at program exit */ -static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn) +static u64 __noreorder ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn) { #define BPF_INSN_2_LBL(x, y) [BPF_##x | BPF_##y] = &&x##_##y #define BPF_INSN_3_LBL(x, y, z) [BPF_##x | BPF_##y | BPF_##z] = &&x##_##y##_##z From patchwork Mon Nov 14 11:43:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19752 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098142wru; Mon, 14 Nov 2022 03:49:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf6by5Y9OD0/oNcoxs1hLOabuj/bC+MFT0vstNusjPSbIMGLPcr/LX6YIrrgzkTR601cE4oJ X-Received: by 2002:a17:907:6f1a:b0:78d:981a:d997 with SMTP id sy26-20020a1709076f1a00b0078d981ad997mr10345858ejc.654.1668426553324; Mon, 14 Nov 2022 03:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426553; cv=none; d=google.com; s=arc-20160816; b=J9x+VHOUmZQjbDsaDeNOsZBfhyH+nQscIh0pDDSeb78zGHI/wRt5Tnm1iXyiNjlxzb h1wKMj5V2KPHJLVwl0sbsj7Ypn7+8SUOaOq4X2t7PRV4aMGGAQpkdyEc4rYKbNnrKdTE 8/CScEq13zFez66nkCblosmEbWP9zD7+Vcrd7C1QkU/SbtD/0OobD+gAKTJsegwTX4M8 cVNKNPB3xRii7mbdjH84O4I7q9AoW+KMNEy9h7IFuPUMdrAmYpBa1ky/GrMQf2CMs5jA 95v1vjmDTowPUCJ6DCBfDjxMHrLbdfDzP3cZnDeie5ABsQYQpz4maRTX15HLzUJb+Ydq Pcvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Jmytq3Y5nAaTdo4BP0g+AwwvXUZln/vIi6AVZ9nX/Dc=; b=tCndZwNFNROT4aRwf7298I4GWvGiRL5KJKD+P8s9oT/Cg5663UpS4K8sI6JWS5t7U3 66cOra/XStaaWJxryvMb3rTxDPZ/J8TJYht5omymxYu8C3enkXE3Qsb9ZsZnVPz839dY MqMg/a2IsMM5uToGqEnbof1WDxwqCbUaFeac20yHZhFx1a8kmh8lBImKlP4M4koBddyx +EJFcpTvc570E1ZaxO3vuyyNWfSeTN5mVsTp0RzVFVfVorqlbNVzT/3rhgujEqSCrp3d NAJdVg3PO8eBKWn6G7TnSqS5QFifYaEjoz/DLRP5uPU0WmLHgDWtgGjSuVzUZecjJBZa qfFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PJ6WVKuI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b11-20020a17090636cb00b007a44a13536bsi6713624ejc.243.2022.11.14.03.48.48; Mon, 14 Nov 2022 03:49:13 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=PJ6WVKuI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236724AbiKNLqg (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236332AbiKNLqC (ORCPT ); Mon, 14 Nov 2022 06:46:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D3DA473 for ; Mon, 14 Nov 2022 03:44:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 53F4C6106E for ; Mon, 14 Nov 2022 11:44:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAD94C43146; Mon, 14 Nov 2022 11:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426298; bh=s+opGJ7QoOGk4sclN8NLpDopS2NNvFfrwRO9izFas60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PJ6WVKuI/QgsSuRDFCKOvAO0uUM0gU8psBNgN+vVzgutS5/SEveoHFBC8sti98ChE 21raGHbXdg1YvVHO1pwKMyCQ79tbvGbCsBATj5YZM6qdlZV07GqGvxGZAfw/B3kQsg MoY8iU5jOKJpwYVBSP2fgzkJWa3naU5SYi95ul/KKOTG3T2MMcmJbV/UetvmyFR4rO kyxdeQEndDY9ETWR1hlki3J3//BGzIO3tD1UvsGblsDOUbFQwl2QvsSt2BVK+tZpzQ Q+EvDa4orxePuIVGvDuJ9hFPzjoUk703JRBFaCQTbyKRTCU67lhK9dSnEcv9pb+Fo1 UJ+XyfhxOgjRg== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 25/46] sched, lto: mark sched classes as __noreorder Date: Mon, 14 Nov 2022 12:43:23 +0100 Message-Id: <20221114114344.18650-26-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472041560769253?= X-GMAIL-MSGID: =?utf-8?q?1749472041560769253?= From: Andi Kleen The scheduler code assumes that the scheduler classes are in a particular order in memory. gcc LTO can violate this. Specify __noreorder to avoid a boot BUG(). Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Juri Lelli Cc: Vincent Guittot Cc: Dietmar Eggemann Cc: Steven Rostedt Cc: Ben Segall Cc: Mel Gorman Cc: Daniel Bristot de Oliveira Cc: Valentin Schneider Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- kernel/sched/sched.h | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index a4a20046e586..fe2703528972 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2230,6 +2230,7 @@ static inline void set_next_task(struct rq *rq, struct task_struct *next) */ #define DEFINE_SCHED_CLASS(name) \ const struct sched_class name##_sched_class \ + __noreorder \ __aligned(__alignof__(struct sched_class)) \ __section("__" #name "_sched_class") From patchwork Mon Nov 14 11:43:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098177wru; Mon, 14 Nov 2022 03:49:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf5Mzk00Z6oiikXHEcvrsiOBQjJUt88RbzNTSbF6Qan4i034IyPzHOhY72awlz5CLMRU4x5T X-Received: by 2002:a17:906:eca7:b0:7aa:6998:ad72 with SMTP id qh7-20020a170906eca700b007aa6998ad72mr10168522ejb.763.1668426558784; Mon, 14 Nov 2022 03:49:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426558; cv=none; d=google.com; s=arc-20160816; b=KJv0fQcrhRgb0scmTNXPFCDpXTXqXpP7M8m+IUG6lB8jtWCTMdtZJpmYBZjnw4EZN2 8KCl0pZyJPrXU5WLEsQbDiAy6ujEBPTjqqbuqhHsx/AeLQTZQPNBsoue4V21KEXshmrG AOBFkgKoIXNr9pT3z+o2VggBPEpqAApzUoXTVwS6VvjRLaq/8txp2iH0zzUdz2eQfjvz PD+5UOAUZtUs5U+E+BZLepmyn0a4uOHIgByWEF1yE8+NIQOWMHN6hhZJ7a7oVkt0kkY4 NGrfVpVvzyjX5HXnB7/c7647uOAR+kuLnotRhATRqiSJ0KmRLMwkeM1LXOEl/1WYw9of i2aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/BrU/y+CSSvNZcbm3qUhy1jSpabUUTyv+j7fBbKHBRM=; b=hdvWkuJQJbCfjPdw6v68a5hZ1d5QuSNJ85YkTDdcBTWO3NJLug3XldpDe3lcpcMsTq ZlB+a0L7ALyeuaQ0UPtIsx5GblisHNrVHasT+jWURH+j2V8aTtgt73e8Hzswn+giLdSy s9zpu/vE7JN6zRyHVWCpuzHAOfDGAMYKePsLw+hwxVBKcTfQw1bIhofxFJ491jO9mpac z6PD9/7scQJMMFuZHb9x+caBZe9ayEsMuMM+Tdl3QHO6ktx9p1dc70xPsqm0HODknP3s TSOQxMaquQr30ZQ8LK0lTprecU0VR1UfhH7xeiKNmCRRVo7avn3FRMbQmDSP6HVp9ci0 rPng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OA+g6g1O; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm14-20020a170907948e00b0078d3b940ec5si521089ejc.373.2022.11.14.03.48.55; Mon, 14 Nov 2022 03:49:18 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=OA+g6g1O; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236781AbiKNLqu (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236769AbiKNLqF (ORCPT ); Mon, 14 Nov 2022 06:46:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDCD523179 for ; Mon, 14 Nov 2022 03:45:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81933B80E77 for ; Mon, 14 Nov 2022 11:45:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3997EC433D6; Mon, 14 Nov 2022 11:44:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426301; bh=5FX1a1JgcDe4CO/FI8j/3+v36Volg7rloP622gTjs4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OA+g6g1OOecEy+y6VOPK3J54mGvMkQm2tYT6ZFbxX+0wGYJHWM01XYB/5x9ld9PVo ktQcoiU9YUeFjxsllBKPobxgacW1tr1IHrVPZsiXK8EjBpyZvTtFrjM5G5dCk4x8HZ nc88qy7GvW16gdXTeBP4dZuKahL4Kr5aCEgo/L/GJirF85Y7RtvE3uyW/YtCECZ8Lr 01J3///gSOype8s079CsWY2X0rJMO1TSSGscywo63cbm0Jp6GtaC+Qd5PHI4hW1A9Q 828gJx3mCuVbH1A/6dw/5GGVj3d6bol7osArPmK8EJ1BAdoJMqnpdJWjNVVer16h8v sFHNuPR0rd9Vw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Jiri Slaby , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska Subject: [PATCH 26/46] x86/apic, lto: Mark apic_driver*() as __noreorder Date: Mon, 14 Nov 2022 12:43:24 +0100 Message-Id: <20221114114344.18650-27-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472047452030799?= X-GMAIL-MSGID: =?utf-8?q?1749472047452030799?= From: Jiri Slaby The apic code assumes that the apic drivers are in a particular order in memory. gcc LTO can violate this. So add __noreorder to apic_driver() and apic_drivers() to avoid a boot BUG(). Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/include/asm/apic.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h index 3415321c8240..9c5c69482ab0 100644 --- a/arch/x86/include/asm/apic.h +++ b/arch/x86/include/asm/apic.h @@ -363,12 +363,12 @@ extern struct apic *apic; * to enforce the order with in them. */ #define apic_driver(sym) \ - static const struct apic *__apicdrivers_##sym __used \ + static const struct apic *__apicdrivers_##sym __used __noreorder \ __aligned(sizeof(struct apic *)) \ __section(".apicdrivers") = { &sym } #define apic_drivers(sym1, sym2) \ - static struct apic *__apicdrivers_##sym1##sym2[2] __used \ + static struct apic *__apicdrivers_##sym1##sym2[2] __used __noreorder \ __aligned(sizeof(struct apic *)) \ __section(".apicdrivers") = { &sym1, &sym2 } From patchwork Mon Nov 14 11:43:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19754 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098156wru; Mon, 14 Nov 2022 03:49:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ZFukwUCDZzS7fIb6Lsx0dLJ3tHt3c0EXDnmmgWcckfgntxB5aU7qqVb0JpILWO2d5VA57 X-Received: by 2002:aa7:ccc2:0:b0:461:bff7:9783 with SMTP id y2-20020aa7ccc2000000b00461bff79783mr10980920edt.200.1668426555492; Mon, 14 Nov 2022 03:49:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426555; cv=none; d=google.com; s=arc-20160816; b=uMM0ZPGsY/rm40l9Xljr0ojuK4WZ6wDi2bBdIDWtHW024DDH/7x2hofsaFlCSz8wFX 4J9LMJH0cDXjcboloA+wR/T7jkK+NxqVIZyheWA7bHNHMTQHfULPjg6Xi6Kx7dcDlo7u rdOA1uBo1QnFPZBq9mUs/67XMgDD71xc4KTaPC7g462hNJBF1Nz/CrnCaCPxtDfTuquU 14H82hPV/OMqm4M6hjknvBF4QpY0CPSQ3mnkRSJFwkvRiDEp5kejA4KA01zI8ccQb4fO SorZnPScleUGgg1TSqii47650K+Dwo9JfaTQJ6Qu1eFQXqO36T30n/MMhySVNH3Fnm4E XUAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=niYE+2vHdFeabX/BtdymKh2nPC3u0FdbpZcA/6S66pc=; b=Yr5TgPSdkXa6nh7D5usCeoFev0r7aAN8fG9hTMg/vGmzzEDGpiQCLv55ipx6Pvtfuy 5t8BOulwA7PV+wugGabkBalLETGmiNiojzJsz0yz6EmDHAxEL/saVnPm191JH0Itqzhi 8p3JNleWGxlRfslsJcfhTF6dVG7h4ablGJl6QAcqo4Qq4NHeF0jlXmaSKprRE0JbnnW+ mGz41fEEFr3XoibiWOd3BaVDwABU10ZSkJ6PdrqFzmJgbnz9//FuE0+ORcmpELRYjgGo LjqhOErk+rLkJd7MqUV6zKI221zCSGIWw6y7MVB/E7Gu+oZtaUYxQRBzXOZnPMNbD7Xi G51g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c4YB722i; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p26-20020a056402075a00b004517955b673si2012762edy.124.2022.11.14.03.48.50; Mon, 14 Nov 2022 03:49:15 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=c4YB722i; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236577AbiKNLql (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236765AbiKNLqF (ORCPT ); Mon, 14 Nov 2022 06:46:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2AFC2315D for ; Mon, 14 Nov 2022 03:45:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 505DA6106E for ; Mon, 14 Nov 2022 11:45:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5C99C4314E; Mon, 14 Nov 2022 11:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426302; bh=6jLF3Au9Jv2wIjIVvswUXpj2PpU4T7lNtaA1NXDNBOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c4YB722iE9i9n7o4La+2/68ElAJk/ENrJDWwub5IjMQwrsNvbdovTdtnYYiVqNIbA rM+HNFsjMR4hlolITBP7Fwsv26I6qgBXdIwFGAOXLPNvO3aQf4YtHj5/YYsn6POrCN rn71tz+N7Q0f1dJaJs9jasaElQqXaluaD2iz2cXu4RFJEn52RW5m2aQX7Wn3mdsIR4 MycUe+s1pbpKSIXUshnIkYm+mT03ixbt19GFzEEfNqmZy0TXWmhKHW6+mm2NfqEXVP 8sSocr5JcNs4IdtcfS/kvM65FvB6LyYaaA532o+ljK7NFI6mrDHnEnI9LgBLZgMNRa lbqTThPypuD7w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 27/46] linkage, lto: use C version for SYSCALL_ALIAS() / cond_syscall() Date: Mon, 14 Nov 2022 12:43:25 +0100 Message-Id: <20221114114344.18650-28-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472044184429962?= X-GMAIL-MSGID: =?utf-8?q?1749472044184429962?= From: Andi Kleen With LTO, aliases get largely resolved in the compiler, not in the linker. Implement cond_syscall() and SYSCALL_ALIAS() in C to let the compiler understand the aliases so that it can resolve them properly. Likely, the architecture specific versions are now not needed anymore, but they are kept for now. There is one subtlety here: The assembler version didn't care whether there was a prototype or not. This variant assumes there is no prototype because it uses a dummy (void) signature. This works for sys_ni.c, but breaks for kernel/time/posix-stubs.c. To avoid problems there, a second variant of the macro (_PROTO) is added. That uses the previously declared type (by typeof()). I actually tried to avoid this by adding prototypes for SYS_NI() and use only the _PROTO variant, but it resulted in very large patches and lots of problems with all the different cases. Eventually, I gave up and just use the prototype case in posix-stubs.c [js] gcc >= 8 emits Wattribute-alias warning. Work around that by __diag_*(). This is ugly, but due to gcc bug, I see no better option. Suggestions welcome. Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/linkage.h | 16 ++++++++-------- kernel/time/posix-stubs.c | 19 +++++++++++++++++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/include/linux/linkage.h b/include/linux/linkage.h index 1feab6136b5b..688b9bb80e96 100644 --- a/include/linux/linkage.h +++ b/include/linux/linkage.h @@ -23,17 +23,17 @@ #endif #ifndef cond_syscall -#define cond_syscall(x) asm( \ - ".weak " __stringify(x) "\n\t" \ - ".set " __stringify(x) "," \ - __stringify(sys_ni_syscall)) +#define cond_syscall(x) \ + extern long x(void) __attribute__((alias("sys_ni_syscall"), weak)); #endif #ifndef SYSCALL_ALIAS -#define SYSCALL_ALIAS(alias, name) asm( \ - ".globl " __stringify(alias) "\n\t" \ - ".set " __stringify(alias) "," \ - __stringify(name)) +#define SYSCALL_ALIAS(a, name) \ + long a(void) __attribute__((alias(__stringify(name)))) +#define SYSCALL_ALIAS_PROTO(a, name) \ + typeof(a) a __attribute__((alias(__stringify(name)))) +#else +#define SYSCALL_ALIAS_PROTO(a, name) SYSCALL_ALIAS(a, name) #endif #define __page_aligned_data __section(".data..page_aligned") __aligned(PAGE_SIZE) diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c index 90ea5f373e50..23e1a63adc2b 100644 --- a/kernel/time/posix-stubs.c +++ b/kernel/time/posix-stubs.c @@ -31,13 +31,21 @@ asmlinkage long sys_ni_posix_timers(void) } #ifndef SYS_NI -#define SYS_NI(name) SYSCALL_ALIAS(sys_##name, sys_ni_posix_timers) +#define SYS_NI(name) SYSCALL_ALIAS_PROTO(sys_##name, sys_ni_posix_timers) #endif #ifndef COMPAT_SYS_NI -#define COMPAT_SYS_NI(name) SYSCALL_ALIAS(compat_sys_##name, sys_ni_posix_timers) +#define COMPAT_SYS_NI(name) \ + SYSCALL_ALIAS_PROTO(compat_sys_##name, sys_ni_posix_timers) #endif +/* + * This cannot go to SYS_NI() or SYSCALL_ALIAS_PROTO() due to gcc bug fixed in + * gcc >= 13 (cf. PR 97498). I wonder how is __SYSCALL_DEFINEx() able to work? + */ +__diag_push(); +__diag_ignore(GCC, 8, "-Wattribute-alias", "Alias to nonimplemented syscall"); + SYS_NI(timer_create); SYS_NI(timer_gettime); SYS_NI(timer_getoverrun); @@ -51,6 +59,8 @@ SYS_NI(clock_adjtime32); SYS_NI(alarm); #endif +__diag_pop(); + /* * We preserve minimal support for CLOCK_REALTIME and CLOCK_MONOTONIC * as it is easy to remain compatible with little code. CLOCK_BOOTTIME @@ -157,6 +167,9 @@ SYSCALL_DEFINE4(clock_nanosleep, const clockid_t, which_clock, int, flags, which_clock); } +__diag_push(); +__diag_ignore(GCC, 8, "-Wattribute-alias", "Alias to nonimplemented syscall"); + #ifdef CONFIG_COMPAT COMPAT_SYS_NI(timer_create); #endif @@ -170,6 +183,8 @@ COMPAT_SYS_NI(setitimer); SYS_NI(timer_settime32); SYS_NI(timer_gettime32); +__diag_pop(); + SYSCALL_DEFINE2(clock_settime32, const clockid_t, which_clock, struct old_timespec32 __user *, tp) { From patchwork Mon Nov 14 11:43:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19753 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098141wru; Mon, 14 Nov 2022 03:49:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf6SpohLPO+pmUyFfJJNB5ithIelaTiVLX2remJJIro5gtdbe8Lvl3C8IBk+2HJqeJFuPG/V X-Received: by 2002:a63:da0c:0:b0:470:8a45:32a8 with SMTP id c12-20020a63da0c000000b004708a4532a8mr11037253pgh.543.1668426553164; Mon, 14 Nov 2022 03:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426553; cv=none; d=google.com; s=arc-20160816; b=N6izBSZoaOzx5lbst+wR21bKaIyv1ESY8zsvKZMf7F9K/hhIIYn5Q6FRCt2cB/5AJa fczO9myCbvK1qOJoPg1CoK14lUmIzKFOwGBEkZWnddAVBUnbTnUo8X1y5rDcAe62ZucU TSPFlBQTa7eHTuthej94utCLL14Ra+t/zwslzapENJ4D3fSaZJx1S/ZE+wSgPWNFMAXE K8TPt5uwAQL1fiEkmN1G26MEipGbPmaVctBagx5WDCImQwonOpQpAc/2UfZBsINlfifX +g2v4uwlKLmHFMoZPw2sCtEnVYZ1y5AxTHZbcDvWX4zg10tYJeHwK8OaJ6SHiYjhEfDg mrQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hajIKub3AJJOWYXmTshMo76USdrhddqRwcmfQzbCzvw=; b=QHLSyvA7WostFCrFxgOcFQGq5UIWtQk6tviT8M0pScU12apSn/QMpk/zmyuqbReikC 9xd5Db5J/k0dfq226AHqvU3y77Wz7tBxWpGL1deF9xoug0B1D0slBBOpzm9HX/dOv+v2 gS83HKbHYVIlGWOBPNJdlnojkmgtFaDS7A1CFilDJfhfpdHTYXGBRKttBWlASOKJ0Aor QXmeMgFa+vhZa3jCN0XGq58cpQEkQOuslGLFmsNkWc9Mll6a41F7CW+cnXy2cj6ODDtL 6ZsY7kaA22sZ3V8hzrc9z4P/aScsuzTmusNVdnNbIo/WWcWgGuNQftvUwE83GSmJxYLQ Qf8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=axz9z9rm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a17090322ca00b00186e114bedfsi10690518plg.126.2022.11.14.03.49.00; Mon, 14 Nov 2022 03:49:13 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=axz9z9rm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236660AbiKNLqy (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236779AbiKNLqH (ORCPT ); Mon, 14 Nov 2022 06:46:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F110523392; Mon, 14 Nov 2022 03:45:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8B9556106E; Mon, 14 Nov 2022 11:45:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31EBBC433D6; Mon, 14 Nov 2022 11:45:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426305; bh=cDaL2fr4ds1QFPZqTUk+kKTp3g2JDWGKaf0MMC6B8X0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=axz9z9rmp0DF1yNW2Noyvv4Ams50QT88IMMv7mytIv0BAoxo3ZprIJOr3jD2qNkrH hLr2L8iLnT9EqQrGmrVi+ERKM2z7/wk2jkUtqr2gQggsZfBszIRDNeWhDZG0m/xMPI g6leDXiyanYdsK11/1nbv9vxpama8/y0C7iVa5DVRx60ByfqeVTVBFztfRXZJdEy1G vlLWZCVQlFb/1TNrxcaswglRAzWwC4BgmYFyM8qtqLiXtG+5cBribG3CViVtlQEqZE ZksYWKtDotJ7HbrcxfDMelz0cNtFB3Cf4kpoaaIORBy+haBnZdaPlB7QSUCHuNlwsq 7N3JHoXdEPk5Q== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 28/46] scripts, lto: re-add gcc-ld Date: Mon, 14 Nov 2022 12:43:26 +0100 Message-Id: <20221114114344.18650-29-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472041375665216?= X-GMAIL-MSGID: =?utf-8?q?1749472041375665216?= From: Andi Kleen The primary goal of the script is to mangle linker command line arguments into something which gcc understands. Such as converting "-z now" into "-Wl,-z,now". The script was removed by commit 86879fd277e8 (scripts: remove obsolete gcc-ld script) as there was no use in the kernel. It had been added long time ago to support exactly these lto patches, so we need to add it back now. Since the removed version, it is improved a bit: * some missing linker and gcc command line arguments were added, and * when V=1 is specified, it prints the final gcc command line [js] rebase + commit message massage Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- scripts/gcc-ld | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 scripts/gcc-ld diff --git a/scripts/gcc-ld b/scripts/gcc-ld new file mode 100755 index 000000000000..13e85ece8d04 --- /dev/null +++ b/scripts/gcc-ld @@ -0,0 +1,40 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# run gcc with ld options +# used as a wrapper to execute link time optimizations +# yes virginia, this is not pretty + +ARGS="-nostdlib" + +for j in "$@" ; do + if [ "$j" = -v ] ; then + exec `$CC -print-prog-name=ld` -v + fi +done + +while [ "$1" != "" ] ; do + case "$1" in + -save-temps*|-m32|-m64) N="$1" ;; + -r) N="$1" ;; + -flinker-output*) N="$1" ;; + -[Wg]*) N="$1" ;; + -[olv]|-[Ofd]*|-nostdlib) N="$1" ;; + --end-group|--start-group|--whole-archive|--no-whole-archive|\ +--no-undefined|--hash-style*|--build-id*|--eh-frame-hdr|-Bsymbolic) + N="-Wl,$1" ;; + -[RTFGhIezcbyYu]*|\ +--script|--defsym|-init|-Map|--oformat|-rpath|\ +-rpath-link|--sort-section|--section-start|-Tbss|-Tdata|-Ttext|-soname|\ +--version-script|--dynamic-list|--version-exports-symbol|--wrap|-m|-z) + A="$1" ; shift ; N="-Wl,$A,$1" ;; + -[m]*) N="$1" ;; + -*) N="-Wl,$1" ;; + *) N="$1" ;; + esac + ARGS="$ARGS $N" + shift +done + +[ -n "$V" ] && echo >&2 $CC $ARGS + +exec $CC $ARGS From patchwork Mon Nov 14 11:43:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098466wru; Mon, 14 Nov 2022 03:50:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf68NnTI1hjw5BJJANf+oy+PpszF/hZre8VKozteOg3Y97fY+SiyWE4tCmZW8z+HyA2GEWUL X-Received: by 2002:a17:906:7203:b0:7ae:664a:a7d2 with SMTP id m3-20020a170906720300b007ae664aa7d2mr9886463ejk.676.1668426604295; Mon, 14 Nov 2022 03:50:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426604; cv=none; d=google.com; s=arc-20160816; b=mFkgKb2DPwanKlzcyKIrFw4dGUEo4eQM3gBxQfuuQRz404Ijl55DqnJMb3DASpuTSo MePsmskpM/lbULvksvrOaoBmwTpljwFz2f7NYzbihKAnYkIhmD/hPi0rBZ2RXjrxCjqv VlH3cc3dM5/9VfZIP79U9VRWk8R1NYNJV906qGOC0LXbcIlL1jx8fkR3+h298/aJRKpn N4w/REoj2GffXCyyfCFW9rIqw2bVjxKKpA+tbZsQKuPL+ZSZrwHIIUs73pRYxoSCrTcJ FswNtdRgbeKOZ4B1csJQ69XNnjfx3AdPiFPZHnmOArDeSHborEl4i8wLlRv0nZjBopLH ebnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EJAJFHR7RCtoqSc/MLHiIuiYndNYnthA9bZlw039hpQ=; b=qdvag0tiTRKJZDjQGoSnwD7CM68piSY+Aredky37Xp01SfeU2PcPU8ulKUXR0+Jgi9 2nHMowPwip+HsirJ/tZ5gWP118QUI8OczeL95Y+hx+G9zIIblcPdebXVJLo3bUfptSpl jL0jTmXdY1J+5LCRc1hCisesAgFWrlPsCrnl4ROH0GaxOMlyK7KR56W5s3MzXCp0dbtf 3vnQADGRPLwSBQyjCz/9/8+m7XHYYnGJF/7iM3WsE5Cn2mEMuz7QFfvP8eG8f78YRWEP dxWj229olRZDTbkKu1/pEBKsPhnHuoURpZoPb8l3/djnsLGoN+RIjtgbDDl9oDyxy1vb AyBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ig5CDdXq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz3-20020a1709072ce300b00757bd7f53dcsi10309071ejc.14.2022.11.14.03.49.40; Mon, 14 Nov 2022 03:50:04 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=ig5CDdXq; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236769AbiKNLq4 (ORCPT + 99 others); Mon, 14 Nov 2022 06:46:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236602AbiKNLqO (ORCPT ); Mon, 14 Nov 2022 06:46:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98790233BD; Mon, 14 Nov 2022 03:45:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCE9C61087; Mon, 14 Nov 2022 11:45:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 731AFC433D7; Mon, 14 Nov 2022 11:45:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426307; bh=rax9Sk0B97anfjE870tVIfylOGOMvkqIjn17Y4+e0zw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ig5CDdXql15Gd4fTP+IlvjoNHuzHJ1zDAzs4QbD1+lazKnKCGuM6a3Uft+OMx66Xt 8U15M+SeRg6aVyP0214WZo5NmzOwzkrpzlLdbt6OLr1347K9G60URIFBT2/NARAjcD pycuPOnQGZmhBS/w2xZXJquS8UwgI3vi0Zc1ItKB2gra8PWZ/qPLncpVkxiczC9CJr j9/JIbQMIt/EEdfFRm9cP8A+6YX4oU5qO6oEBnbkU3+FZQEE4MrOHFVE0I5u0Pxf+N E9RFsrchKpk8KrzeUB7FDEDS2psNEjuwE451izXf/2+67zbtlMJtUy5FXJyWrNSZEt O9bKWwNdvdvuw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 29/46] scripts, lto: use CONFIG_LTO for many LTO specific actions Date: Mon, 14 Nov 2022 12:43:27 +0100 Message-Id: <20221114114344.18650-30-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472095179433390?= X-GMAIL-MSGID: =?utf-8?q?1749472095179433390?= From: Andi Kleen The clang LTO and the gcc LTO share some changes in Makefiles and build scripts. Change the common ones to use CONFIG_LTO instead of CONFIG_LTO_CLANG so that they can be used by gcc too. [js] fix scripts/link-vmlinux.sh too Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- Makefile | 2 +- include/asm-generic/vmlinux.lds.h | 2 +- kernel/kallsyms.c | 2 +- scripts/Makefile.build | 2 +- scripts/Makefile.lib | 2 +- scripts/link-vmlinux.sh | 2 +- scripts/module.lds.S | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 58cd4f5e1c3a..0b723c903819 100644 --- a/Makefile +++ b/Makefile @@ -992,7 +992,7 @@ endif endif endif -ifdef CONFIG_LTO +ifdef CONFIG_LTO_CLANG KBUILD_CFLAGS += -fno-lto $(CC_FLAGS_LTO) KBUILD_AFLAGS += -fno-lto export CC_FLAGS_LTO diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 3dc5824141cd..5e2179dd41d5 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -96,7 +96,7 @@ * RODATA_MAIN is not used because existing code already defines .rodata.x * sections to be brought in with rodata. */ -#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO_CLANG) +#if defined(CONFIG_LD_DEAD_CODE_DATA_ELIMINATION) || defined(CONFIG_LTO) #define TEXT_MAIN .text .text.[0-9a-zA-Z_]* #define DATA_MAIN .data .data.[0-9a-zA-Z_]* .data..L* .data..compoundliteral* .data.$__unnamed_* .data.$L* #define SDATA_MAIN .sdata .sdata.[0-9a-zA-Z_]* diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 60c20f301a6b..1d4557ae090f 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -167,7 +167,7 @@ static bool cleanup_symbol_name(char *s) { char *res; - if (!IS_ENABLED(CONFIG_LTO_CLANG)) + if (!IS_ENABLED(CONFIG_LTO)) return false; /* diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 564a20ce2667..0a28e3884efe 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -153,7 +153,7 @@ is-single-obj-m = $(and $(part-of-module),$(filter $@, $(obj-m)),y) # When a module consists of a single object, there is no reason to keep LLVM IR. # Make $(LD) covert LLVM IR to ELF here. -ifdef CONFIG_LTO_CLANG +ifdef CONFIG_LTO cmd_ld_single_m = $(if $(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-target) $@) endif diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 3aa384cec76b..ac918fd84d96 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -269,7 +269,7 @@ objtool-args = $(objtool-args-y) \ $(if $(delay-objtool), --link) \ $(if $(part-of-module), --module) -delay-objtool := $(or $(CONFIG_LTO_CLANG),$(CONFIG_X86_KERNEL_IBT)) +delay-objtool := $(or $(CONFIG_LTO),$(CONFIG_X86_KERNEL_IBT)) cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool-args) $@) cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd) diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 918470d768e9..652f33be9549 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -60,7 +60,7 @@ vmlinux_link() # skip output file argument shift - if is_enabled CONFIG_LTO_CLANG || is_enabled CONFIG_X86_KERNEL_IBT; then + if is_enabled CONFIG_LTO || is_enabled CONFIG_X86_KERNEL_IBT; then # Use vmlinux.o instead of performing the slow LTO link again. objs=vmlinux.o libs= diff --git a/scripts/module.lds.S b/scripts/module.lds.S index da4bddd26171..b36b0527b0a8 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -27,7 +27,7 @@ SECTIONS { __kcfi_traps : { KEEP(*(.kcfi_traps)) } #endif -#ifdef CONFIG_LTO_CLANG +#ifdef CONFIG_LTO /* * With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and * -ffunction-sections, which increases the size of the final module. From patchwork Mon Nov 14 11:43:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19757 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098269wru; Mon, 14 Nov 2022 03:49:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Rmc+bf/2zJX3iQ7RIKcwA1Iv2jiW8OgOBIGVFEZJznSq8oWryO1rRNKAbnIjBcBpoFshU X-Received: by 2002:aa7:cd49:0:b0:461:60e8:7ac1 with SMTP id v9-20020aa7cd49000000b0046160e87ac1mr10282008edw.45.1668426571789; Mon, 14 Nov 2022 03:49:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426571; cv=none; d=google.com; s=arc-20160816; b=AZGR3GtZDos0je5RZgAYChfL2fyLPchyqTkTdTkfVo5DKI3Sx30Uph8/n2zrCufRr0 N6ovcOnF1OB8HgJbttrMIMqvD0oP7u7HZ0Bxqun7OvMBeHXZVQ648k+qKvvxpQuL58qv NWPL0+mNdlvbLAZd4naR5xNW90RDh54e8GioQvnOdQ7Hs1g+InWmDQcA5s6PUCHQ7Cjm 5T6NE4aSq8lKCZT/D/bpKF8IJNp+l56c53jPWiiJQ37DVTKdWqv2XH6QBU4wAThVon7Q Sp48Y2EueQIPUdkyq0Uxzpm9KM+IsX9o3s9W9w83dy8ffnu4yjF+YkYYwCTmiqzw5gNw 1tSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DTB/FFiUivOFPS/OMdNPchnG6WIkGLKFpeANgztjJVM=; b=ylzKuvRMvOtqqefj/WXOyRkBrIf8gSO+i6dRBK00SilkQwDSPmKZaSq1maceXi3gc2 a8rkOIte8Nq9V1UGa2mg8ZgoYdxE/lTrAcGhLa7VjUnu+HOhez/JG8/pTXtrpLuYiaRa 9+mD879LBHJEJ6oyhLhEwwV3uzXfd4Dg7hYUYPq9FZdYxf+dHX5U2ERb4G/8+h3vsAs6 5RjnB+N6dL12YWb7v0luMUi7RXJeV1j+bOL/qcb96Op8cAemeuW3+W23nyxrx5pmGAyt 7QUDtNwuDxrIJGB0A8JtqEJ89Aq8eJmypFUokRRiaytllc+acsv66jkXYws838EWayc4 ErAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nCVxoEI+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wt5-20020a170906ee8500b0073d8830e4c7si8757087ejb.954.2022.11.14.03.49.08; Mon, 14 Nov 2022 03:49:31 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=nCVxoEI+; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235592AbiKNLrd (ORCPT + 99 others); Mon, 14 Nov 2022 06:47:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236796AbiKNLqe (ORCPT ); Mon, 14 Nov 2022 06:46:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BFC423EAC; Mon, 14 Nov 2022 03:45:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0562F6108D; Mon, 14 Nov 2022 11:45:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6DE6C433B5; Mon, 14 Nov 2022 11:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426310; bh=U88ByfantOuqzsZrA5yzPeb/FIn96646m0chM2LVf7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nCVxoEI+5LJxBX9rN6Wc4juqda9V3epctKjzV0CwK6X+3ichJiOIK60Tu2gpnW8ph wOAUVqcC1DzgiZSNap1P1bfMgvh5IKkk+HrZG9yDldZkvc9ZMIneUY9LvIXSzW7SA5 pod26Nz6sLlRYYh/pyp7q21H7bN1si2MZEeOm1mEDfYOIBK/nqolX9f/QstqZNR4w/ /91dtHhwKmPvVUoQ3QcthWqBXqzarLnpckf5WCFtmsmZY2KAaNgA76W9ARF8ZLQ1bP E7rTL9Z7ENOYAFF9VKlIIMG/lntAB6YMs9mPj4biyKADkCzOVnfGzr5x8wL5qRed3+ Qhg0VmAt/jt9A== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Richard Biener , Jan Hubicka , "H . J . Lu" , Don Zickus , Martin Liska , Bagas Sanjaya , Jiri Slaby Subject: [PATCH 30/46] Kbuild, lto: Add Link Time Optimization support Date: Mon, 14 Nov 2022 12:43:28 +0100 Message-Id: <20221114114344.18650-31-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472060624205442?= X-GMAIL-MSGID: =?utf-8?q?1749472060624205442?= From: Andi Kleen This patch adds gcc LTO support. It leverages some of the existing support for clang LTO. With LTO, gcc will do whole program optimizations for the whole kernel and each module. This increases compile time, but can generate faster and smaller code and allows the compiler to do global checking. For example the compiler can complain now about type mismatches for symbols between different files. LTO allows gcc to inline functions between different files and do various other optimization across the whole binary. The LTO patches have been used for many years by various users, mostly to make their kernel smaller. The original versions date back to 2012. This version has a lot of outdated cruft dropped and doesn't need any special tool chain (except for new enough) anymore. This adds the basic Kbuild plumbing for LTO: * Add a new LDFINAL variable that controls the final link for vmlinux or module. In this case we call gcc-ld instead of ld, to run the LTO step. * Add Makefile support to enable LTO For more information see Documentation/kbuild/lto-build.rst Thanks to H.J. Lu, Joe Mario, Honza Hubicka, Richard Biener, Don Zickus, Changlong Xie, Gleb Schukin, Martin Liska, various github contributors, who helped with this project (and probably some more who I forgot, sorry). [js] pass -flto only once (the one with jobserver) [ml] "-m: command not found" and whitespace fix [bs] fixed Documentation issues: * blank line padding before single requirement list * use bullet list for FAQ * use bullet lists for external link references list * add LTO documentation to toc index Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Cc: Richard Biener Cc: Jan Hubicka Cc: H.J. Lu Cc: Don Zickus Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Bagas Sanjaya Signed-off-by: Jiri Slaby --- Documentation/kbuild/index.rst | 2 + Documentation/kbuild/lto-build.rst | 76 ++++++++++++++++++++++++++++++ Makefile | 4 +- arch/Kconfig | 52 ++++++++++++++++++++ scripts/Makefile.build | 9 ++-- scripts/Makefile.lto | 43 +++++++++++++++++ scripts/Makefile.modfinal | 2 +- scripts/Makefile.vmlinux | 3 +- scripts/Makefile.vmlinux_o | 4 +- scripts/link-vmlinux.sh | 7 +-- 10 files changed, 190 insertions(+), 12 deletions(-) create mode 100644 Documentation/kbuild/lto-build.rst create mode 100644 scripts/Makefile.lto diff --git a/Documentation/kbuild/index.rst b/Documentation/kbuild/index.rst index cee2f99f734b..1937eee7c437 100644 --- a/Documentation/kbuild/index.rst +++ b/Documentation/kbuild/index.rst @@ -22,6 +22,8 @@ Kernel Build System gcc-plugins llvm + lto-build + .. only:: subproject and html Indices diff --git a/Documentation/kbuild/lto-build.rst b/Documentation/kbuild/lto-build.rst new file mode 100644 index 000000000000..3fb17342e72f --- /dev/null +++ b/Documentation/kbuild/lto-build.rst @@ -0,0 +1,76 @@ +===================================================== +gcc link time optimization (LTO) for the Linux kernel +===================================================== + +Link Time Optimization allows the compiler to optimize the complete program +instead of just each file. + +The compiler can inline functions between files and do various other global +optimizations, like specializing functions for common parameters, +determing when global variables are clobbered, making functions pure/const, +propagating constants globally, removing unneeded data and others. + +It will also drop unused functions which can make the kernel +image smaller in some circumstances, in particular for small kernel +configurations. + +For small monolithic kernels it can throw away unused code very effectively +(especially when modules are disabled) and usually shrinks +the code size. + +Build time and memory consumption at build time will increase, depending +on the size of the largest binary. Modular kernels are less affected. +With LTO incremental builds are less incremental, as always the whole +binary needs to be re-optimized (but not re-parsed) + +Oopses can be somewhat more difficult to read, due to the more aggressive +inlining: it helps to use scripts/faddr2line. + +It is currently incompatible with live patching. + +Normal "reasonable" builds work with less than 4GB of RAM, but very large +configurations like allyesconfig typically need more memory. The actual +memory needed depends on the available memory (gcc sizes its garbage +collector pools based on that or on the ulimit -m limits) and +the compiler version. + +Requirements: +------------- + +- Enough memory: 4GB for a standard build, more for allyesconfig + The peak memory usage happens single threaded (when lto-wpa merges types), + so dialing back -j options will not help much. + +A 32bit hosted compiler is unlikely to work due to the memory requirements. +You can however build a kernel targeted at 32bit on a 64bit host. + +FAQs: +----- + +* I get a section type attribute conflict + + Usually because of someone doing const __initdata (should be + const __initconst) or const __read_mostly (should be just const). Check + both symbols reported by gcc. + +References: +----------- + +* Presentation on Kernel LTO + (note, performance numbers/details totally outdated.) + + http://halobates.de/kernel-lto.pdf + +* Generic gcc LTO: + + * http://www.ucw.cz/~hubicka/slides/labs2013.pdf + * http://www.hipeac.net/system/files/barcelona.pdf + +* Somewhat outdated too (from GCC site): + + * http://gcc.gnu.org/projects/lto/lto.pdf + * http://gcc.gnu.org/projects/lto/whopr.pdf + +Happy Link-Time-Optimizing! + +Andi Kleen diff --git a/Makefile b/Makefile index 0b723c903819..d0dfb5ca2b21 100644 --- a/Makefile +++ b/Makefile @@ -482,6 +482,7 @@ KBUILD_HOSTLDLIBS := $(HOST_LFS_LIBS) $(HOSTLDLIBS) # Make variables (CC, etc...) CPP = $(CC) -E +LDFINAL = $(LD) ifneq ($(LLVM),) CC = $(LLVM_PREFIX)clang$(LLVM_SUFFIX) LD = $(LLVM_PREFIX)ld.lld$(LLVM_SUFFIX) @@ -604,7 +605,7 @@ export RUSTC RUSTDOC RUSTFMT RUSTC_OR_CLIPPY_QUIET RUSTC_OR_CLIPPY BINDGEN CARGO export HOSTRUSTC KBUILD_HOSTRUSTFLAGS export CPP AR NM STRIP OBJCOPY OBJDUMP READELF PAHOLE RESOLVE_BTFIDS LEX YACC AWK INSTALLKERNEL export PERL PYTHON3 CHECK CHECKFLAGS MAKE UTS_MACHINE HOSTCXX -export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD +export KGZIP KBZIP2 KLZOP LZMA LZ4 XZ ZSTD LDFINAL export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS @@ -1085,6 +1086,7 @@ include-$(CONFIG_KMSAN) += scripts/Makefile.kmsan include-$(CONFIG_UBSAN) += scripts/Makefile.ubsan include-$(CONFIG_KCOV) += scripts/Makefile.kcov include-$(CONFIG_RANDSTRUCT) += scripts/Makefile.randstruct +include-$(CONFIG_LTO_GCC) += scripts/Makefile.lto include-$(CONFIG_GCC_PLUGINS) += scripts/Makefile.gcc-plugins include $(addprefix $(srctree)/, $(include-y)) diff --git a/arch/Kconfig b/arch/Kconfig index 8f138e580d1a..ad52c8fddfb4 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -689,6 +689,21 @@ config HAS_LTO_CLANG The compiler and Kconfig options support building with Clang's LTO. +config ARCH_SUPPORTS_LTO_GCC + bool + +# Some ar versions leak file descriptors when using the LTO +# plugin and cause strange errors when ulimit -n is too low. +# Pick an arbitrary threshold, which should be enough for most +# kernel configs. This was a regression that is only +# in some transient binutils version, so either older or +# new enough is ok. +# This might not be the exact range with this bug. +config BAD_AR + depends on LD_VERSION = 23000 + depends on $(shell,ulimit -n) < 4000 + def_bool y + choice prompt "Link Time Optimization (LTO)" default LTO_NONE @@ -736,8 +751,45 @@ config LTO_CLANG_THIN https://clang.llvm.org/docs/ThinLTO.html If unsure, say Y. + +config LTO_GCC + bool "gcc LTO" + depends on ARCH_SUPPORTS_LTO_GCC && CC_IS_GCC + depends on GCC_VERSION >= 100300 + depends on LD_VERSION >= 22700 + depends on !BAD_AR + select LTO + help + Enable whole program (link time) optimizations (LTO) for the whole + kernel and each module. This usually increases compile time, + especially for incremential builds, but tends to generate better code + as well as some global checks. + + It allows the compiler to inline functions between different files + and do other global optimization, like propagating constants between + functions, determine side effects of functions, avoid unnecessary + register saving around functions, or optimize unused function + arguments. It also allows the compiler to drop unused functions. + + With this option the compiler will also do some global checking over + different source files. + + This requires a gcc 10.3 or later compiler and binutils >= 2.27. + + On larger non modular configurations this may need more than 4GB of + RAM for the link phase, as well as a 64bit host compiler. + + For more information see Documentation/kbuild/lto-build.rst endchoice +config LTO_CP_CLONE + bool "Allow aggressive cloning for function specialization" + depends on LTO_GCC + help + Allow the compiler to clone and specialize functions for specific + arguments when it determines these arguments are commonly + called. Experimential. Will increase text size. + config ARCH_SUPPORTS_CFI_CLANG bool help diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 0a28e3884efe..9b522c9efcb6 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -154,7 +154,7 @@ is-single-obj-m = $(and $(part-of-module),$(filter $@, $(obj-m)),y) # When a module consists of a single object, there is no reason to keep LLVM IR. # Make $(LD) covert LLVM IR to ELF here. ifdef CONFIG_LTO -cmd_ld_single_m = $(if $(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-target) $@) +cmd_ld_single_m = $(if $(is-single-obj-m), ; $(LDFINAL) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-target) $@) endif quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ @@ -265,7 +265,8 @@ $(obj)/%.usyms: $(obj)/%.o FORCE $(call if_changed,undefined_syms) quiet_cmd_cc_lst_c = MKLST $@ - cmd_cc_lst_c = $(CC) $(c_flags) -g -c -o $*.o $< && \ + cmd_cc_lst_c = $(if $(CONFIG_LTO),$(warning Listing in LTO mode does not match final binary)) \ + $(CC) $(c_flags) -g -c -o $*.o $< && \ $(CONFIG_SHELL) $(srctree)/scripts/makelst $*.o \ System.map $(OBJDUMP) > $@ @@ -446,8 +447,8 @@ $(obj)/modules.order: $(obj-m) FORCE $(obj)/lib.a: $(lib-y) FORCE $(call if_changed,ar) -quiet_cmd_ld_multi_m = LD [M] $@ - cmd_ld_multi_m = $(LD) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@) $(cmd_objtool) +quiet_cmd_ld_multi_m = LDFINAL [M] $@ + cmd_ld_multi_m = $(LDFINAL) $(ld_flags) -r -o $@ @$(patsubst %.o,%.mod,$@) $(cmd_objtool) define rule_ld_multi_m $(call cmd_and_savecmd,ld_multi_m) diff --git a/scripts/Makefile.lto b/scripts/Makefile.lto new file mode 100644 index 000000000000..33ac0da2bb47 --- /dev/null +++ b/scripts/Makefile.lto @@ -0,0 +1,43 @@ +# +# Support for gcc link time optimization +# + +DISABLE_LTO_GCC := +export DISABLE_LTO_GCC + +ifdef CONFIG_LTO_GCC + CC_FLAGS_LTO_GCC := -flto + DISABLE_LTO_GCC := -fno-lto + + KBUILD_CFLAGS += ${CC_FLAGS_LTO_GCC} + + CC_FLAGS_LTO := -flto + export CC_FLAGS_LTO + + lto-flags-y := -flinker-output=nolto-rel -flto=jobserver + lto-flags-y += -fwhole-program + + lto-flags-$(CONFIG_LTO_CP_CLONE) += -fipa-cp-clone + + # allow extra flags from command line + lto-flags-y += ${LTO_EXTRA_CFLAGS} + + # For LTO we need to use gcc to do the linking, not ld + # directly. Use a wrapper to convert the ld command line + # to gcc + LDFINAL := ${CONFIG_SHELL} ${srctree}/scripts/gcc-ld \ + ${lto-flags-y} + + # LTO gcc creates a lot of files in TMPDIR, and with /tmp as tmpfs + # it's easy to drive the machine OOM. Use the object directory + # instead for temporaries. + # This has the drawback that there might be some junk more visible + # after interrupted compilations, but you would have that junk + # there anyways in /tmp. + TMPDIR ?= $(objtree) + export TMPDIR + + # use plugin aware tools + AR = $(CROSS_COMPILE)gcc-ar + NM = $(CROSS_COMPILE)gcc-nm +endif # CONFIG_LTO_GCC diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index 25bedd83644b..c52536c91c8c 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -32,7 +32,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) quiet_cmd_ld_ko_o = LD [M] $@ cmd_ld_ko_o += \ - $(LD) -r $(KBUILD_LDFLAGS) \ + $(LDFINAL) -r $(KBUILD_LDFLAGS) \ $(KBUILD_LDFLAGS_MODULE) $(LDFLAGS_MODULE) \ -T scripts/module.lds -o $@ $(filter %.o, $^); \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) diff --git a/scripts/Makefile.vmlinux b/scripts/Makefile.vmlinux index 49946cb96844..8871e55f881b 100644 --- a/scripts/Makefile.vmlinux +++ b/scripts/Makefile.vmlinux @@ -26,7 +26,8 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink) # Final link of vmlinux with optional arch pass after final link cmd_link_vmlinux = \ - $< "$(LD)" "$(KBUILD_LDFLAGS)" "$(LDFLAGS_vmlinux)"; \ + $< "$(LD)" "$(LDFINAL)" "$(KBUILD_LDFLAGS)" \ + "$(LDFLAGS_vmlinux)"; \ $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true) targets += vmlinux diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o index 1c86895cfcf8..1f646b16aa70 100644 --- a/scripts/Makefile.vmlinux_o +++ b/scripts/Makefile.vmlinux_o @@ -44,9 +44,9 @@ objtool-args = $(vmlinux-objtool-args-y) --link # Link of vmlinux.o used for section mismatch analysis # --------------------------------------------------------------------------- -quiet_cmd_ld_vmlinux.o = LD $@ +quiet_cmd_ld_vmlinux.o = LDFINAL $@ cmd_ld_vmlinux.o = \ - $(LD) ${KBUILD_LDFLAGS} -r -o $@ \ + $(LDFINAL) ${KBUILD_LDFLAGS} -r -o $@ \ $(addprefix -T , $(initcalls-lds)) \ --whole-archive vmlinux.a --no-whole-archive \ --start-group $(KBUILD_VMLINUX_LIBS) --end-group \ diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 652f33be9549..c89258bcf818 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -29,8 +29,9 @@ set -e LD="$1" -KBUILD_LDFLAGS="$2" -LDFLAGS_vmlinux="$3" +LDFINAL="$2" +KBUILD_LDFLAGS="$3" +LDFLAGS_vmlinux="$4" is_enabled() { grep -q "^$1=y" include/config/auto.conf @@ -82,7 +83,7 @@ vmlinux_link() ldlibs="-lutil -lrt -lpthread" else wl= - ld="${LD}" + ld="${LDFINAL}" ldflags="${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux}" ldlibs= fi From patchwork Mon Nov 14 11:43:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19758 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098276wru; Mon, 14 Nov 2022 03:49:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf64gJeqQg2Osj0Y/lkh7JrYzQkDSa2ggN2eUiJ52AUTsTck24g7GwHMjDVs/caPZ/S3rzq9 X-Received: by 2002:a17:906:5f8b:b0:79a:101a:7e57 with SMTP id a11-20020a1709065f8b00b0079a101a7e57mr10134556eju.368.1668426573252; Mon, 14 Nov 2022 03:49:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426573; cv=none; d=google.com; s=arc-20160816; b=dsaSdnG47aA8/a+qGQgc6LLDblbbl2it0WG4LwSRN4WAfMK88WM4yuCXRCA3od6pBW IMj+yatVry1CZaLE5S8obL4JYTJxQFguhV3ljCiE05UnsbRgeW6R2TtPlZPwCS0/nUoe 0HT3p4kTVptS5c0eZ9ziQ0bg+bS2gZ43vNjFJjo2pktjHSYgHGPtabGJQ/Fkm2iRwvH3 jQBMh61LMbLZ5PfD3i+sN4PYt20KmxWkD+vkFc2+yVbVYivWeL4aHCheuYWSMGsHx9mU +hsC7PPrJX0JL+vqS6u82akIecvXf3PtRFMvk9EltQSfFO9zj74iE/WuPJzTyosr63q/ PZOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lhIanhEFWe0fO4Hdv9dAUATf8tRy7f7Ch6Oukt4Tg84=; b=FdwXmGChns07Rr0tyM/8CNCqNPkTJVuvDWVpnz/VtqIuqR3VfwMsVISgMBQUvNzI6u zlvQsgYRGR2/1iwXl8oROYMTPjWYQef+/s5o0xYiIO8lPp94X8eYs5VWROgtAEjmEzYR Nu1LXdStSrJBfilD+bWK3qlJ30p6mVvDMCXh58gLhGdIIFFAsMTlkp1BT1wX9CrO+tLZ ZMLlF/F1QGx9iHOSaDCD4RNwkpsdsKMbtJhQeneA8PztepRXwGULl0Adn6K8rHPpATtH XpCD9DERR2R8H7X9/HvRkGEZ1Y94EqguFhkLew/ugfscUAqOGDOyYkq/848pqebsQn8X uT1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mr+JYDfS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q26-20020a50cc9a000000b0045c3f6adb7csi8266318edi.215.2022.11.14.03.49.09; Mon, 14 Nov 2022 03:49:33 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=mr+JYDfS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236069AbiKNLrh (ORCPT + 99 others); Mon, 14 Nov 2022 06:47:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236799AbiKNLqj (ORCPT ); Mon, 14 Nov 2022 06:46:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3150623E93 for ; Mon, 14 Nov 2022 03:45:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A32B761087 for ; Mon, 14 Nov 2022 11:45:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2217C433C1; Mon, 14 Nov 2022 11:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426313; bh=NQjJxsyILnecrraVLrD0UKjVsHwWFfzkE/ontSglPSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mr+JYDfS+0aus5xijYRaMBvF+FXRDnpM+dWoHIiFfmScS3GOY36UxHNYZeLj3b3zS XNaakPmcEiSPxT80ueG3+y7woeiEEbVWMtAtTN/zR17K1PhT7njmfVrr/KeBIIxFjR do1cwcwwThBI9Kjq3eb5p+Z1Ptv/8WEvXBLuOoM6QX7TWUpM4h9A+ifuJLwtfBCplk pj43yCKwVF67uQq0okCBxNvKIzb6bLVKZsP5z724LHOZlpC4vzQI4neD1PsZxr67PD j4owce6boYT9eo0JCWwP43SA5/F/30l1iGQMf4D9/TTVm4EyYqcC3+QNuOJzOmBlbr nrdMoRJB/JTGg== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 31/46] x86/purgatory, lto: Disable gcc LTO for purgatory Date: Mon, 14 Nov 2022 12:43:29 +0100 Message-Id: <20221114114344.18650-32-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472062473937589?= X-GMAIL-MSGID: =?utf-8?q?1749472062473937589?= From: Andi Kleen There are various issues with gcc LTO in the purgatory code, so disable LTO here for now. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/purgatory/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 17f09dc26381..c00dc09d6fe4 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -60,6 +60,8 @@ ifdef CONFIG_CFI_CLANG PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_CFI) endif +PURGATORY_CFLAGS_REMOVE += $(CC_FLAGS_LTO) + CFLAGS_REMOVE_purgatory.o += $(PURGATORY_CFLAGS_REMOVE) CFLAGS_purgatory.o += $(PURGATORY_CFLAGS) From patchwork Mon Nov 14 11:43:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19759 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098303wru; Mon, 14 Nov 2022 03:49:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf4LYs2J1GZsJLYSmhc+81JQVf970NBaqJgHIAo7cCsZCJikZGXzWp3XNeuj3WZxtwbiqzZW X-Received: by 2002:a17:907:a604:b0:799:9ace:e868 with SMTP id vt4-20020a170907a60400b007999acee868mr9576985ejc.451.1668426578146; Mon, 14 Nov 2022 03:49:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426578; cv=none; d=google.com; s=arc-20160816; b=dbBOV5eqO2iesoUdfBTRTpKXrwwhA+xg9ujOYrAu4zayGNyFIfabtDEKvGWlwxmHZk xwmi+G2QreDb3SbJbc1WcJOTwU31u4sNdoxaEJNdEpJBckgE7JAiokjSX3/KnVY1tC9J CMTwnWdnQwPDsHwfS7ycwTFU1vlJo2VvhoJqo3xHuPbvRg31YptoniZQ+tUD7uqIM3wC FVKmKtepJB8UOjuQ4poMuU23oVPcAp/Wpdc0qU3crwlS8ihJ30GsiDRe+qFp7ntdg4gO 3F++wWpKTF7OCToDydZefrct2VWLCc/6RC4RARTtvY2bYulS8vifc5GYhnnj163Qc17w qsIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eZEgFILnkU/ZrE4BOwsYciLEnwldVLd19sH6dOnM+uA=; b=e3qq3ApdBZ449GhaC9ovw47FvAQyLY83BtXhdxWtQ/7ewpUfNgevcfxiz/+KzQy52h 6WOUD2exMlvsMgrh2Ahoq771aXR1zGVZ8Eb7WA3F+rCsQvlUnJc+Cd1E/Zy2ox5WQIWM KDjBnv2rGW9o65cBUDb0VJQZZi41T+gNcIieXt1fcPZDhLsOkA4k/Yob/0KX1M1xZNHA UwoCyufWgnCnDFmqZYb4Zd4CjD1IEzU7rRZaFbtBE39pSodzJzrfqkOXJtSNGy861oNt 9sKUcVMox61afUJrkiI3LdMc+7yNQmInJJ9Wpde9fGy0GIKaWfTFE9FnsXKk1qvL7OXp qUNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=kRPR2qJU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv13-20020a17090760cd00b007aee592fd06si5722239ejc.203.2022.11.14.03.49.14; Mon, 14 Nov 2022 03:49:38 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=kRPR2qJU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236478AbiKNLrl (ORCPT + 99 others); Mon, 14 Nov 2022 06:47:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236732AbiKNLqt (ORCPT ); Mon, 14 Nov 2022 06:46:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E49921E1E for ; Mon, 14 Nov 2022 03:45:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0312DB80E26 for ; Mon, 14 Nov 2022 11:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85D5EC433D6; Mon, 14 Nov 2022 11:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426315; bh=BN2cuMa0qT4NjbFa7HZu9zQS7wMchMYkFG7N3eApFaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kRPR2qJUqvtgJqU06ijIqi67atB7yH6+KzSJyCIMY6hbV8UbrOECAeVPHSluPpjpm 53lo9872wtWJDBnzIiZmtn1iDQ0s83j2xSD3tI7FjqbppRIBlWiFLtxaNhsIwxs7L7 aulrGm29nAYAKIhlNdpKIwk792S9Gq+2sr4TGvD20ejRReMx6CK8uw+tFFUwy4jrgr oVCBitd5daCKQmboVuubgmYdtsrSn/PLQPlhoBNrpyhjszYl/G3Taf9mIr0R7VquxD r3tWqO5aEdQJVaCRCvaRciRqzKH6LsfAAb14LIJCyVc0ZexAQNS+2krwBzcXHb3oqH 0LyoyzcLFpcGA== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 32/46] x86/realmode, lto: Disable gcc LTO for real mode code Date: Mon, 14 Nov 2022 12:43:30 +0100 Message-Id: <20221114114344.18650-33-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472067457992552?= X-GMAIL-MSGID: =?utf-8?q?1749472067457992552?= From: Andi Kleen The early real mode bootup code makes various assumptions that break with LTO. For example it assumes that top level assembler statements don't get reordered. Disable LTO for the real mode code. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/realmode/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/realmode/Makefile b/arch/x86/realmode/Makefile index a0b491ae2de8..47b8b500cf15 100644 --- a/arch/x86/realmode/Makefile +++ b/arch/x86/realmode/Makefile @@ -10,6 +10,7 @@ # Sanitizer runtimes are unavailable and cannot be linked here. KASAN_SANITIZE := n KCSAN_SANITIZE := n +KBUILD_CFLAGS += $(DISABLE_LTO_GCC) subdir- := rm From patchwork Mon Nov 14 11:43:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098312wru; Mon, 14 Nov 2022 03:49:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf40Y/UL/7FiNWQWCFZOVB07GlDHT9pFpfPJ+Y928zdtEa3SGvHm5aRh3DaGeb6ZEt1Qriyq X-Received: by 2002:a17:906:e241:b0:7ae:e592:6d83 with SMTP id gq1-20020a170906e24100b007aee5926d83mr5583751ejb.699.1668426579955; Mon, 14 Nov 2022 03:49:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426579; cv=none; d=google.com; s=arc-20160816; b=Z+grJjTpMBvxOH0BcCZj5WCdP2MwmoX9rYEAdLJ/+mLmYz9SB4LaJcBH9t3lU2rKcv NwkvCf0ZZKyS1cYyR4uHHoVVaoy6JbpPPOxUHlOPmcQgsTk+zwN0j38iIeApkpffeu2o H1ZxI1vSrmuJlJlzozQXDsQnQVuvMlCK9rS5EQbpGU0OLP9QIu7jL2+6V6Bi5wfsbnHZ fraGUOT/Tc1NF/vg/ObPCQ3lyemT7AC8ZNAWOGTV30PxIXdagRqCbCb03GhcKEb9PTB3 rxAtzF0kF2QXhkKGYcRCGGI8+FE2F9LnDLDW3Ihxd1qbBdxIWzo4e3Q8W1/LHtYQUn/X wkQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jV6gJDTJwMNT3Th2aiK0VrSTVKtWf4X9aVwfUpAswVk=; b=TDwGI0L+XpE1Oo2tjisHwEk109pY7qb5XkHy7VDwr4CvKB+3IC2sD+8OCrkMeyabUK OOu2cjyn+SlhC8KQ8NttyktB5brUGPj7OOLn8G/S/4VdBNkPdYUrUPg6+O9jUFKnHuxJ XxeiJShFAmq2BzSdMo92+hBXMjth0GYngWZHSc/ycyUPWhYwoOGY0jjS03yACHOINEV1 PCqAvdJHa6897q/CmMqr/G3dKCt2sMdxz+B3oBPIcWaEsVz1NnySwzT+gzP6BR7y4s0R G3itPVsXGljRQFq4Vx25UTUqnr4LydtGErOncUFEgTMLfe6zQQnsIMaQGGSwSYPHkZmf HHVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="MbgUD/gS"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a1709060f1000b0078c5d28e27esi6944701eji.604.2022.11.14.03.49.16; Mon, 14 Nov 2022 03:49:39 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="MbgUD/gS"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236690AbiKNLrz (ORCPT + 99 others); Mon, 14 Nov 2022 06:47:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236597AbiKNLqw (ORCPT ); Mon, 14 Nov 2022 06:46:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B598E21E23 for ; Mon, 14 Nov 2022 03:45:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 17ED76109A for ; Mon, 14 Nov 2022 11:45:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A9FEC433B5; Mon, 14 Nov 2022 11:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426318; bh=UhlkqTA9nzxaD+YdFYt+90TEESiE0LrCL59k48oC154=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MbgUD/gSsv3dYvhc9g1nrt6qvj/Wzy72bW4GCQzXLUMoMgzlaR+gj88EtQhtFcJs8 6EQKgZHjYEeRH2lE5e9qGTLqnzTPyzx88WZPVjeNzsiHhsS9xvjh6ougVjwpxnypEx eUASlx0KkFunf5tE6ONzo4UcB7QnlVaYA6H2a9nGYjOTv6jE34rhgV80eC7TZq0GeT xRqkR00qWYh7oDjHrPeByf9jSOr3rK/+5hOvAYKGiFaw6vzj0UfxaHrsNLEf7Lots9 uRf410vzaq3NsJTOCumxjUsoesmVP61D4i4YAM7aKC4A/oAztOwKkJBlnF3s2DLL4t DBLntunTjp/6A== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 33/46] x86/vdso, lto: Disable gcc LTO for the vdso Date: Mon, 14 Nov 2022 12:43:31 +0100 Message-Id: <20221114114344.18650-34-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472069220173830?= X-GMAIL-MSGID: =?utf-8?q?1749472069220173830?= From: Andi Kleen Disable gcc LTO for the vdso. It's not really useful here and causes various strange problems. Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/entry/vdso/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/entry/vdso/Makefile b/arch/x86/entry/vdso/Makefile index 3e88b9df8c8f..e8099ee163a0 100644 --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -3,6 +3,8 @@ # Building vDSO images for x86. # +KBUILD_CFLAGS += $(DISABLE_LTO_GCC) + # Absolute relocation type $(ARCH_REL_TYPE_ABS) needs to be defined before # the inclusion of generic Makefile. ARCH_REL_TYPE_ABS := R_X86_64_JUMP_SLOT|R_X86_64_GLOB_DAT|R_X86_64_RELATIVE| From patchwork Mon Nov 14 11:43:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19761 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098330wru; Mon, 14 Nov 2022 03:49:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ekR3D0Z/GEpmvV6x2vub7o2C0bM4IRwa3tuxzvb04bo7PeWM8iHvk9GuUiilTicCC2oZY X-Received: by 2002:a50:d0d0:0:b0:459:2d37:dfbd with SMTP id g16-20020a50d0d0000000b004592d37dfbdmr11017185edf.336.1668426583506; Mon, 14 Nov 2022 03:49:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426583; cv=none; d=google.com; s=arc-20160816; b=RypQs1OS3rPg33Fz3CAfBGgj7QUNh4rFyx+31UQ40XleUG4hXGZuFUSWN+mpFZkhHI Icj722vjCPAQRxR1cZZnfNbVoF8TBI4X7fazKiclgT0gMdDz2KCtuvx4iRfWWSHDJY// k1Bm2JBUvlDbmiG+OaRjk32nbPaDDMIUW0XOIErRX7x3yMmzCepWLmR2fCfOPOc+RvrW JH/+6qSiBChIfaevBNImLRTmS49OTeSKU6ccnDODJNiK38MLhUkD21+UfPWlNgvtsGDv gxhYUYLu06yoQxtYkYM4a0JEinBB/1a8mqNa3oE1XnENh8rXaYPTGH/C7Dtacv92Q83Z 1jJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6Ezq5SFDYzCCTWSyWKFzFvPjHZwQb/GJmO95NlsqwJg=; b=NLj6gea0WgZGWUaBc6Zi5/ElQ7LWLO9MQZMHxBMEh/z4vPhKHZFFE6wFCkGpfJX+Bf 5w6a8DElHpIbl4AJBJLXNPDqOy3DYf3vdJwg3m+ests2IB9cmw8kyjTGOG0B/cgbL+y0 QHzlrwARd8L0jBQ2Zy4Bxzxay1+2zRlwh2QQxN/cSpK2HFggXV2N0ojgLbTc+yjlCems gXhReyivcTvYSWpeO8nG9v7d3J+/FOeNM+uJ9/ZCXDFpvA+xT1rJNk3Z2TI5VgJYH/NR ZJOdR1/80qPj0qDDtTYfHMOvtQyr68d86WGNLlm9Q2dEPKa6av9RWDH9fQnLdYB8v+Gy A7uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=F4KLVe8Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wu14-20020a170906eece00b007a8dddc7ec8si9196521ejb.382.2022.11.14.03.49.20; Mon, 14 Nov 2022 03:49:43 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=F4KLVe8Q; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236623AbiKNLsE (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236874AbiKNLrM (ORCPT ); Mon, 14 Nov 2022 06:47:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9488E25EBD; Mon, 14 Nov 2022 03:45:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 45B37B80E26; Mon, 14 Nov 2022 11:45:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF98FC433C1; Mon, 14 Nov 2022 11:45:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426320; bh=DJF+imgy2HAxwvL4BHvytn2wHCCnLG9Lu7S4hynUjxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F4KLVe8QD97rdiLvx0ybBKluX02uyPznww0DIzficAchO+9g5a627u9P/z0nD682k OtGx4Ppr4+qjnsK0CkMv+SJsF0CikUkpWdPEu+cbAUS9yjVgtS+Us8ZZVPC4LU1JPv b/N4tv8tXiXLdB6DTEZ4/BkwygPZqexBuh20hhiOgsgGptRq0/GoyA0HFXDr5URhsZ DxACqxfyXs4loradezI38i/S0zOEhS/+Q/nDm3n/ltR8xMwKH8R9r1WwM1F3XKjqw/ Kb3EVH4XNqZyglviCHlikYMRMFV+K+T9v2iDSBhFPuODIOEC2c9zsk8bnkcJfhc1iZ LEZf0p+BLa2nA== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 34/46] scripts, lto: disable gcc LTO for some mod sources Date: Mon, 14 Nov 2022 12:43:32 +0100 Message-Id: <20221114114344.18650-35-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472072853920625?= X-GMAIL-MSGID: =?utf-8?q?1749472072853920625?= From: Andi Kleen The mod tools scan assembler (devicetable-offsets.s) to generate symbols into devicetable-offsets.h and binary (empty.o) to find out ELF setup. That doesn't work with LTO. So just disable LTO for empty.o and devicetable-offsets.s. Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- scripts/mod/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/mod/Makefile b/scripts/mod/Makefile index c9e38ad937fd..aa3465d6bc4a 100644 --- a/scripts/mod/Makefile +++ b/scripts/mod/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 OBJECT_FILES_NON_STANDARD := y CFLAGS_REMOVE_empty.o += $(CC_FLAGS_LTO) +CFLAGS_REMOVE_empty.o += $(CC_FLAGS_LTO_GCC) hostprogs-always-y += modpost mk_elfconfig always-y += empty.o @@ -9,6 +10,8 @@ modpost-objs := modpost.o file2alias.o sumversion.o devicetable-offsets-file := devicetable-offsets.h +$(obj)/devicetable-offsets.s: KBUILD_CFLAGS += $(DISABLE_LTO_GCC) + $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s FORCE $(call filechk,offsets,__DEVICETABLE_OFFSETS_H__) From patchwork Mon Nov 14 11:43:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19763 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098355wru; Mon, 14 Nov 2022 03:49:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf7FMFgWbqlT6lBL5UPLXeNxULnuG4eNymkWGlXpZpjZFf8h12+H6l0/LVvOADRv/Jlv0/eI X-Received: by 2002:a17:906:a015:b0:7ad:b868:f096 with SMTP id p21-20020a170906a01500b007adb868f096mr9669492ejy.295.1668426588207; Mon, 14 Nov 2022 03:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426588; cv=none; d=google.com; s=arc-20160816; b=qg+Sh/ERZ2LWI2ovttfBz7HVi+Huy8bDLQquWV2MayD21ctioqIEJXfJvINrPAWlI8 jmk2Sy7+y3McMEDSk1DP5jal2JxpDFeTIqLXezLStadqmeOQ97evG6bn1EKWe8NvMUta Vkbg0Y2pusZGZ8CixKa2vCMf2BLKp9VIr391AtWvjNI8p0I61+9nK9BEnBoKPYslbS2w eJwKByol449xW7NkTHJp4zsLbYwEZ3lYLkCixNswjuWceXW/u7Q+jEGpLNFnQDGFFj6w CAza8CydySkx9YnPdoqA1j1IRuDPZKgA22avboqj1cbHlTLw2wkmcqxcuRBd6q/jxThB iiNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zyzEZJkczXCXC33g/IrrQvUIU/CJoxCCzjqlntwC3yo=; b=c37XZX3i8RtXa01aXoPM6OkIP+Udv07YkvDewfeZD3bCPdKl3UN/oZA3KmS82hPN7H uZ4+TyGpSRn7fr37AgccmUw2QKg7CL7BFDEJ/hHFRTjq1aGLEFSKMCjQX7U+A+1+iZ1q WWziIuO2GcV5kIMzwt9RiURSAVOvuZiQ3n+jmmDg1qn827Y6p+gadxT4RGY4tgtqRM8T x+luCGlCoUrVTAamSMZhUYKhVonH3l1XJLD0/ez4ysj0Tu25PGPSoBTI3PRqWDE8rctv XEMjO/AL0YLnpfuVCn6oqISK98DeYBgw2QbdM68kihRfnEyR9FlFvoy/GMDFWjqvyJmY cOdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WhEo3a5L; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n11-20020aa7c78b000000b0045a0e39062esi8025738eds.76.2022.11.14.03.49.24; Mon, 14 Nov 2022 03:49:48 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=WhEo3a5L; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236269AbiKNLsO (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236931AbiKNLr3 (ORCPT ); Mon, 14 Nov 2022 06:47:29 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5010222508; Mon, 14 Nov 2022 03:45:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id DFF2ACE0F52; Mon, 14 Nov 2022 11:45:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66E11C433D7; Mon, 14 Nov 2022 11:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426323; bh=2VZ4ODzq0c+qrTqaRhf/GBj3Hij1v5FmA5K2QGdY/7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WhEo3a5Lx3UZZADPhb5Wp70Y2vIT2YeqX9rt3iHUK9eS+k/5sSbR2h9BZZZHUn7OB t3cI5HGlUnqznWOwYP2wjqyreX+9nSEH+r97DCMAmR1B5BZZnM02A97aSEpHsDmnGV Q6iV21VOlcdoSFRKninhJTHK3XUoCvEKM3s7HXBrOWaCLmbDxs7EIB8U/yIKLMLd74 iUwYaDPgNw9YryLoADxfO/+sdnwJr69IK7wRzQsrU1h6X+1yMqSZG9CgBE0Uxv9NNM FNtdG/7I+sxoMD3Gk6bglBTDaKot5bWBlP5pfqsDQ48tN8Hyt83yGvoh4IeUp4VSxB tJO24okcYNl3w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 35/46] Kbuild, lto: disable gcc LTO for bounds+asm-offsets Date: Mon, 14 Nov 2022 12:43:33 +0100 Message-Id: <20221114114344.18650-36-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472078398713351?= X-GMAIL-MSGID: =?utf-8?q?1749472078398713351?= From: Andi Kleen Disable LTO when generating the bounds+asm-offsets.s files which are scanned for C constants. With a LTO build, the file would contain the gcc IR in assembler form, which breaks the scanning scripts. Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- Kbuild | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Kbuild b/Kbuild index 464b34a08f51..40744d76d416 100644 --- a/Kbuild +++ b/Kbuild @@ -11,6 +11,8 @@ bounds-file := include/generated/bounds.h targets := kernel/bounds.s +kernel/bounds.s: KBUILD_CFLAGS += $(DISABLE_LTO_GCC) + $(bounds-file): kernel/bounds.s FORCE $(call filechk,offsets,__LINUX_BOUNDS_H__) @@ -30,6 +32,7 @@ offsets-file := include/generated/asm-offsets.h targets += arch/$(SRCARCH)/kernel/asm-offsets.s arch/$(SRCARCH)/kernel/asm-offsets.s: $(timeconst-file) $(bounds-file) +arch/$(SRCARCH)/kernel/asm-offsets.s: KBUILD_CFLAGS += $(DISABLE_LTO_GCC) $(offsets-file): arch/$(SRCARCH)/kernel/asm-offsets.s FORCE $(call filechk,offsets,__ASM_OFFSETS_H__) From patchwork Mon Nov 14 11:43:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19762 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098346wru; Mon, 14 Nov 2022 03:49:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Bm2JzEEW9I5cdv53jqNBqtSYF6DcxixBc/7dvzcP/3LMWXfLIQDSpWR+DKwCzoLQP/w8K X-Received: by 2002:a17:906:6acc:b0:7a8:10d7:a420 with SMTP id q12-20020a1709066acc00b007a810d7a420mr9743434ejs.746.1668426586003; Mon, 14 Nov 2022 03:49:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426585; cv=none; d=google.com; s=arc-20160816; b=hTZFETqyI33Xn8CY0Nzit5T1IGIIqM5MHdrcc1cyWejWXUN3bq8ilnbmuZhlIaoHNJ 7iHvQ1/3I+8CpgUITZr/e4ZGAgVC4ho/0nnuGnlBZUIR3bgyGR154S9oYuX2IK2CBdbQ Q5lfwUWhlxfH6U5b8CzVQMxtzB9igSUluV+A9X7D8LGM4OlfS3xaf9vSioIzZEvvMWtb xixrpTam7pv4+Puuwtvg5IqNdrsiA+0gLDWQG2wKCEDW8H/B8l0CG8g7TXOGt01TGWNO R78Cig0Jgqeu5byOO8JWc8oRs8n40R/tRCXmZaAebhEqgtkBG1bNbJwf3Jqw4trgw/Fx wB1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0tL4tkr3jLhPhHhx70+H27UvslppZ8dylQ/Nqx6V4tQ=; b=k0k+krq9bKd1FQrpUeIzFAvl92RslEdzO8wgYBP0KQnF5CczgTvMBNoGDE/cKVfdbs z2GwdIS3L4wDmdqVpaQgAmWzaEz0Ym4Zv6htkYyCGApfWSXZflT0XkF6gLL+//NjzP8F DwBatqQaVkD0xXzo3R3rsr2QcNr/oz/GHLtQUHhQCii8fu6zs4ADArnI/8P/Rdte+t7a wKSbfKR1ruVM3v1vAJ7PUI3LYu4DF/K2EG5VdHrCo4yy7LzVvem6YgrWa8k+d9d4QSu0 xe77qqvmw70DS/mA7mC898jk4vFCs3jpZK/sp6CXEYd7nVL4UpsZSjwBFnapaCwUTuZ/ lAFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gDBhXqES; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j2-20020a1709062a0200b007803e371aedsi6919980eje.161.2022.11.14.03.49.22; Mon, 14 Nov 2022 03:49:45 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=gDBhXqES; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236850AbiKNLsK (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236929AbiKNLr3 (ORCPT ); Mon, 14 Nov 2022 06:47:29 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 427C821804 for ; Mon, 14 Nov 2022 03:45:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id AD35DCE0FA7 for ; Mon, 14 Nov 2022 11:45:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3B2AC43470; Mon, 14 Nov 2022 11:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426324; bh=ZL8klCP1h/76P9kKdRbQUqGgBjn+aOHuV9EO8AnyNpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gDBhXqESy6UCVyjpxo3+gHOdn5+SwcoEj+Qouka4izFXaIPdOuHoSpb7k+SFn8oth VXuPpZRMcCBKR4Xw+OevAnNvdq5k3eMN/i84bvYUEFHdPDd4BoFx9FtnmgrO0i3xRF ivayV7hWJ8m3iLSTe02S8hRElQjKacFRyR9IFaoD2gauyajwW1hT/MaKiV2ShRD6gO h3+tgaW552ZpfxVqw5BIYEsiDZJyWkmNMXCqtQiX7sOBj10i/5f6pWmcc9K2uBFT6o lMzmLMQTMKOFTTaa+kz3osbkQX8JW+Evh3eViaTG6NbUHImSKEWdb0N6ny77tLWAw3 uuw6XHCb0q7zQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 36/46] lib/string, lto: disable gcc LTO for string.o Date: Mon, 14 Nov 2022 12:43:34 +0100 Message-Id: <20221114114344.18650-37-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472075701125851?= X-GMAIL-MSGID: =?utf-8?q?1749472075701125851?= From: Andi Kleen gcc can generate calls for string functions implicitly, and that assumes they exist in a non-LTOed copy. Mark string.o as LTO disabled to avoid missing symbols at link time. Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- lib/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Makefile b/lib/Makefile index 59bd7c2f793a..bf72b58de5c8 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -27,6 +27,8 @@ KASAN_SANITIZE_string.o := n CFLAGS_string.o += -fno-stack-protector endif +CFLAGS_string.o += $(DISABLE_LTO_GCC) + lib-y := ctype.o string.o vsprintf.o cmdline.o \ rbtree.o radix-tree.o timerqueue.o xarray.o \ maple_tree.o idr.o extable.o irq_regs.o argv_split.o \ From patchwork Mon Nov 14 11:43:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19764 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098361wru; Mon, 14 Nov 2022 03:49:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Y/F0W/YUYZgQSioDvAyvonYlaNnnsq/NNiN/bIoqFURTPerD7Bv9ubOIdsVjY8OQ8WOix X-Received: by 2002:a17:906:79a:b0:73d:715c:5730 with SMTP id l26-20020a170906079a00b0073d715c5730mr9749147ejc.293.1668426588693; Mon, 14 Nov 2022 03:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426588; cv=none; d=google.com; s=arc-20160816; b=BiZyAs+p2n7PELxVir0Fz5iMiPnAQqF7sovXwT/TyiNyoru2j2U4/P1hk107r9FABa 4iE0qI1MjM1JGpAoa9kcYK27Jw4D447MffoVdoEZOZ0cpIiQZhmg8K2BVGLo/stXMkLM JsWexYVnkMUpUlSGGS4ojMI30tYcP781T35WhKzikNyz4hIN2tLAQM/8zdKw1VPi38Qz B3AMkDtm33zjCSOzC3+zFEaSGOT2Vcg6Nfp80Nsp9IJ3Tc3W2P5dIHKa7NJga0j7Buqd I8pr4wseN2GMJzw0VJbX3zg8uD0vR3lRMabgz2PiuEAFtdi0q1tfvGyjJyArwlYnHJPu 5m5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jknY8RAzgdWn9SxfxApPWvhy4im0I1SE1/1URE6RX8I=; b=UwgPRVKsFt0tibvHXp8TlM1IIBjg20BNtIFvzlNsmd32fdy049DEFOdbcw1foEx1uj fEGDCnIsl9ZOidIal7Qc49MiNFd3fQgqTT3S4zQrggjXDCzUtOpfSEXCu8dV9TJW5y8C ShM7164dvFfZ03cn8o0zJY0GbookhT85CPwdfWmb/Mvnj4Zy+U1hGZ7A1oGsPhQfdMtk gt0kxrYT37C2vEHXcTtxMnjaF+tWuCbsDEv/7wb+wTQBJzQLgMrx0aJQaQ9m2TLJJ6+2 idU4rrp+aNj7wnjtVQasx937qEgDYFA2nfV1Lt9bkWfsL5ppMqI9TJZb6PyynnGwLJYC uk/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=la1ciPpE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb14-20020a170907960e00b007ae4717bf08si9733716ejc.359.2022.11.14.03.49.25; Mon, 14 Nov 2022 03:49:48 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=la1ciPpE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236414AbiKNLsR (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236940AbiKNLra (ORCPT ); Mon, 14 Nov 2022 06:47:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55BF824087 for ; Mon, 14 Nov 2022 03:45:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1881EB80E78 for ; Mon, 14 Nov 2022 11:45:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58D34C433C1; Mon, 14 Nov 2022 11:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426326; bh=F41S5/OfJJjx4Qyx7KDXsJWPyr7ThQmJ94m+jQiNNUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=la1ciPpE+MIEVxztF90HGogzquhV08rLd3CsVUecIZyEyXFO5P7K4UPkoTyfnvLqe oUMOIiKfbnSMlLH8X67gdclvvmnSs5uh/T5YUsCNDd3DXFnt2rd+wfoXNIpEdxsFcv TZRrtnoHYltBZ7AWs9y146QMRODFePDO4jpkTqcx6Aal5rcpFilq/Eak7oKV5xkEy/ V6+LPxwF7j1bSe9M7pjGIOt2c4yw7tnK6WEWxpIrge8ihcc+HmUtpvbi1ieF0BFe19 Lulw23FgtYKiIrJ5/qmL8ISkxM9W9u0k/OtloelPjQZrVLX9gUIIIR0DqsxVtL/EHQ 1CpfBlSEyzcfw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Miguel Ojeda , Nick Desaulniers , Martin Liska , Jiri Slaby Subject: [PATCH 37/46] Compiler attributes, lto: disable __flatten with LTO Date: Mon, 14 Nov 2022 12:43:35 +0100 Message-Id: <20221114114344.18650-38-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472078682618351?= X-GMAIL-MSGID: =?utf-8?q?1749472078682618351?= From: Andi Kleen Using __flatten causes a simple gcc 12 LTO build not fit into 16GB anymore. Disable flatten with LTO. With gcc 12, the build still does not finish linking in 10 minutes, eating 40GB of RAM at that point. There is an upstream bug about this: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107014 Until this is resolved, simply disable __flatten with LTO. In the future, instead of this patch, we should likely drop __flatten and its only user (pcpu_build_alloc_info()) and use always_inline to all functions which shall be inlined there. Cc: Miguel Ojeda Cc: Nick Desaulniers Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- include/linux/compiler_attributes.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h index be6c71fd5ebb..09cf8eebcb0d 100644 --- a/include/linux/compiler_attributes.h +++ b/include/linux/compiler_attributes.h @@ -229,7 +229,12 @@ * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes * clang: https://clang.llvm.org/docs/AttributeReference.html#flatten */ +#ifndef CONFIG_LTO_GCC # define __flatten __attribute__((flatten)) +#else +/* Causes very large memory use with gcc in LTO mode */ +# define __flatten +#endif /* * Note the missing underscores. From patchwork Mon Nov 14 11:43:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098408wru; Mon, 14 Nov 2022 03:49:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4HhaIAt51VgrAgOI9nLFg+398zkHBjB+WkpUz6xPM7iRbiXbDj4cttnhZ2WMEiJrhZy6Ew X-Received: by 2002:a17:906:a450:b0:7ad:a3c6:6797 with SMTP id cb16-20020a170906a45000b007ada3c66797mr10200352ejb.665.1668426596286; Mon, 14 Nov 2022 03:49:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426596; cv=none; d=google.com; s=arc-20160816; b=0Omb2LhtiXr7NAeOWc1Afmo8uMqNu4TlmbjSREuJVZvp8d2L9JeQWuVDPZF/CjtxCN 5ZxCZIEXF35LbW0mUTAE6Qgn0HPKMGE8V29EutdR7H0iWzvCism2PgBKlKw/W9S0PWW7 fk562SSA33n5lDqSLWu6ZLh9NLJOlCuDAr4hRo2kXdnZdM80BGY1hVZK8vIiZIOx0DD3 inLSehohGJceN0araKK5xaZYNFPT8edSKoXzsu+SfYtw35S7HG3nwt7wRVQGFCIhbNOD b1rv7PEcDYflVTHAOT508cX7bqsWxnFcpe08FqV50mew+pmgsVLVs8aj+YmubzJOJ6g3 I7kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3i1STPuiGNu48uDX1Jx2DZLOnelbou1vTah7BljaFYs=; b=T0/aT1dKdj3ySQARNhebKS8NyzArImwBLALGSaB05HIBJiQEYoQ+dyaUxNw7KjgkoA anTbKiurWJvAUjwlKyBYC5zJ2q43nGXiOmvbfESQjzbEJefTYdfgBXPeDKtKJKHjaVfv ekDh7GGG2Sydq7t5yd8qUvN3s/cq01162xuIUstbwNg+7D2Y34VNXDMJBXD421lK7mjf vSxfk22/y/OCGEdpKpG79BT9kWdBeT505V8zoKX15VS6XW49Ddz1tXGwBjmLfgP6J4j5 8UJ26M3Z95hdwreB3XxIxCpHJk4LWBWsyV28Onn+sOINNMs1vWBNLZ4cRj2bAI0ntrxw tINg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vH2xVVq9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z14-20020a05640235ce00b004615855c483si8769784edc.98.2022.11.14.03.49.32; Mon, 14 Nov 2022 03:49:56 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=vH2xVVq9; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236866AbiKNLsV (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236947AbiKNLra (ORCPT ); Mon, 14 Nov 2022 06:47:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07582222B4; Mon, 14 Nov 2022 03:45:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A2BC61093; Mon, 14 Nov 2022 11:45:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DC2FC433B5; Mon, 14 Nov 2022 11:45:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426329; bh=VHTSznvRU1NJt50Gn5cdfooru5h/hvP+AUl+sJEGPhU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vH2xVVq9a7oMkBu897W0gAjD0uxcCuvGq364us9j38XwBhoYpK8lFuUcFpiWDuxut Rsu0/3S/RibVjT4IyA5Ub6bRkMIFahMLJwEj0f0edsEqkwxelhgus+v7RrQCCfLaZl yen5wyyk4N+ExrJ4A27S61XQL3Gi4R11PvTXF6VSm+z9OG0ugUmGYAZ2tYiI+92bq8 VksRgFcyAPLh+LqhvXh0lLNY46bkwx/tzkFbOSiak1O6hcRKUI5jXUvXny8xqmM125 4+VUObmU1Ll+vN5aesZZUCHC75DdkqIjkZ5a+I8GAGHUQ4gfH9jf9Ytd/AE+00JKhF BioFZgDVl2A4w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 38/46] Kbuild, lto: don't include weak source file symbols in System.map Date: Mon, 14 Nov 2022 12:43:36 +0100 Message-Id: <20221114114344.18650-39-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472086176281372?= X-GMAIL-MSGID: =?utf-8?q?1749472086176281372?= From: Andi Kleen The gcc LTO build can generate some extra weak source code file name symbols on the second kallsyms link like: 0000000002fdf20a W head64.c.552cf5a6 This causes the "Inconsistent kallsyms data" error due to mismatches in the stage1 vs stage2 kallsyms link. Filter those out when generating the System.map. Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- scripts/mksysmap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/mksysmap b/scripts/mksysmap index 16a08b8ef2f8..0f19a44ab136 100755 --- a/scripts/mksysmap +++ b/scripts/mksysmap @@ -34,6 +34,7 @@ # U - undefined global symbols # N - debugging symbols # w - local weak symbols +# W - weak symbols if they contain .c. # readprofile starts reading symbols when _stext is found, and # continue until it finds a symbol which is not either of 'T', 't', @@ -57,4 +58,5 @@ $NM -n $1 | grep -v \ -e ' __kstrtab_' \ -e ' __kstrtabns_' \ -e ' L0$' \ + -e ' W .*\.c\.' \ > $2 From patchwork Mon Nov 14 11:43:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19766 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098411wru; Mon, 14 Nov 2022 03:49:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5e3ZNjiIIfy2o0ea3dqqaXWGb9w/BFQSSfGse8jDERCFatXlC+aIO2x6ZeziKb5OISCkA2 X-Received: by 2002:a17:907:900d:b0:78d:a7f0:e232 with SMTP id ay13-20020a170907900d00b0078da7f0e232mr10088730ejc.9.1668426596605; Mon, 14 Nov 2022 03:49:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426596; cv=none; d=google.com; s=arc-20160816; b=1BMUgOEnX8a/zMBJLW1/hLVLyUFITiRJhB4yyQqr6Wfwm3qAUXDjtDjFSzanItxP8r pnDhKs9NAyuJ1/pOl9sxzCEiNxu5yKN9PyjEmqoOvvRi7VA7yBKlbTWIeRYTTb8Cnxlc nQBHtnGHcbzcu1t4s6X2RuGKZfiR7z/hENnQSMBaTKY+xlJbcHbrBwRTXYnjWxgY4YwO VyUWZsCfHKaHL0Sox98s6orR5Hl9sDpLKlL20dPU+yoCHr7n/wYckzLICF6omEpPNpqO UNTTM+ICnwvcp3ShnN7BkrE/pnETMzfVbJra9CPbB451Q+eifw4PkmnOlTBtXvYjwsqp h3Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1wZifb8HxAVafLtlY4aUAD3Z2z2ALxhYZ2XGoWj4bMg=; b=J07ImrFmNq/Zi+I53hhrYy45Hb2GtXajDgLqCIhxsNWHW7NWvLbWEqpytFsBmgPzWg CSWB7+0JFCchgsvzXKh0rs6BNu2cwA/yBw1i0BTEia65NkbcxNicLbB4pberVzEHjDAr ToCQJLVbPFbPHakKD8u2qv1gF6Dgx/tx24kUa2PDOptpl2H85GWpb4HoOYNjCr86NlHU l/7feMsyBZESN0HeTtgxL+CE06ZNntoog9z0t3mjLxWcSM5K0XiGKhc0g9h0HsI/MMvJ fJV2PjRHZzkwv+KJbN0pdTUhnGn065ZvUEEvdROj3GrAO834k65Mm9bRqHCtUGtoboK4 qQ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W4TWAOiO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a05640226c500b00461c252c3f8si9010365edd.382.2022.11.14.03.49.32; Mon, 14 Nov 2022 03:49:56 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=W4TWAOiO; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236881AbiKNLsp (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236762AbiKNLsC (ORCPT ); Mon, 14 Nov 2022 06:48:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82785264A1 for ; Mon, 14 Nov 2022 03:45:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0E906B80E73 for ; Mon, 14 Nov 2022 11:45:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E621C433D7; Mon, 14 Nov 2022 11:45:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426331; bh=Sb5J4tc+210hDjMm1S+r84/cDdsYNhaQnAubcresp6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W4TWAOiOCRKCQ583UsRVJqRZL9TXgqtsh/kO2P2iM6H8yG5Vh3zIcUtnXgB+CtT9k J4XFfzRxV3rxNMJhERy4YISkzY63w1sJyGO8MmNJwcUGpHNICYvpOcWBW1bIVhpMqX I0XtivbOaI3ZGnEjeKPoBGT9ms+3RpXtDlYVCDCUUiNpVY0Um3Jm3BFJxQOED54X6u a5eQXUFEsjQneKC2G/orT8iFJCgVDFhpouGKGHs7MkvEX8FcluGPe5edNdTidV6wE7 25em7LPdg8CaXJKaN5/BjOqWfRDXnS3llMOvj0NWlr8sZNXaIh7lvcsE0r0qvFJbFF 3GgUWrZWjWF9w== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 39/46] x86, lto: Disable relative init pointers with gcc LTO Date: Mon, 14 Nov 2022 12:43:37 +0100 Message-Id: <20221114114344.18650-40-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472087038069776?= X-GMAIL-MSGID: =?utf-8?q?1749472087038069776?= From: Andi Kleen Relative init pointers are implemented using custom top-level assembler that references the init function. With LTO, the top-level assembler statement can end up in other assembler files than the init function, which then causes linker errors if the init function was static. This could be fixed by making all the init functions global, but that would be a very intrusive change all over the tree. Instead, disable relative init pointers for gcc LTO. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/Kconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 67745ceab0db..6455d843d559 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -176,7 +176,9 @@ config X86 select HAVE_ARCH_MMAP_RND_BITS if MMU select HAVE_ARCH_MMAP_RND_COMPAT_BITS if MMU && COMPAT select HAVE_ARCH_COMPAT_MMAP_BASES if MMU && COMPAT - select HAVE_ARCH_PREL32_RELOCATIONS + # LTO can move assembler to different files, so all + # the init functions would need to be global for this to work + select HAVE_ARCH_PREL32_RELOCATIONS if !LTO_GCC select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_THREAD_STRUCT_WHITELIST select HAVE_ARCH_STACKLEAK From patchwork Mon Nov 14 11:43:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19767 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098440wru; Mon, 14 Nov 2022 03:50:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf5EPGVv6fioHFosSbiyKt+uVnYj28cCXvGfZfV6Noisgmi9idcckL5YpNoCo5rzI85pv4a0 X-Received: by 2002:a17:907:9618:b0:78e:17ad:ba62 with SMTP id gb24-20020a170907961800b0078e17adba62mr9846766ejc.719.1668426600631; Mon, 14 Nov 2022 03:50:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426600; cv=none; d=google.com; s=arc-20160816; b=0n+jLkqJYYGpvWautMJQHws1fGIryJ+ueD7UJSIfnoOUJ4X6dTHxpwFOSH37aQrAvk Awkr3E+ltZG0rVyq7nnwvBzPTOUXNlGXihYMtM12pVhBgrH+skrbzKh5qSylKId+v1n9 XbvMzJlgeZqN817683Ivlm68zGGqoZpU/Eobb7TIZ7bq4zqmLIv6eO+A8JKGw056NYLi mKOoLNVzaR6v4ys4ccwURup7/tf8oYdKAK2kXaQWbc+l5jUMwzgMg/CqHrwUCAuacz0C 1uPS0aXjySy5KqrweIoUo6XYeFokcm1G3Ae5kPRYJytLRRRikdM6qG+7WHYaQO5Pdxzp ekdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hfW68vlzImJ9VWw36gGP8kKR4M7g53GIW7BTkc56XY4=; b=wrLYl2LQms91t1pSK1P74c4pM8kaxGaKjRNDRwLtrFtG2ffAMK//hPxyS/k6affHlw CbF8HUTGjkQAGZk4OgDPdxjftOOAuhd79oTxvXU9vUTNaIFVysiorLakcFKlm3LBa3XK 1oz6CJ+nNfudlsPHGgOCKl5PWbbfj/JSJDh2lA1HQPXNSghR3rq6m8L6HpwgS1NMpddg wRpSmxmQF6soKXWq/onCnLGCXt0OHLOsGQisqoR3cBpIULdCy+5eumPTeZVpy4qGRAzD JWN8A1I4vwxWgUIj0DoyvFjIZj50D+ALqphtEDENmy7W4K99caSQolMXKIM95n6UziyH kYgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lKwgXStS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p21-20020a056402075500b0046168e49e6fsi8289715edy.80.2022.11.14.03.49.35; Mon, 14 Nov 2022 03:50:00 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=lKwgXStS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236819AbiKNLsr (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236804AbiKNLsE (ORCPT ); Mon, 14 Nov 2022 06:48:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 735442252F; Mon, 14 Nov 2022 03:45:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 10D0D61045; Mon, 14 Nov 2022 11:45:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2416DC433C1; Mon, 14 Nov 2022 11:45:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426334; bh=E5uKKkSwNTVS2fkyiUTAmxhhGrPiE6X9sXCDPf3qXro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lKwgXStSf5BKGYokF2vP5wwXHZ8kyH6GC/7CZR735e0tt2uwibnhyjRwidpNrhuRE 7wuYoAIM8NIoLhYgNKKhSlEpLOC/wLxgTmxgY8cwmO7xq+/ybN6O7NLZPiuWVMnCQ8 n4+5Kt1SqPDbdFIdpVt6Jo7l8QuHjozrEkB2L0nO5sylYBZasNhS4FMUoWA5OV687r 7PENiN1LQelH6MSTfsfI+cV9z3s3l/tJn1FdHWODV5Ho42JMu8/L6I0LAn55fU2a/f PKdOKJM1aAPdAnxda4OdISiVeDjVBHrkOyOMeuiHuD661PbY2u5nzkadl/hRLPd3dM mVTEojYb5NrqQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , live-patching@vger.kernel.org, Andi Kleen , Martin Liska , Jiri Slaby Subject: [PATCH 40/46] x86/livepatch, lto: Disable live patching with gcc LTO Date: Mon, 14 Nov 2022 12:43:38 +0100 Message-Id: <20221114114344.18650-41-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472091468848274?= X-GMAIL-MSGID: =?utf-8?q?1749472091468848274?= From: Andi Kleen It is not supported by gcc 12 so far, so it causes compiler "sorry" messages. Other than the compiler support, there shouldn't be any barriers for live patching LTOed kernels, although it might be more difficult to create patches for larger functions. Cc: Josh Poimboeuf Cc: Jiri Kosina Cc: Miroslav Benes Cc: Petr Mladek Cc: Joe Lawrence Cc: live-patching@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- kernel/livepatch/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/livepatch/Kconfig b/kernel/livepatch/Kconfig index 53d51ed619a3..22699adc39a6 100644 --- a/kernel/livepatch/Kconfig +++ b/kernel/livepatch/Kconfig @@ -12,6 +12,7 @@ config LIVEPATCH depends on KALLSYMS_ALL depends on HAVE_LIVEPATCH depends on !TRIM_UNUSED_KSYMS + depends on !LTO_GCC # not supported in gcc help Say Y here if you want to support kernel live patching. This option has no runtime impact until a kernel "patch" From patchwork Mon Nov 14 11:43:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098627wru; Mon, 14 Nov 2022 03:50:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf4IE9EIbXpJc279RZlcSpqcLatMMtfa5L7HfoJzVTeN1dPKpPT8p8c28WMDRIwoDaoMDiJB X-Received: by 2002:a17:907:c94:b0:78d:b8ab:9a5a with SMTP id gi20-20020a1709070c9400b0078db8ab9a5amr9925528ejc.454.1668426627001; Mon, 14 Nov 2022 03:50:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426626; cv=none; d=google.com; s=arc-20160816; b=kUELaxhX5+ndAivyTkaKIMLD/Nx2IkFlmQfNj0HimgjO1pt9Z27fdTkTPk3nPvFhiy 9RFzaqw6OsbrweLn0IdvkiS/D6jUEzxN5sHKTMGmIHxCiMuAgePsVDo96L3Ar43rMYfh /lvdl8iK2ad5f4sKEw1yzBDVqBS558NDwWjECU8Gm32pw4phnNZ8DuUsbbI7exoQTbLU EmsZcCCnShj+7gWuBOKQn0vtZrtx7y0T9uv/3RAppcQBtKaeTN0mgtJeVQXLW+71Tl5M te/vtB/2Bn9rmG8Iw7z74Nek7qBd88QSBN/p6ld4b8UgKtGcg6nhJAKvfn0D5yxY9rcf XZzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WPBU7UxL6LPnR5x/J5PrEh4xEFZt/PbTMPnv6dZIqf0=; b=WS6uGYMWiGx32AuU6S7Jhjkf+IDldvKA/BEfqAGMZ3NiP8cJi6MUYyQBEiHtttt0Xq K2G18BiIb/xBVXs/qryf0VlMokYmp86qS0pohBsYhXgdorbYE+dCbhVrBFz59j046bkh bZAwvUl3c8iyYUvZL9WhvOktHBiBJWvfMpNOVOp06NDk5IyBHSWh7KCE0Nqn/4r2hApF j6EetvSgcy2rcKb0yu8pX7w4mdqLwdy8vF2wd9d4SpGU/za87JMwdcreQrTF9efuwU3C 7rLMF+xIkc2T0EHm0k+AR4w1RlbdRNIhWyrugGY65bz3+yNAilw48/Cg91gn3jerPKYN TNwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z56jXBWI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du2-20020a17090772c200b007aedb84056csi4806688ejc.718.2022.11.14.03.50.02; Mon, 14 Nov 2022 03:50:26 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=Z56jXBWI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236830AbiKNLsx (ORCPT + 99 others); Mon, 14 Nov 2022 06:48:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236842AbiKNLsK (ORCPT ); Mon, 14 Nov 2022 06:48:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8415264BF for ; Mon, 14 Nov 2022 03:45:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 72A66B80E78 for ; Mon, 14 Nov 2022 11:45:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9976C433D7; Mon, 14 Nov 2022 11:45:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426337; bh=VYQURovUo97zO8sJmHkHAsr8KxvRG48y3FQbb9I2wLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z56jXBWIsBXBUMabvHqQKKRnY5i9Yvn3pWB+MImH0iB9rNmtARnU/nYhyOp87J2KY ml3vFdOHGOQgMiMSvx5Mk9jDreX5NOGSklPB09RpuPYi+6TENrcT7e60VFQGSmIUnR 3LKqf5Jt4rbq42rrcKS6/ItDLaLySbMldOWP6LlnQs755cD5K9NsUQaLQN9y1Hq8Qa ntYAvZPVESwrDLyh1XRFO6i3Cd2GeaSSmag4Fhiys6xEuadykc9BW7b3Vt3njgjZbX 5xCxKCBLPRNrwm7FWVhhsk+4CZhs9ltA6UF4Nnmd7n16b/JKDFvmZ10Qakl4qVQnv5 8u7O4bFsjNrJw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 41/46] x86/lib, lto: Mark 32bit mem{cpy,move,set} as __used Date: Mon, 14 Nov 2022 12:43:39 +0100 Message-Id: <20221114114344.18650-42-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472118661164895?= X-GMAIL-MSGID: =?utf-8?q?1749472118661164895?= From: Andi Kleen gcc doesn't always recognize that memcpy/set/move called through __builtins are referenced because the reference happens too late in the RTL expansion phase. This can make LTO to drop them, leading to undefined symbols. Mark them as __used to avoid that. This is only needed on 32bit, on 64bit they're assembler anyways. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/lib/memcpy_32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/lib/memcpy_32.c b/arch/x86/lib/memcpy_32.c index ef3af7ff2c8a..53fa1cac79d1 100644 --- a/arch/x86/lib/memcpy_32.c +++ b/arch/x86/lib/memcpy_32.c @@ -6,19 +6,19 @@ #undef memset #undef memmove -__visible void *memcpy(void *to, const void *from, size_t n) +__used __visible void *memcpy(void *to, const void *from, size_t n) { return __memcpy(to, from, n); } EXPORT_SYMBOL(memcpy); -__visible void *memset(void *s, int c, size_t count) +__used __visible void *memset(void *s, int c, size_t count) { return __memset(s, c, count); } EXPORT_SYMBOL(memset); -__visible void *memmove(void *dest, const void *src, size_t n) +__used __visible void *memmove(void *dest, const void *src, size_t n) { int d0,d1,d2,d3,d4,d5; char *ret = dest; From patchwork Mon Nov 14 11:43:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098523wru; Mon, 14 Nov 2022 03:50:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf5eAIi9Mjjr+G9/LGsSOViFZCdgJOC+eQhrPDAXsGn+Mo6KQZohf6JiW5hcBUeGu1Ezd+I+ X-Received: by 2002:aa7:c446:0:b0:468:74:9820 with SMTP id n6-20020aa7c446000000b0046800749820mr1583712edr.288.1668426612634; Mon, 14 Nov 2022 03:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426612; cv=none; d=google.com; s=arc-20160816; b=s/FyTOq3WZ68BjyYRFwKN9il7eN+CCE5GPfHxSdq5hbeql3F8XuR8wWgEnCL37Pe01 10GgQKLedxryzUt/HYuOAQUOjkz+fy2vFT0p1Qkiqed7gcUSeY1PD1+mYjgi2B4iLh6q Tr5AdsmVrAy+EKTjk31quKXLVtd0Eyz4VfGgf8CSXHtoaKFgTe2/S1/3y4cEf/Fz/avA TK+EhYwvHru/7HSPz9D7B35cpnQKXX1/iJ4CZf4JVz+TFnW9JPaPlJgjCXeI1gCPiDhb 1vNcCIqzlXDIYpYHTwGGayaBHvLFH1hW7Vn8EiHD7JWnV+kKXglzTVskd7MWJhVdlyxo xdEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BfbFJP9xIxthF4S61VznWCy99JUkc3m8GUdJ+Jei+2g=; b=cMO4Zi6KIwyFGrhhRQ4LUw5tJsLjVqTWDluLUvZ3eSI+bp92N/72qPsFt/4Vdpi97c OitrLaVa52v6teC1TOeeCh8NLg5+lKKz7gM0OogiJVjn+fA+Gvehnvvh8MA1Bd5GhPCW Yi38zN3RyAJRJt+tA4T6K2enNNBKje6Axlt8pE7HY9JDXgw6+uLTuEkQWtSbvFJQY+n8 wup9JJRi3wbGcjKRqh2OtowcS+8+177ATgmDrSrSIrFscKmtpc8xy6VMB7An4NNRj7Mk g4eZZzO1BArGvU+Ovrn2ICMXKSzJJCy9fDRPyMdT69z7DqCyW21TDDYjh4mG7NxnIp9h +c6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ivICbmQi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y15-20020a170906470f00b00783e7d72fc0si7592458ejq.272.2022.11.14.03.49.47; Mon, 14 Nov 2022 03:50:12 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=ivICbmQi; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235929AbiKNLtH (ORCPT + 99 others); Mon, 14 Nov 2022 06:49:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236661AbiKNLsW (ORCPT ); Mon, 14 Nov 2022 06:48:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8093C26570 for ; Mon, 14 Nov 2022 03:45:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3E0CDB80E72 for ; Mon, 14 Nov 2022 11:45:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E91DC43470; Mon, 14 Nov 2022 11:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426339; bh=88jaPx4iCX4zMvSz58mQ2Zj5p3k63uCxoL6FcunYz3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ivICbmQi7wHzNyqcXXy2gBkoVBoBCTmkhvCzCikjByib4s8RaoY1lW4WmY9i9fJB5 fYZtyMMcxvFxBADEGFKQdsa3WruxjgLmBiWGmXivBeRy8kLTjLOmEAweToWxhQ6yz+ x0LdG1T+pvu8StRDeYlGH0Tdyy/ePWCQ/Sv+rDu7l45RUSDts6OddVrDlDVLJAdfl8 +GmcClU8zPprpmtMhRrIPMLXfJ8PvLzwBu49jJzmOaY+cmjBFdgkwJ1Rc5viBYm/GK /AbTQVDinVxn/OvJ40QkgSYd9IXHHQ9KE/H5v6KLBpoVlHLMGb92iJ1uONOwOTZGtC 5+9YnP17R7gUg== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Martin Liska , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Andrew Morton , kasan-dev@googlegroups.com, linux-mm@kvack.org, Jiri Slaby Subject: [PATCH 42/46] mm/kasan, lto: Mark kasan mem{cpy,move,set} as __used Date: Mon, 14 Nov 2022 12:43:40 +0100 Message-Id: <20221114114344.18650-43-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472103717453825?= X-GMAIL-MSGID: =?utf-8?q?1749472103717453825?= From: Martin Liska gcc doesn't always recognize that memcpy/set/move called through __builtins are referenced because the reference happens too late in the RTL expansion phase. This can make LTO to drop them, leading to undefined symbols. Mark them as __used to avoid that. Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Vincenzo Frascino Cc: Andrew Morton Cc: kasan-dev@googlegroups.com Cc: linux-mm@kvack.org Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- mm/kasan/shadow.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c index 0e3648b603a6..94c98feea9c8 100644 --- a/mm/kasan/shadow.c +++ b/mm/kasan/shadow.c @@ -39,7 +39,7 @@ bool __kasan_check_write(const volatile void *p, unsigned int size) EXPORT_SYMBOL(__kasan_check_write); #undef memset -void *memset(void *addr, int c, size_t len) +__used void *memset(void *addr, int c, size_t len) { if (!kasan_check_range((unsigned long)addr, len, true, _RET_IP_)) return NULL; @@ -49,7 +49,7 @@ void *memset(void *addr, int c, size_t len) #ifdef __HAVE_ARCH_MEMMOVE #undef memmove -void *memmove(void *dest, const void *src, size_t len) +__used void *memmove(void *dest, const void *src, size_t len) { if (!kasan_check_range((unsigned long)src, len, false, _RET_IP_) || !kasan_check_range((unsigned long)dest, len, true, _RET_IP_)) @@ -60,7 +60,7 @@ void *memmove(void *dest, const void *src, size_t len) #endif #undef memcpy -void *memcpy(void *dest, const void *src, size_t len) +__used void *memcpy(void *dest, const void *src, size_t len) { if (!kasan_check_range((unsigned long)src, len, false, _RET_IP_) || !kasan_check_range((unsigned long)dest, len, true, _RET_IP_)) From patchwork Mon Nov 14 11:43:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19774 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2099017wru; Mon, 14 Nov 2022 03:51:37 -0800 (PST) X-Google-Smtp-Source: AA0mqf6fuETkVpS/g5b09PzknpKpPtpNdGdoJB5KGIzEOP+lf2BwHi51msL7U1iAo3WpFMxCK68X X-Received: by 2002:a17:90b:1891:b0:210:4438:2d40 with SMTP id mn17-20020a17090b189100b0021044382d40mr13389922pjb.196.1668426697473; Mon, 14 Nov 2022 03:51:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426697; cv=none; d=google.com; s=arc-20160816; b=d3pvxntgIoEAgc9PJOeKDB3Gvsu4yoUvv0BhITUwPt7nirwHxJ2Rzpf2GOtGsShSeW 4VxMzh2Malv6+A8uWPEETo4E/czGgt3RH/IQ8QGx4qzUDQlicwS4ycGlbIb0FYVlMUY7 SvImkQUs/FitL9b+/lY7ergsBnc402ZwfvNB2EACunj+mgIQQi6WvhnXu9E+XTpZWuUZ /PMXQ8kl9zyBtFQEv8t6lxW1/TzBhrbFKLJ0n8COfL4ZQZEQiyBazK5jWQcR53DC9X6E Os3P2W+0ZW+16knJSQir5T/ygG+9u7Po93SPUEVqbSScwn+XDAH2vOTmOeahF+TexRhu r02A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xFJ6K2Yd9HaZgF81PKdc0t8NeDVPWkEH8/ha6oXLqq8=; b=0x3L6a5MeMSt1z+GuHg5QvNfLoym99Fk3gNTSGa3YlnvvkyrPjnkWpvYgQimgn5EQl MPjb0ZSJSMnpLemZsv7KvcfxSTO3TFgNUyizYQ6j+TLszOAJCAgoMgwszcqIH4Y+CEUG MTqxSIvkNQNnJp3EOq/jiIY9TfmLa4Nix1WXSj549H3swjfJ74eGKycU7gSxG3bFgJgv C7uLdVyyhy7qMWOu53OZVIrNKbafTh8fXRDpO6KeHHEFCbmNVIT7oM5hI4Z+hjFaougM 8SE3YhgvB/I8qzDzdAuXmP0SsB4J90y5JuX/tDc4Alk2CTpou8Je/6qfXPyvUkIAfXfI kdNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T7n13i8y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a632a12000000b0045b0a113f6asi9296520pgq.846.2022.11.14.03.51.24; Mon, 14 Nov 2022 03:51:37 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=T7n13i8y; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236703AbiKNLtE (ORCPT + 99 others); Mon, 14 Nov 2022 06:49:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236625AbiKNLsY (ORCPT ); Mon, 14 Nov 2022 06:48:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28BF026577; Mon, 14 Nov 2022 03:45:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBC0361090; Mon, 14 Nov 2022 11:45:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 600C5C433C1; Mon, 14 Nov 2022 11:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426342; bh=LDDWnbc0G82XezA7Wy98vToKYOH6Yv/7cEWA4wpWfUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T7n13i8yGgCA6xfsV2rnP2Sn2LRC3XAIWA67SLNgXWXfb/KLM+FpdCj3dH7Y7MK0K ZFpnJPsia5D9y+j37HQE+wvcQCcPCYKPwpaIDH51AgBam6gDc6YnjzSOGzjhAQtPPZ BuV4mFX63jbFtrHwGzWF9uefmuk5uCwWd1AOjOwgT4jwgucnZo4DcyvqVMncXkX/Xi ww1vFk+Vd4oYdxIVzT2mt40FyMs70o9Y5xW55gLvnX0UaCWguDqZvgBrD98tHkTAfc qiUDD4bphIEkYCn0zqfMmUAy4ulNVj39L1XzJ3XsV5tmWEYlmcMH5X/1DnAGDPj/st KXI7Ob2C7SEtQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 43/46] scripts, lto: check C symbols for modversions Date: Mon, 14 Nov 2022 12:43:41 +0100 Message-Id: <20221114114344.18650-44-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472192802280694?= X-GMAIL-MSGID: =?utf-8?q?1749472192802280694?= From: Andi Kleen The gcc LTO nm doesn't output assembler symbols, which makes the symversions check fail because ksymtab is defined in assembler. Instead, check for a C symbol that is generated too. Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 9b522c9efcb6..dafa8aeed9c2 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -173,7 +173,7 @@ ifdef CONFIG_MODVERSIONS # be compiled and linked to the kernel and/or modules. gen_symversions = \ - if $(NM) $@ 2>/dev/null | grep -q __ksymtab; then \ + if $(NM) $@ 2>/dev/null | grep -q __kstrtab; then \ $(call cmd_gensymtypes_$(1),$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ >> $(dot-target).cmd; \ fi From patchwork Mon Nov 14 11:43:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098584wru; Mon, 14 Nov 2022 03:50:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf79pIu6U2GF33G7JZtm26seguuF8g8JDCupDb5b1NxdbYWxck52olN3ESpRZ8lnp4ANAuho X-Received: by 2002:a17:906:b755:b0:78d:b8b3:f027 with SMTP id fx21-20020a170906b75500b0078db8b3f027mr9718582ejb.439.1668426620870; Mon, 14 Nov 2022 03:50:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426620; cv=none; d=google.com; s=arc-20160816; b=JxgiktmKlE4TPGv8pcgbS58YqrfYlR7w0M/h27xOne7Kw2fJJCwAn0D1etitvtmMet 5nNMcC+wZ46s5SEuQO08I/2dzoopmNjipXxQC4SiuzftIvq94aoYOSpFguSoe0CrUyAH f6nzEFhhkgiRp2OEZKQU+EU5d3nQpANF0xoKVZ9Kya6QnsjZFzzfFnWSAZ2/ToZ5MwK2 dgkA8/29nt6X6iFTsnAPmfmsbbn783NHCDapJjdcxmbqq8NXCfyTny3BANDDZBIqX/nb TOEnQ1FXgeCVkiUaMGWDiylx6b72P7tGHD7KvAwwcXcZze0Q+jh4lpVsatgdr/L2mfPt jwKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=K45gGdRp5MOmi5LrYe/52NKixQYdpA0Sf5b2sxz0zLQ=; b=iCUA+7inf7G9UCMBy0teCyzFz6O3Wv+tNTJjIaeo4M1ZANC94WsH0HrAJz0c5tcVzG LfS6wGs3eQBsu8IF6PWVg9XYwClU8fzfCaeJkFAA2F0oJEnvxy4KM37cphTWSWsUStGj 0rdKqcma8HXOVx3RHaJGgLirPSCABrqpz6fk+FQXkPlSedO79bVQc98LCaLh5udmoDRw tglrUKr45gw5ZoImGVeJ4XA/5D9Tn5f7YttHET+rHhdbjKf427aKYCpeJOMFK48EPmJX 3CthVmBIE7FM2/R5qnABbCS2MWvmgdvDsNfXtL8eUfWxQA/CAqMpZjm8TPuUTKSWojgc /Z8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eNTVR7Yx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jz6-20020a170906bb0600b007a8c58b51a1si7766084ejb.179.2022.11.14.03.49.55; Mon, 14 Nov 2022 03:50:20 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=eNTVR7Yx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236925AbiKNLtQ (ORCPT + 99 others); Mon, 14 Nov 2022 06:49:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236791AbiKNLso (ORCPT ); Mon, 14 Nov 2022 06:48:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05AA122BCB; Mon, 14 Nov 2022 03:45:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5E0FB80E6C; Mon, 14 Nov 2022 11:45:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F72EC433D7; Mon, 14 Nov 2022 11:45:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426344; bh=G+vw37jjgRCPwdc1JxfhASj9yJQMYjGyuVjD7aOBanE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eNTVR7Yx8lZnY0lqCRyi5JIDpYvNn2+K4wTQzUi5xXUVgDX06l8t75Ij7EeS8NQlZ o06lTGdDbvZHpYMT522j6EAJwd06l5nk1A7aNKe/tvWylCIsMdnE4KM+MTEalUJRzI ayuXBvGeo9yYSyVLjfdNsFq03GLKfLBDxCQdPwFKwk1g+8y0oTLsjLruT9Q0Sw7xHT qPNVVdhkm6DKE/RlJDKRg+AcDo61w7nHGAkorUnJttKILR7M3vUgjwJzVqc814df+2 JOcdH2JCbjj+mVGZQyq0t+w1L2DXuin1C9565yCq5EFq0jwP4qFGVTDa0cZzh//G7T /KxlRioeirYBQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Masahiro Yamada , Michal Marek , Nick Desaulniers , linux-kbuild@vger.kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 44/46] scripts/bloat-o-meter, lto: handle gcc LTO Date: Mon, 14 Nov 2022 12:43:42 +0100 Message-Id: <20221114114344.18650-45-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472112261225555?= X-GMAIL-MSGID: =?utf-8?q?1749472112261225555?= From: Andi Kleen gcc LTO can add .lto_priv postfixes to symbols. Ignore those in bloat-o-meter to allow comparison of non-LTO with LTO kernels. Cc: Masahiro Yamada Cc: Michal Marek Cc: Nick Desaulniers Cc: linux-kbuild@vger.kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- scripts/bloat-o-meter | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter index f9553f60a14a..ab994b3bf6e2 100755 --- a/scripts/bloat-o-meter +++ b/scripts/bloat-o-meter @@ -45,7 +45,7 @@ def getsizes(file, format): if name == "linux_banner": continue if name == "vermagic": continue # statics and some other optimizations adds random .NUMBER - name = re_NUMBER.sub('', name) + name = re_NUMBER.sub('', name).replace(".lto_priv", "") sym[name] = sym.get(name, 0) + int(size, 16) return sym From patchwork Mon Nov 14 11:43:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098590wru; Mon, 14 Nov 2022 03:50:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6PkU76pv/QNo7K41PpYlF9m1oLYDSmU6RU/GYLZNjXpow3WRA86FQrbRVPAvSfQn3T2WDM X-Received: by 2002:a17:906:d8a3:b0:7a0:9d58:5c7b with SMTP id qc3-20020a170906d8a300b007a09d585c7bmr10028065ejb.115.1668426621405; Mon, 14 Nov 2022 03:50:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426621; cv=none; d=google.com; s=arc-20160816; b=xLANVisnPeLS53CR8drhh5AXEYS/nfo2ce+Josi+9px9Q3M6vrsasknWYRdMd+MbjF NqrGGOF870hNLAw0wER4vEWgSLEMkitlMbXXqs755Bu/XtF6M2UR7T775EW4iiuZXdzP FMa6nWeZsHdRnMAMEz+nZaiT9QQI76rIQKyMBSo431TOC6wxMkcT4/4bAxgH1b0hajG6 zW84z7yNJ9GLUsU77L+7QKFEwsBjSlKZpx1HzMz22VOCijaoi5sFvUtmu/A1+LYgRwXn Rb23k3n5gvgp3Kj2iFIZwIN1LzXCVxMVlj/+++uGl+0PWSabyK498WofXrpIgkSzbHn2 bHKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WKn9laZEOJi3RLi6Cjh54rnSbYfEE4oIQi1+zqu/7Pw=; b=BGdO+mlXhwdXLxwoLYQ4iPXb3QbP3+BdD5uTACVbPB+WkggfE2u9TKbDm0IG1aYgUb cDrUeQslrCWvFS/7KsnVNdpJW+CW2hHuUGcFLNEwxdQUtkfl6+zac0Cs7ydJq68g9IV1 Di95KHdo/KGEgcfBOsHWq7eesySPI2IX9L+ArrcL0fbz5xbHc21FICq5enAOzZVrCHN7 1BPNY81gk529ZUki6oZpKEBenwi8D6RZ3iSroTFd6k1JKkgMLXVPURMoMBLJCjIwojBZ +Cxcu/E1gDRHWepBVfadQpobJJ1bclHpVqthJ3rxuslWIop0QXGIadNOkmeMnwMjOLSy dYYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EFbgopP7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg40-20020a170907a42800b007a072b8240csi9015797ejc.927.2022.11.14.03.49.57; Mon, 14 Nov 2022 03:50:21 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=EFbgopP7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236936AbiKNLtS (ORCPT + 99 others); Mon, 14 Nov 2022 06:49:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236807AbiKNLsp (ORCPT ); Mon, 14 Nov 2022 06:48:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0FE926ACF for ; Mon, 14 Nov 2022 03:45:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 85743B80E73 for ; Mon, 14 Nov 2022 11:45:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E18D3C433B5; Mon, 14 Nov 2022 11:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426347; bh=Vp8sXRjsUE/N3VsCm0HTjAxgxp+yKdf3km9PrguLdDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EFbgopP7Xnz3OCxeyZ9dcO7w77PdM+IjWJR+aVFwRb07CIksjaoVGfWRstf783N3H E9KmA6woJ2FGqfK90S6TJFAAg5qqUMfIZnpNnD41beNsjEwz7rSxXUrO/OrMHRPSV3 kDGkTCXO58rfI0ilFhyev9a6eZAWQ4x6BDFE2vqHEpHf0eHS/AIvBpS/g2iCLWeQCw tuPzy3sFNcoiPdUxzbGfFS2cjgRdxlor4gHE27/K7pGeaQwOwKcjJnL6WF/8Y/rjRI BS2gkGyi1GVd1B+Xzolmhmm9kcReS83I2v/sHxf4/uIXfQZgFX5WQhRWeZYl4WEm3q I0gUgpxAvcQJw== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Martin Liska , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Andrew Morton , kasan-dev@googlegroups.com, linux-mm@kvack.org, Jiri Slaby Subject: [PATCH 45/46] kasan, lto: remove extra BUILD_BUG() in memory_is_poisoned Date: Mon, 14 Nov 2022 12:43:43 +0100 Message-Id: <20221114114344.18650-46-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472112553821613?= X-GMAIL-MSGID: =?utf-8?q?1749472112553821613?= From: Martin Liska The function memory_is_poisoned() can handle any size which can be propagated by LTO later on. So we can end up with a constant that is not handled in the switch. Thus just break and call memory_is_poisoned_n() which handles arbitrary size to avoid build errors with gcc LTO. Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Vincenzo Frascino Cc: Andrew Morton Cc: kasan-dev@googlegroups.com Cc: linux-mm@kvack.org Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby Reviewed-by: Andrey Konovalov --- mm/kasan/generic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c index d8b5590f9484..d261f83c6687 100644 --- a/mm/kasan/generic.c +++ b/mm/kasan/generic.c @@ -152,7 +152,7 @@ static __always_inline bool memory_is_poisoned(unsigned long addr, size_t size) case 16: return memory_is_poisoned_16(addr); default: - BUILD_BUG(); + break; } } From patchwork Mon Nov 14 11:43:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Slaby X-Patchwork-Id: 19773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2098707wru; Mon, 14 Nov 2022 03:50:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf48F6QIQUz3Zk4gpKQxiD7VL1q3Ubn703OWzopGbkTwg0fl2smM+tspisV9hWEPCuKJVY9q X-Received: by 2002:a05:6402:2cf:b0:467:69a4:afe1 with SMTP id b15-20020a05640202cf00b0046769a4afe1mr10342753edx.332.1668426642409; Mon, 14 Nov 2022 03:50:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668426642; cv=none; d=google.com; s=arc-20160816; b=O4wVWt+n1IROyGgQQta7D+GSeJmYLaoYjJ/mBx0UddofjF6C6yKMxhck1pocNuKZto +kocIXYD3RszGhm9SbBQMXPqkcINkAwszg2fW9gkdyxSwSnxsjiwzHWrdY0avtaDm3kw LOkUFFmZ+OdVHYcFYeRxWpaojVsMqaxoupxIUSh2UHTVhPoMR0f/l9EzydLxLOE914g4 7gpJzxH2le+4Ab5bAwPEZRUM1N+P2ON5Xgp6B0xFnPlS3kCV6ETZ3u30ryS5PjkDOxR5 LETfUkwkjnpS8PbBHb8Y/KzvGuofdRUREBnChF/3SLWBVXo1uvYxktXjU25zNYhSuMkf cmNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DHJEZ1hkti3eVHDoUOYKZ242N/C17Ji6rQfiOtGS9UQ=; b=My8nPfh8TG678ugVKD+wFJG0iYOohffPr5fCag+M9GjCVpQkeZ9wUoYTH/EGF+T0CP Bxg9KYxutzWRdog6IIJouJG4ELAP10tQDXRMQgb8rU+r7SHm8m6VE4aHURwMt2AU3kST mo0z989oU8J5o9K17FVVXzi8Oo/ZY2kKM0m3ginCn++OO3dYdVjbLh4XBom+KXaG20Hq u7qi+Z3EOv5ctQa2NqkYor+Y0UZ0YKxq83UZOipew0e80aawYAq0tI2h3hJLKWbubUCP XN5QiPCIF33+tPZ8xJeCW0VECTSKgNKsHnFdYCxyD85mX4jYbyp85Gf3AGakC1EqmQrn DkaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MFQ4rwMo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd6-20020a1709076e0600b007adb6459e64si8951836ejc.862.2022.11.14.03.50.17; Mon, 14 Nov 2022 03:50:42 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=MFQ4rwMo; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236827AbiKNLtV (ORCPT + 99 others); Mon, 14 Nov 2022 06:49:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236888AbiKNLsr (ORCPT ); Mon, 14 Nov 2022 06:48:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA56226AEF for ; Mon, 14 Nov 2022 03:45:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7120261089 for ; Mon, 14 Nov 2022 11:45:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1C12C433D6; Mon, 14 Nov 2022 11:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668426349; bh=A+tvGmiPkdD/tiJtZ2PygCRidinCj9dZAztxEalKFws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MFQ4rwMoo91PDbtGRAhfNHD2tB2gdI6kaKYYhll+WgT0N9ClgCLrz1G7eSJEKm32N 7vAm+qRyLv4yj+Av9FVbav/+u2qCr3OoSa3T1c5qz8OFUar6/MuEi7g0KSLHiuTyom aZEc1+di2HwETuEHaTap3kRcwEPi6pYFPEG+SFkJsz4qwF33JpqqHpdaK4Yo8UU8Kl yDPm8yHfi717VqpaDrINO58xEtRnByReq+wr7l5ohVzyDcjPedqMTXvB7US2QTjAWC uUVgPeNxkPhQDQI5j1q+leAY0OJE3PN+0+Hzcn/7JvukNQyT4L/yFfV/Ug926FErkQ NCWmmkHRry9kQ== From: "Jiri Slaby (SUSE)" To: linux-kernel@vger.kernel.org Cc: Andi Kleen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , x86@kernel.org, Martin Liska , Jiri Slaby Subject: [PATCH 46/46] x86, lto: Finally enable gcc LTO for x86 Date: Mon, 14 Nov 2022 12:43:44 +0100 Message-Id: <20221114114344.18650-47-jirislaby@kernel.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221114114344.18650-1-jirislaby@kernel.org> References: <20221114114344.18650-1-jirislaby@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749472134797663096?= X-GMAIL-MSGID: =?utf-8?q?1749472134797663096?= From: Andi Kleen Now that everything is in place, allow gcc LTO for the x86 build. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: x86@kernel.org Signed-off-by: Andi Kleen Signed-off-by: Martin Liska Signed-off-by: Jiri Slaby --- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 6455d843d559..2c96facf4a42 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -112,6 +112,7 @@ config X86 select ARCH_USES_CFI_TRAPS if X86_64 && CFI_CLANG select ARCH_SUPPORTS_LTO_CLANG select ARCH_SUPPORTS_LTO_CLANG_THIN + select ARCH_SUPPORTS_LTO_GCC select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_MEMTEST select ARCH_USE_QUEUED_RWLOCKS