Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2533200ybg; Fri, 31 Jul 2020 02:37:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz70nOA5AgK9imwvXPpgS10iKbqMmGI2Uk5l76K8+FZwxc4kWhJ0DO6a25ARFSDatPvo1iK X-Received: by 2002:aa7:dc4f:: with SMTP id g15mr2986437edu.335.1596188248802; Fri, 31 Jul 2020 02:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596188248; cv=none; d=google.com; s=arc-20160816; b=ZguInrcgWd2QgmCVRwy9wDtdz0EefS9VaijFY3q6gv/E7cMs/X2AGUctOdT6etQsuK ZKD1sEz78W8AdIcA+fkSChIuje6tVNRTacSlgGi5n+y9qZwv/heTFunA4aZGhNpNDyap dsMBQnCKlKYJ9sc4drbRwtUm2hg2c0OqTBKmf+WqBVp8AU0f+zzo/ZMPUj3FSo93aCv2 bb3/o/gXDxRsRkGqA+BZ47ll71sSp8pRaxnXqBybe3Wi7ze8Mux+H/aQnbohR+P2xtfb J8byGeWBxj0uEx7i4DDpePeiCeO9H6h0Di2foraP5LR4/RIfg0r01Dh1sYUXlhaFW8D8 LHAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=9Ctv9OxMxq6ftNiYmBAiJ3RsrGDjO8BVv2UOeR56SSI=; b=N8M2qXjd0QbRS9UOe6qgtVgnwE4pLc2eanw5F4Mz4hs/lQGCKaywoVla4d5e0qDz2C BVSNfg8pkFx1sfW+df6gDSVcX9r8KZ5XjOsdY24zIESthLEV+Dh6b4OpNQBIF7otZedM URE0sZlmbv3EtvsN4H1LG1jyhGrr6Uq7DHtXv22Ks7TEGuupoV2TVLoUJxsbzzExB6UI 7/pd+HJdEXVOV1krkHFcLUG877nHr0LeJm+GnTUUy770w35s7kPRS++OO3ywH8xu5FrA arbD/6gMwsKOkT3UyMgzI/O8TDFpwJVn5iRfuD6U0Pt2S/MLii/snC+giZ1O+6+7itdt qwWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZPAK5/n5"; 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 w18si5089920edl.306.2020.07.31.02.37.06; Fri, 31 Jul 2020 02:37:28 -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="ZPAK5/n5"; 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 S1732107AbgGaJgr (ORCPT + 99 others); Fri, 31 Jul 2020 05:36:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727096AbgGaJgq (ORCPT ); Fri, 31 Jul 2020 05:36:46 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C29C061574 for ; Fri, 31 Jul 2020 02:36:46 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id j8so18711375ioe.9 for ; Fri, 31 Jul 2020 02:36:46 -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=9Ctv9OxMxq6ftNiYmBAiJ3RsrGDjO8BVv2UOeR56SSI=; b=ZPAK5/n5sNePzDkzOOb1uwKDsGgIghcMbjqgn6gZ8Tt9tuu28u7/sGdePPDIQt9dWY 8cfsEC4wFu3h3P7xL4AXIShUZ6aHJruyWRWeRYN957ZoMRG3FCzWoSnhO2g/8l7UDOOz k6TbHfVW2XMOJn1PRzaA2JnjqGHmKI+yZXCJB11XWwVn+9ZnU6iVhuGG+Hn9hbJ9J0HH PjPAUxVWScd4497dOKDDJmkZOFH8eAi8U5U3z4CJ5Gc1d8Pob7z9EKgiem58itUXtOaR kxZBZK8qPcUYQ9+uRLqK+7F6KgwyVFb4xs6sXsunViIPo/MY53tpU9UPI7PFxZACN0wN B89g== 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=9Ctv9OxMxq6ftNiYmBAiJ3RsrGDjO8BVv2UOeR56SSI=; b=uPTss+q8Gj47EfTXxb1J+AUutFIrbmks2avlbtCoIP5NPRaIwlxHCozg2WPoI5Q5ky hFr4iMLSb381lKHgz6xBamKdju2dneKl0JKT8BtLG6oEPwWH64zMSqMtdRXDL9k5J/jm 3UbOac8d0Uab4tpb3YDQadE3TH1FL2pl+IxvHXKa74wJZGY+XFSoqhWNvgYqr+2MESK2 oLsEI3Ef3hDmFDQsGv4epWeW5BWSoPhJqxp8NAqA8i27p++bJQsbe+ZaZPDKnT1zbSWV ad7hNjQXjk0DY/LdMcQdyAQv1onj4X9oMhRR/kGHxN1OeqxSHRvjvWnmwvv390djGbR4 yBGw== X-Gm-Message-State: AOAM532UdpGchuLXJYoA9CJ0nTNP1pWl3QSrkGaJHyDSZkKJ7/zm6cSt kE2zhQVB8yv3+r0b5PUC5bYp/B1ksohF8mJiaQ== X-Received: by 2002:a6b:b215:: with SMTP id b21mr2687836iof.43.1596188205758; Fri, 31 Jul 2020 02:36:45 -0700 (PDT) MIME-Version: 1.0 References: <1596097609-14118-1-git-send-email-kernelfans@gmail.com> In-Reply-To: From: Pingfan Liu Date: Fri, 31 Jul 2020 17:36:34 +0800 Message-ID: Subject: Re: [PATCH] x86/purgatory: strip debug info To: Nick Desaulniers Cc: "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Hans de Goede , Arvind Sankar , Steve Wahl , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 31, 2020 at 7:11 AM Nick Desaulniers wrote: > > On Thu, Jul 30, 2020 at 1:27 AM Pingfan Liu wrote: > > > > It is useless to keep debug info in purgatory. And discarding them saves > > about 200K space. > > > > Original: > > 259080 kexec-purgatory.o > > Stripped: > > 29152 kexec-purgatory.o > > > > Signed-off-by: Pingfan Liu > > Cc: Thomas Gleixner > > Cc: Ingo Molnar > > Cc: Borislav Petkov > > Cc: "H. Peter Anvin" > > Cc: Hans de Goede > > Cc: Nick Desaulniers > > Cc: Arvind Sankar > > Cc: Steve Wahl > > Cc: linux-kernel@vger.kernel.org > > To: x86@kernel.org > > I don't see any code in > arch/x86/purgatory/ > arch/x86/include/asm/purgatory.h > include/linux/purgatory.h > include/uapi/linux/kexec.h > kernel/kexec* > include/linux/kexec.h > include/linux/crash_dump.h > kernel/crash_dump.c > arch/x86/kernel/crash* > https://github.com/horms/kexec-tools/tree/master/kexec/arch/x86_64 > that mentions any kind of debug info section. I'm not sure what you'd > do with the debug info anyway for this binary. So I suspect this > information should ok to discard. > > This works, but it might be faster to build to not generate the > compile info in the first place via compile flag `-g0`, which could be > added `ifdef CONFIG_DEBUG_INFO` or even just unconditionally. That > way we're not doing additional work to generate debug info, then > additional work to throw it away. What about: diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 088bd76..7e1ad9e 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -32,7 +32,7 @@ KCOV_INSTRUMENT := n # make up the standalone purgatory.ro PURGATORY_CFLAGS_REMOVE := -mcmodel=kernel -PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss +PURGATORY_CFLAGS := -mcmodel=large -ffreestanding -fno-zero-initialized-in-bss -g0 PURGATORY_CFLAGS += $(DISABLE_STACKLEAK_PLUGIN) -DDISABLE_BRANCH_PROFILING PURGATORY_CFLAGS += $(call cc-option,-fno-stack-protector) Thanks, Pingfan