Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2629120rwb; Thu, 17 Nov 2022 13:41:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf7YwNfEOGMepsiXTD+iS8n4oKP+BE5yoSmnHhRuOeH3a6kw1TAHD29zP2ycT8ka+1sKee2y X-Received: by 2002:a17:906:a107:b0:77f:9082:73c7 with SMTP id t7-20020a170906a10700b0077f908273c7mr3555665ejy.517.1668721275987; Thu, 17 Nov 2022 13:41:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668721275; cv=none; d=google.com; s=arc-20160816; b=022zTMFIfkpYdcVEye3xGuqVsA4+nFwNIxVSVQX42UtjyWRePAV09xqra69wyvZYma i08vgNm4/CxXWJu25ksr8XrkAAtfKtT31k8kPI/lnApR+Jy4lRfhTnbcKNXxbjz0TwE9 wVf3yY30FTatQGahA9NRAbuyhXuMr9BtUoCPQHIojECBB3LjRmXK7DHWNR+kEKfhPLN0 L2pl3cH+3BOAETmCXCp8V97UGIlrEF27LTZaS83KiqJLaaUK4DZ/mfTFsGzElN55OGIY /wybho+nCuQbe3Ddtr31DForg3wQC+kTnbdDIHCvijSKQmbju9AMQMH9WyoT0gqRwQtf sJAQ== 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=WkqynFnuTl+SBnf8vAzWE9ynW3+h/Y4/Q34MzfRHcPc=; b=ZtvjRcxRJlFU4DMrcl9Mht9/WX4LoLwnX9kHZCjj2Cw3GNvgiZeqLKIJVzvMOcdCLy 095R937uK2TCZzDmoh4wk/qMny6OOPYTcp0fR9oe36nJb5iAWjiqMfJVX6K+5tWtsw1Z zIG/Wh/xDM3Be2AalLUZSdsiIZ2EtiSeDVF+wNtda/4aptEz70INT+tAg+1I/s8S3yk2 olVvAr/wsAPd4N7uSSImw6yqDUSprmBKC7RPHCI+Ck+Xe6gukA9DrkZKbV9zTtcOPL0h dFu6J+0d1DXHb1nNMWrySyAhk0w2QwLlvL63eXr9w61HI4Bwp/gaBT8n7Ld8kK/8MH0O vmtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XcGF4xkz; 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 wu9-20020a170906eec900b0073ce34d1a13si1614303ejb.499.2022.11.17.13.40.54; Thu, 17 Nov 2022 13:41:15 -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=XcGF4xkz; 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 S235116AbiKQVZi (ORCPT + 92 others); Thu, 17 Nov 2022 16:25:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240861AbiKQVZS (ORCPT ); Thu, 17 Nov 2022 16:25:18 -0500 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35D792DEC for ; Thu, 17 Nov 2022 13:23:20 -0800 (PST) Received: by mail-yb1-xb34.google.com with SMTP id v123so3445995ybv.5 for ; Thu, 17 Nov 2022 13:23:20 -0800 (PST) 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:message-id:reply-to; bh=WkqynFnuTl+SBnf8vAzWE9ynW3+h/Y4/Q34MzfRHcPc=; b=XcGF4xkzh24/cOTLB7WLZEBztN+OCwfswrdgEOAyH3o3QLjQbxkfEyH9o6xNF9BsRK 9x4aQ+1HEgJsRN/V4s0WVTj59/sznY5RKQ254hPsFHzZnqkC5uSIuiFpu3XaslREx5xC P8NyDAs/d/rBmQrhuwVc/JrZo2D21hAbhmF/6zUxC7MbyPTI1bJzIrQ7D07JFTtiQ4Um 476qa2MATVla+W4z06fWU6nud4VsmPVx/sQicQ8RqDPMg8hZAWr85jrrY+fZX/GQbNmF vmWjmgHtn4296hBgxIusZKveQBin0uDHIIWJezBuCX7EU89J3FrQsbKkEK8metMUqSw6 9ToQ== 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:message-id :reply-to; bh=WkqynFnuTl+SBnf8vAzWE9ynW3+h/Y4/Q34MzfRHcPc=; b=CVa2tTHCAvBXCrde/V87jVxISQRKVC5/POH0IEfSEQZL8yxABbWqhcQ3Ef5CjD/ikO XqrsqPPwVQboSTIxo3mSDXAHJL3ctFjJ+P+NmX6tUSFweuTml2QCazwnF4LMjWXDINnu kOmPtjTTVHcbMWFQX3JOzVV3YmB+aFC4eKEnjsoSeuGieG0+1WAIaFMuS6xffQl9p5io A0Qd4ME5ivXIdVF8o80p4G2/KD8ni3iRxcuBrlYUNaiJVRWfWgUDPJNqUKbK2fPL1kGM H8spbKdLj5MFwHqyhicsMDa81AUAJupyBXCVFGUtFWN9bBmJzcm08ao/8UwgwwaXHQxs GWBw== X-Gm-Message-State: ANoB5pmn/ptgj7l/1PZ2u3FcF1aPNxVXknG7h2p2quuTpmglfQ8s6D5B rO0cJV1RyrHXg0hI74RkwbxUwZN+X2ciwTPfZTihXA== X-Received: by 2002:a25:744f:0:b0:6e6:8d2d:4b42 with SMTP id p76-20020a25744f000000b006e68d2d4b42mr3924310ybc.435.1668720198916; Thu, 17 Nov 2022 13:23:18 -0800 (PST) MIME-Version: 1.0 References: <20220812183501.3555820-1-acdunlap@google.com> <20220908170456.3177635-1-acdunlap@google.com> <2625dbfa-434c-7d55-6469-9d9e89397e8f@intel.com> <81950d38-4d5a-6902-bc2e-327d2800eb58@amd.com> In-Reply-To: <81950d38-4d5a-6902-bc2e-327d2800eb58@amd.com> From: Marc Orr Date: Thu, 17 Nov 2022 13:23:08 -0800 Message-ID: Subject: Re: [PATCH v2 RESEND] x86/asm: Force native_apic_mem_read to use mov To: Tom Lendacky Cc: "H. Peter Anvin" , Adam Dunlap , Peter Gonda , Sean Christopherson , Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "the arch/x86 maintainers" , Nathan Chancellor , Nick Desaulniers , Tom Rix , "Kirill A. Shutemov" , 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, 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, Oct 5, 2022 at 6:29 AM Tom Lendacky wrote: > > On 10/3/22 18:11, H. Peter Anvin wrote: > > On October 3, 2022 4:01:01 PM PDT, Adam Dunlap wrote: > >> Thanks for all the responses. Is the consensus that we should use the > >> readl function here or instead use inline assembly directly as in the patch > >> I originally sent out: > >> > >> asm_inline("movl %1, %0" : "=r"(out) : "m"(*addr)); > >> > >> ? The readl function has this exact same code, I'm just not sure > >> which version fits better stylistically. > > > > Is mov with an arbitrary addressing mode still acceptable for whatever is causing this problem? > > The acceptable forms of MOV are covered by insn_decode_mmio() in > arch/x86/lib/insn-eval.c. Is this blocked on an item? There seems to be consensus that this patch fixes a bug and is taking the right high-level approach (i.e., change the guest code to avoid triggering a sequence that isn't supported under CVM exception-based emulation). Without something like this, we weren't able to build the kernel w/ CLANG when it is configured to run under SEV-ES. We sent out two versions of the patch. One that does the mov directly [1] and a second that calls readl [2]. Is one of these two patches acceptable? Or do we need to follow up on something? [1] https://lore.kernel.org/lkml/0D6A1E49-F21B-42AA-BBBF-13BFC308BB1E@zytor.com/T/ [2] https://lore.kernel.org/all/20220812183501.3555820-1-acdunlap@google.com/ Thanks, Marc