Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4313568pxj; Tue, 8 Jun 2021 11:14:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyUd11v1xD17PXmgWKKGzJVOZbolfCnfgrnKf3mCXrYlq6SdYCrg+jcgHbODpSXGmy40YTg X-Received: by 2002:a17:906:311a:: with SMTP id 26mr18085199ejx.517.1623176069802; Tue, 08 Jun 2021 11:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623176069; cv=none; d=google.com; s=arc-20160816; b=vb0t2ryxVwOkxPpiwc0kuU+yUdwcPOl03idY2ou66PxQ0oX409q2rmbdn25TjTTHRE euJsMgHVgBJaqJDOFWDHg/gNDxaGYV6RgZHAVhuGPn4JG1Z9anZ3fzBtO7DQ+JGr6Ccq MC0fdDYnE3je0DZ+kUyTuDerlddRCAt1FEAsZvz+MqPoZ7pmgQaLrihrIjns3T56En/n GUcSI2v1qrCiuHpWWIPxOln6Bt4wICjUyErAz9ADaMQ/y7h7F/SxSdme6L35vj7H7t8l 2MtkSrp0ZV0NfihvvcYETHNlwPnzjmpOVFSTUc9H/i7sBi7VChnICFkNLGVS1MG2XvQK 188Q== 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=7lUaW5872sGech8CgHkJXTMavU2QTUwm1iedJTUhvMs=; b=Yd5RxcNiuMQdsPXMhB6uO/wCauG0Cmeam/DQLjIMFskmLcJ7OuUnJPCcv9HUYSN8NZ +NMUwIfMQcXHyf5ryqK8DiReDW0vrf73cQWKhBXMsulDtd2p/7/0AnTOtqoz9kchd2rM TR+CZvPMDp5BrwGvs0lmw5HJXlS+XnhkjUsMpRj8TO9mHzRNpeRoBpi2t8ZY4+apNP2c oN1qMZ7hxoMydwh3d9uRX17RuDoIitfqfvpXHbIjeN/MYc34D+LF1OwUpuCJBo47xiXY kOLxk+Q/xhQ8pphqQi7eelkaFmwdZBwfLTlbAfrYsDwZ5vz9YI7gTgq5SmE8TLhqZO6s cjaQ== 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 t26si298555edf.425.2021.06.08.11.14.05; Tue, 08 Jun 2021 11:14:29 -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 S232630AbhFHSOo (ORCPT + 99 others); Tue, 8 Jun 2021 14:14:44 -0400 Received: from mga07.intel.com ([134.134.136.100]:45594 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231652AbhFHSOo (ORCPT ); Tue, 8 Jun 2021 14:14:44 -0400 IronPort-SDR: 27xYeBIv45qHg5aThElVla4MzTQkFtD/R/+tYSshUvEFIJ7Yz+QLheheC4Utic7JMYYskWKWUA /Exv4qD+ZVCw== X-IronPort-AV: E=McAfee;i="6200,9189,10009"; a="268759607" X-IronPort-AV: E=Sophos;i="5.83,259,1616482800"; d="scan'208";a="268759607" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 11:12:50 -0700 IronPort-SDR: Qr/JpfWv9OcHVH7zHoKkx6FMb91zwWrT7KKtl14D3eEKNzLcEE4pptjdA2Qp9XY6/m20TwO48G MtEdFuCYemYA== X-IronPort-AV: E=Sophos;i="5.83,259,1616482800"; d="scan'208";a="551701528" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.209.24.11]) ([10.209.24.11]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 11:12:49 -0700 Subject: Re: [RFC v2 08/32] x86/traps: Add #VE support for TDX guest To: Dave Hansen , Sean Christopherson Cc: Kuppuswamy Sathyanarayanan , Peter Zijlstra , Andy Lutomirski , Dan Williams , Tony Luck , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , linux-kernel@vger.kernel.org References: <8a1d6930f784cb57c957cf20cea870947db91e05.1619458733.git.sathyanarayanan.kuppuswamy@linux.intel.com> <42f6b603-7c21-28fa-b6ec-e53268aa6ff7@intel.com> From: Andi Kleen Message-ID: <3afaebee-77dc-83ff-c397-aa64991c52be@linux.intel.com> Date: Tue, 8 Jun 2021 11:12:48 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <42f6b603-7c21-28fa-b6ec-e53268aa6ff7@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/8/2021 10:53 AM, Dave Hansen wrote: > On 6/8/21 10:48 AM, Sean Christopherson wrote: >> On Tue, Jun 08, 2021, Dave Hansen wrote: >>> On 4/26/21 11:01 AM, Kuppuswamy Sathyanarayanan wrote: >>>> +#ifdef CONFIG_INTEL_TDX_GUEST >>>> +DEFINE_IDTENTRY(exc_virtualization_exception) >>>> +{ >>>> + struct ve_info ve; >>>> + int ret; >>>> + >>>> + RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); >>>> + >>>> + /* >>>> + * Consume #VE info before re-enabling interrupts. It will be >>>> + * re-enabled after executing the TDGETVEINFO TDCALL. >>>> + */ >>>> + ret = tdg_get_ve_info(&ve); >>> Is it safe to have *anything* before the tdg_get_ve_info()? For >>> instance, say that RCU_LOCKDEP_WARN() triggers. Will anything in there >>> do MMIO? >> I doubt it's safe, anything that's doing printing has the potential to trigger >> #VE. Even if we can prove it's safe for all possible paths, I can't think of a >> reason to allow anything that's not absolutely necessary before retrieving the >> #VE info. > What about tracing? Can I plop a kprobe in here or turn on ftrace? I believe neither does mmio/msr normally (except maybe ftrace+tp_printk, but that will likely work because it shouldn't recurse more than once due to ftrace's reentry protection) -Andi