Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp7853994rwn; Wed, 14 Sep 2022 05:37:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR4pnEFYK4smobfrjCR2V0p0mGatMhlIakwxS6VR0uYiCQHz6lekjFf3swg5ARIdeJxxRVWK X-Received: by 2002:a17:903:248b:b0:172:a790:3206 with SMTP id p11-20020a170903248b00b00172a7903206mr36045246plw.139.1663159033848; Wed, 14 Sep 2022 05:37:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663159033; cv=none; d=google.com; s=arc-20160816; b=roZH3/iwYmQd/CbQyxgAWRr3Sx8+6uOCe2WPq2J9n5Y0bizHCdcfnhmmXLQLfNIHt4 LV52qVGJP1vzHTpeFUR9olXqLzL1Jmwch4s9bqLnZLYlUeNnKM2qBnKbDXBGF0Dxl/V8 +CXZDqO3Q7Ai7le6WxgstShs9ReSTarfEDyJJ0m9GRKJbYwdByRnylt31exeMyfS0Xlw G85Zaox2cf2QWGHDaqm01RwtMKr7D7wFZPb0GZH2WrSy260xcjtLPVH+7BSOWOp9IQRf 0NP7fBN3w+Zi8Dt1x6Mni43my2jwYJrh9vWpvnxs85eNGP+TkbNFY3ypRv5b2BqCjKzx 2C1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=pmSixUZNvOEGU0TH+1j+fIRX3ERTaQ9g2cRZh4xkDu0=; b=PK7pmaTEns8IG5cnMPHsEhbhDT6zhh0xNSq+ub8EKS3w7yTv7lrFmwuQr3dSv3320e ZpP1mBCw+clhPw+a65EFdMZG9fpP15A2TaZ1wKtjgyBD8Vm2H0eiHcLtOdC6DvUq0zKS VYdngjoNPKwx5qXuGAz5WsDR1u/94Ry1O6B6+wT/GrV/HheA/8znzXs5+b4tdQufG4oZ lCxvjjqb16+pKaaMgC9x6JgQwqHGV9ZZISijWY14p46orfFq85FYQ9K9Plo9nDWVnYtE Y1aQpoCwsZscP7Thj3jdmbL4FIsF9+JhDa8bVjbQOg5M9Zgt1T5cmyolVImW7ecxRxHj 77YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IWhhdsuR; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt18-20020a17090afa5200b002006b213af9si14497217pjb.32.2022.09.14.05.37.02; Wed, 14 Sep 2022 05:37:13 -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=@intel.com header.s=Intel header.b=IWhhdsuR; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbiINMEJ (ORCPT + 99 others); Wed, 14 Sep 2022 08:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbiINMEH (ORCPT ); Wed, 14 Sep 2022 08:04:07 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7B7D3719D for ; Wed, 14 Sep 2022 05:04:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663157046; x=1694693046; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=udCJhyc3zUwPrqKS2ZA+808BCqR4ZsWMs3OJuoP2Ax4=; b=IWhhdsuR4igbv/cKfYCnHC27MKpHdd0/NS8oThx71ruAlbusTgRVyFmq iywUKkjwe2vVyO5mSu5muELJnGmmcgyj8CtJSYOLzXiVYG1JBj7BzGnyh 2QQddFmtYLUTlyDwsHcJKripBihETHSujy+fz9oOGOltIIVQxAS2lGjQL yWLfWgzyTzLBZE3kHeGT3QY97UHMlN5ae3uhG8QZJdykzQTAvsZKxXHTl YgFtcEkHGV0w2FoVtD+Ri0nzuZNvow9YfmjagEOpkqcydG2i4N3C/wDy+ 2Fn3tbJtEy4pe3ewe7FBgtiSiUplmAWGYkPc5MFpDm7qW93D4S0up+rgj g==; X-IronPort-AV: E=McAfee;i="6500,9779,10469"; a="360149164" X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="360149164" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 05:04:06 -0700 X-IronPort-AV: E=Sophos;i="5.93,315,1654585200"; d="scan'208";a="567984401" Received: from rwathan-mobl1.ger.corp.intel.com (HELO [10.213.220.95]) ([10.213.220.95]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 05:04:01 -0700 Message-ID: <2625dbfa-434c-7d55-6469-9d9e89397e8f@intel.com> Date: Wed, 14 Sep 2022 05:03:59 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v2 RESEND] x86/asm: Force native_apic_mem_read to use mov Content-Language: en-US To: Peter Gonda , 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 References: <20220812183501.3555820-1-acdunlap@google.com> <20220908170456.3177635-1-acdunlap@google.com> From: Dave Hansen In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 9/14/22 04:13, 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? No. It's not just an SEV-ES thing. It's a problem for TDX and _probably_ a problem for normal virtualization where it's a host-side issue. Kirill wrote a lot of great background information in here: > https://lore.kernel.org/all/164946765464.4207.3715751176055921036.tip-bot2@tip-bot2/ So, the question is not "should we extend the MMIO instruction decoders to handle one more instruction?". It is "should we extend the MMIO decoders to handle *ALL* memory read instructions?" That's an even more emphatic "NO". readl() seems to be the right thing to do. Also, Dear TDX, SEV and virt folks: please look for more of these. They're going to bite you sooner or later. You should have caught this one before now.