lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25d2bf93854ae7410d82119227be3cb2ce47c4f2.camel@intel.com>
Date: Tue, 23 Apr 2024 13:59:04 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Yamahata, Isaku" <isaku.yamahata@...el.com>
CC: "Zhang, Tina" <tina.zhang@...el.com>, "isaku.yamahata@...ux.intel.com"
	<isaku.yamahata@...ux.intel.com>, "seanjc@...gle.com" <seanjc@...gle.com>,
	"Yuan, Hang" <hang.yuan@...el.com>, "Chen, Bo2" <chen.bo@...el.com>,
	"sagis@...gle.com" <sagis@...gle.com>, "isaku.yamahata@...il.com"
	<isaku.yamahata@...il.com>, "Aktas, Erdem" <erdemaktas@...gle.com>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>, "pbonzini@...hat.com"
	<pbonzini@...hat.com>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v19 024/130] KVM: TDX: Add placeholders for TDX VM/vcpu
 structure

On Fri, 2024-03-22 at 15:45 -0700, Isaku Yamahata wrote:
> Hmm, now I noticed the vm_size can be moved here.  We have
> 
>  	vcpu_size = sizeof(struct vcpu_vmx);
>  	vcpu_align = __alignof__(struct vcpu_vmx);
> 	if (enable_tdx) {
> 		vcpu_size = max_t(unsigned int, vcpu_size,
> 				  sizeof(struct vcpu_tdx));
> 		vcpu_align = max_t(unsigned int, vcpu_align,
> 				   __alignof__(struct vcpu_tdx));
>                 vt_x86_ops.vm_size = max_t(unsigned int, vt_x86_ops.vm_size,
>                                           sizeof(struct kvm_tdx));
> 	}

Hmm.. After reading again, I don't think we can?

In your comments that was replied to Binbin:

/*
 * vt_hardware_setup() updates vt_x86_ops.  Because kvm_ops_update()
 * copies vt_x86_ops to kvm_x86_op, vt_x86_ops must be updated before
 * kvm_ops_update() called by kvm_x86_vendor_init().
 */

You said update to vt_x86_ops.vm_size must be done in vt_hardware_setup().

But I think we should move the above comment to the vt_hardware_setup()
where vm_size is truly updated.

	/*
	 * TDX and VMX have different VM structure.  If TDX is enabled,
	 * update vt_x86_ops.vm_size to the maximum value of the two
	 * before it is copied to kvm_x86_ops in kvm_update_ops() to make
	 * sure KVM always allocates enough memory for the VM structure.
	 */

Here the purpose to calculate vcpu_size/vcpu_align is just to pass them to
kvm_init().  If needed, we can add a comment to describe "what this code
does":

	/*
	 * TDX and VMX have different vCPU structure.  Calculate the 
	 * maximum size/align so that kvm_init() can use the larger 
	 * values to create the vCPU kmem_cache.
	 */

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ