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]
Date: Thu, 14 Mar 2024 09:13:17 -0700
From: Isaku Yamahata <isaku.yamahata@...el.com>
To: Chao Gao <chao.gao@...el.com>
Cc: isaku.yamahata@...el.com, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
	Paolo Bonzini <pbonzini@...hat.com>, erdemaktas@...gle.com,
	Sean Christopherson <seanjc@...gle.com>,
	Sagi Shahar <sagis@...gle.com>, Kai Huang <kai.huang@...el.com>,
	chen.bo@...el.com, hang.yuan@...el.com, tina.zhang@...el.com,
	isaku.yamahata@...ux.intel.com
Subject: Re: [PATCH v19 019/130] KVM: x86: Add is_vm_type_supported callback

On Thu, Mar 14, 2024 at 04:32:20PM +0800,
Chao Gao <chao.gao@...el.com> wrote:

> >-static bool kvm_is_vm_type_supported(unsigned long type)
> >+bool __kvm_is_vm_type_supported(unsigned long type)
> > {
> > 	return type == KVM_X86_DEFAULT_VM ||
> > 	       (type == KVM_X86_SW_PROTECTED_VM &&
> > 		IS_ENABLED(CONFIG_KVM_SW_PROTECTED_VM) && tdp_enabled);
> 
> maybe just do:
> 	switch (type) {
> 	case KVM_X86_DEFAULT_VM:
> 		return true;
> 	case KVM_X86_SW_PROTECTED_VM:
> 		return IS_ENABLED(CONFIG_KVM_SW_PROTECTED_VM) && tdp_enabled;
> 	default:
> 		return static_call(kvm_x86_is_vm_type_supported)(type);
> 	}
> 
> There are two benefits
> 1) switch/case improves readability a little.
> 2) no need to expose __kvm_is_vm_type_supported()

The following[1] patch will supersede this patch. Will drop this patch.

[1] https://lore.kernel.org/kvm/20240226190344.787149-12-pbonzini@redhat.com/
-- 
Isaku Yamahata <isaku.yamahata@...el.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ