Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1605906pxj; Fri, 4 Jun 2021 20:38:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRTQ2zOatsxLgyfsJJiafTMG9KuYIn2FEQtXsVdoSLBzIn4JxYRgvOUzJoNlP0oZcC/6Lp X-Received: by 2002:aa7:dd0b:: with SMTP id i11mr7981824edv.51.1622864307190; Fri, 04 Jun 2021 20:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622864307; cv=none; d=google.com; s=arc-20160816; b=HOfmBu6quEDzxaNSCwTcloYgDQvQ49Goy46I1YRuHrrQFpnjPEHeyyiu1mHHrkv4xn GqQ7qyu0zK3YCYvvyvAmopz9fdtPH/JB3Pfr88oPEBRBzp898N8llZ+XOS60P0jGRlKk 0MmghiVmUL3hnTN6pENLgFhmZa1DLmUGjSViPkbus3ekUcg/yNQH58O9CufYabzWT2i1 blOA7IMmPVjHaIXyTp3BndlYULglXaivzum1VESa3jwx4Waa//ZEi1ctYAKF0sJuH4lh IIKXp4CSTB8h7lqrVCjweQT+wcUnhckYRDU7k78db3fu5vjqHBfIvJVFmQatybJRRhS4 Cang== 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=tZseS8aSnULurPdZf/si9iNA+qWf4+HN6oG8w6/+geQ=; b=tVaxu+p8u5MDIPIy9DFwhEI0nn1kvCuFAviyKdbAjUrSgDFT1D0BYLhgCZC9m4ESqg wsdpgSEyaCd0i05zBbqooh9bVgvH70n9oBwzXtij0wgO5dr56rrxz7XtXVongEimqxS8 CeJS2XEZ3tgyvruJ43rxeovzNXBrLfciOK0hMDbOXH4zO9lQ7wYVjLdcj9nLm+07Y7w8 zUBhqppCsUcG3GzNrsqAERc1VGZ7wg5NBVk2P6DNVl6NY0Aw4RMzLEe0DI/HPG1Dh2Qf 1Z5ECJepz6H4UD1GIOEcQGgQOdVZoszWCsi2Z/CgW0R9XydOuu6s6LUhPzyy54Wl4EJz +HKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=uCcYmDmD; 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 i24si6725057ejx.167.2021.06.04.20.38.00; Fri, 04 Jun 2021 20:38:27 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=uCcYmDmD; 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 S230212AbhFEDha (ORCPT + 99 others); Fri, 4 Jun 2021 23:37:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229726AbhFEDha (ORCPT ); Fri, 4 Jun 2021 23:37:30 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23CD2C061766 for ; Fri, 4 Jun 2021 20:35:43 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id c12so8849164pfl.3 for ; Fri, 04 Jun 2021 20:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tZseS8aSnULurPdZf/si9iNA+qWf4+HN6oG8w6/+geQ=; b=uCcYmDmD0mdD2R/F6Gx+4Lbo0Twudda2tFrZ7DfTrInQq5Ll/iB15gFtdu/unlvR3X 35GsCTp+XPoAqExK9lGFbn2ufkny/LzF5L93Jy7ykmZUrJ3iVqdIjf5kUBLPhoLat7Vd cSjF86b/MNToAntmJB5RbAY/bhs3TqfA4plcoHzc0u6MCEfViwP7+KdfdTTxrAKTamky Tyw6Eau1CpxfJ2BU4oKQhUCHZ2p2uwjQRi/Y/iUBGzDWfMivR1BMMHkLnxskRe9XUcQv tDTINfeuJRDjTAs66Y877GWpFqyRwxMVpHtXCbvIyezP0GVaEAKeHQG2qZLtsf0MuzaF cKoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tZseS8aSnULurPdZf/si9iNA+qWf4+HN6oG8w6/+geQ=; b=g+JgwqoUeYf7xIgzqqkDm6YUWGoxP9HOm96oxxxq6xOBIYKb0q7GMWtdw2O4JY70mb M2a5VioNr023T1Z7SVUpLQSfMkFlwR9+nsMcElVmTn5a8kwCFUAAc+Nnfifg0b8h4cTz Q/xGE1eDeLo1mZayexMXoqLOu1uoGcZ+yxm/DQeP8wfrDeJFPyk7jKkRbqiPGCBovbq4 Vowci6pwcqBMJzHGBrmSM1luekBJ/x3Fj64tAgUQ+KmK95VE5/KPY7UgjQTluaQcQlO6 AD92dKe7Z4WYh4pRGUYyVH7qnndsH4cdKAXcmkfvwpoUMfANbWmu8R4c/2B2nAjmh7DC STzA== X-Gm-Message-State: AOAM533tB6q1y7YBr2rzgNbkl1TT8/V3CaG0uVmwz7ZBmDO+TQBL98l3 ix5/KCQbi5lRnAsPiqvTvrnG/MqbIEHpwTI6hEdc9Q== X-Received: by 2002:a05:6a00:234f:b029:2c4:b8d6:843 with SMTP id j15-20020a056a00234fb02902c4b8d60843mr7547776pfj.71.1622864142613; Fri, 04 Jun 2021 20:35:42 -0700 (PDT) MIME-Version: 1.0 References: <20210527043832.3984374-1-sathyanarayanan.kuppuswamy@linux.intel.com> In-Reply-To: <20210527043832.3984374-1-sathyanarayanan.kuppuswamy@linux.intel.com> From: Dan Williams Date: Fri, 4 Jun 2021 20:35:31 -0700 Message-ID: Subject: Re: [RFC v2-fix-v3 1/1] x86/tdx: Ignore WBINVD instruction for TDX guest To: Kuppuswamy Sathyanarayanan Cc: Peter Zijlstra , Andy Lutomirski , Dave Hansen , Tony Luck , Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 26, 2021 at 9:38 PM Kuppuswamy Sathyanarayanan wrote: > > Functionally only devices outside the CPU (such as DMA devices, > or persistent memory for flushing) can notice the external side > effects from WBINVD's cache flushing for write back mappings. One > exception here is MKTME, but that is not visible outside the TDX > module and not possible inside a TDX guest. > > Currently TDX does not support DMA, because DMA typically needs > uncached access for MMIO, and the current TDX module always sets > the IgnorePAT bit, which prevents that. > > Persistent memory is also currently not supported. There are some > other cases that use WBINVD, such as the legacy ACPI sleeps, but > these are all not supported in virtualization and there are better > mechanisms inside a guest anyways. The guests usually are not > aware of power management. Another code path that uses WBINVD is > the MTRR driver, but EPT/virtualization always disables MTRRs so > those are not needed. This all implies WBINVD is not needed with > current TDX. > > So handle the WBINVD instruction as nop. Currently, #VE exception > handler does not include any warning for WBINVD handling because > ACPI reboot code uses it. This is the same behavior as KVM. It > only allows WBINVD in a guest when the guest supports VT-d (=DMA), > but just handles it as a nop if it doesn't . > > If TDX ever gets DMA support, or persistent memory support, or > some other devices that can observe flushing side effects, a > hypercall can be added to implement it similar to AMD-SEV. But > current TDX does not need it. Please just drop this patch. It serves no purpose especially when the assertion is that nothing in TDX will miss WBINVD. Why would Linux merge a patch that has no claimed end user benefit? If the only known usage of WBINVD in a TDX guest is the ACPI reboot path then add an is_protected_guest() to that one usage. If a TDX guest runs an unexpected WBINVD that's a bug that needs a kernel fix.