All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Zhang Yi <yi.z.zhang@linux.intel.com>, xen-devel@lists.xenproject.org
Cc: kevin.tian@intel.com, tamas@tklengyel.com, wei.liu2@citrix.com,
	jun.nakajima@intel.com, george.dunlap@eu.citrix.com,
	andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com,
	jbeulich@suse.com
Subject: Re: [PATCH RFC 14/14] xen: tools: Added xen-subpage tool.
Date: Thu, 19 Oct 2017 11:42:17 +0300	[thread overview]
Message-ID: <9d839e5c-b3b4-8dc1-8378-a937fee45e95@bitdefender.com> (raw)
In-Reply-To: <90cbda6aa45b0de7e16b685af9b64e2973a139ba.1508397860.git.yi.z.zhang@linux.intel.com>

> +#include <errno.h>
> +#include <inttypes.h>
> +#include <stdlib.h>
> +#include <stdarg.h>
> +#include <stdbool.h>
> +#include <string.h>
> +#include <time.h>
> +#include <signal.h>
> +#include <unistd.h>
> +#include <sys/mman.h>
> +#include <poll.h>
> +
> +#include <xenctrl.h>
> +
> +#define DPRINTF(a, b...) fprintf(stderr, a, ## b)
> +#define ERROR(a, b...) fprintf(stderr, a "\n", ## b)
> +#define PERROR(a, b...) fprintf(stderr, a ": %s\n", ## b, strerror(errno))
> +
> +void usage(char* progname)
> +{
> +    fprintf(stderr, "Usage: %s [-m] <domain_id> get|set [gfn] [bit_map]", progname);
> +
> +            fprintf(stderr,
> +            "\n"
> +            "set - set gfn bitmap.\n"
> +            "\n"
> +            "-m requires this program to run\n");
> +}
> +
> +int main(int argc, char *argv[])
> +{
> +    domid_t domain_id;
> +    xc_interface *xch;
> +    xen_pfn_t gfn = 0;
> +    uint32_t access = 0;
> +    int required = 0;
> +    int rc = 0;
> +
> +    char* progname = argv[0];
> +    argv++;
> +    argc--;
> +
> +    if ( argc == 5 && argv[0][0] == '-' )
> +    {
> +        if ( !strcmp(argv[0], "-m") )
> +            required = 1;
> +        else
> +        {
> +            usage(progname);
> +            return -1;
> +        }
> +        argv++;
> +        argc--;
> +    }
> +
> +    if ( argc != 4 )
> +    {
> +        usage(progname);
> +        return -1;
> +    }
> +
> +    domain_id = atoi(argv[0]);
> +    argv++;
> +    argc--;
> +
> +    if ( !strcmp(argv[0], "set") )
> +    {
> +        gfn = strtoul(argv[1], 0, 0);
> +        access = strtoul(argv[2], 0, 0);
> +        DPRINTF("set subpage gfn:0x%lx -- map:0x%x\n", gfn, access);
> +        xch = xc_interface_open(NULL, NULL, 0);
> +        if ( !xch )
> +        {
> +            ERROR("get interface error\n");
> +            return -1;
> +        }
> +        xc_mem_set_subpage(xch, domain_id, gfn, access);
> +        xc_interface_close(xch);
> +    }
> +    else
> +    {
> +        usage(argv[0]);
> +        return -1;
> +    }
> +
> +    return rc;
> +}

As far as I understand, this example just calls the new hypercall and exits.

Should there be another vm_event-subscribed application that will be
affected by the changes? If so, doesn't this rather belong in the
xen-access.c test?

Also, no explanation is given in comments in the source code or the
displayed help for useful values of the access parameter, and what it
stands for.


Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-10-19  8:42 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19  8:04 [PATCH RFC 00/14] Intel EPT-Based Sub-page Write Protection Support Zhang Yi
2017-10-19  8:08 ` [PATCH RFC 01/14] xen: vmx: Added EPT based Subpage Write Protection Doc Zhang Yi
2017-10-19  8:08 ` [PATCH RFC 02/14] xen: vmx: Added VMX SPP feature flags and VM-Execution Controls Zhang Yi
2017-10-19  8:09 ` [PATCH RFC 03/14] xen: vmx: Introduce the SPPTP and SPP page table Zhang Yi
2017-10-19  8:10 ` [PATCH RFC 04/14] xen: vmx: Introduce SPP-Induced vm exit and it's handle Zhang Yi
2017-10-19  8:11 ` [PATCH RFC 05/14] xen: vmx: Disable the 2M/1G superpage when SPP enabled Zhang Yi
2017-10-19 18:17   ` Tamas K Lengyel
2017-10-20  8:44     ` Yi Zhang
2017-10-24 17:43       ` Tamas K Lengyel
2017-10-25 15:32         ` Yi Zhang
2017-10-25 15:12           ` Tamas K Lengyel
2017-10-19  8:11 ` [PATCH RFC 06/14] xen: vmx: Added SPP flags in EPT leaf entry Zhang Yi
2017-10-19  8:12 ` [PATCH RFC 07/14] xen: vmx: Update the EPT leaf entry indicated with the SPP enable bit Zhang Yi
2017-10-19  8:12 ` [PATCH RFC 08/14] xen: vmx: Added setup spp page structure Zhang Yi
2017-10-19 18:26   ` Tamas K Lengyel
2017-10-20  8:43     ` Yi Zhang
2017-10-19  8:13 ` [PATCH RFC 09/14] xen: vmx: Introduce a Hyper call to set subpage Zhang Yi
2017-10-19 18:34   ` Tamas K Lengyel
2017-10-20  8:41     ` Yi Zhang
2017-10-19  8:13 ` [PATCH RFC 10/14] xen: vmx: Implement the Hypercall p2m_set_subpage Zhang Yi
2017-10-19  8:14 ` [PATCH RFC 11/14] xen: vmx: Added handle of SPP write protection fault Zhang Yi
2017-10-19  8:15 ` [PATCH RFC 12/14] xen: vmx: Support for clear EPT SPP write Protect bit Zhang Yi
2017-10-19  8:15 ` [PATCH RFC 13/14] xen: tools: Introduce the set-subpage into xenctrl Zhang Yi
2017-10-19  8:37   ` Razvan Cojocaru
2017-10-20  8:40     ` Yi Zhang
2017-10-19  8:16 ` [PATCH RFC 14/14] xen: tools: Added xen-subpage tool Zhang Yi
2017-10-19  8:42   ` Razvan Cojocaru [this message]
2017-10-20  8:39     ` Yi Zhang
2017-10-19  9:07 ` [PATCH RFC 00/14] Intel EPT-Based Sub-page Write Protection Support Razvan Cojocaru
2017-10-20  8:37   ` Yi Zhang
2017-10-20  8:39     ` Razvan Cojocaru
2017-10-20  8:39     ` Razvan Cojocaru

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9d839e5c-b3b4-8dc1-8378-a937fee45e95@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=tamas@tklengyel.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yi.z.zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.