Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8612177rwp; Wed, 19 Jul 2023 12:28:11 -0700 (PDT) X-Google-Smtp-Source: APBJJlFkmFv+0MFECUqGf1ZqrtdBOPCBdirLUgIho4HlSEZup3Dvzomfx1lufcpLjcs9JQyyt2aA X-Received: by 2002:a17:906:b1d4:b0:967:e015:f542 with SMTP id bv20-20020a170906b1d400b00967e015f542mr359889ejb.44.1689794891260; Wed, 19 Jul 2023 12:28:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689794891; cv=none; d=google.com; s=arc-20160816; b=rFHPda1dS0fNeTu5+8vKHyUWxVkyYyf6vvPS33UvcERXEw3BxALJd9V41Cio+2ejNW l4AeOy02i7S9G9bwq/dY9lHOlInYGL1n3U8mdweiADHgpBfLk1yw0zesEU7LXnXHP5A3 32/ru7QFT30cuvNbBRK4dskbL/1kIbdPdrK1v0Y7dk8NcpGVrx/6ncPaSMC9ONpjOGHk UTmpxIegC6vzkuJvdYlh1ygp9iH4rgteymEH8eQLcgo0znFGl0G1Qy8YkTNDnC8VRr// qpfnlJPr0f/Fzqw4YWDfE+b0THUL6fNxm166R2gReYKts27qtIPcw8+bNJcf5EI6q7n1 j7Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=6pLh1ge91wbNtTxbzR8m1LU9rst4j1dBIJURPHXKS74=; fh=rUZWDY09e3HqGKl4Xq9RwKvnT90x+Ijg/CNiEZbh684=; b=QWYp/nXiUCYPSldPfjI4zts2hx1ypDWkrKpL4RmYK2Q07Bs/NR1pEvYWF84/CpD208 SMD41SY+U9NZJqnkrgjvl5VWI1Q00tSca3yu0WiekrqKAuYcFYK6dQyVz6xaaLcxjXqC VvRplYH6RlNcjfa67CmJxGE4xJn7W3fXCyzSt5tCqSEQ3H27DxsbX2bSeZMn7ElSlHnH bf5F7M4Yx91nBPxAgAZH6W1M7VfcIgZGNIfDIri4Zo2s9OLzxPuvNgJ4IJsEw+IyuWe8 fwekgUJ2wp7pGi2x5rmyrkYxTPH5uzpu7CgSfFQZXyG+OPScVBIlpbNOGo+e4Gt9ggbH 3O5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rl18-20020a170907217200b00997c9f1bdf7si3281164ejb.407.2023.07.19.12.27.46; Wed, 19 Jul 2023 12:28:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbjGSTJM (ORCPT + 99 others); Wed, 19 Jul 2023 15:09:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjGSTJL (ORCPT ); Wed, 19 Jul 2023 15:09:11 -0400 Received: from hi1smtp01.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CDB1199A; Wed, 19 Jul 2023 12:09:09 -0700 (PDT) Received: from hi2exch02.adit-jv.com (hi2exch02.adit-jv.com [10.72.92.28]) by hi1smtp01.de.adit-jv.com (Postfix) with ESMTP id 93BEF520165; Wed, 19 Jul 2023 21:09:07 +0200 (CEST) Received: from lxhi-064.domain (10.72.94.1) by hi2exch02.adit-jv.com (10.72.92.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.27; Wed, 19 Jul 2023 21:09:07 +0200 Date: Wed, 19 Jul 2023 21:09:02 +0200 From: Eugeniu Rosca To: Masahiro Yamada , Nicolas Schier , SzuWei Lin CC: , , , , , , Eugeniu Rosca , Eugeniu Rosca Subject: Re: [PATCH 3/5] kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22} Message-ID: <20230719190902.GA11207@lxhi-064.domain> References: <20220109181529.351420-1-masahiroy@kernel.org> <20220109181529.351420-3-masahiroy@kernel.org> <20230623144544.GA24871@lxhi-065> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230623144544.GA24871@lxhi-065> X-Originating-IP: [10.72.94.1] X-ClientProxiedBy: hi2exch02.adit-jv.com (10.72.92.28) To hi2exch02.adit-jv.com (10.72.92.28) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 Hello Yamada-san, On Fri, Jun 23, 2023 at 04:45:44PM +0200, Eugeniu Rosca wrote: > Hello Yamada-san, > Hello Nicolas, > Cc: SzuWei Lin (committer of the patch in AOSP [1]) > Cc: Kbuild > > On Mon, Jan 10, 2022 at 12:33:15PM +0100, Nicolas Schier wrote: > > On Mon, Jan 10, 2022 at 03:15:27AM +0900, Masahiro Yamada wrote: > > > GZIP-compressed files end with 4 byte data that represents the size > > > of the original input. The decompressors (the self-extracting kernel) > > > exploit it to know the vmlinux size beforehand. To mimic the GZIP's > > > trailer, Kbuild provides cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}. > > > Unfortunately these macros are used everywhere despite the appended > > > size data is only useful for the decompressors. > > > > > > There is no guarantee that such hand-crafted trailers are safely ignored. > > > In fact, the kernel refuses compressed initramdisks with the garbage > > > data. That is why usr/Makefile overrides size_append to make it no-op. > > > > > > To limit the use of such broken compressed files, this commit renames > > > the existing macros as follows: > > > > > > cmd_bzip2 --> cmd_bzip2_with_size > > > cmd_lzma --> cmd_lzma_with_size > > > cmd_lzo --> cmd_lzo_with_size > > > cmd_lz4 --> cmd_lz4_with_size > > > cmd_xzkern --> cmd_xzkern_with_size > > > cmd_zstd22 --> cmd_zstd22_with_size > > > > > > To keep the decompressors working, I updated the following Makefiles > > > accordingly: > > > > > > arch/arm/boot/compressed/Makefile > > > arch/h8300/boot/compressed/Makefile > > > arch/mips/boot/compressed/Makefile > > > arch/parisc/boot/compressed/Makefile > > > arch/s390/boot/compressed/Makefile > > > arch/sh/boot/compressed/Makefile > > > arch/x86/boot/compressed/Makefile > > > > > > I reused the current macro names for the normal usecases; they produce > > > the compressed data in the proper format. > > > > > > I did not touch the following: > > > > > > arch/arc/boot/Makefile > > > arch/arm64/boot/Makefile > > > arch/csky/boot/Makefile > > > arch/mips/boot/Makefile > > > arch/riscv/boot/Makefile > > > arch/sh/boot/Makefile > > > kernel/Makefile > > > > > > This means those Makefiles will stop appending the size data. > > > > > > I dropped the 'override size_append' hack from usr/Makefile. > > > > > > Signed-off-by: Masahiro Yamada > > > --- > > > > Reviewed-by: Nicolas Schier > > If you don't mind, I would like to report another instance of > "/bin/sh: Argument list too long" while building some out-of-tree *ko > in a number of downstream v5.15.78+ kernels containing [1]. > > For some time now, we've been living with ugly hacks to overcome it. > > Fortunately, recent git bisecting efforts apparently reveal that > current v5.17-rc1 commit (and its backports in downstream) look to > act as the culprit (confirmed on several host machines). So, I > started to have some hopes of a long-term solution and hence > sharing the findings as a first step. > > I am not entirely clear how to properly trace this behavior, since no > amount of "make V=1/V=2" uncovers more details. Purely by accident, I > looked into the top/htop output (while running the repro) and > noticed several processes doing: > > /bin/sh -c dec_size=0; for F in ; do \ > fsize=$(sh /abs/path/to/scripts/file-size.sh $F); \ > dec_size=$(expr $dec_size + $fsize); done; printf "%08x\n" $dec_size \ > | sed 's/\(..\)/\1 /g' | { read ch0 ch1 ch2 ch3; for ch in \ > $ch3 $ch2 $ch1 $ch0; do printf '%s%03o' '\\' $((0x$ch)); done; } > > As it was the case in the recent report [2], the above command seems > to require/assume generous amount of space for the shell arguments. > > I still haven't compared the exact traces before and after this commit, > to quantify by how much the shell argument list is increased (TODO). > > Another aspect is that current commit seems to introduce the > regression in a multi-threaded make only. The issue is apparently > masked by 'make -j1' (TBC), which adds another level of complexity. > > Unfortunately, the build use-case is highly tailored to downstream > and is not repeatable against vanilla out of the box. > > I will continue to increase my understanding behind what's happening. > In case there are already any suggestions, would appreciate those. JFYI, we've got confirmation from Qualcomm Customer Support interface that reverting [1] heals the issue on QC end as well. However, it looks like none of us has clear understanding how to properly troubleshoot/trace/compare the behavior before and after the commit. I would happily follow any suggestions. > [1] https://android.googlesource.com/kernel/common/+/bc6d3d83539512 > ("UPSTREAM: kbuild: rename cmd_{bzip2,lzma,lzo,lz4,xzkern,zstd22}") > > [2] https://lore.kernel.org/linux-kbuild/20230616194505.GA27753@lxhi-065/ -- Best regards, Eugeniu Rosca