From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E85ABC47082 for ; Tue, 8 Jun 2021 18:12:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C183B61380 for ; Tue, 8 Jun 2021 18:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233254AbhFHSOp (ORCPT ); Tue, 8 Jun 2021 14:14:45 -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