Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2931087rwa; Mon, 22 Aug 2022 17:12:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR7F4mbn3bK2Zfry7aY7AeXDHofi7Xrr68ls5p189bLaQnNjf9Q1NrJDOlPnfCOg/2btmyMU X-Received: by 2002:a05:6a00:2302:b0:536:c7c2:10a9 with SMTP id h2-20020a056a00230200b00536c7c210a9mr4623941pfh.11.1661213573111; Mon, 22 Aug 2022 17:12:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661213573; cv=none; d=google.com; s=arc-20160816; b=HL4aGKLjtbaFBMag2C5gh6teMXtYWGt33HUZ8V0PPmPJnDGX3IwhvS5LTXbDyu0jf9 zINsTjRMJJJ7jzxgpCkJtLcEKDv/vTqUmYfBwnTOyUhdGXHbRP+xklEmBswR10LFhqwF ZzfWU+i3GjZgdIvFjVEWa77R5LOudmcE7JAWshNukOzAIIUwwlcTWyoPbv+KY/3y6HS1 miE9g79g7byJ0xrc2eoHHfQi2DYvuxxnUZ46L7+K4YOauJeF+LwB+J44/ryJC+HpDHNI 1sotQHR/yLhCCxsfpfkSPodJVXXf7BFtXQO8AgRwI44JT6SOldJXvvxQmNvRLE05S9nP XVrw== 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=DFTMwRMyUNoCzrFPNgv8ys2sausHJWIL+AVipPkABmQ=; b=cBxkxKY/gCO2bNazcPp6YYM4VRPCsJfoacIjBXH/r9IlU3aZ8H9aDl9YnPKfEVqpLo XubY3B92s0uRi2OcPxo1HzEsPuDTLH1FHK8wmIPkUE6imdxV6PAzwUmr+6YxbiR61sPz CSjK8Dan787OwSUX2p4I/nacHOVSazKu+7H0QPpbHSOqgsFUbDlWjoodyoT1EbKwsRfE tYMEVXPSebLYwygZ2ExzwAHBkCPYqwcaqFhi2++wftg4Eil8V3Ox6E+8FGINUqPzOcJa rSgMvUAyaCZRh7/YKXEnrQk7nZCjzNK2BQ7QwEOj+0/lMAjYh466IOjV5zikGP03LEZ7 eeaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=pPXvEGUI; 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 n8-20020a6546c8000000b0041603073c17si15218573pgr.394.2022.08.22.17.12.42; Mon, 22 Aug 2022 17:12:53 -0700 (PDT) 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=pPXvEGUI; 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 S238872AbiHVXzo (ORCPT + 99 others); Mon, 22 Aug 2022 19:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232777AbiHVXza (ORCPT ); Mon, 22 Aug 2022 19:55:30 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 927E25244B for ; Mon, 22 Aug 2022 16:55:29 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id 73so10792880pgb.9 for ; Mon, 22 Aug 2022 16:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=DFTMwRMyUNoCzrFPNgv8ys2sausHJWIL+AVipPkABmQ=; b=pPXvEGUI2VVm2HNlQxfpHcnrXYcJgzeHJTf7JpKE/wdALSKlCu9YYcVhUAGsfZpScZ i9iP794rArn60DEO4jMtrdrUcMErGSJM446/bWhL9vi7A/UwlCkwKludVGEnXrzO87r1 Co+7SrNFnTykekPmtGF5ZBQpC5L6GhdFwFm8aorbXnpf2EGs/l0sK2ylX/3ZXJ6gipny GeMoEkhxWLFEyf0Y/UvfVwCgYm4YjNYHAfsssXUXoZJpgwDp9oG/LYzLujlxpXsrvVnA s6bmtvrGo/bEdeoQZH/kWe28TF7znSGb1rwZCpVe/nIPI6GLm1L0/XsaGAbeW0wfwbhf hFyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=DFTMwRMyUNoCzrFPNgv8ys2sausHJWIL+AVipPkABmQ=; b=SYzUqfVXVYtYTDvXSM1T7aGb0jReX/so0fcQrjKM9DcWSPyN7CWpq/4ggPMpEds+Fd rXEgr3F3ws4u9smmG7l+u7/PkNpXIq77oJYxKc+zwIhlA4gz3khrOSbcNvaW41BTq+X5 Cbkf874VCaSDQtbUQzICZIrzhHFbP3hYVQ01NViD/nyQjwtc9gKinSvesFjyO6xFjf/G 2jONyh7qA9gKRhIoXbQq5+aCrZdSj+u9SowQjeiO3Kisv6qLW5JpMaizC9+nVgnMGKGM wNACwkHzRKIUW7DRAeC1NeKsSyGvxVCRx8PZVXGNdGT/s8KyeBdQY8of3zAc5GoPHmM0 uxSA== X-Gm-Message-State: ACgBeo2u2UJDBb9VOS8+M7qaP9jKJJXii6zSdvL6hQNDX1VydELqTZvj kW+TDpzouZA1agegHy+bEbGmK1DNyNTAgfc14nvbxw== X-Received: by 2002:a65:5941:0:b0:41d:a203:c043 with SMTP id g1-20020a655941000000b0041da203c043mr18451145pgu.483.1661212528790; Mon, 22 Aug 2022 16:55:28 -0700 (PDT) MIME-Version: 1.0 References: <20220810152033.946942-1-pgonda@google.com> <20220810152033.946942-11-pgonda@google.com> In-Reply-To: From: Vishal Annapurve Date: Mon, 22 Aug 2022 16:55:17 -0700 Message-ID: Subject: Re: [V3 10/11] KVM: selftests: Add ucall pool based implementation To: Sean Christopherson Cc: Peter Gonda , kvm list , LKML , Marc Orr , Michael Roth , Tom Lendacky , Joerg Roedel , Mingwei Zhang , Paolo Bonzini , andrew.jones@linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 On Fri, Aug 19, 2022 at 12:37 PM Sean Christopherson wrote: > > On Fri, Aug 19, 2022, Vishal Annapurve wrote: > > On Wed, Aug 10, 2022 at 8:20 AM Peter Gonda wrote: > > > void ucall(uint64_t cmd, int nargs, ...) > > > { > > > - struct ucall uc = {}; > > > + struct ucall *uc; > > > + struct ucall tmp = {}; > > > > This steps seems to result in generating instructions that need SSE > > support on x86: > > struct ucall tmp = {}; > > movaps %xmm0,0x20(%rsp) > > movaps %xmm0,0x30(%rsp) > > movaps %xmm0,0x40(%rsp) > > movaps %xmm0,0x50(%rsp) > > > > This initialization will need proper compilation flags to generate > > instructions according to VM configuration. > > Can you be more specific as to why generating SSE instructiions is problematic? > The compiler emitting fancy instructions for struct initialization is not out of > the ordinary. When executing these instructions, I was hitting #GP in the guest VM. CR4/CPUID settings seem to allow a VM to execute instructions that need SSE support enabled (which I was doubting earlier). After some more digging, it looks like the compiler is not able to ensure that operands for such instructions are 16 byte aligned as required by the hardware. There is a bug discussing this same issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838. Adding -mstackrealign seems to help avoid running into #GP and things seem to work normally. Though I am not sure if SSE instruction execution is reliable from guest VM within selftests and so was suggesting usage of "-mno-sse" or equivalent flags.