Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7814282rwn; Wed, 14 Sep 2022 05:04:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Vguc6bkT3yOAMUImyxtkrJNnyJvOOToSA3nwI0UhWWHsipQecUdusnyQm/uSyFcYKURni X-Received: by 2002:a17:906:a219:b0:6e4:86a3:44ea with SMTP id r25-20020a170906a21900b006e486a344eamr26151757ejy.385.1663157049505; Wed, 14 Sep 2022 05:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663157049; cv=none; d=google.com; s=arc-20160816; b=XLJ+zMWP5sVnzBC7IEHrIwafIPP7TZolAEaTT3lAJW+xIPybJAthUbS7v16FonbrVS 9Gxcc2Ora0dHnpSDdVap8JyMcJFj9JpdGowUQreipc5gdR2jYpOplxj1G2heAeZoTD3R VzHcLsgYusC7n91ltLIXJe/6+Ka+c+cJXedSYFka+IGv+bba7RhhV9XEcAI8rtz9NYV9 /sD6jonQ9knG8HTg05l1e6e4Msi4cN0Vwt8eeSSljwbOTn+6tvx1+kmLjDQY+D0iCzZ4 9do+Q3sVGs7dcX1zABZyKneMFrYCR6d/iDJ6QrIiF7F7jR094KCveKTdoOxiEOxkAQAe AxzQ== 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=Af0ZsDPyJgdTr/TUks7HMX0MOkiwdsdfC6dDsp+AdmY=; b=dA2eYOSJK7DrqfGtB5v1hOR49Iu0nYa6BKPD8bcB1fk0WfV++SUkbEPjV7JhfAZn1b gm3RqSCrOLX4dEswjpxYI6nytrGT0QIN1hJLATfxOEV3DfdkNNDkS79vWY3ASG6Jzmpm Q713BtCwYI3gR0oZcA70oL51W1DKmtEXkYHDTW8i6lepxa+VJBKujntrLIaFb8tYVtLH ZMDUZrLJklLG3SoSbEYQRR/niRa+6gqcJUzho/rxqwon5rdfppo01qnD/C7vQLZMxiDQ ZutdZqXuys/MlXna02u8O6fNiQRYOwirW9Brx3MT50DjNSGO6AC2ar0qpfL/w2QB+8sC tnOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=caMfRnhM; 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 u6-20020a50a406000000b00448988d4d84si9773310edb.414.2022.09.14.05.03.40; Wed, 14 Sep 2022 05:04:09 -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=caMfRnhM; 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 S230002AbiINL7z (ORCPT + 99 others); Wed, 14 Sep 2022 07:59:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230032AbiINL7k (ORCPT ); Wed, 14 Sep 2022 07:59:40 -0400 Received: from mail-yw1-x1133.google.com (mail-yw1-x1133.google.com [IPv6:2607:f8b0:4864:20::1133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 539FB38AE for ; Wed, 14 Sep 2022 04:59:31 -0700 (PDT) Received: by mail-yw1-x1133.google.com with SMTP id 00721157ae682-349c4310cf7so11198327b3.3 for ; Wed, 14 Sep 2022 04:59:31 -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=Af0ZsDPyJgdTr/TUks7HMX0MOkiwdsdfC6dDsp+AdmY=; b=caMfRnhMjAAcuWfqKzIREz06Y0ofv0vsUz0iAAkXwc/p27apoikQfCiZ//EqFBLCyX 6/LjkFijqkgoWK0xoBNs2ebOVJztDz+TGO8xbTtwJSWPdAhYNh8IhhcQOEyJlIoGv6bv gb+uelQjQxKhROytfgCELdZFNmdk0RrV8Z13ONPYwLUuss1DpC7h21uqinTMHDRYnpIN 0m6Zix9kEZ8EttadiD/vvQj5iN4rzEAvZZuSNgK13bGVSk/BL/jH6CRn0Oii86AF1i8R 4d1bnqe3a9aD2QvDPPAgXSY/7QU5qG9mDzDjs6FLncaCfebKU0FIgGbC8C5Uw4uaOSVI Zt0A== 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=Af0ZsDPyJgdTr/TUks7HMX0MOkiwdsdfC6dDsp+AdmY=; b=bTECqlT90AYfypY387vMobzH8e9TyRA5nvbXW1lNFR7wkdC3n/zUQM7wFavF3jhQcW U8ttwiDyivyoaHYW4O6hmgaE1K9MjHYSil7iTu/xJwj3fIJl/jQwJzZDqeTyzsEbVk3U d7fo5kvGWlFo8y4yif2z2La4Seb8gJnPolel7On1VAwYX7xAkwOTKJwPKP7BRVyDbvpr Ijq/+XTkAURc54X8NDWQI6R8s/cNt5FJXj2RwFsKx1AWnA7yzhfx4e8fGTfv27VHROPe JdUXCEGD2XCN0l+7qtVCz3UqNSaZBvn8/nqXQjdbJnRiSRErxpaZ3Cg0E6V6l/P47dpc Dgbw== X-Gm-Message-State: ACgBeo3ZKZoJB7be6ksnl6T2HN0q+Yfs847f0e/TbOmDxUArQeSRgdWo LslRTJoHzk24dAZa9fBQCi8HpHubFJTONfdUTgDI/A== X-Received: by 2002:a0d:de05:0:b0:345:4827:5029 with SMTP id h5-20020a0dde05000000b0034548275029mr29700203ywe.385.1663156770383; Wed, 14 Sep 2022 04:59:30 -0700 (PDT) MIME-Version: 1.0 References: <20220812183501.3555820-1-acdunlap@google.com> <20220908170456.3177635-1-acdunlap@google.com> In-Reply-To: From: Marc Orr Date: Wed, 14 Sep 2022 12:59:19 +0100 Message-ID: Subject: Re: [PATCH v2 RESEND] x86/asm: Force native_apic_mem_read to use mov To: Peter Gonda Cc: Adam Dunlap , 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 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 Wed, Sep 14, 2022 at 12:13 PM Peter Gonda wrote: > > 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. That was my initial reaction too. But we spoke w/ Tom offline (before sending this) and my understanding was that we really should be using MOV for MMIO. I've cc'd Tom so he can speak to this directly though.