Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3131101pxj; Mon, 10 May 2021 19:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVj+1lZZUakrcK7iyp5uVC2UVm/zWi3PIFMd4UQ5Yv+4adDGIFeYMD2tzSlfbjDnw3nNhV X-Received: by 2002:a17:906:b048:: with SMTP id bj8mr29192611ejb.236.1620701649234; Mon, 10 May 2021 19:54:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620701649; cv=none; d=google.com; s=arc-20160816; b=sPFs7ngzvdNy3SzXKNCoNSzpf16Q1tvf6RzKvVwO2Bb6L9Yk9/DFlCC8O3ua1Iveji ya8rwMVpT9tc9jfqDHn06oREV7itBBGbl+NMe8VfjHn8KQmYB86Sx2e8l31axIhfTyf9 jwQOkDgOqCNxvCdgC0VmaHnSPoEvYIZDCwDe/k3g6kBPJoTIc8+HFMwjNM1FRM92GLxo 1XkV1js9HcpvyyCwqEQLZZEP9HGvivnnRJKWlULxjIRneQBvOLvW39FZs6kF/WPPiEjh S7z3+nHGTgDcmLf5KN7RB9kyKF23mbxnTfYN8MZmiLRMwg7/wOIzGdJyEBNzMh8LRe9O VTLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=jA470Enkuzq3pJVxvmTTM69pDM0iSvSmESwp++01+Ww=; b=RnbpnY3kD2H283yEGepoPhjVTDo6MK2SPXk+F5HK6K6uXf5LeoBtjAFh/dcOBMJSFD QZbY1Q9lulfJHY5uhUd1RZ63t+bFZd6MpaVfEnYTjUGhjnJOoTxjX509fUqovVLIW2Ld 98r85z/s2PXbkIjJwMZ9VWzKvrwRLelLpFw79hTJ/xjGW8Mle04JuwoRKKJEHbyCg0AX OSV6UKL98Dxhq4JqGokvYLLBs2Cl6lfK8ufw6vuQ5bdb+cRqQ9VWdYenJbHamNplPsbg GBs0QiKP6KbeQfeL3T+kzoXLXMnMX4URyAxY6kv5OY/DhpyZLep8hrSaZE3bRT+JVdBZ qQLg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si12391513edy.589.2021.05.10.19.53.45; Mon, 10 May 2021 19:54:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbhEKCwe (ORCPT + 99 others); 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