Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4776391pxj; Wed, 12 May 2021 13:02:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl6wrUVWhTtiuASQyGs/Fzy1t5Io2kCPBU8JiK3KszpZxZZZ0qZ0PZxUmPCXoR3Kfi9GtV X-Received: by 2002:a05:6402:2550:: with SMTP id l16mr45674222edb.249.1620849726254; Wed, 12 May 2021 13:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620849726; cv=none; d=google.com; s=arc-20160816; b=aKylNG/aT1Dm5YzoAGPy11Oone6FSgKKhCGSuKRAMPDZ2CEzDGctH2mvT8PuKZxTlI DvUa767xRiTmcN1ZPx5dR5Xl+sN3VcJOMtjuY5UVyKEL8inWlG1XVu4kHoxFxgfCJX5p XvQHCw+zfss+fC155yUkMXMSbVw7KrsRj879wIWxdXD7B0ZK1STGWUwURtIB9JEzgdQx 3+iefIymho6M4ZOHxXjUAOTm7ia8shmj/8btBJXsjpHif4Cmbh4TbzBwbWYvcsDD6EnB FJBXzFLeQEsF8I6icGGoeetA6j6GYKEqEtClGVfQFrbJDqlK2OUNT8U8SYfXE1vnra2t U20g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=d6PyBDz5Hz+HLZJQx9m2fhDjeQhvfMXZj/HKgsByeXo=; b=X39cHY92Xk0a7io+Zte6YVg63pnPHXet/Huay9m7TLfQMWhYs6huf1wexN4LBzyBi5 6+sh9y3hDcwFQaGw3R50t1GTd7P0WM5xVqRLfuZoNdkJo53jICRoKvNRrSNVRKASNi3+ 7UTsGKEgEy6/RJM7xn5H2PBlkoQ0d9pSMK2Gralmqx7BnOBGJKBQQ5NSBzvEbLsZePjG pXOj8gRic5jaGv+jk4QxztACnf93XtJE5imAUz96NlT0/F09xty4jQdPz5o+837UXBUC IyOa0K77IlJofBUcl/LIQUrSnryHKfxa3RUD08BDnrfujhR/XAA17G8d7dYfzo6DJ5uE ujxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EwWfS3nU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb7si664480ejc.507.2021.05.12.13.01.39; Wed, 12 May 2021 13:02:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EwWfS3nU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1383611AbhELTxJ (ORCPT + 99 others); Wed, 12 May 2021 15:53:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353016AbhELSGk (ORCPT ); Wed, 12 May 2021 14:06:40 -0400 Received: from mail-vk1-xa34.google.com (mail-vk1-xa34.google.com [IPv6:2607:f8b0:4864:20::a34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2261C061344; Wed, 12 May 2021 11:04:14 -0700 (PDT) Received: by mail-vk1-xa34.google.com with SMTP id l124so4877686vkh.7; Wed, 12 May 2021 11:04:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=d6PyBDz5Hz+HLZJQx9m2fhDjeQhvfMXZj/HKgsByeXo=; b=EwWfS3nUxUd6F4Hza9Wih48U/DhHt7dkvd7SLfXZB9AGGY0vfd4pqFrdusmN8cEYyS lQKD0SvIknzYN1dLg9K0qeIpr0aJTt96qaYa6V4J/wf4mjLc7k/lK18/sRp6PhSws5dv r14mRXobZqw+H/tl/bTwJK1xulWqG1EF93+eSdX519DzA3USBFSPV3TRhpryr/imW6/h IWEqrrl1Wlc5lDzEUm25bGumfYBqVBftmsSBUcMiOFXjEvh3NzJaGQVLR8+NzPj8bhpr mLyRO8xnT7z4aaJ9s2rAEczBml/s9ZWy6r7SvVTO0mFtUSciYzUZLTWk7D1GcQbJdi3a CZFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=d6PyBDz5Hz+HLZJQx9m2fhDjeQhvfMXZj/HKgsByeXo=; b=FICTEHw+dI4MVkehfttBwt7859WgoZR71tvf924gYIJl4v44TJr4k4yGz7a1IIvBYT 5R5DLcALZmqinI7+vLKcB/rWBXKQe0YBPwXl4dn4wynYsYUYhMRtLsc6jBpeu9IUX9qt xZJkFYyJ8c/aFRC+Kf4ejdEVgF3NunRk50/izw8Dj8ybey0TvSXomFixi8LAi5KMlAox oZKrkeuWMGMn7U/Juzmzx7gUk81SKGQNKbQVH4cwhe4DetU8SXFAXy88OaJBdxV06O/W U2e4WmjEFvSWNBGFpdFC/0N43U00wMWVtvzPindH1FVStgnyZrgFo0TPp29tFngbw8xV Oxew== X-Gm-Message-State: AOAM530Z3YfLqwLBQFjajtXDHVMNa/SsFXJgsLnqfFwPJ/FZnbC79yWY rQxCDnt3obiX1IYuEfm94z5QoW4LVuf+CFH3qJs= X-Received: by 2002:a1f:20c9:: with SMTP id g192mr4453848vkg.8.1620842654032; Wed, 12 May 2021 11:04:14 -0700 (PDT) MIME-Version: 1.0 References: <20210511185057.3815777-1-jim.cromie@gmail.com> <20210511185057.3815777-18-jim.cromie@gmail.com> In-Reply-To: From: jim.cromie@gmail.com Date: Wed, 12 May 2021 12:03:47 -0600 Message-ID: Subject: Re: [RFC PATCH v5 17/28] dyndbg: prevent build bugs via -DNO_DYNAMIC_DEBUG_TABLE To: Ard Biesheuvel Cc: Russell King , "David S. Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , X86 ML , "H. Peter Anvin" , Andy Lutomirski , Kees Cook , Nick Desaulniers , Masahiro Yamada , Linus Walleij , Nathan Chancellor , Geert Uytterhoeven , Bill Wendling , Sami Tolvanen , Arvind Sankar , Joerg Roedel , Nick Terrell , Dave Young , Pingfan Liu , Atish Patra , Linux ARM , Linux Kernel Mailing List , "open list:SPARC + UltraSPARC (sparc/sparc64)" , linux-efi , Linux Memory Management List , kbuild test robot Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 12, 2021 at 8:55 AM Ard Biesheuvel wrote: > > On Tue, 11 May 2021 at 20:51, Jim Cromie wrote: > > > > The next patch adds DEFINE_DYNAMIC_DEBUG_TABLE(), which broke several > > subtrees, including efi, vdso, and some of arch/*/boot/compressed, > > with various relocation errors, iirc. > > > > Avoid those problems by adding a define to suppress the "transparent" > > DEFINE_DYNAMIC_DEBUG_TABLE() invocation. I found the x86 problems > > myself, lkp@intel.com found arm & sparc problems, and may yet find > > others. > > > > Given that I was only cc'ed on this patch in isolation, would you mind > adding more clarification here? What is DEFINE_DYNAMIC_DEBUG_TABLE() > supposed to do, and why is it breaking standalone binaries? > > hi Ard, the thread starts here: https://lore.kernel.org/linux-mm/20210511185057.3815777-1-jim.cromie@gmail.com/ the _TABLE macro derives from DEFINE_DYNAMIC_DEBUG_METADATA, which puts private static struct _ddebug's in section("__dyndbg") the _TABLE macro populates a different section(".gnu.linkonce.dyndbg"), which is then placed by linker script at the start of the section. ISTM that the new section might be whats breaking things. And maybe that the vmlinux linker script isnt involved. so the storage the _TABLE wants to define is unbound (and unused, since there are no pr_debugs) I did see relocation errors somewhere... This is my 1st time doing something creative with the linker As to larger purpose, I'll try to restate the patchset mission: theres ~45kb savings possible by compressing the highly redundant data (~70kb) which decorates pr_debug messages. 1 - split the compressible/decoration columns to a different section|block, for block compression this adds temporary .site pointer from _ddebug -> _ddebug_site 2 - change code so !site is safe. _TABLEs only real job is to provide a header record, at the beginning of the section/array, for a single .site pointer to the _dyndbg_sites section added in 1. Because the header has a fixed offset from any pr_debug in the vector, all pr_debugs can use the headers copy of .site, and dont need their own. specialize & unionize So it allows to drop the temporary pointer, restoring memory size parity with master. And we then have the _dyndbg_sites section, full of redundant data, ready to compress. suppression with -DNO_DYNAMIC_DEBUG was a workaround, didnt think about it afterwards does this clarify ? thanks Jim