xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Wei Liu" <wei.liu2@citrix.com>,
	"Jan Beulich" <JBeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH 13/14] xen/gnttab: Simplify gnttab_map_frame()
Date: Thu, 22 Nov 2018 14:36:25 +0000	[thread overview]
Message-ID: <612fc9e9-a639-2daa-fd3b-a37d30aba5ab@arm.com> (raw)
In-Reply-To: <1542806482-24030-14-git-send-email-andrew.cooper3@citrix.com>

Hi Andrew,

On 11/21/18 1:21 PM, Andrew Cooper wrote:
>   * Reflow some lines to remove unnecessary line breaks.
>   * Factor out the gnttab_get_frame_gfn() calculation.  Neither x86 nor ARM
>     builds seem to be able to fold the two calls, and the resulting code is far
>     easier to follow.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Julien Grall <julien.grall@arm.com>

Cheers,

> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Julien Grall <julien.grall@arm.com>
> ---
>   xen/common/grant_table.c | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
> index d5a1a00..f00eba9 100644
> --- a/xen/common/grant_table.c
> +++ b/xen/common/grant_table.c
> @@ -3869,8 +3869,7 @@ static int gnttab_get_shared_frame_mfn(struct domain *d,
>       return 0;
>   }
>   
> -int gnttab_map_frame(struct domain *d, unsigned long idx, gfn_t gfn,
> -                     mfn_t *mfn)
> +int gnttab_map_frame(struct domain *d, unsigned long idx, gfn_t gfn, mfn_t *mfn)
>   {
>       int rc = 0;
>       struct grant_table *gt = d->grant_table;
> @@ -3878,8 +3877,7 @@ int gnttab_map_frame(struct domain *d, unsigned long idx, gfn_t gfn,
>   
>       grant_write_lock(gt);
>   
> -    if ( gt->gt_version == 2 &&
> -         (idx & XENMAPIDX_grant_table_status) )
> +    if ( gt->gt_version == 2 && (idx & XENMAPIDX_grant_table_status) )
>       {
>           idx &= ~XENMAPIDX_grant_table_status;
>           status = true;
> @@ -3889,10 +3887,13 @@ int gnttab_map_frame(struct domain *d, unsigned long idx, gfn_t gfn,
>       else
>           rc = gnttab_get_shared_frame_mfn(d, idx, mfn);
>   
> -    if ( !rc && paging_mode_translate(d) &&
> -         !gfn_eq(gnttab_get_frame_gfn(gt, status, idx), INVALID_GFN) )
> -        rc = guest_physmap_remove_page(d, gnttab_get_frame_gfn(gt, status, idx),
> -                                       *mfn, 0);
> +    if ( !rc && paging_mode_translate(d) )
> +    {
> +        gfn_t gfn = gnttab_get_frame_gfn(gt, status, idx);
> +
> +        if ( !gfn_eq(gfn, INVALID_GFN) )
> +            rc = guest_physmap_remove_page(d, gfn, *mfn, 0);
> +    }
>   
>       if ( !rc )
>           gnttab_set_frame_gfn(gt, status, idx, gfn);
> 

-- 
Julien Grall

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

  reply	other threads:[~2018-11-22 14:36 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 13:21 [PATCH 00/14] XSA-277 followup Andrew Cooper
2018-11-21 13:21 ` [PATCH 01/14] x86/soft-reset: Drop gfn reference after calling get_gfn_query() Andrew Cooper
2018-11-22 14:45   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 02/14] x86/mem-sharing: Don't leave the altp2m lock held when nominating a page Andrew Cooper
2018-11-21 16:56   ` Tamas K Lengyel
2018-11-22 14:46   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 03/14] AMD/IOMMU: Fix multiple reference counting errors Andrew Cooper
2018-11-22 14:51   ` Jan Beulich
2018-11-22 17:46     ` Andrew Cooper
2018-11-23  8:23       ` Jan Beulich
2018-11-23 16:03         ` Andrew Cooper
2018-11-26  9:05           ` Jan Beulich
2019-01-31 15:59   ` Woods, Brian
2018-11-21 13:21 ` [PATCH 04/14] x86/p2m: Fix locking in p2m_altp2m_lazy_copy() Andrew Cooper
2018-11-21 13:59   ` Razvan Cojocaru
2018-11-22 15:01   ` Jan Beulich
2018-12-05 19:53     ` Andrew Cooper
2018-11-21 13:21 ` [PATCH 05/14] x86/p2m: Don't overwrite p2m_altp2m_lazy_copy()'s callers p2m pointer Andrew Cooper
2018-11-21 14:07   ` Razvan Cojocaru
2018-11-22 15:03   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 06/14] x86/hvm: Make the altp2m locking easier to follow Andrew Cooper
2018-11-21 14:43   ` Razvan Cojocaru
2018-11-22 15:08   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 07/14] x86/p2m: Coding style cleanup Andrew Cooper
2018-11-22 15:12   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 08/14] xen/memory: Drop ARM put_gfn() stub Andrew Cooper
2018-11-22 14:07   ` Julien Grall
2018-11-22 15:15   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 09/14] x86/p2m: Switch the two_gfns infrastructure to using gfn_t Andrew Cooper
2018-11-21 17:06   ` Tamas K Lengyel
2018-11-22 15:17   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 10/14] x86/mm: Switch {get, put}_gfn() " Andrew Cooper
2018-11-21 14:48   ` Razvan Cojocaru
2018-11-21 16:12   ` Paul Durrant
2018-11-22 15:34   ` Jan Beulich
2018-11-23  2:58   ` Tian, Kevin
2018-11-26 15:51   ` Woods, Brian
2018-11-21 13:21 ` [PATCH 11/14] xen/mm: Switch mfn_to_virt()/virt_to_mfn() to using mfn_t Andrew Cooper
2018-11-22 14:32   ` Julien Grall
2018-11-22 15:44   ` Jan Beulich
2018-11-22 15:49     ` Andrew Cooper
2018-11-21 13:21 ` [PATCH 12/14] xen/gnttab: Drop gnttab_create_{shared, status}_page() Andrew Cooper
2018-11-22 14:35   ` Julien Grall
2018-11-22 15:47   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 13/14] xen/gnttab: Simplify gnttab_map_frame() Andrew Cooper
2018-11-22 14:36   ` Julien Grall [this message]
2018-11-22 15:48   ` Jan Beulich
2018-11-21 13:21 ` [PATCH 14/14] xen/gnttab: Minor improvements to arch header files Andrew Cooper
2018-11-22 15:51   ` Jan Beulich
2018-11-22 17:56   ` Andrew Cooper
2019-01-30 20:04     ` Julien Grall
2019-01-30 20:05       ` Andrew Cooper
2018-11-21 17:19 ` [PATCH 00/14] XSA-277 followup Tamas K Lengyel
2018-11-21 21:22   ` Andrew Cooper
2018-11-21 22:42     ` Tamas K Lengyel
2018-11-22  0:08       ` Andrew Cooper
2018-11-26 17:48         ` Tamas K Lengyel
2018-11-23 15:46     ` Roger Pau Monné
2019-01-30 18:36 ` Pings for 4.12 " Andrew Cooper

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=612fc9e9-a639-2daa-fd3b-a37d30aba5ab@arm.com \
    --to=julien.grall@arm.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).