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:	Mon, 27 Apr 2015 10:11:29 +0200
From:	Christian Borntraeger <borntraeger@...ibm.com>
To:	Michael Mueller <mimu@...ux.vnet.ibm.com>, qemu-devel@...gnu.org,
	kvm@...r.kernel.org, linux-s390@...r.kernel.org,
	linux-kernel@...r.kernel.org
CC:	Eduardo Habkost <ehabkost@...hat.com>,
	Gleb Natapov <gleb@...nel.org>, Alexander Graf <agraf@...e.de>,
	Daniel Hansel <daniel.hansel@...ux.vnet.ibm.com>,
	"Jason J. Herne" <jjherne@...ux.vnet.ibm.com>,
	Cornelia Huck <cornelia.huck@...ibm.com>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Richard Henderson <rth@...ddle.net>,
	Andreas Faerber <afaerber@...e.de>
Subject: Re: [Qemu-devel] [PATCH v5 15/17] target-s390x: Extend arch specific
 QMP command query-cpu-definitions

Am 13.04.2015 um 15:56 schrieb Michael Mueller:
> This patch implements the QMP command 'query-cpu-definitions' in the S390
> context. The command returns a list of cpu definitions in the current host
> context. A runnable and migratable cpu model has the related attributes
> set to true. The order attribute is used to bring the listed cpu definitions
> in a release order.

Can you add some explanation why we need the fallback code (e.g. something
along the line, when querying no KVM guest is available and to query the
capabilities we have to open a dummy VM bla bla)

[...]
> -static int kvm_s390_get_machine_props(KVMState *s, S390MachineProps *prop)
> +static int get_machine_props_fallback(S390MachineProps *prop)
> +{
> +    struct kvm_device_attr dev_attr;
> +    int rc, kvmfd = -1, vmfd = -1;
> +
> +    rc  = qemu_open("/dev/kvm", O_RDWR);
> +    if (rc < 0) {
> +        goto out_err;
> +    }
> +    kvmfd = rc;
> +
> +    rc = ioctl(kvmfd, KVM_CREATE_VM, 0);
> +    if (rc < 0) {
> +        goto out_err;
> +    }
> +    vmfd = rc;
> +
> +    rc = ioctl(vmfd, KVM_CHECK_EXTENSION, KVM_CAP_VM_ATTRIBUTES);
> +    if (rc < 0) {
> +        rc = -ENOSYS;
> +        goto out_err;
> +    }
> +
> +    dev_attr.group = KVM_S390_VM_CPU_MODEL;
> +    dev_attr.attr = KVM_S390_VM_CPU_MACHINE;
> +    rc = ioctl(vmfd, KVM_HAS_DEVICE_ATTR, &dev_attr);
> +    if (rc < 0) {
> +        rc = -EFAULT;
> +        goto out_err;
> +    }
> +
> +    dev_attr.addr = (uint64_t) prop;
> +    rc = ioctl(vmfd, KVM_GET_DEVICE_ATTR, &dev_attr);
> +
> +out_err:
> +    if (vmfd >= 0) {
> +        close(vmfd);
> +    }
> +    if (kvmfd >= 0) {
> +        close(kvmfd);
> +    }
> +
> +    return rc;
> +}
> +
> +int kvm_s390_get_machine_props(KVMState *s, S390MachineProps *prop)
>  {
>      int rc = -EFAULT;
> 
>      if (s) {
>          rc = cpu_model_get(s, KVM_S390_VM_CPU_MACHINE, (uint64_t) prop);
> +    } else {
> +        rc = get_machine_props_fallback(prop);
>      }
>      trace_kvm_get_machine_props(rc, prop->cpuid, prop->ibc);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ