Jan Beulich
2012-Mar-22 15:55 UTC
[PATCH] x86/gnttab: fix asm() operand in gnttab_clear_flag()
The operand needs to use the ''w'' modifier in case the compiler happens to pick a register (which apparently it does for no-one but the reporter of this problem). Reported-by: Lin Ming <mlin@ss.pku.edu.cn> Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/xen/include/asm-x86/grant_table.h +++ b/xen/include/asm-x86/grant_table.h @@ -54,7 +54,7 @@ static inline void gnttab_clear_flag(uns * Note that this cannot be clear_bit(), as the access must be * confined to the specified 2 bytes. */ - asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st)); + asm volatile ("lock btrw %w1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st)); } /* Foreign mappings of HHVM-guest pages do not modify the type count. */ _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel
Lin Ming
2012-Mar-22 16:13 UTC
Re: [PATCH] x86/gnttab: fix asm() operand in gnttab_clear_flag()
On Thu, Mar 22, 2012 at 11:55 PM, Jan Beulich <JBeulich@suse.com> wrote:> The operand needs to use the ''w'' modifier in case the compiler happens > to pick a register (which apparently it does for no-one but the > reporter of this problem). > > Reported-by: Lin Ming <mlin@ss.pku.edu.cn> > Signed-off-by: Jan Beulich <jbeulich@suse.com> > > --- a/xen/include/asm-x86/grant_table.h > +++ b/xen/include/asm-x86/grant_table.h > @@ -54,7 +54,7 @@ static inline void gnttab_clear_flag(uns > * Note that this cannot be clear_bit(), as the access must be > * confined to the specified 2 bytes. > */ > - asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st)); > + asm volatile ("lock btrw %w1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));Nice. It works. Thanks, Lin Ming> } > > /* Foreign mappings of HHVM-guest pages do not modify the type count. */
Keir Fraser
2012-Mar-22 17:14 UTC
Re: [PATCH] x86/gnttab: fix asm() operand in gnttab_clear_flag()
On 22/03/2012 15:55, "Jan Beulich" <JBeulich@suse.com> wrote:> The operand needs to use the ''w'' modifier in case the compiler happens > to pick a register (which apparently it does for no-one but the > reporter of this problem). > > Reported-by: Lin Ming <mlin@ss.pku.edu.cn> > Signed-off-by: Jan Beulich <jbeulich@suse.com>Acked-by: Keir Fraser <keir@xen.org>> --- a/xen/include/asm-x86/grant_table.h > +++ b/xen/include/asm-x86/grant_table.h > @@ -54,7 +54,7 @@ static inline void gnttab_clear_flag(uns > * Note that this cannot be clear_bit(), as the access must be > * confined to the specified 2 bytes. > */ > - asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st)); > + asm volatile ("lock btrw %w1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st)); > } > > /* Foreign mappings of HHVM-guest pages do not modify the type count. */ > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel
Jan Beulich
2012-Mar-23 07:44 UTC
Re: [PATCH] x86/gnttab: fix asm() operand in gnttab_clear_flag()
>>> On 22.03.12 at 18:14, Keir Fraser <keir.xen@gmail.com> wrote: > On 22/03/2012 15:55, "Jan Beulich" <JBeulich@suse.com> wrote: > >> The operand needs to use the ''w'' modifier in case the compiler happens >> to pick a register (which apparently it does for no-one but the >> reporter of this problem). >> >> Reported-by: Lin Ming <mlin@ss.pku.edu.cn> >> Signed-off-by: Jan Beulich <jbeulich@suse.com> > > Acked-by: Keir Fraser <keir@xen.org>Committed. Can you please also pull this over into both 4.x-testing trees (as the now adjusted original c/s is in there too)? Thanks, Jan>> --- a/xen/include/asm-x86/grant_table.h >> +++ b/xen/include/asm-x86/grant_table.h >> @@ -54,7 +54,7 @@ static inline void gnttab_clear_flag(uns >> * Note that this cannot be clear_bit(), as the access must be >> * confined to the specified 2 bytes. >> */ >> - asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st)); >> + asm volatile ("lock btrw %w1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st)); >> } >> >> /* Foreign mappings of HHVM-guest pages do not modify the type count. */ >> >> >> >> _______________________________________________ >> Xen-devel mailing list >> Xen-devel@lists.xen.org >> http://lists.xen.org/xen-devel