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: <jhmonkl53vrgz3pjhbbopvrx6infgbezlsvba3luccrpwtnmtb@ptobfcxrr4ud>
Date: Fri, 1 Nov 2024 14:52:39 +0100
From: Alyssa Ross <hi@...ssa.is>
To: Tamir Duberstein <tamird@...il.com>
Cc: Brendan Higgins <brendan.higgins@...ux.dev>, 
	David Gow <davidgow@...gle.com>, Rae Moar <rmoar@...gle.com>, linux-kselftest@...r.kernel.org, 
	kunit-dev@...glegroups.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] kunit: enable hardware acceleration when available

On Fri, Oct 25, 2024 at 05:03:54PM -0400, Tamir Duberstein wrote:
> @@ -124,6 +125,29 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations):
>  				'-no-reboot',
>  				'-nographic',
>  				'-serial', self._serial] + self._extra_qemu_params
> +		accelerators = {
> +			line.strip()
> +			for line in subprocess.check_output([qemu_binary, "-accel", "help"], text=True).splitlines()
> +			if line and line.islower()
> +		}
> +		if 'kvm' in accelerators:
> +			try:
> +				with open('/dev/kvm', 'rb+'):
> +					qemu_command.extend(['-accel', 'kvm'])
> +			except OSError as e:
> +				print(e)
> +		elif 'hvf' in accelerators:
> +			try:
> +				for line in subprocess.check_output(['sysctl', 'kern.hv_support'], text=True).splitlines():
> +					if not line:
> +						continue
> +					key, value = line.split(':')
> +					if key == 'kern.hv_support' and bool(value):
> +						qemu_command.extend(['-accel', 'hvf'])
> +						break
> +			except subprocess.CalledProcessError as e:
> +				print(e)
> +

QEMU supports falling back if one accelerator is not available, if you
specify multiple like -accel kvm:tcg.  Couldn't you rely on that rather
than re-implementing the availability checks here?

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ