Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5210439pxj; Wed, 9 Jun 2021 11:46:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxtcWFTG6sCDEEH1N5gd0fB8uQ7TAMmAtLaSQcnbJLsdlG2JyN3ZJyee/u2UlZhUjPgSoJ X-Received: by 2002:a17:906:8608:: with SMTP id o8mr1200168ejx.72.1623264408452; Wed, 09 Jun 2021 11:46:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623264408; cv=none; d=google.com; s=arc-20160816; b=LuKJAAhfDl2aLtrOQd9gbRS3VYZtWNHAmL4g6AtCDIabKrZiMrd9+8rDO3ETcMvqQb wtPNCuXpNi1s0OQLazvLXB5y/yM4ENuYvHGSLQS6tIGRHN0cFGr/GdbM0HiEsv1Rjdh2 O72qj3IU0RDX8zzhGK8L655X7Eiob1K29maWSv/kr72SBz+uE4rIalf64mObCxI5eaHn iJGyUjBaY/8u3FFlnAgzGhr0pH/feNxsEvB1qwYzA6jLyWrXwerfmhcxiwCT+/LqKrc4 6O9hhCGXBvmMuA0tPuKKpVXTC/rrmzcjBvG0kcYVXrFbVPh0LuByJNiQTGIV7Xp2f3oh yi0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=HBVAb0zxgkzhtWeC6tGkTBr6qW3thFcqHxr33kguu7w=; b=WY39o+BlPUEJZ9jFMRnoj+HEOYdTtWpIKnziKps54G95hNcLKN/4CNJHaE8dM2QNjy 638Y6tVkzuceLmIvy/jOkiikrTIefhICqOAjSXCzwERxR9CJwwtEx/xzQkNgyWUo9EF+ q7u/cz9oJImAlkHvWLtGc69ZYKFHczEoXvnWE+kERvpi4GXlYxXTVRW/unR8JK6nH6Mc uPne0TuJ/UxllM5qQaQRWF1rofhL5hC6ipFpaXQqMV5RLKLD1r9GP0cDzhSOSEqZJVA9 szmGId7s15kaIoSTtvM1AsV5iNL/ItMwqXIMaW9mKgM8sO8do7BfjiKA/H1tj+cjEzHn dsBw== 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 dh2si351480edb.430.2021.06.09.11.46.24; Wed, 09 Jun 2021 11:46:48 -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 S229963AbhFIRaT (ORCPT + 99 others); Wed, 9 Jun 2021 13:30:19 -0400 Received: from mga12.intel.com ([192.55.52.136]:28063 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229823AbhFIRaO (ORCPT ); Wed, 9 Jun 2021 13:30:14 -0400 IronPort-SDR: iX8pSg86aPuGvfg89vW4U7a1r+J9G0Jym9Y6q3amMU/gVRh7h5zRQ0ghcwayPmngZWRuYScC93 ei1qmNtBqcsA== X-IronPort-AV: E=McAfee;i="6200,9189,10010"; a="184812035" X-IronPort-AV: E=Sophos;i="5.83,261,1616482800"; d="scan'208";a="184812035" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2021 10:28:18 -0700 IronPort-SDR: u8sSWI2koZL75xdfN/Jh7FIYJLdh/eT6OLrO65DKm19TP6+x3fbu87ixuIQ7BH3g4q6ZCJtWtv MlKvvwo9yBRw== X-IronPort-AV: E=Sophos;i="5.83,261,1616482800"; d="scan'208";a="402513924" Received: from davidhok-mobl3.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.209.9.9]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2021 10:28:16 -0700 Subject: Re: [RFC v2-fix-v4 1/1] x86/tdx: Skip WBINVD instruction for TDX guest To: Andy Lutomirski , Dan Williams , Andi Kleen Cc: Peter Zijlstra , Dave Hansen , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , Linux Kernel Mailing List References: <20210609011030.751451-1-sathyanarayanan.kuppuswamy@linux.intel.com> <682f0239-8da0-3702-0f14-99b6244af499@linux.intel.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: <59484871-8ef1-b7c3-fb29-b143bd53f074@linux.intel.com> Date: Wed, 9 Jun 2021 10:28:14 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/9/21 9:12 AM, Andy Lutomirski wrote: > On 6/9/21 8:09 AM, Dan Williams wrote: >> On Tue, Jun 8, 2021 at 9:27 PM Andi Kleen wrote: >>> >>> >>> here is no resume path. >>> >>>> Host is free to go into S3 independent of any guest state. >>> >>> Actually my understanding is that none of the systems which support TDX >>> support S3. S3 has been deprecated for a long time. >> >> Ok, I wanted to imply any power state that might power-off caches. >> >>> >>> >>>> A hostile >>>> host is free to do just enough cache management so that it can resume >>>> from S3 while arranging for TDX guest dirty data to be lost. Does a >>>> TDX guest go fatal if the cache loses power? >>> >>> That would be a machine check, and yes it would be fatal. >> >> Sounds good, so incorporating this and Andy's feedback: >> >> "TDX guests, like other typical guests, use standard ACPI mechanisms >> to signal sleep state entry (including reboot) to the host. The ACPI >> specification mandates WBINVD on any sleep state entry with the >> expectation that the platform is only responsible for maintaining the >> state of memory over sleep states, not preserving dirty data in any >> CPU caches. ACPI cache flushing requirements pre-date the advent of >> virtualization. Given guest sleep state entry does not affect any host >> power rails it is not required to flush caches. The host is >> responsible for maintaining cache state over its own bare metal sleep >> state transitions that power-off the cache. A TDX guest, unlike a >> typical guest, will machine check if the CPU cache is powered off." >> >> Andi, is that machine check behavior relative to power states >> mentioned in the docs? > > I don't think there's anything about power states. There is a general > documented mechanism to integrity-check TD guest memory, but it is *not* > replay-resistant. So, if the guest dirties a cache line, and the cache > line is lost, it seems entirely plausible that the guest would get > silently corrupted. > > I would argue that, if this happens, it's a host, TD module, or > architecture bug, and it's not the guest's fault. If you want to apply this fix for all hypervisors (using boot_cpu_has (X86_FEATURE_HYPERVISOR) check), then we don't need any TDX specific reference in commit log right? It can be generalized for all VM guests. agree? > > --Andy > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer