mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Borisov <nik.borisov@suse.com>
To: Kai Huang <kai.huang@intel.com>,
	peterz@infradead.org, kirill.shutemov@linux.intel.com,
	linux-kernel@vger.kernel.org
Cc: dave.hansen@intel.com, tglx@linutronix.de, bp@alien8.de,
	mingo@redhat.com, hpa@zytor.com, x86@kernel.org,
	seanjc@google.com, pbonzini@redhat.com, kvm@vger.kernel.org,
	isaku.yamahata@intel.com,
	sathyanarayanan.kuppuswamy@linux.intel.com
Subject: Re: [PATCH 08/10] x86/tdx: Unify TDX_HYPERCALL and TDX_MODULE_CALL assembly
Date: Sat, 15 Jul 2023 13:05:48 +0300	[thread overview]
Message-ID: <b95c4169-88c8-219e-87b7-6c4e058c246a@suse.com> (raw)
In-Reply-To: <c22a4697cfe90ab4e1de18d27aa48ea2152dbcfa.1689151537.git.kai.huang@intel.com>



<snip>

> diff --git a/arch/x86/coco/tdx/tdx.c b/arch/x86/coco/tdx/tdx.c
> index 0f16ba52ae62..a5e77893b2c0 100644
> --- a/arch/x86/coco/tdx/tdx.c
> +++ b/arch/x86/coco/tdx/tdx.c
> @@ -51,13 +51,38 @@
>   
>   #define TDREPORT_SUBTYPE_0	0
>   
> +/* Called from __tdx_hypercall() for unrecoverable failure */
> +static noinstr void __tdx_hypercall_failed(void)
> +{
> +	instrumentation_begin();
> +	panic("TDVMCALL failed. TDX module bug?");
> +}

So what's the deal with this instrumentation here. The instruction is 
noinstr, so you want to make just the panic call itself instrumentable?, 
if so where's the instrumentation_end() cal;?No instrumentation_end() 
call. Actually is this complexity really worth it for the failure case?

AFAICS there is a single call site for __tdx_hypercall_failed so why 
noot call panic() directly ?

> +
> +static inline u64 __tdx_hypercall(struct tdx_module_args *args)
> +{
> +	u64 ret;
> +
> +	args->rcx = TDVMCALL_EXPOSE_REGS_MASK;
> +	ret = __tdcall_saved_ret(TDG_VP_VMCALL, args);
> +
> +	/*
> +	 * RAX!=0 indicates a failure of the TDVMCALL mechanism itself and that

nit: Why mention the register explicitly, just say that if 
__tdcall_saved_ret returns non-zero ....

> +	 * something has gone horribly wrong with the TDX module.
> +	 */
> +	if (ret)
> +		__tdx_hypercall_failed();
> +
> +	/* The return status of the hypercall itself is in R10. */
> +	return args->r10;
> +}
> +
>   /*
> - * Wrapper for standard use of __tdx_hypercall with no output aside from
> - * return code.
> + * Wrapper for standard use of __tdx_hypercall() w/o needing any output
> + * register except the return code.
>    */
>   static inline u64 _tdx_hypercall(u64 fn, u64 r12, u64 r13, u64 r14, u64 r15)
>   {
> -	struct tdx_hypercall_args args = {
> +	struct tdx_module_args args = {
>   		.r10 = TDX_HYPERCALL_STANDARD,
>   		.r11 = fn,
>   		.r12 = r12,

<snip>

  reply	other threads:[~2023-07-15 10:06 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12  8:55 [PATCH 00/10] Unify TDCALL/SEAMCALL and TDVMCALL assembly Kai Huang
2023-07-12  8:55 ` [PATCH 01/10] x86/tdx: Zero out the missing RSI in TDX_HYPERCALL macro Kai Huang
2023-07-12 19:19   ` Sathyanarayanan Kuppuswamy
2023-07-12  8:55 ` [PATCH 02/10] x86/tdx: Use cmovc to save a label in TDX_MODULE_CALL asm Kai Huang
2023-07-12 19:27   ` Sathyanarayanan Kuppuswamy
2023-07-13 10:32     ` Huang, Kai
2023-07-12  8:55 ` [PATCH 03/10] x86/tdx: Move FRAME_BEGIN/END to TDX_MODULE_CALL asm macro Kai Huang
2023-07-12 19:57   ` Sathyanarayanan Kuppuswamy
2023-07-12 22:05   ` Isaku Yamahata
2023-07-12  8:55 ` [PATCH 04/10] x86/tdx: Make macros of TDCALLs consistent with the spec Kai Huang
2023-07-14 12:28   ` Nikolay Borisov
2023-07-14 12:28   ` Nikolay Borisov
2023-07-17  0:57     ` Huang, Kai
2023-07-12  8:55 ` [PATCH 05/10] x86/tdx: Rename __tdx_module_call() to __tdcall() Kai Huang
2023-07-12  8:55 ` [PATCH 06/10] x86/tdx: Pass TDCALL/SEAMCALL input/output registers via a structure Kai Huang
2023-07-12  8:55 ` [PATCH 07/10] x86/tdx: Extend TDX_MODULE_CALL to support more TDCALL/SEAMCALL leafs Kai Huang
2023-07-12 16:53   ` Peter Zijlstra
2023-07-12 16:59     ` Peter Zijlstra
2023-07-13  8:02       ` Huang, Kai
2023-07-13  8:43         ` Peter Zijlstra
2023-07-13 10:19           ` Huang, Kai
2023-07-13 10:24             ` Huang, Kai
2023-07-13 10:39               ` Peter Zijlstra
2023-07-13 10:37             ` Peter Zijlstra
2023-07-13 10:47               ` Huang, Kai
2023-07-13 11:22                 ` Andrew Cooper
2023-07-13 11:40                   ` Huang, Kai
2023-07-13  7:48     ` Huang, Kai
2023-07-13  8:46       ` Peter Zijlstra
2023-07-13  9:34         ` Huang, Kai
2023-07-13  9:40           ` Peter Zijlstra
2023-07-12 17:11   ` Peter Zijlstra
2023-07-13  8:09     ` Huang, Kai
2023-07-13  9:01       ` Peter Zijlstra
2023-07-13  9:15         ` Huang, Kai
2023-07-13  9:25           ` Peter Zijlstra
2023-07-13 10:01             ` Huang, Kai
2023-07-12  8:55 ` [PATCH 08/10] x86/tdx: Unify TDX_HYPERCALL and TDX_MODULE_CALL assembly Kai Huang
2023-07-15 10:05   ` Nikolay Borisov [this message]
2023-07-17  6:35     ` Huang, Kai
2023-07-17  7:02       ` Nikolay Borisov
2023-07-17  7:58         ` Huang, Kai
2023-07-18 10:32           ` Huang, Kai
2023-07-12  8:55 ` [PATCH 09/10] x86/virt/tdx: Wire up basic SEAMCALL functions Kai Huang
2023-07-12 22:15   ` Isaku Yamahata
2023-07-13  3:46     ` Huang, Kai
2023-07-13  7:42       ` Peter Zijlstra
2023-07-13  8:18         ` Huang, Kai
2023-07-13  9:03           ` Peter Zijlstra
2023-07-13  9:20             ` Huang, Kai
2023-07-13 14:51           ` Sean Christopherson
2023-07-17  3:52             ` Huang, Kai
2023-07-13 18:44       ` Isaku Yamahata
2023-08-08  9:16         ` Yuan Yao
2023-08-14 20:37           ` Isaku Yamahata
2023-07-12  8:55 ` [PATCH 10/10] x86/virt/tdx: Allow SEAMCALL to handle #UD and #GP Kai Huang
2023-07-13  8:07   ` Peter Zijlstra
2023-07-13  9:58     ` Huang, Kai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b95c4169-88c8-219e-87b7-6c4e058c246a@suse.com \
    --to=nik.borisov@suse.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=isaku.yamahata@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®