Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7763586ybi; Mon, 22 Jul 2019 20:15:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdx30KdqHfzuYJnQajD8kdsSghTd8wd3nnBAh1fo5HpUVdIG76HKToHBR7+BxW1p36C34/ X-Received: by 2002:a65:50c5:: with SMTP id s5mr74228820pgp.368.1563851715779; Mon, 22 Jul 2019 20:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563851715; cv=none; d=google.com; s=arc-20160816; b=KQejRLKyyERlKThuduKTQksxkWQVeQNhoHCmmLCJBJ0CHOkVyHCUh9+OjEd+vwq43e 6WvJPaV5T6K/83cDF49j3YRl741m67rxkG89SMmttZfwNh3FUrUe2NJlH/QNMfIRt97l fsWuW7uptwnI6KpZSBDy02McOnV6K7GAz5UNIB985Rekc6XySpuivo6iyKTkDffrQRec iioyi1eg2NoXCqbgEThlZLugTLmn/IJMsY94ATf7jVVwlLMhCIP5Qa8i7NVvgSgUbvXW rotcYYaeIg2NBPFg/oKp232nqlGJbg8x9lHmJwU3PI4za4YHPtBiKFwONZJTyJqr5SyZ xJjA== 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=Bx2/ePKA8H3cgL5H2m2rJiaOZ0YWGIns7rKdFWu1CvE=; b=maRyNI//L8jL7HwrV3A/Ja8+KUNLh6U/AdF2uxqCbSevZ2Q1NjGELZ6WhrJ5yNrpn8 a8MTw0jZLhYQtjPW/IuMOP2mNrb6jImp2ufwx5dlNgCvXkHVsfB+8G7TUHHDkmLnwT7l Z5c987tvPv8Az7jQrdbI9UQPrdTa7AK3MZhs8ub9HsV9yyh8nK75mwCvi00wseXZ4G1M s0KpZfCRdAy2qWRmKpqMJUTqZmV9cmzws8CKNedDR7BM/2XSP3K6MyMPndVdMkkX9zM7 9r8zRKHtCNALruVyueIBwkNOMJdp+h2+cl8u+L7CgKATjaN5SwxQNybGXU65uulUJth9 mI7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cpwkkjOL; 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 y65si10955939pgd.487.2019.07.22.20.15.00; Mon, 22 Jul 2019 20:15:15 -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=cpwkkjOL; 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 S1730923AbfGVVMV (ORCPT + 99 others); Mon, 22 Jul 2019 17:12:21 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33736 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbfGVVMU (ORCPT ); Mon, 22 Jul 2019 17:12:20 -0400 Received: by mail-pf1-f195.google.com with SMTP id g2so17974518pfq.0 for ; Mon, 22 Jul 2019 14:12:20 -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=Bx2/ePKA8H3cgL5H2m2rJiaOZ0YWGIns7rKdFWu1CvE=; b=cpwkkjOLk25nBbTGu2WNpjUDYdO+q1x07ANNm/j3n6/Ri82GyGhsmPlLyNydLB84me c88eJ3vF2boELtTlxfZl5HAuOq6KfFavmpEIRW81ecH92XPTLO7lPzU71NUNl+dtHtaX kWTBdNvHFtNYi2ySsiiFM6ZvTn1xfilyYzw7kU+bcbORNN0SHD5CAVr0dE7egLY7Tf6B J4uusXzpXcelhxkL8Yh2yCaLynfgNkqns22rVNk0OQg3JD9yPv2xeFdbnx0W8ZcW5euK XTgZLd5NBCrFenu+gJTV2jDJX+gLtOgIvPxgWCW7E/6mA2mfjlqtfPAy8PwAALWwushW sIrw== 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=Bx2/ePKA8H3cgL5H2m2rJiaOZ0YWGIns7rKdFWu1CvE=; b=bkoqRwU+UMXx2a9PDmGkas7mWsVTn50Xrk829WskZtvTGCLOaJGYiRc0zuKpLh9tjB a4kt9K9Dc2tLlGwwrZtLpldW6R0v3hcgA9EQrtWhGWauINb6VN2XhuevhuN7llolp/gY nq3nXMgmoOBuXGRUQOumInegItrwK8sDyCRrbV2QokM6IjYbkR21FycUE2WDxw68+gNX 00MjltQBOxJkdl6g2Q6yZ4tm9FL98HEyiX/dn17t5FP0tDE0jj+/mYP5hnP5H1QCD6QL xrOB3m16Qs32n6Ieqt7RKsqHzHbhh8Ya5nNvLmKwGOxfGAuTjNZPKQBQsXTLr7MiKdDT +ugQ== X-Gm-Message-State: APjAAAUbn9VShtqpnh4TexPIeudx8hkJ9C3Bh3q5cVX5+BKVVQes0Sqh WaFDZV1keh0b8J1uJK1v0ghIG5Satanfvpb3VazxFw== X-Received: by 2002:a65:5687:: with SMTP id v7mr74705885pgs.263.1563829939659; Mon, 22 Jul 2019 14:12:19 -0700 (PDT) MIME-Version: 1.0 References: <20190718000206.121392-1-vaibhavrustagi@google.com> <20190718000206.121392-2-vaibhavrustagi@google.com> <20190719081732.GF3419@hirez.programming.kicks-ass.net> In-Reply-To: <20190719081732.GF3419@hirez.programming.kicks-ass.net> From: Nick Desaulniers Date: Mon, 22 Jul 2019 14:12:08 -0700 Message-ID: Subject: Re: [PATCH 1/2] x86/purgatory: add -mno-sse, -mno-mmx, -mno-sse2 to Makefile To: Peter Zijlstra Cc: Vaibhav Rustagi , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , LKML , Vivek Goyal , "# 3.4.x" 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 19, 2019 at 1:17 AM Peter Zijlstra wrote: > > On Thu, Jul 18, 2019 at 02:34:44PM -0700, Nick Desaulniers wrote: > > On Wed, Jul 17, 2019 at 5:02 PM Vaibhav Rustagi > > wrote: > > > > > > Compiling the purgatory code with clang results in using of mmx > > > registers. > > > > > > $ objdump -d arch/x86/purgatory/purgatory.ro | grep xmm > > > > > > 112: 0f 28 00 movaps (%rax),%xmm0 > > > 115: 0f 11 07 movups %xmm0,(%rdi) > > > 122: 0f 28 00 movaps (%rax),%xmm0 > > > 125: 0f 11 47 10 movups %xmm0,0x10(%rdi) > > > > > > Add -mno-sse, -mno-mmx, -mno-sse2 to avoid generating SSE instructions. > > > > > > Signed-off-by: Vaibhav Rustagi > > > --- > > > arch/x86/purgatory/Makefile | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile > > > index 3cf302b26332..3589ec4a28c7 100644 > > > --- a/arch/x86/purgatory/Makefile > > > +++ b/arch/x86/purgatory/Makefile > > > @@ -20,6 +20,7 @@ KCOV_INSTRUMENT := n > > > # 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 += -mno-mmx -mno-sse -mno-sse2 > > > > Yep, this is a commonly recurring bug in the kernel, observed again > > and again for Clang builds. The top level Makefile carefully sets > > KBUILD_CFLAGS, then lower subdirs in the kernel wipe them away with > > `:=` assignment. Invariably important flags don't always get re-added. > > In this case, these flags are used in arch/x86/Makefile, but not here > > and should be IMO. Thanks for the patch. > > Should we then not fix/remove these := assignments? Good point, it's actually pretty straightforward to do so. It just will invert the order of patches in the series, as then the memcpy/memset infinite recursion is now guaranteed with CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE=y (without the other patch in this series). Did the x86 maintainers have thoughts on their favorite implementation of memset/memcpy for me to use from the thread from the other patch in the series? I'll just resend with this fix and maybe we can discuss there and spin a v3 if needed. -- Thanks, ~Nick Desaulniers