Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp652761rdb; Mon, 29 Jan 2024 13:55:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHXoCe9IpouwpztY+rzEg+uuDZUEgNagD4G8oPRY8/1+sAGKgfkeKE2LPBbNmC2g9eUC5CM X-Received: by 2002:a05:622a:18e:b0:42a:a67d:c9b4 with SMTP id s14-20020a05622a018e00b0042aa67dc9b4mr2374789qtw.42.1706565315268; Mon, 29 Jan 2024 13:55:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706565315; cv=pass; d=google.com; s=arc-20160816; b=mdV2xAutkB93ijjr/WUj6YdInbUnMiOHlw6xnbPfMEhev2rZQ3QhRbLi/EtrNuCGE9 ++2nMTMBcQv0Zlqbv4uurFBFkYb6KptWKT/Q3nX2LCc/ZORvigPEm+PH4smIsGl7gN0m b2ECoC+n0KNngLgFSFMuBg2KRSAZpa+PZDmkq2J8tlrPk9UCZN72rWHlY8akXtF77ENq /wsKZVzjVU9uwZSfrliDLHyYEeIDuu+D0IJWG1vJ2NMCy0dPRRzrzRHybODVQi/0weoT i5h2pDF1uwXVIll+HiHvSfJ1km/pduDVFVF5BTKIEnTAQm8S6YZSM1GlutMAMHZIz0Rw 0sZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XXYS9TkQoqVsA2/j1ZpPOarxxbCcsVezOFnQzSRmewI=; fh=3lQYfwYvdVLrT8jnliQ/LDt7z1FOqh9TPJLqgcBe/xE=; b=XhZ2qna4jbiysN5+206c6Pp3WkPnE3IAdlUQV8H8UefigLgab2YN7u52mmUNWNg6qx xcfpykmguqaKCM3NuPkivj//1z61bX/Fbicx8TkyZaXUgBLAUWQJZy4Ls7YW/z9YM+93 EgT9EKujScdVeaVhbUh5aDjZoRHIMAHZ+2TBTx3C7S3AYeqQYAourKT7pPB4Qg74wFlj 9gEZ0eswaAxF+Ccf3DONaE11rJikw6nuAIyqzQIzDS43fFeznAEg8Qzt8enENfDpQUZn DzgbNlUcVQ2bW2QY7IAnz2cfL2zVIXxbEwVVjyGf8FPzCKdQgua1QiP8O8AidO8GNwL7 4bEQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=WN71L1hV; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-43404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id u29-20020a05622a199d00b0042ab1888f61si848088qtc.432.2024.01.29.13.55.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 13:55:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-43404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=WN71L1hV; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-43404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-43404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 137041C23C89 for ; Mon, 29 Jan 2024 19:27:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E439376048; Mon, 29 Jan 2024 19:26:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="WN71L1hV" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FE7E76021; Mon, 29 Jan 2024 19:26:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706556412; cv=none; b=rHpbNX6jqvsvuOtIZAFI3d3Ey/PfQy4C71BVKpaXWZU+vVwRCBt5PLoVYUFH5CzHqN7zE0q5axc1rr11dPcmcV8FWOm0ygrx6Q/+wsISG4rjqPdwm5G+KL4d/sOs8Z9ukiUqpvV8lZ6oyL7iX1TuJmCjzZaxu1Fw+YxcFbfZjEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706556412; c=relaxed/simple; bh=6OCiC4FJvH1puMIfLD93cYqmFZGQ2Vf7xz9Nc/cNcoA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BP2tI5p0bl+9kt5fPTzX/XDCTEt6BGogl2hSU1CmlIb1BBWFGWbkSUZBkyJtq6mgVN7SAfmb35tsKiNnx2BuVUj9cuHchNh7Q7hU4U+b1n7pq4sAIeIg3yNWw1mnrZSyTCvo1slWoMPDAECWalFt6FV36sui/1HZQZrcmGxXM0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=WN71L1hV; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=XXYS9TkQoqVsA2/j1ZpPOarxxbCcsVezOFnQzSRmewI=; b=WN71L1hVDnV73rQGCe1x5FDleW sYb7DdMVHM89sqGnrR8vPtZ42XF+EMe6oLumSmpBaMuumjyo0bVPr1jOZQ+pkQka9LWJxnttcRoem o/vLR1aYBMIEJWGTZjvKZrJ5UyBukiVjgoKSyLUobeGB/dh3TFhWIvigEoA0qj2DDRU4/u53tMNrb O2xqnDzgVPu5uph/EIkrWgP2fwZOBkZiOOOlTFwwhubcq7RK8T3ihZmgIufg3j4fghnMn0+f73Pix vV8CxxXfbCPq+3epwL3Gk6KR/WMde16v5toaOz3R8VWp9KJHUm85V+GpRoutqFZOkdZP92HENVO4z PAMtEV7g==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rUXHN-0000000E67l-2blY; Mon, 29 Jan 2024 19:26:49 +0000 From: Luis Chamberlain To: masahiroy@kernel.org, deller@gmx.de Cc: mcgrof@kernel.org, arnd@arndb.de, linux-arch@vger.kernel.org, linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] modules: Ensure 64-bit alignment on __ksymtab_* sections Date: Mon, 29 Jan 2024 11:26:41 -0800 Message-ID: <20240129192644.3359978-3-mcgrof@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240129192644.3359978-1-mcgrof@kernel.org> References: <20240129192644.3359978-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain From: Helge Deller On 64-bit architectures without CONFIG_HAVE_ARCH_PREL32_RELOCATIONS (e.g. ppc64, ppc64le, parisc, s390x,...) the __KSYM_REF() macro stores 64-bit pointers into the __ksymtab* sections. Make sure that those sections will be correctly aligned at module link time, otherwise unaligned memory accesses may happen at runtime. The __kcrctab* sections store 32-bit entities, so use ALIGN(4) for those. Testing with the kallsyms selftest on x86_64 we see a savings of about 1,958,153 ns in the worst case which may or not be within noise. Testing on parisc would be useful and welcomed. On x86_64 before: Performance counter stats for '/sbin/modprobe test_kallsyms_b': 86,430,119 ns duration_time 84,407,000 ns system_time 213 page-faults 0.086430119 seconds time elapsed 0.000000000 seconds user 0.084407000 seconds sys Performance counter stats for '/sbin/modprobe test_kallsyms_b': 85,777,474 ns duration_time 82,581,000 ns system_time 212 page-faults 0.085777474 seconds time elapsed 0.000000000 seconds user 0.082581000 seconds sys Performance counter stats for '/sbin/modprobe test_kallsyms_b': 87,906,053 ns duration_time 87,939,000 ns system_time 212 page-faults 0.087906053 seconds time elapsed 0.000000000 seconds user 0.087939000 seconds sys After: Performance counter stats for '/sbin/modprobe test_kallsyms_b': 82,925,631 ns duration_time 83,000,000 ns system_time 212 page-faults 0.082925631 seconds time elapsed 0.000000000 seconds user 0.083000000 seconds sys Performance counter stats for '/sbin/modprobe test_kallsyms_b': 87,776,380 ns duration_time 86,678,000 ns system_time 213 page-faults 0.087776380 seconds time elapsed 0.000000000 seconds user 0.086678000 seconds sys Performance counter stats for '/sbin/modprobe test_kallsyms_b': 85,947,900 ns duration_time 82,006,000 ns system_time 212 page-faults 0.085947900 seconds time elapsed 0.000000000 seconds user 0.082006000 seconds sys Signed-off-by: Helge Deller [mcgrof: ran kallsyms selftests on x86_64] Signed-off-by: Luis Chamberlain --- scripts/module.lds.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/module.lds.S b/scripts/module.lds.S index bf5bcf2836d8..b00415a9ff27 100644 --- a/scripts/module.lds.S +++ b/scripts/module.lds.S @@ -15,10 +15,10 @@ SECTIONS { *(.discard.*) } - __ksymtab 0 : { *(SORT(___ksymtab+*)) } - __ksymtab_gpl 0 : { *(SORT(___ksymtab_gpl+*)) } - __kcrctab 0 : { *(SORT(___kcrctab+*)) } - __kcrctab_gpl 0 : { *(SORT(___kcrctab_gpl+*)) } + __ksymtab 0 : ALIGN(8) { *(SORT(___ksymtab+*)) } + __ksymtab_gpl 0 : ALIGN(8) { *(SORT(___ksymtab_gpl+*)) } + __kcrctab 0 : ALIGN(4) { *(SORT(___kcrctab+*)) } + __kcrctab_gpl 0 : ALIGN(4) { *(SORT(___kcrctab_gpl+*)) } .ctors 0 : ALIGN(8) { *(SORT(.ctors.*)) *(.ctors) } .init_array 0 : ALIGN(8) { *(SORT(.init_array.*)) *(.init_array) } -- 2.42.0