From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86A37C433B4 for ; Tue, 11 May 2021 02:51:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 651DE61352 for ; Tue, 11 May 2021 02:51:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229996AbhEKCwe (ORCPT ); Mon, 10 May 2021 22:52:34 -0400 Received: from mga05.intel.com ([192.55.52.43]:39324 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbhEKCwd (ORCPT ); Mon, 10 May 2021 22:52:33 -0400 IronPort-SDR: iqLvfrjiYacyiwpBF8sKmqJm/L007MR5ucDhT2PAe8GA9pSkVU9TOKtW4iYSVKyac/Ydff27Zk Q9MFM4BmPFSA== X-IronPort-AV: E=McAfee;i="6200,9189,9980"; a="284827763" X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="284827763" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2021 19:51:28 -0700 IronPort-SDR: GPU1pqRJ3VZNfl7amQuTQHnxjB24nO5QAFh2We7eOSxtuj0pWGVmrpE6exQrnsBBXDV8NaX149 Yq4+QM7qwI6Q== X-IronPort-AV: E=Sophos;i="5.82,290,1613462400"; d="scan'208";a="434083678" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.209.32.217]) ([10.209.32.217]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2021 19:51:27 -0700 Subject: Re: [RFC v2 16/32] x86/tdx: Handle MWAIT, MONITOR and WBINVD To: "Kuppuswamy, Sathyanarayanan" , Dan Williams Cc: Peter Zijlstra , Andy Lutomirski , Dave Hansen , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , Linux Kernel Mailing List References: <0e577692-101e-38f7-ebe2-2e7222016a9f@linux.intel.com> <04c3922a-36e2-bf07-e5fd-0d2eebda250b@linux.intel.com> From: Andi Kleen Message-ID: Date: Mon, 10 May 2021 19:51:26 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <04c3922a-36e2-bf07-e5fd-0d2eebda250b@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/10/2021 7:44 PM, Kuppuswamy, Sathyanarayanan wrote: > > > On 5/10/21 7:17 PM, Andi Kleen wrote: >>>> To prevent TD guest from using MWAIT/MONITOR instructions, >>>> support for these instructions are already disabled by TDX >>>> module (SEAM). So CPUID flags for these instructions should >>>> be in disabled state. >>> Why does this not result in a #UD if the instruction is disabled by >>> SEAM? >> >> It's just the TDX module (SEAM is the execution mode used by the TDX >> module) > > If it is disabled by the TDX Module, we should never execute it. But > for some > reason, if we still come across this instruction (buggy TDX module?), > we add > appropriate warning inĀ  #VE handler. I think the only case where it could happen is if the kernel jumps to a random address due to a bug and the destination happens to be these instruction bytes. Of course it is exceedingly unlikely. Or we make some mistake, but that's hopefully fixed quickly. -Andi