Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4944172pxj; Wed, 9 Jun 2021 05:52:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrEqG1wu65I4NBgMqq155Yy6yMb2dhkeWLrVQ89XMvNFCxfzo/JiJmTIuuomdrueju80nr X-Received: by 2002:aa7:c40f:: with SMTP id j15mr29430551edq.169.1623243158081; Wed, 09 Jun 2021 05:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623243158; cv=none; d=google.com; s=arc-20160816; b=vTV3yH8xAGDE2IQ1VmvQociYX+HRK2IhPNY2WbUY9k3YZsmp+jbgrO/u3Bg9k8V+Za dOADaEsBL1U1wdeXwZ+pKgDTGzZn3Ga91d66mhr7metfuGs/vZG4I0RzC5bn/ggNPSo6 qbDLK04mmNRwPGz7/Mt1U5KZqRW63/AJyl3p+plxGzrO3lHlSZdvc4cJWfg5mVUqGO8X dPqztZ5lnMX+xTuyLVUS9JvgHB+grLXQpKY34yr7p4kryGB46h6jIdp+sCg29qV6g8Y5 BHAfKcdW8XNuKhV017RKiwPCwgtY5Vr4WAT5BanL+HJzszIk3bnSs6rBplKzt0SCh+4I fBTA== 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=Gu4aAugtTWhST+fD0fZSYBJQcoAcaYV2q242zsShtPQ=; b=MvcZX9+lzJ4OLCFt17GF1uwXiEsnWe36SiKjai3gJ7u3n99GGnBAaR0NjwjZuwm2TB 3TecfNm0lRoZ70fVYQ580CgF7gJXvv2yqcffKCv0+AzQlSlqORjZBOnB7se7Qmn0moyI Dzs1/lzYGG7f/MSWbrqnmdi6v+2DD6wOii2Vn3c0JY+9h9s0eiHDjKvLbEcnqRcfupuj F8DojeX43PaypL4PLtSLUf5XLZKQOpIDvI8ZKrkfepTke3XJ3I6AzFsrThFoNpY5OZxA xRnOaOsqO3hot8C3jVd/X5uuCnO3cudPzInFDtct+1nwxYDKQgajOBhNeeXLY8qX2N5K NQqg== 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 h7si2102576ejo.519.2021.06.09.05.52.14; Wed, 09 Jun 2021 05:52:38 -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 S229914AbhFIE4Z (ORCPT + 99 others); Wed, 9 Jun 2021 00:56:25 -0400 Received: from mga07.intel.com ([134.134.136.100]:55376 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbhFIE4Y (ORCPT ); Wed, 9 Jun 2021 00:56:24 -0400 IronPort-SDR: gBMjJfB3w7HqRntFRuekXA9EAYm8c3CXr9Z4EqcqqOAhtBg8PsdwbeR+d+XYACEkCht+H42/3P luT0FBjSYjVA== X-IronPort-AV: E=McAfee;i="6200,9189,10009"; a="268858160" X-IronPort-AV: E=Sophos;i="5.83,260,1616482800"; d="scan'208";a="268858160" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 21:54:30 -0700 IronPort-SDR: yp6UxF6aTXDSGVA4DPfi/owkf5vf9OHVqY0BKZnY7xrkn53TRi3Z4NH2wuigV9P47xY6yJ4s8J f5maYtJ7LDxA== X-IronPort-AV: E=Sophos;i="5.83,260,1616482800"; d="scan'208";a="402317455" Received: from dabarred-mobl1.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.254.185.80]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 21:54:29 -0700 Subject: Re: [RFC v2-fix-v4 1/1] x86/tdx: Skip WBINVD instruction for TDX guest To: Andi Kleen , Andy Lutomirski , "Williams, Dan J" Cc: "Peter Zijlstra (Intel)" , 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> <23418f34-7c03-7477-6fbf-1b36b4718cb9@kernel.org> <4e5ac34f-28cb-def6-0b87-e560fa42e5e5@linux.intel.com> <390d6712-35b5-e52a-fb32-205844bad4ef@linux.intel.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: Date: Tue, 8 Jun 2021 21:54:28 -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: <390d6712-35b5-e52a-fb32-205844bad4ef@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/8/21 9:40 PM, Andi Kleen wrote: > >>> KVM only turns it into a noop if there is no VT-d, because with VT-d you >>> might need it to turn mappings into uncached and vice versa. >> Wow, I found the kvm_arch_register_noncoherent_dma() stuff.  That's horrifying.  What's it for?  e > > e.g. if you want to run a GPU it really needs some uncached memory. Same is true for other more > complex devices. > > Now modern Linux of course will be preferring CLFLUSH instead for the conversion, but there are old > versions that preferred WBINVD. > > I don't think it's a DoS, as long as you're not too picky about latencies on the host. > > -Andi > Currently we use prot_guest_has(PR_GUEST_DISABLE_WBINVD)) check for disabling the wbinvd() usage (which can be selectively enabled for tested guests). Is it alright to generalize it with boot_cpu_has(X86_FEATURE_HYPERVISOR) without verify it? > > -- Sathyanarayanan Kuppuswamy Linux Kernel Developer