xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Re: [Xen-devel] [PATCH 4/5] xen/gnttab: Refactor gnttab_clear_flag() to be gnttab_clear_flags()
@ 2019-06-28 10:20 Jan Beulich
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Beulich @ 2019-06-28 10:20 UTC (permalink / raw)
  To: andrew.cooper3
  Cc: sstabellini, wl, George.Dunlap, julien.grall, xen-devel, Roger Pau Monne

>>> On 21.06.19 at 11:36, <andrew.cooper3@citrix.com> wrote:
> --- a/xen/include/asm-x86/grant_table.h
> +++ b/xen/include/asm-x86/grant_table.h
> @@ -60,14 +60,11 @@ static inline int replace_grant_host_mapping(uint64_t 
> addr, mfn_t frame,
>  
>  #define gnttab_mark_dirty(d, f) paging_mark_dirty(d, f)
>  
> -static inline void gnttab_clear_flag(struct domain *d, unsigned int nr,
> -                                     uint16_t *st)
> +static inline void gnttab_clear_flags(struct domain *d,
> +                                      uint16_t mask, uint16_t *addr)
>  {
> -    /*
> -     * Note that this cannot be clear_bit(), as the access must be
> -     * confined to the specified 2 bytes.
> -     */
> -    asm volatile ("lock btrw %w1,%0" : "+m" (*st) : "Ir" (nr));
> +    /* Access must be confined to the specified 2 bytes. */
> +    asm volatile ("lock andw %w1,%0" : "+m" (*addr) : "Ir" (~mask));

The I constraint limits literal numbers to 5 bits, which is not what
you want here (albeit it's fine for the two bits we currently want
this for). "N" would widen the range to 8 bits, while "e" and "i"
would go beyond the 16 we want. Therefore I think you want
to cast ~mask to uint16_t and use "e" or "i". (This would then
also allow dropping the w modifier.)

Speaking of uint16_t - the "mask" parameter could easily be
unsigned int, possibly allowing the compiler to avoid a 66 prefix
here and there.

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

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [Xen-devel] [PATCH 0/5] xen/gnttab: XSA-295 followup
@ 2019-06-21  9:36 Andrew Cooper
  2019-06-21  9:36 ` [Xen-devel] [PATCH 4/5] xen/gnttab: Refactor gnttab_clear_flag() to be gnttab_clear_flags() Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Cooper @ 2019-06-21  9:36 UTC (permalink / raw)
  To: Xen-devel
  Cc: Stefano Stabellini, Wei Liu, George Dunlap, Andrew Cooper,
	Julien Grall, Jan Beulich, Roger Pau Monné

This series came out of observations during the development of XSA-295.

It has been tested on x86, but only compile tested on arm.  It can be obtained
in git form from:

  http://xenbits.xen.org/gitweb/?p=people/andrewcoop/xen.git;a=shortlog;h=refs/heads/xen-grant-status

Andrew Cooper (5):
  xen/gnttab: Reduce complexity when reading grant_entry_header_t
  xen/gnttab: Reduce code volume when using union grant_combo
  arm/gnttab: Implement stub helpers as static inlines
  xen/gnttab: Refactor gnttab_clear_flag() to be gnttab_clear_flags()
  xen/gnttab: Fold adjacent calls to gnttab_clear_flags()

 xen/arch/arm/mm.c                 |  16 ----
 xen/common/grant_table.c          | 160 ++++++++++++++++++++------------------
 xen/include/asm-arm/grant_table.h |  17 +++-
 xen/include/asm-x86/grant_table.h |  11 +--
 4 files changed, 104 insertions(+), 100 deletions(-)

-- 
2.1.4


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-28 10:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-28 10:20 [Xen-devel] [PATCH 4/5] xen/gnttab: Refactor gnttab_clear_flag() to be gnttab_clear_flags() Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2019-06-21  9:36 [Xen-devel] [PATCH 0/5] xen/gnttab: XSA-295 followup Andrew Cooper
2019-06-21  9:36 ` [Xen-devel] [PATCH 4/5] xen/gnttab: Refactor gnttab_clear_flag() to be gnttab_clear_flags() Andrew Cooper

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).