[CRIU] [PATCH] bitops: use the UL literal for constants

Andrei Vagin avagin at virtuozzo.com
Mon Jun 18 20:55:03 MSK 2018


On Mon, Jun 18, 2018 at 08:50:17AM +0200, Adrian Reber wrote:
> Hello Andrei,
> 
> I just tested this again and it indeed fixes the cow01 test case. For
> aarch64 I am running criu 3.9 with the aarch64 patches on top of it. For
> initial testing of this patch I applied the patch on a clean 3.9
> checkout without the aarch64 patches so it failed.
> 
> Now I first applied the aarch64 patches on 3.9 and then this patch and
> now everything seems to work correctly on aarch64.
> 
> Thanks for the patch and sorry for the confusion.

Adrian, thank you for driving this work of supporting aarch64.

Could you check that "./zdtm.py run -a --pre 2" passes without fails
too?
> 
> 		Adrian
> 
> Tested-by: Adrian Reber <areber at redhat.com>
> 
> On Sun, Jun 17, 2018 at 06:44:42AM +0300, Andrei Vagin wrote:
> > We operate by long variables in out bit arithmetics, so our constants
> > should be marked as long too.
> > 
> > Cc: Adrian Reber <areber at redhat.com>
> > Reported-by: Adrian Reber <areber at redhat.com>
> > Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
> > ---
> >  include/common/asm-generic/bitops.h | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/include/common/asm-generic/bitops.h b/include/common/asm-generic/bitops.h
> > index e1a097511..0d861bdcc 100644
> > --- a/include/common/asm-generic/bitops.h
> > +++ b/include/common/asm-generic/bitops.h
> > @@ -28,25 +28,25 @@
> >  
> >  static inline void set_bit(int nr, volatile unsigned long *addr) {
> >  	addr += nr / BITS_PER_LONG;
> > -	*addr |= (1 << (nr % BITS_PER_LONG));
> > +	*addr |= (1UL << (nr % BITS_PER_LONG));
> >  }
> >  
> >  static inline void change_bit(int nr, volatile unsigned long *addr)
> >  {
> >  	addr += nr / BITS_PER_LONG;
> > -	*addr ^= (1 << (nr % BITS_PER_LONG));
> > +	*addr ^= (1UL << (nr % BITS_PER_LONG));
> >  }
> >  
> >  static inline int test_bit(int nr, volatile const unsigned long *addr)
> >  {
> >  	addr += nr / BITS_PER_LONG;
> > -	return (*addr & (1 << (nr % BITS_PER_LONG))) ? -1 : 0;
> > +	return (*addr & (1UL << (nr % BITS_PER_LONG))) ? -1 : 0;
> >  }
> >  
> >  static inline void clear_bit(int nr, volatile unsigned long *addr)
> >  {
> >  	addr += nr / BITS_PER_LONG;
> > -	*addr &= ~(1 << (nr % BITS_PER_LONG));
> > +	*addr &= ~(1UL << (nr % BITS_PER_LONG));
> >  }
> >  
> >  /**
> > -- 
> > 2.14.3
> > 


More information about the CRIU mailing list