Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2590453rdb; Wed, 21 Feb 2024 12:30:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUwaXjzwEFJiOm7OC5ERzOQJW2aN3zSsZ7LX/HI70WGisXVLaO7eJYXUxhTVNyNuypXFUdaXgG0um7VUw7QBIDtPGOOdHlXbV7On+uCCA== X-Google-Smtp-Source: AGHT+IG+mS0m65FHzVkjLt+sUnxgLKoYUWm+Ji2bUQV5oubIq42hlI0ee1jQlkZpiBfRpOxEzoRw X-Received: by 2002:a17:90b:1085:b0:299:3f45:bd57 with SMTP id gj5-20020a17090b108500b002993f45bd57mr10836946pjb.30.1708547451338; Wed, 21 Feb 2024 12:30:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708547451; cv=pass; d=google.com; s=arc-20160816; b=u5NRzgCrb/FAJlkxzXuil1sf1joFyIoReQKjOeoImvE2b0iiHJIXKJcBwjhn9ghN+x GAWMs0/JNgJSkC9Y0Z954NruurSRGjqFMvgBqz6o+W7YySufj+x8/yYIPUdjfMe6QBqe 3POLfndmp5vwE4DPWzvH5wzP3csb71B2fr8S73mrqzeXp+/GpbhQPLXHnXrvAFcL2kIh TTA7dM8BwoYkt7k5M3YhhiVLZFuChOcLBQPEZpCg5m9l+6+WhK5DOlDUEm+W47uU1al9 Qz27c9JCjKYBZlElW3hwNj+9ytEaQWNGmc3TiIToDxIKcDbQTWy/kxw7lB2UGlD4J/8i 3Hcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=vWEUJWbOIDWjPVpsgtWgbej7BleeWIMrMnxc/5NBnN8=; fh=8owG9aYiG9GBF4X3nBcIS5FHntnyywlz3fk7IamJwOE=; b=kh9aP69UJ7zKy0C/supPsMlcwD7CQkgTD+kBjmTFsjPiSnUyWUIRpyBZGweOF1hHvG lLsui2Bq4CnTo0C5HDQNd3aN6Z93jR3IsormqSMrp8hhQEjpU0tjgB8UYmoef+lszDq0 8Jdnakl1zfmqHrTcJ6DwC0A02cOycG7RvxAjLka94fHiciRgqmQQ0QNFnoTgWBYIajVY FhI+0t8/VsxOVcY1iiN3trYeIAxxsVRv9rEpk2mJ1o5DCeQXDKtugx0ATHlwLqIH3t1r cEalrxiX3YCZ2Xs5IKnPjG7yBQ+GfROKXUE6+J51WNeGuspCVCvNmkerR8McLVsZ0gzZ uX/A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mTHYVEhr; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75463-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75463-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e63-20020a17090a6fc500b002970ba9b73asi8649779pjk.128.2024.02.21.12.30.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 12:30:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75463-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mTHYVEhr; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75463-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75463-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 96C61284DEF for ; Wed, 21 Feb 2024 20:30:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A365D53A1; Wed, 21 Feb 2024 20:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mTHYVEhr" Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 541701EB41 for ; Wed, 21 Feb 2024 20:30:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708547433; cv=none; b=KZtxyALOXgYQiZxkxSVZ+A0GXhn+NfRzEBzT+E2pVYKnzzJXgx+6tE+cl3efKV70ro03C4rSSc8M1VOme3x9+PY3eznndOW6VN2hojhA/nZ90OJNBR0GcY6u+WevytYX7GzhRAhgWQY1Ffmvb4+OaHLpuFave4k1xQ4fMVNwExU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708547433; c=relaxed/simple; bh=vWEUJWbOIDWjPVpsgtWgbej7BleeWIMrMnxc/5NBnN8=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=VroLqVzxCgtKlJZlpA35+fgXOLwRqoe92xFmZ/hz8GOX2I5v/SvGSn8GKkWIWyzzqp/Gt5n6KhJlYMiuniW7IF5wMTrjTrwm80YFBVQ8VmH0i7XwrHLPt/YrNYS6bHE+BsmwP4JdTeJrje1L/1vV95r4nf18mRprQbhPdXZ2Rvw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=mTHYVEhr; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-564e4477b7cso3046a12.1 for ; Wed, 21 Feb 2024 12:30:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708547431; x=1709152231; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vWEUJWbOIDWjPVpsgtWgbej7BleeWIMrMnxc/5NBnN8=; b=mTHYVEhrbqNew1JkiUQytTshKEogY+StCD9t8+hxWSFhiVQtWNGtyGK0mZFuZZyXCw txPg27l9xifIOzRMtWHD9HDs6MZMdjZCbMQPtbDKpBQDDs+bkOLO8uRhlr6A/I3F+s61 RfKkMnJWhyh1bJ6LVaz1cgpVObEj/d12ufqEvuSf+SURj7T/TFFopU5AhHH35L2vdvu0 IZeVkCn2KdCEnCM6BFBUQyMFaofmHOdkQ5w8VGlfQZ5Sv84vDL+ASIoVpGZdojpL+keZ UydFWbcWLNXb3ma8D37UX/Myg6vpAm2UzwTwTogbA8dXSIVXmc0FU5O3/YpQoPdJzC2g nSLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708547431; x=1709152231; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vWEUJWbOIDWjPVpsgtWgbej7BleeWIMrMnxc/5NBnN8=; b=nqsu+iMP1JkiLiBLz2/N3tMZegiwQkfQDc79Jbw/2KC3ObKDdtuoQxId7y7xvcOv/O z5sYvaFjqu61tg2vC/2Nw5U09vmn+Daw4MYkQgwyZUQcHrKU1lN8FIPsGe32rs+ZrgKy 6Bbe6Hw2ZMctB7KGyGiR0QGNMuz6h4xLC2GpsGqJpuEKB8i7XKJzWvsOd0xl2XA7XWQ8 foSlfSqZRgtq6tfzaH4IfO6b8Yn7G/1oR4NiMtOGJRilxzV2EBHcH5J0aB3ETQzGo7hC Y10AVWZ1qeCjxEfjI66gKjJBeEYXhM7FQCKQL3doXMWL+9vUKAYiY6ft3IkW+g//IQow w+oA== X-Forwarded-Encrypted: i=1; AJvYcCUIX/fXxRHC2Dv2uhWlESgSrgnvYQb/eVezcSc5w/N4Sru6RGf77G29pHnlsdxGD24xOBrHsgEFGbqnDvRAd1izg6byXs4hpqA0nXNB X-Gm-Message-State: AOJu0YzzcksGY8zgsF/5ZXOD1Xt4XG0enrP7ETDsIPi8MwhwbENRiqHt OkAYQ6oTI3f0/GU97ctoeXSuPijsZtEJgT7jKJT7R3RU8ycTpdq5smeEvq2bzyG8AZGX09cgXmk y62VzStxc7atu+N/PdcWkrismwJ0MqnOj7weC X-Received: by 2002:a50:c30f:0:b0:564:55e5:6ee1 with SMTP id a15-20020a50c30f000000b0056455e56ee1mr261904edb.2.1708547430535; Wed, 21 Feb 2024 12:30:30 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240221202655.2423854-1-jannh@google.com> <20240221202655.2423854-2-jannh@google.com> In-Reply-To: <20240221202655.2423854-2-jannh@google.com> From: Jann Horn Date: Wed, 21 Feb 2024 21:29:52 +0100 Message-ID: Subject: Re: [PATCH 2/2] kallsyms: build faster by using .incbin To: Andrew Morton , Masahiro Yamada Cc: Nick Desaulniers , Miguel Ojeda , Zhen Lei , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 21, 2024 at 9:27=E2=80=AFPM Jann Horn wrote: > Currently, kallsyms builds a big assembly file (~19M with a normal > kernel config), and then the assembler has to turn that big assembly > file back into binary data, which takes around a second per kallsyms > invocation. (Normally there are two kallsyms invocations per build.) > > It is much faster to instead directly output binary data, which can > be imported in an assembly file using ".incbin". This is also the > approach taken by arch/x86/boot/compressed/mkpiggy.c. > So this patch switches kallsyms to that approach. > > A complication with this is that the endianness of numbers between > host and target might not match (for example, when cross-compiling); > and there seems to be no kconfig symbol that tells us what endianness > the target has. > So pass the path to the intermediate vmlinux ELF file to the kallsyms > tool, and let it parse the ELF header to figure out the target's > endianness. > > I have verified that running kallsyms without these changes and > kallsyms with these changes on the same input System.map results > in identical object files. > > This change reduces the time for an incremental kernel rebuild > (touch fs/ioctl.c, then re-run make) from 27.7s to 24.1s (medians > over 16 runs each) on my machine - saving around 3.6 seconds. Ah, I found no maintainer for this file in MAINTAINERS, but now that I'm looking at the git history, it looks like fixes have come in through Masahiro Yamada's kbuild tree? So I'm not entirely sure whether the maintainer for this is Masahiro Yamada or akpm.