Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3886234pxj; Mon, 24 May 2021 17:52:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvzIliu+rcK0mi36ixjxbbQB/2OcEnsHya++2rIt1w69GpdUsVJWF7NKXvPxRd7kjaCpt3 X-Received: by 2002:a17:906:6941:: with SMTP id c1mr9011617ejs.172.1621903950093; Mon, 24 May 2021 17:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621903950; cv=none; d=google.com; s=arc-20160816; b=kV903g/Aqch1NPWijpgufjfqTTxdnrf6RNWGJeNXw7CqKqpphjXS9NzJAhPRI1rElu Q2k+R0uDl2hL9L3olX+4glWd1s3x0IzpEjNqnNQGj1CODRUlthJb7o+KjO/lCYc7R4mB 3l3RsEH6BErg7cVOBFN1U++FKV2WlBDX5UFDJoNyJvi4Br0C4RU8yPbSeuoTUC5AUJa7 Ji9sQdQ6hjcuEHUtpmzqApF6d2lSTRleyJHYP2BYkLg9TDlZ95n/QzlcpH21nNuXFbNw dJJfDN2uOWYDhNsbyfxEmgmS4kg86edStiqq9sC3864JTM4dGUoR4F96i9l1vVW5HOLB QImQ== 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=ypHKpyRTob+xrgfwU5gGLsKAe8BKVFOM0sRqnb3sj+E=; b=GcbcM/0ZVozL6Q33JeAyrGlMS/gLOWZLtT/Af4RJJBdkm/sSLzi64i1NUlPuhqubmm V0mJ58l5drGvaaSe28cuZe1yO5UrR6a1gWxUfReOjFngCe/44tYDJ5rMp8RPffOUp+hk DdIhR6N4FrHggyNfzSL9mppq3ml0guI1NrLsXiD/klGJRdyA9Hz0XjnR7tIeITpp3lYn VagkveEJFM/1ImCqNo7rcvsOwSq4BY3dzwhJvtnr0VtqveRug8V9fspO0n4+UX46zE1z RvuAUeKgVq2JbsAG0KbQxwekvVXGJI5UfByXxsGwjZGnPfudztZVWyvah6SKh/Mw3BkH 7bjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=SXAGlGz1; 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 u5si14687396ejy.632.2021.05.24.17.51.43; Mon, 24 May 2021 17:52:30 -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=SXAGlGz1; 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 S229598AbhEYAwN (ORCPT + 99 others); Mon, 24 May 2021 20:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbhEYAwN (ORCPT ); Mon, 24 May 2021 20:52:13 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3475C061574 for ; Mon, 24 May 2021 17:50:44 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id n8so10269493plf.7 for ; Mon, 24 May 2021 17:50:44 -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=ypHKpyRTob+xrgfwU5gGLsKAe8BKVFOM0sRqnb3sj+E=; b=SXAGlGz12w/hj2kefafkJ/glyQo61147RyvoAyOQLTctRXwWe8J8Mrl8/MZ3ZDqPm2 Qe8dh0NHy5YEuUpXhd/9ST/wNFNn5+pfXXPoFVjam1iJ8/sRV3ClycXeStDk/6pQdlOX xQcYC5/20tMt3Ug5yfhBM48bQ7QAi72CLQ+CivRgzMbKhoA4KErL6BXo4YwbBSJ3DY33 gm02oDjUHRZB6jcCCTDvnmSMusRTJg7Gk82hdxRdwXNW2ekT93RHFWKqytRq8nbj6rwR /aSH55zBsWGCpNPhm//d6sJFochLT//85ldaC8WILCEPNl43SCru/TKqR9VVhTrE2LRP VlhQ== 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=ypHKpyRTob+xrgfwU5gGLsKAe8BKVFOM0sRqnb3sj+E=; b=X6F4CStUkpF/ufM/jR6uvUAUoKNJJc64FCdmBcFKx7Zh5UzIKuUAdXncrKIHVa+kf/ f04+wjzeFzBuE1YR948GTdBBh5c2soY4K2ss/I27lLj4ckyktW+l3uK1nrMOe+uF8y7n f6k/FUWryx5/YyUxxmR4i3RCOweirVaq/6WsEsr3FLQOixmI7IPt44RnttbJGMV2wlsM 6IV94RSryafoW7hQCQk7bx6JdSRDYarZ5xwTrNdjxprMbmJEXqUqA3zs2J5Bh6uiG2T3 54FtWwWscF4imuWp3arhRi8e42QBzqf44X0ia+d9LINNCvQH+0pdQ5giHqnnIYhUleLs a2+w== X-Gm-Message-State: AOAM530ztX8u+56FT122jO/IOq4fhnRIUqYwtKA9jNjvKIrPMTphMpfC mfW6IMATU/xpJ8k8yVk4Xa974scxGXR76+xKErjWktY7YA4= X-Received: by 2002:a17:90b:3709:: with SMTP id mg9mr1885892pjb.149.1621903844281; Mon, 24 May 2021 17:50:44 -0700 (PDT) MIME-Version: 1.0 References: <37ad50ca-f568-4c62-56e2-9e9b1f34084c@linux.intel.com> <20210524233211.802033-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210524233211.802033-2-sathyanarayanan.kuppuswamy@linux.intel.com> In-Reply-To: From: Dan Williams Date: Mon, 24 May 2021 17:50:37 -0700 Message-ID: Subject: Re: [RFC v2-fix-v2 2/2] 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 Mon, May 24, 2021 at 5:30 PM Kuppuswamy, Sathyanarayanan wrote: > > > > On 5/24/21 4:39 PM, Dan Williams wrote: > >> Functionally only DMA devices can notice a side effect from > >> WBINVD's cache flushing. But, 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. > > > I thought we discussed that there are other considerations for wbinvd > > besides DMA? In any event this paragraph is actively misleading > > because it disregards ACPI and Persistent Memory secure-erase whose > > usages of wbinvd have nothing to do with DMA. I would much prefer a > > patch to shutdown all the known wbinvd users as a precursor to this > > patch rather than assuming it's ok to simply ignore it. You have > > mentioned that TDX does not need to use those paths, but rather than > > assume they can't be used why not do the audit to explicitly disable > > them? Otherwise this statement seems to imply that the audit has not > > been done. > > But KVM also emulates WBINVD only if DMA is supported. Otherwise it > will be treated as noop. > > static bool need_emulate_wbinvd(struct kvm_vcpu *vcpu) > { > return kvm_arch_has_noncoherent_dma(vcpu->kvm); > } That makes KVM also broken for the cases where wbinvd is needed, but it does not make the description of this patch correct.