Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7776094rwn; Wed, 14 Sep 2022 04:26:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ylds6XHn5xXWo5h+Wkk4jvI/AGREI9STWLkeG/x+UNkgZcbpaF1ap5r1jR+Qpi9SxlKXD X-Received: by 2002:a05:6a00:4206:b0:545:68f2:292e with SMTP id cd6-20020a056a00420600b0054568f2292emr3295031pfb.76.1663154811928; Wed, 14 Sep 2022 04:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663154811; cv=none; d=google.com; s=arc-20160816; b=oXuva3aZnWAj3s3FQMWx8jeo8aM9Oyw77YKEJ2i4saadQdlsueCp1ELkcMYjQjw5Ey ep2wF1IXwfGsWCRGj6ZgquWK9ku2MMpnjH34RVTYTa9lG1/h3Enk2HvcRNeQgsFa3RC6 Sz4XF+hyYdREWw7LeqcXIsVAXTAo22nETNvRdcgeTBleL+ePsMawqM2SibQL4zo3jEYy sYrZq7WIHF+ap731aljYQo+pmFyRvM9sTbBr2a6Fjn5mM0SyykxS1vXoFw94/hZUZe4L CKX1uLI0IbjKV+SEoK2vxQqq9NjoGTx/YUYde9BWYqhH/FUp0Gd5M+KLd5UGcXfP5kWv S1UQ== 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=hynKxUpBmUZLP/FxLm3hy+mBVxBV89eC7WIYWyCM4RA=; b=g+0t1+kLYq6PqOXfSMKe97UnGpcGBKNegqxoR2Fxh6Q4Cb7vBTxgMdSSe00wuKXKe9 7K6rw57HN+4H0Pxkap3HfCT0Bs9yXf5I6k3nXm0ttzTAmKPUmyC9/ijly2e+dewd9hgw 7pOZPJ1+VpgeWQuggNCtzq7WYIKSDTu7cxkEczgwVFHi/XpCwDUFZsYmC770bdSjFAYz pajTpqHCza5S31gW9O3KMm24rG/KmREJtOeTSsefTKPXX6tIZkfWYx7stW+A+8VfmfNB LxCXpxwxjO2j9PM+03oNCYA8J45ReaQVuwPANxs7+Qm0VA58yE0u6g3SfEXt1Zt1nkJc X40Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=hZw5FTpS; 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 me3-20020a17090b17c300b002031441a918si2292448pjb.175.2022.09.14.04.26.38; Wed, 14 Sep 2022 04:26:51 -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=hZw5FTpS; 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 S229637AbiINLNU (ORCPT + 99 others); Wed, 14 Sep 2022 07:13:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiINLNS (ORCPT ); Wed, 14 Sep 2022 07:13:18 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF3045E643 for ; Wed, 14 Sep 2022 04:13:17 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id a8so24545434lff.13 for ; Wed, 14 Sep 2022 04:13:17 -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:subject:date; bh=hynKxUpBmUZLP/FxLm3hy+mBVxBV89eC7WIYWyCM4RA=; b=hZw5FTpSo/DvWzG5Z8akdgKlNmWcIBgk9FqFOjXpNCPbFWMeU9DHijYmxVQ9vrYa7B lEIrqpitm5cSCpF4IzYUD2/a8r+TwA3d2wh/+zrJ7nDatXOINTlwIq645fxCvSM8uPay kN3eEVOuAsX7uFZMy51wU5aXXsHqhI82pXonFguyOHp0X/otg7DIliqbx5HoQHaqmnt7 P/PHBLyf1ub5NsxkNAAIN5Q6UXSO0JIcUVCUHDvw83ss0+aeAul58s+U11XYePyJqLlx /dM5jMxp2Dexplk3w1tOMf+Y0Pa9gBoGUhFHuoEUSw+ZNXFGZs9+BzS2W65b22DQWR4S YeJw== 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:subject:date; bh=hynKxUpBmUZLP/FxLm3hy+mBVxBV89eC7WIYWyCM4RA=; b=Bh5uAAoonOgddajKK+4FXu3lMUO0khNDR5BBavwD0pQmpH90gwtS6KE/QFWH+RqsQ1 mG6fIRdU6JpHdrCDh6wX+1p2ykN5NbWPOuO41u4QYC67injlNeL4naBBlCD0g3OfNRCw 4Cl3KXEv62I2X0C8uIXquJ2YA0MgQHJofM+8wcTJuugeBdiAUJ0xyt5IMaYoGuvE+XVS fbWHch3zHuqeyb0ro9Wt+jzgk+aIJDcRqBAI1VghszaF6ZUyjPoEu++6q11CsRIseZRK 0TkIpr0enHf5+0HDx2u1S44GwXoCGR/1o4/vGMsZl13LYtd6LBN+x6Sw/a/28a/I9xrF jcEA== X-Gm-Message-State: ACgBeo1j+AqEjU8ZmGT6xo0HFgvhcO9lXN4cr8DuBOUBGki4C4mutUOo YxFVuHblemVawTFECQlo7Pin6cJX1/+H6PBVuUMJaw== X-Received: by 2002:a05:6512:2382:b0:494:9d44:a5fd with SMTP id c2-20020a056512238200b004949d44a5fdmr11814198lfv.494.1663153995919; Wed, 14 Sep 2022 04:13:15 -0700 (PDT) MIME-Version: 1.0 References: <20220812183501.3555820-1-acdunlap@google.com> <20220908170456.3177635-1-acdunlap@google.com> In-Reply-To: <20220908170456.3177635-1-acdunlap@google.com> From: Peter Gonda Date: Wed, 14 Sep 2022 12:13:04 +0100 Message-ID: Subject: Re: [PATCH v2 RESEND] x86/asm: Force native_apic_mem_read to use mov To: Adam Dunlap Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "the arch/x86 maintainers" , "H. Peter Anvin" , Nathan Chancellor , Nick Desaulniers , Tom Rix , "Kirill A. Shutemov" , Sean Christopherson , Kuppuswamy Sathyanarayanan , Andi Kleen , Ben Dooks , LKML , llvm@lists.linux.dev, Jacob Xu , Alper Gun , Marc Orr 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 Thu, Sep 8, 2022 at 6:05 PM Adam Dunlap wrote: > > Previously, when compiled with clang, native_apic_mem_read gets inlined > into __xapic_wait_icr_idle and optimized to a testl instruction. When > run in a VM with SEV-ES enabled, it attempts to emulate this > instruction, but the emulator does not support it. Instead, use inline > assembly to force native_apic_mem_read to use the mov instruction which > is supported by the emulator. This seems to be an issue with the SEV-ES in guest #VC handler's "emulator" right? If that's the case I think this should be fixed in the #VC handler instead of fixing the code that is failing to be emulated. What if there are other places where a testl is used and our tests have not caught them.