Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3449486rwb; Fri, 20 Jan 2023 16:41:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXsq2p0AyynXRc6sntGA+SVgPIchpIqBQnShQ+WjWQi9f+9SIrh2XNBKZC8OcK+Q0aFxUWhk X-Received: by 2002:a17:902:ebc9:b0:194:8260:cc50 with SMTP id p9-20020a170902ebc900b001948260cc50mr17817183plg.43.1674261693768; Fri, 20 Jan 2023 16:41:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674261693; cv=none; d=google.com; s=arc-20160816; b=uGQj5Sd2fe9Qy+CMH7sGmjg02pS7RW5p4+e+2fYrUYlWts0/Hc+zVEtbv/8Ff8EU/K WUigzlvCx8Et2TWFH2j+I8rYV8Uv/ZVbIoxh/0Bt1u6svIRjqclHiUgYtBeI4aksE1RX 8waqgNrTCIeg1b1k7Vcww+gVmumpAYFeZGbPmiSyUoH6venWR+Vfx91ijsV8l8FfoZP3 QYbtB0a6aYSvby3KbQZBl8nrOisfxd8uEKZlfiyfrN+0sCGpASydmVVEo9lyFgss8Xms Kvbgca4T7z+sxVTqL5ACWL7QXoQurqOFrAcFhoDpSe4qjlonvr22n5qRKxKYatrcgbVz xchw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=iSSiGqnlhzGiDLCzSAtleJIHOm3o/jPruEIVdPoSPmM=; b=HSRHA6bEpT6I6o64fHVg4spNTZoyv8x+B1QVPHtxtTMptwdIA4hpZKCMWnTdY5FY1a Pkje1tqLzbc9l/oJzHmcdcR5OLDgzgN1MW4KbGExJWZjoNLASiJL1IbihtCH/Gj9XelC TNjn3O2QXc3Dyde5Pxw39Dde4MCBI8MXsxAu3Nt+F0fnISAFyem6lKvdmCmsx6RTL8CA lfZNt6gRtmV77wjHsrjbyoBMklMj8Cj9XS6x/3KnR3x+FzYQPZzxaNCP6P1/5t6jMFER G/x1DL3wqdPxEFYZNUhsSSEzkiBn/Dr3tSu59syxcNFm93JrcjXMb216RnD+0TjFeAeH b2bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=i3bQf8fO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p6-20020a170902bd0600b00194d678f367si4719129pls.321.2023.01.20.16.41.28; Fri, 20 Jan 2023 16:41:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=i3bQf8fO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229604AbjAUARc (ORCPT + 50 others); Fri, 20 Jan 2023 19:17:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbjAUARV (ORCPT ); Fri, 20 Jan 2023 19:17:21 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E3B0BAF19 for ; Fri, 20 Jan 2023 16:16:54 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id a14-20020a5b0ace000000b007bf99065fcbso7437957ybr.2 for ; Fri, 20 Jan 2023 16:16:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=iSSiGqnlhzGiDLCzSAtleJIHOm3o/jPruEIVdPoSPmM=; b=i3bQf8fOpOKYn4DsIRRzCUmnsCj+LMJV96+HJVERlyQV50GGhU4m9vph9dFvXLxh33 a6PijOok3GOHph4F2aF0Uo8zDnzeIuzhlwcNn/lmpe5ODxgUHA6krkenLMHAVsTMVG8A DQOBErL8T8utFKaa2hBwsfFZN+8NkBWs2+uZyhMMxhKrvH43FYJ7I3M1J/lUsHYsC3JO fw9Xc1e8mfpAWmMp8YsemFubhIbnl6sBYlN9R8OgKxypq4dN68xuIBEA7FNjAMYzR1gV Yu5F1WkIRQy/QQlujBYRghEm0b6qOSbdB7fBbpYVu8C0LSyi/b3WnM5jtqRfovPdsPgx hPeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iSSiGqnlhzGiDLCzSAtleJIHOm3o/jPruEIVdPoSPmM=; b=aiVLeTYVPKLFTBOqHSjYXV8XkOBDXwXj08bzJ54nXnLnnHpHzLpa+0flxTerwd5mhM kzrGIi5u0gEms/GLrxYYiewjeZ30uwXD7Cny99vx/MOodqE5X/AGYi2yJ+QJ5ndelHPd 1v+UK1LemwTFgvdS1bO80DmN73yPqirM9UsTBAaRZfBbCeNRdohz2pbNG0RXuM5A1Laj +rYI0rA8dakH0gs3KR4ipU3rkap1XH4fhxCEEGRCdIrclfI1cQGbUcypVMd8bJKENxXQ gP8KXV2CVJbSXYnzWabC/Q46r6RPsEtZbrHug3T37mB9Xn9xBJmleFCYNF82OBozKJ5q vK9Q== X-Gm-Message-State: AFqh2kovC8Zgjy243aNk5moxIqzqlkf9uFk5Kmbuinbz7ykt230gEtRY 0JQdaJ4ZI4mAQW7BnFCX8VaVA5ITbJ6TMyU//Q== X-Received: from ackerleytng-cloudtop-sg.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:b30]) (user=ackerleytng job=sendgmr) by 2002:a81:bc9:0:b0:471:d0:fcdf with SMTP id 192-20020a810bc9000000b0047100d0fcdfmr1932256ywl.108.1674260206107; Fri, 20 Jan 2023 16:16:46 -0800 (PST) Date: Sat, 21 Jan 2023 00:15:19 +0000 In-Reply-To: <20230121001542.2472357-1-ackerleytng@google.com> Mime-Version: 1.0 References: <20230121001542.2472357-1-ackerleytng@google.com> X-Mailer: git-send-email 2.39.0.246.g2a6d74b583-goog Message-ID: <20230121001542.2472357-9-ackerleytng@google.com> Subject: [RFC PATCH v3 08/31] KVM: selftests: Require GCC to realign stacks on function entry From: Ackerley Tng To: linux-kselftest@vger.kernel.org Cc: pbonzini@redhat.com, seanjc@google.com, isaku.yamahata@intel.com, sagis@google.com, erdemaktas@google.com, afranji@google.com, runanwang@google.com, shuah@kernel.org, drjones@redhat.com, maz@kernel.org, bgardon@google.com, jmattson@google.com, dmatlack@google.com, peterx@redhat.com, oupton@google.com, ricarkol@google.com, yang.zhong@intel.com, wei.w.wang@intel.com, xiaoyao.li@intel.com, pgonda@google.com, marcorr@google.com, eesposit@redhat.com, borntraeger@de.ibm.com, eric.auger@redhat.com, wangyanan55@huawei.com, aaronlewis@google.com, vkuznets@redhat.com, pshier@google.com, axelrasmussen@google.com, zhenzhong.duan@intel.com, maciej.szmigiero@oracle.com, like.xu@linux.intel.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Ackerley Tng Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some SSE instructions assume a 16-byte aligned stack, and GCC compiles assuming the stack is aligned: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838. This combination results in a #GP in guests. Adding this compiler flag will generate an alternate prologue and epilogue to realign the runtime stack, which makes selftest code slower and bigger, but this is okay since we do not need selftest code to be extremely performant. Similar issue discussed at https://lore.kernel.org/all/CAGtprH9yKvuaF5yruh3BupQe4BxDGiBQk3ExtY2m39yP-tppsg@mail.gmail.com/ Signed-off-by: Ackerley Tng --- tools/testing/selftests/kvm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 317927d9c55bd..5f9cc1e6ee67e 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -205,7 +205,7 @@ LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/x86/include else LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/tools/arch/$(ARCH)/include endif -CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ +CFLAGS += -mstackrealign -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \ -fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \ -I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \ -I$(