Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7809403ybi; Mon, 22 Jul 2019 21:16:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlvlnotyXGsgeU20g3jQvPavRMlSOe2Jtu2CVIZZK1NMA764Nl3OZLZvgezTHqoPwmHsVw X-Received: by 2002:a63:6f8f:: with SMTP id k137mr21499619pgc.90.1563855388360; Mon, 22 Jul 2019 21:16:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563855388; cv=none; d=google.com; s=arc-20160816; b=cfgMjuwYQD7mDkVZ53kI3KiYnZkbak/TLqF1MoQrcwyEfaVEepV4pGpltqQ6Y12U97 mYAaWRjOGYBf2VFz/ZfuAE1r7tBboMxjif0zznxEO/1HsQePlOVHi6/jlDLe/aELNDoa PhLrDIqr4/xi3+D0N3BEI8FwcBAE7cs/GgUNbqd3WsR63ranVzS2m9WiEOeQ2DDM6tAd FwIy3ALApNmPpdnq/cQ9F3+u46GDEemC7OSzSH2kyY2aXtaIvhpbq0kAh0UjLbnKs2on lQ5JGrgkoBVLkdmfW4aHKqcopdtp5gXWBe2tyyHze4dJGD6MJQEY1EWGOTjIMEQ0h0Ik IQvA== 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=krTygS594B1FZs0zxHGIhwRvOWSOgPOCJ7d+lzUap1c=; b=okFtsI32SJQNi6V8/URC+Nw2Fn6upcYwLZO3v9c3BKUqTBcDMySiLOBRGtepucRAgP 3Sn6a3Xoyj/hIowtbgSnH6lgzivJkSHBK7Sweh+VnC93ll58xMg3YbSRVo9ojbeK17wc 0SU9eDy3N4yk/QrfQSbHsdbE4DxDFMcNA1y6KsC8iNssr0F2JpA2KbbOxz8Y4usaP8yz RY+V659z9o1vVF/iwqTGs2/SYIwi9JR76VHj+bLWopioMP0qeLqIdksZCt/Ypt+wm1Bq J1pEGpuzNjuAhYb8eoLc/0QynV8mzV9EYJkx/9fcHTBWvF5Qdavl0FZe8H9vui4PD5/P CI8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dzmrcvvd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c16si38645522pjq.20.2019.07.22.21.16.11; Mon, 22 Jul 2019 21:16:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dzmrcvvd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727362AbfGVWKQ (ORCPT + 99 others); Mon, 22 Jul 2019 18:10:16 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:37400 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726265AbfGVWKQ (ORCPT ); Mon, 22 Jul 2019 18:10:16 -0400 Received: by mail-pf1-f195.google.com with SMTP id 19so18028705pfa.4 for ; Mon, 22 Jul 2019 15:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=krTygS594B1FZs0zxHGIhwRvOWSOgPOCJ7d+lzUap1c=; b=dzmrcvvdXqjOOH2iH+12XcZSKksebydFb2ZYxT9GbodnuOF9BpqJp4n5j/loQphpRI HRmUqha1rPX4GIAsOG5ImqmEboaBmiQgjZch3HR9H6BSbOMMhPrqIb6oU+Pn1nUIrnHc 3mf1VzZNZFQ/8rHIdepI5IkRKI0GpLDBO4sZraLNkvMg/W7J74U8tKaeYUjrtLpQ3ls1 hCufw3bRSGl2a19r8jW4qqy9nk3oMrB0pE8kJLyDD4B+MIcmjTTCCV7D/pOc0Bs42x4g h/0AsU2iK6XXjcEEwQMK87YBdya+yV8Vo40BgY4mtxAYPyNhful5BcgHWMMCxsf6hmVR SfHA== 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=krTygS594B1FZs0zxHGIhwRvOWSOgPOCJ7d+lzUap1c=; b=pRsEQHpSwV0qCwFtGgpgl5xH83v3eGdUFb7NQzL1JU3WbCpWSH7zmNh0NBv2nRCRUs XvtRazRfu2e7Fivz+eULi/atZbsi4rhnuML+aU+9EI9P4mcnqYIHtxYU9Qq19CkFQ3wF 8TfYW/X0wROY3OsjFu1cCoKYjtoHiNYBmFPHYPQOPTdquPDqkUE53QhZ4BnLHYmbJ6Hc YygdPt9yxESBNQs30ADt2Q9Zbu/l9w9wMBybDYG9T8/BY0nv70DPWvvk5EOE8fGiI5yd VUsXvgS/HiFJh1zNT+tVLw/14UpBM6iophfX4MwN9TURtN8SWxnUcAB4QwBjuFIPVO1b qDwA== X-Gm-Message-State: APjAAAVOQ+dexBWDpHg/XFJSi67UXuLikUhybKYBHseMMRmQFsDvScJg 7Rs48ZR37jnmAO9PuoEzHPZlojOG2MjDwN/ywkbgOA== X-Received: by 2002:a65:5687:: with SMTP id v7mr74903566pgs.263.1563833415147; Mon, 22 Jul 2019 15:10:15 -0700 (PDT) MIME-Version: 1.0 References: <20190722213250.238685-1-ndesaulniers@google.com> <20190722213250.238685-2-ndesaulniers@google.com> In-Reply-To: <20190722213250.238685-2-ndesaulniers@google.com> From: Nick Desaulniers Date: Mon, 22 Jul 2019 15:10:04 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] x86/purgatory: use CFLAGS_REMOVE rather than reset KBUILD_CFLAGS To: Thomas Gleixner , Ingo Molnar , Borislav Petkov Cc: Peter Zijlstra , clang-built-linux , Vaibhav Rustagi , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , 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 Mon, Jul 22, 2019 at 2:33 PM Nick Desaulniers wrote: > > KBUILD_CFLAGS is very carefully built up in the top level Makefile, > particularly when cross compiling or using different build tools. > Resetting KBUILD_CFLAGS via := assignment is an antipattern. > > The comment above the reset mentions that -pg is problematic. Other > Makefiles like arch/x86/xen/vdso/Makefile use > `CFLAGS_REMOVE_file.o = -pg` when CONFIG_FUNCTION_TRACER is set. Prefer > that pattern to wiping out all of the important KBUILD_CFLAGS then > manually having to re-add them. > > Fixes: 8fc5b4d4121c ("purgatory: core purgatory functionality") > Reported-by: Vaibhav Rustagi > Suggested-by: Peter Zijlstra > Signed-off-by: Nick Desaulniers > --- > Rather than manually add -mno-sse, -mno-mmx, -mno-sse2, prefer to filter > -pg flags. > > arch/x86/purgatory/Makefile | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile > index 91ef244026d2..56bcabca283f 100644 > --- a/arch/x86/purgatory/Makefile > +++ b/arch/x86/purgatory/Makefile > @@ -20,11 +20,13 @@ KCOV_INSTRUMENT := n > > # Default KBUILD_CFLAGS can have -pg option set when FTRACE is enabled. That > # in turn leaves some undefined symbols like __fentry__ in purgatory and not > -# sure how to relocate those. Like kexec-tools, use custom flags. > - > -KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -Os -mcmodel=large > -KBUILD_CFLAGS += -m$(BITS) Is purgatory/kexec supported for CONFIG_X86_32? Should I be keeping `-m$(BITS)`? arch/x86/purgatory/Makefile mentions `setup-x86_$(BITS).o` which I assume is broken as there is no arch/x86/purgatory/setup-x86_32.S? > -KBUILD_CFLAGS += $(call cc-option,-fno-PIE) > +# sure how to relocate those. > +ifdef CONFIG_FUNCTION_TRACER > +CFLAGS_REMOVE_sha256.o = -pg > +CFLAGS_REMOVE_purgatory.o = -pg > +CFLAGS_REMOVE_string.o = -pg > +CFLAGS_REMOVE_kexec-purgatory.o = -pg > +endif > > $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE > $(call if_changed,ld) > -- > 2.22.0.657.g960e92d24f-goog > -- Thanks, ~Nick Desaulniers