[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XTF-ARM] tests: Hypercall xen_version testing


  • To: Michal Orzel <michal.orzel@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 15 Dec 2022 16:48:57 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oceKss5hYKN711vmcuhTmnFPfZW+sexdiFHWqOCkPjA=; b=EDTh96nFl2ckikhnodLh7suscdu54kx6YkCDYJEJM4EDnqYbI4DNWW5yLTBWAKRYiQ0hm4823iFdiAlZ6csESuK7dGH7hIWLW2dX/xvTZjOaV7q7IZd5iEg06EyC2MF3KFvrxrKMxQtBrAVgJI/GKxRKYRLDfRGQQzW6xX7BuXnEUw9Fm/vAuuEoa6ZGOiYzw9ehDB5oZ7y9dlXplpGduOwm+0NsiQ9jyAwDRxnrquptWeAjNigRtarwrPfrf/F7baRneT1vHdJaLEkeHBR+cfmtn0o1+sHBbtS3eA9hmro63YaWSNzjZPZbc7xNs6ZWgHji/VfccJAC7iS2vuRsLA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LG3PK6kZfii/MBi20hIx8sDbTB+WJLQnVQsDKnXhQuuR+5MfVqAyJnC+ZRJUxZ7QIoIbXmpGreUY9yZXYHQwqk2o1Vj5BxntHe7cUttIa10WwlF/4HOXj558EPs84fTMFf/AqPLvujmmaLTh48i0uybvpc6ulXj+oV2YFSPU9Rob8M9Li0XuzrX+JIxnrFFSGM1/GyriYdMVRBNq7x7EKGBHAHIBq71ZLQmM/qTXY69zcwFp4SnKmbrwxlbwZ1whmRoUxt/QamD8lR05ohUeCzE9Od8YfYk4K4SA1SSMoI7zA9HdPoa/g7bWA/jsBsRpkqcJ6g1O/NwKyBaXsyFf7Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 15 Dec 2022 15:49:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.12.2022 16:25, Michal Orzel wrote:
> Add a new test hyp-xen-version to perform functional testing of
> xen_version hypercall. Check the following commands (more can be added
> later on):
>  - XENVER_version,
>  - XENVER_extraversion,
>  - XENVER_compile_info,
>  - XENVER_changeset
>  - XENVER_get_features,
>  - passing invalid command.
> 
> For now, enable this test only for arm64.

What's wrong with exposing this uniformly?

> --- /dev/null
> +++ b/tests/hyp-xen-version/main.c
> @@ -0,0 +1,105 @@
> +/**
> + * @file tests/hyp-xen-version/main.c
> + * @ref test-hyp-xen-version
> + *
> + * @page test-hyp-xen-version Hypercall xen_version
> + *
> + * Functional testing of xen_version hypercall.
> + *
> + * @see tests/hyp-xen-version/main.c
> + */
> +#include <xtf.h>
> +
> +const char test_title[] = "Hypercall xen_version testing";
> +
> +#define INVALID_CMD -1
> +
> +void test_main(void)
> +{
> +    int ret;
> +
> +    printk("Checking XENVER_version:\n");
> +    {
> +        /*
> +        * Version is returned directly in format: ((major << 16) | minor),
> +        * so no need to check the return value for an error.
> +        */
> +        ret = hypercall_xen_version(XENVER_version, NULL);
> +        printk(" version: %u.%u\n", ret >> 16, ret & 0xFFFF);
> +    }
> +
> +    printk("Checking XENVER_extraversion:\n");
> +    {
> +        xen_extraversion_t xen_ev;
> +        memset(&xen_ev, 0, sizeof(xen_ev));
> +
> +        ret = hypercall_xen_version(XENVER_extraversion, xen_ev);
> +        if ( ret < 0 )
> +            return xtf_error("Error %d\n", ret);

This, ...

> +        printk(" extraversion: %s\n", xen_ev);
> +    }
> +
> +    printk("Checking XENVER_compile_info:\n");
> +    {
> +        xen_compile_info_t xen_ci;
> +        memset(&xen_ci, 0, sizeof(xen_ci));
> +
> +        ret = hypercall_xen_version(XENVER_compile_info, &xen_ci);
> +        if ( ret < 0 )
> +            return xtf_error("Error %d\n", ret);

... this, and ...

> +        printk(" compiler:       %s\n", xen_ci.compiler);
> +        printk(" compile_by:     %s\n", xen_ci.compile_by);
> +        printk(" compile_domain: %s\n", xen_ci.compile_domain);
> +        printk(" compile_date:   %s\n", xen_ci.compile_date);
> +    }
> +
> +    printk("Checking XENVER_changeset:\n");
> +    {
> +        xen_changeset_info_t xen_cs;
> +        memset(&xen_cs, 0, sizeof(xen_cs));
> +
> +        ret = hypercall_xen_version(XENVER_changeset, &xen_cs);
> +        if ( ret < 0 )
> +            return xtf_error("Error %d\n", ret);

... this can fail because of XSM denying access. (Others can of course
also fail for this reason, but here possible failure is kind of
"intended" - see the dummy xsm_xen_version() handling.) Therefore I
would like to suggest that you also special case getting back -EPERM,
resulting in e.g. just a warning instead of an error.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.