From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26B40C07E96 for ; Sun, 4 Jul 2021 21:34:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D8C4613E5 for ; Sun, 4 Jul 2021 21:34:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbhGDVgr (ORCPT ); Sun, 4 Jul 2021 17:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbhGDVgr (ORCPT ); Sun, 4 Jul 2021 17:36:47 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74A9CC061574; Sun, 4 Jul 2021 14:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=NSFtDVcn1UZ5fHBw/wxs+K3bbxug+yk5lDy1UuFsjwI=; b=RfWCwnqm+aJY6sOMjzxwF735cg 4znkt9Ml72y6/G7e7iEtYhSGs4yIcigKPaZCiNV3h0uIrbaMV+yCfzyRuJ2R+B+UwQ6n4TZSNHXu2 Fpk8shYMvC/Okhl2xlbFBD7PjuXhXPegv2z2UxrE68M+kZXsXDLuPBjIgAeo52oYTQtCZWyFQCQF2 B0P6kICqA4ccWoo5Ggb42bKZssi005FTr7wVhGuMjZH+XsxBfa5PY8wXOqeJ7jP5I5UcaqdsZ7Zgs H6kvRUbSsCYmTx4Kqu1G7WV2mD3UgXhDfabTlMptjtgST8Etz2W7qnaTO7OVZ4t4qaFaINs9n2XYi 0pi5foSg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1m09kB-009byv-Ax; Sun, 04 Jul 2021 21:33:44 +0000 Date: Sun, 4 Jul 2021 22:33:39 +0100 From: Matthew Wilcox To: Miguel Ojeda Cc: Miguel Ojeda , Linus Torvalds , Greg Kroah-Hartman , rust-for-linux , Linux Kbuild mailing list , Linux Doc Mailing List , linux-kernel , Alex Gaynor , Geoffrey Thomas , Finn Behrens , Adam Bratschi-Kaye , Wedson Almeida Filho Subject: Re: [PATCH 01/17] kallsyms: support big kernel symbols (2-byte lengths) Message-ID: References: <20210704202756.29107-1-ojeda@kernel.org> <20210704202756.29107-2-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: rust-for-linux@vger.kernel.org On Sun, Jul 04, 2021 at 11:17:50PM +0200, Miguel Ojeda wrote: > On Sun, Jul 4, 2021 at 11:05 PM Matthew Wilcox wrote: > > > > What happened to my suggestion from last time of encoding symbols < 128 > > as 0-127 and symbols larger than that as (data[0] - 128) * 256 + > > data[1]) ? > > Nothing, sorry, we focused on other parts (e.g. the allocation panics) > during this iteration. I can take a look for v2. Here's what I have. Build testing now. diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index c851ca0ed357..0d45a6e5fdc3 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -67,6 +67,14 @@ static unsigned int kallsyms_expand_symbol(unsigned int off, len = *data; data++; + /* lengths larger than 128 are encoded as two bytes */ + if (len >= 128) { + len -= 128; + len *= 256; + len += *data; + data++; + } + /* * Update the offset to return the offset for the next symbol on * the compressed stream. diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 54ad86d13784..701566e01a1d 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -467,10 +467,16 @@ static void write_src(void) output_label("kallsyms_names"); off = 0; for (i = 0; i < table_cnt; i++) { + int len = table[i]->len; if ((i & 0xFF) == 0) markers[i >> 8] = off; - printf("\t.byte 0x%02x", table[i]->len); + if (len >= 128) { + printf("\t.byte 0x%02x\n", len / 256 + 128); + len %= 256; + off++; + } + printf("\t.byte 0x%02x", len); for (k = 0; k < table[i]->len; k++) printf(", 0x%02x", table[i]->sym[k]); printf("\n");