All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Deegan <tim@xen.org>
To: Aravindh Puthiyaparambil <aravindh@virtuata.com>
Cc: Christian.Limpach@gmail.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 0 of 2] Add libxc API that sets mem_access type for an array of gfns
Date: Thu, 17 May 2012 11:05:09 +0100	[thread overview]
Message-ID: <20120517100509.GB57529@ocelot.phlegethon.org> (raw)
In-Reply-To: <CAB10MZAoKnoR3OHv7J1TcQa_Zuwn+yZtOBRTrL5=hZxOOoyNYQ@mail.gmail.com>

Hi Aravindh,

At 15:02 -0700 on 04 May (1336143748), Aravindh Puthiyaparambil wrote:
> diff -r 9dda0efd8ce1 -r c180942992bf xen/arch/x86/mm/p2m-ept.c
> --- a/xen/arch/x86/mm/p2m-ept.c Fri Apr 27 17:57:55 2012 +0200
> +++ b/xen/arch/x86/mm/p2m-ept.c Fri May 04 14:56:12 2012 -0700
> @@ -274,10 +274,13 @@ static int ept_next_level(struct p2m_dom
>  /*
>   * ept_set_entry() computes 'need_modify_vtd_table' for itself,
>   * by observing whether any gfn->mfn translations are modified.
> + * If sync_deferred is not NULL, then the caller will take care of
> + * calling ept_sync_domain() in the cases where it can be deferred.
>   */
>  static int
>  ept_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,
> -              unsigned int order, p2m_type_t p2mt, p2m_access_t p2ma)
> +              unsigned int order, p2m_type_t p2mt, p2m_access_t p2ma,
> +              bool_t *sync_deferred)
>  {
>      ept_entry_t *table, *ept_entry = NULL;
>      unsigned long gfn_remainder = gfn;
> @@ -309,6 +312,9 @@ ept_set_entry(struct p2m_domain *p2m, un
>             (target == 1 && hvm_hap_has_2mb(d)) ||
>             (target == 0));
> 
> +    if (sync_deferred)

Xen coding style has spaces inside those parentheses.

> +        *sync_deferred = 1;
> +
>      table = map_domain_page(ept_get_asr(d));
> 
>      for ( i = ept_get_wl(d); i > target; i-- )
> @@ -345,8 +351,12 @@ ept_set_entry(struct p2m_domain *p2m, un
>          ept_entry_t new_entry = { .epte = 0 };
> 
>          /* No need to flush if the old entry wasn't valid */
> -        if ( !is_epte_present(ept_entry) )
> +        if ( !is_epte_present(ept_entry) || (!target && sync_deferred) )
> +        {
>              needs_sync = 0;
> +            if ( sync_deferred )
> +                *sync_deferred = 0;

I don't think you should do this -- you call this function in a loop and
you may need to sync because of an earlier iteration.  Better to only
write a 1 to *sync_deferred once you know there's a sync to be done, and
never to write a zero.

> +        }

One comment on the rest of the patch: your calling function calls
ept_sync_domain() directly if sync_deferred == 1.  That's correct for
now but it would be cleaner to use a sync() function pointer in the
struct p2m_domain, the same as the other implementation-specific calls.

Other than that, I think this looks pretty good to go in after 4.2 has
branched.

Cheers,

Tim.

  reply	other threads:[~2012-05-17 10:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 18:33 [PATCH 0 of 2] Add libxc API that sets mem_access type for an array of gfns Aravindh Puthiyaparambil
2012-04-26 18:33 ` [PATCH 1 of 2] x86/mm: Split ept_set_entry() Aravindh Puthiyaparambil
2012-04-26 18:33 ` [PATCH 2 of 2] mem_access: Add xc_hvm_mem_access_bulk() API Aravindh Puthiyaparambil
2012-04-26 20:20 ` [PATCH 0 of 2] Add libxc API that sets mem_access type for an array of gfns Christian Limpach
2012-04-26 22:41   ` Aravindh Puthiyaparambil
2012-04-27  0:15     ` Aravindh Puthiyaparambil
2012-04-27  1:06       ` Christian Limpach
2012-04-27  1:36         ` Aravindh Puthiyaparambil
2012-04-27  8:48           ` Tim Deegan
2012-04-27 18:26             ` Aravindh Puthiyaparambil
2012-04-27 17:37           ` Christian Limpach
2012-04-27 18:25             ` Aravindh Puthiyaparambil
2012-04-28  4:22               ` Aravindh Puthiyaparambil
2012-05-03  3:28                 ` Christian Limpach
2012-05-04 22:02                   ` Aravindh Puthiyaparambil
2012-05-17 10:05                     ` Tim Deegan [this message]
2012-05-17 18:43                       ` Aravindh Puthiyaparambil

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=20120517100509.GB57529@ocelot.phlegethon.org \
    --to=tim@xen.org \
    --cc=Christian.Limpach@gmail.com \
    --cc=aravindh@virtuata.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.