All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: "Lengyel, Tamas" <tlengyel@novetta.com>
To: Wei Liu <wei.liu2@citrix.com>
Cc: Ravi Sahita <ravi.sahita@intel.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Ed White <edmund.h.white@intel.com>,
	Xen-devel <xen-devel@lists.xen.org>,
	Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Daniel De Graaf <dgdegra@tycho.nsa.gov>
Subject: Re: [PATCH v5 15/15] tools/xen-access: altp2m testcases
Date: Tue, 14 Jul 2015 07:52:37 -0400	[thread overview]
Message-ID: <CAD33N+64=gK4pj=8_MG0n_VyeAqkvW9ASXYN-Ubz9aQehFNrig@mail.gmail.com> (raw)
In-Reply-To: <20150714095655.GD4152@zion.uk.xensource.com>


[-- Attachment #1.1: Type: text/plain, Size: 5753 bytes --]

On Tue, Jul 14, 2015 at 5:56 AM, Wei Liu <wei.liu2@citrix.com> wrote:

> On Mon, Jul 13, 2015 at 05:15:03PM -0700, Ed White wrote:
> > From: Tamas K Lengyel <tlengyel@novetta.com>
> >
> > Working altp2m test-case. Extended the test tool to support
> singlestepping
> > to better highlight the core feature of altp2m view switching.
> >
> > Signed-off-by: Tamas K Lengyel <tlengyel@novetta.com>
> > Signed-off-by: Ed White <edmund.h.white@intel.com>
> >
> > Reviewed-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>
> Acked-by: Wei Liu <wei.liu2@citrix.com>
>
> Some nits below.
>
> I do notice there is inconsistency in coding style, so I won't ask you
> to resubmit just for fixing style. But a follow-up patch to fix up all
> style problem is welcome.
>
> > ---
> >  tools/tests/xen-access/xen-access.c | 173
> ++++++++++++++++++++++++++++++------
> >  1 file changed, 148 insertions(+), 25 deletions(-)
> >
> > diff --git a/tools/tests/xen-access/xen-access.c
> b/tools/tests/xen-access/xen-access.c
> > index 12ab921..6b69c26 100644
> > --- a/tools/tests/xen-access/xen-access.c
> > +++ b/tools/tests/xen-access/xen-access.c
> > @@ -275,6 +275,19 @@ xenaccess_t *xenaccess_init(xc_interface **xch_r,
> domid_t domain_id)
> >      return NULL;
> >  }
> >
> > +static inline
> > +int control_singlestep(
> > +    xc_interface *xch,
> > +    domid_t domain_id,
> > +    unsigned long vcpu,
> > +    bool enable)
> > +{
> > +    uint32_t op = enable ?
> > +        XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON :
> XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF;
> > +
> > +    return xc_domain_debug_control(xch, domain_id, op, vcpu);
> > +}
> > +
> >  /*
> >   * Note that this function is not thread safe.
> >   */
> > @@ -317,13 +330,15 @@ static void put_response(vm_event_t *vm_event,
> vm_event_response_t *rsp)
> >
> >  void usage(char* progname)
> >  {
> > -    fprintf(stderr,
> > -            "Usage: %s [-m] <domain_id> write|exec|breakpoint\n"
> > +    fprintf(stderr, "Usage: %s [-m] <domain_id> write|exec", progname);
> > +#if defined(__i386__) || defined(__x86_64__)
> > +            fprintf(stderr, "|breakpoint|altp2m_write|altp2m_exec");
> > +#endif
> > +            fprintf(stderr,
> >              "\n"
> >              "Logs first page writes, execs, or breakpoint traps that
> occur on the domain.\n"
> >              "\n"
> > -            "-m requires this program to run, or else the domain may
> pause\n",
> > -            progname);
> > +            "-m requires this program to run, or else the domain may
> pause\n");
>
> Indentation looks wrong, but this is not your fault so don't worry
> about this.
>
> >  }
> >
> >  int main(int argc, char *argv[])
> > @@ -341,6 +356,8 @@ int main(int argc, char *argv[])
> >      int required = 0;
> >      int breakpoint = 0;
> >      int shutting_down = 0;
> > +    int altp2m = 0;
> > +    uint16_t altp2m_view_id = 0;
> >
> >      char* progname = argv[0];
> >      argv++;
> > @@ -379,10 +396,22 @@ int main(int argc, char *argv[])
> >          default_access = XENMEM_access_rw;
> >          after_first_access = XENMEM_access_rwx;
> >      }
> > +#if defined(__i386__) || defined(__x86_64__)
> >      else if ( !strcmp(argv[0], "breakpoint") )
> >      {
> >          breakpoint = 1;
> >      }
> > +    else if ( !strcmp(argv[0], "altp2m_write") )
> > +    {
> > +        default_access = XENMEM_access_rx;
> > +        altp2m = 1;
> > +    }
> > +    else if ( !strcmp(argv[0], "altp2m_exec") )
> > +    {
> > +        default_access = XENMEM_access_rw;
> > +        altp2m = 1;
> > +    }
> > +#endif
> >      else
> >      {
> >          usage(argv[0]);
> > @@ -415,22 +444,73 @@ int main(int argc, char *argv[])
> >          goto exit;
> >      }
> >
> > -    /* Set the default access type and convert all pages to it */
> > -    rc = xc_set_mem_access(xch, domain_id, default_access, ~0ull, 0);
> > -    if ( rc < 0 )
> > +    /* With altp2m we just create a new, restricted view of the memory
> */
> > +    if ( altp2m )
> >      {
> > -        ERROR("Error %d setting default mem access type\n", rc);
> > -        goto exit;
> > -    }
> > +        xen_pfn_t gfn = 0;
> > +        unsigned long perm_set = 0;
> > +
> > +        rc = xc_altp2m_set_domain_state( xch, domain_id, 1 );
>
> Extraneous spaces in brackets.
>
> > +        if ( rc < 0 )
> > +        {
> > +            ERROR("Error %d enabling altp2m on domain!\n", rc);
> > +            goto exit;
> > +        }
> > +
> > +        rc = xc_altp2m_create_view( xch, domain_id, default_access,
> &altp2m_view_id );
>
> Extraneous spaces and line too long.
>
> > +        if ( rc < 0 )
> > +        {
> > +            ERROR("Error %d creating altp2m view!\n", rc);
> > +            goto exit;
> > +        }
> >
> > -    rc = xc_set_mem_access(xch, domain_id, default_access, START_PFN,
> > -                           (xenaccess->max_gpfn - START_PFN) );
> > +        DPRINTF("altp2m view created with id %u\n", altp2m_view_id);
> > +        DPRINTF("Setting altp2m mem_access permissions.. ");
> >
> > -    if ( rc < 0 )
> > +        for(; gfn < xenaccess->max_gpfn; ++gfn)
> > +        {
> > +            rc = xc_altp2m_set_mem_access( xch, domain_id,
> altp2m_view_id, gfn,
> > +                                           default_access);
>
> Space.
>
> > +            if ( !rc )
> > +                perm_set++;
> > +        }
> > +
> > +        DPRINTF("done! Permissions set on %lu pages.\n", perm_set);
> > +
> > +        rc = xc_altp2m_switch_to_view( xch, domain_id, altp2m_view_id );
>
> Ditto.
>
> The rest of code has similar issues too. I won't point them out one by
> one. Again, don't worry about this now.
>
> Wei.
>

Thanks Wei! I'll submit a patch to fix the style issues after (and if) this
gets merged!

Tamas

[-- Attachment #1.2: Type: text/html, Size: 7678 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

      reply	other threads:[~2015-07-14 11:52 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-14  0:14 [PATCH v5 00/15] Alternate p2m: support multiple copies of host p2m Ed White
2015-07-14  0:14 ` [PATCH v5 01/15] common/domain: Helpers to pause a domain while in context Ed White
2015-07-14  0:14 ` [PATCH v5 02/15] VMX: VMFUNC and #VE definitions and detection Ed White
2015-07-14  0:14 ` [PATCH v5 03/15] VMX: implement suppress #VE Ed White
2015-07-14 12:46   ` Jan Beulich
2015-07-14 13:47   ` George Dunlap
2015-07-14  0:14 ` [PATCH v5 04/15] x86/HVM: Hardware alternate p2m support detection Ed White
2015-07-14  0:14 ` [PATCH v5 05/15] x86/altp2m: basic data structures and support routines Ed White
2015-07-14 13:13   ` Jan Beulich
2015-07-14 14:45     ` George Dunlap
2015-07-14 14:58       ` Jan Beulich
2015-07-16  8:57     ` Sahita, Ravi
2015-07-16  9:07       ` Jan Beulich
2015-07-17 22:36         ` Sahita, Ravi
2015-07-20  6:20           ` Jan Beulich
2015-07-21  5:18             ` Sahita, Ravi
2015-07-14 15:57   ` George Dunlap
2015-07-21 17:44     ` Sahita, Ravi
2015-07-14  0:14 ` [PATCH v5 06/15] VMX/altp2m: add code to support EPTP switching and #VE Ed White
2015-07-14 13:57   ` Jan Beulich
2015-07-16  9:20     ` Sahita, Ravi
2015-07-16  9:38       ` Jan Beulich
2015-07-17 21:08         ` Sahita, Ravi
2015-07-20  6:21           ` Jan Beulich
2015-07-21  5:49             ` Sahita, Ravi
2015-07-14  0:14 ` [PATCH v5 07/15] VMX: add VMFUNC leaf 0 (EPTP switching) to emulator Ed White
2015-07-14 14:04   ` Jan Beulich
2015-07-14 17:56     ` Sahita, Ravi
2015-07-17 22:41     ` Sahita, Ravi
2015-07-14  0:14 ` [PATCH v5 08/15] x86/altp2m: add control of suppress_ve Ed White
2015-07-14 17:03   ` George Dunlap
2015-07-14  0:14 ` [PATCH v5 09/15] x86/altp2m: alternate p2m memory events Ed White
2015-07-14 14:08   ` Jan Beulich
2015-07-16  9:22     ` Sahita, Ravi
2015-07-14  0:14 ` [PATCH v5 10/15] x86/altp2m: add remaining support routines Ed White
2015-07-14 14:31   ` Jan Beulich
2015-07-16  9:16     ` Sahita, Ravi
2015-07-16  9:34       ` Jan Beulich
2015-07-17 22:32         ` Sahita, Ravi
2015-07-20  6:53           ` Jan Beulich
2015-07-21  5:46             ` Sahita, Ravi
2015-07-21  6:38               ` Jan Beulich
2015-07-21 18:33                 ` Sahita, Ravi
2015-07-22  7:33                   ` Jan Beulich
2015-07-16 14:44   ` George Dunlap
2015-07-17 21:01     ` Sahita, Ravi
2015-07-14  0:14 ` [PATCH v5 11/15] x86/altp2m: define and implement alternate p2m HVMOP types Ed White
2015-07-14 14:36   ` Jan Beulich
2015-07-16  9:02     ` Sahita, Ravi
2015-07-16  9:09       ` Jan Beulich
2015-07-14  0:15 ` [PATCH v5 12/15] x86/altp2m: Add altp2mhvm HVM domain parameter Ed White
2015-07-14  0:15 ` [PATCH v5 13/15] x86/altp2m: XSM hooks for altp2m HVM ops Ed White
2015-07-14  0:15 ` [PATCH v5 14/15] tools/libxc: add support to altp2m hvmops Ed White
2015-07-14  0:15 ` [PATCH v5 15/15] tools/xen-access: altp2m testcases Ed White
2015-07-14  9:56   ` Wei Liu
2015-07-14 11:52     ` Lengyel, Tamas [this message]

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='CAD33N+64=gK4pj=8_MG0n_VyeAqkvW9ASXYN-Ubz9aQehFNrig@mail.gmail.com' \
    --to=tlengyel@novetta.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=edmund.h.white@intel.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=ravi.sahita@intel.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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.