diff mbox

[v2,1/5] asm-arm/atomic.h: fix arm32|arm64 macros duplication

Message ID 1468419505-2692-1-git-send-email-czuzu@bitdefender.com (mailing list archive)
State New, archived
Headers show

Commit Message

Corneliu ZUZU July 13, 2016, 2:18 p.m. UTC
Move duplicate macros between asm-arm/arm32/atomic.h and asm-arm/arm64/atomic.h
to asm-arm/atomic.h.

Signed-off-by: Corneliu ZUZU <czuzu@bitdefender.com>
---
 xen/include/asm-arm/arm32/atomic.h | 11 -----------
 xen/include/asm-arm/arm64/atomic.h | 11 -----------
 xen/include/asm-arm/atomic.h       | 11 +++++++++++
 3 files changed, 11 insertions(+), 22 deletions(-)

Comments

Stefano Stabellini July 13, 2016, 6:46 p.m. UTC | #1
On Wed, 13 Jul 2016, Corneliu ZUZU wrote:
> Move duplicate macros between asm-arm/arm32/atomic.h and asm-arm/arm64/atomic.h
> to asm-arm/atomic.h.
> 
> Signed-off-by: Corneliu ZUZU <czuzu@bitdefender.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


>  xen/include/asm-arm/arm32/atomic.h | 11 -----------
>  xen/include/asm-arm/arm64/atomic.h | 11 -----------
>  xen/include/asm-arm/atomic.h       | 11 +++++++++++
>  3 files changed, 11 insertions(+), 22 deletions(-)
> 
> diff --git a/xen/include/asm-arm/arm32/atomic.h b/xen/include/asm-arm/arm32/atomic.h
> index 7ec712f..be08ff1 100644
> --- a/xen/include/asm-arm/arm32/atomic.h
> +++ b/xen/include/asm-arm/arm32/atomic.h
> @@ -149,17 +149,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
>  
>  #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
>  
> -#define atomic_inc(v)		atomic_add(1, v)
> -#define atomic_dec(v)		atomic_sub(1, v)
> -
> -#define atomic_inc_and_test(v)	(atomic_add_return(1, v) == 0)
> -#define atomic_dec_and_test(v)	(atomic_sub_return(1, v) == 0)
> -#define atomic_inc_return(v)    (atomic_add_return(1, v))
> -#define atomic_dec_return(v)    (atomic_sub_return(1, v))
> -#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
> -
> -#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
> -
>  #endif /* __ARCH_ARM_ARM32_ATOMIC__ */
>  /*
>   * Local variables:
> diff --git a/xen/include/asm-arm/arm64/atomic.h b/xen/include/asm-arm/arm64/atomic.h
> index b49219e..80d07bf 100644
> --- a/xen/include/asm-arm/arm64/atomic.h
> +++ b/xen/include/asm-arm/arm64/atomic.h
> @@ -125,17 +125,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
>  	return c;
>  }
>  
> -#define atomic_inc(v)		atomic_add(1, v)
> -#define atomic_dec(v)		atomic_sub(1, v)
> -
> -#define atomic_inc_and_test(v)	(atomic_add_return(1, v) == 0)
> -#define atomic_dec_and_test(v)	(atomic_sub_return(1, v) == 0)
> -#define atomic_inc_return(v)    (atomic_add_return(1, v))
> -#define atomic_dec_return(v)    (atomic_sub_return(1, v))
> -#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
> -
> -#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
> -
>  #endif
>  /*
>   * Local variables:
> diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h
> index 29ab265..41d1b6c 100644
> --- a/xen/include/asm-arm/atomic.h
> +++ b/xen/include/asm-arm/atomic.h
> @@ -138,6 +138,17 @@ static inline void _atomic_set(atomic_t *v, int i)
>  # error "unknown ARM variant"
>  #endif
>  
> +#define atomic_inc(v)       atomic_add(1, v)
> +#define atomic_dec(v)       atomic_sub(1, v)
> +
> +#define atomic_inc_and_test(v)  (atomic_add_return(1, v) == 0)
> +#define atomic_dec_and_test(v)  (atomic_sub_return(1, v) == 0)
> +#define atomic_inc_return(v)    (atomic_add_return(1, v))
> +#define atomic_dec_return(v)    (atomic_sub_return(1, v))
> +#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
> +
> +#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
> +
>  #endif /* __ARCH_ARM_ATOMIC__ */
>  /*
>   * Local variables:
> -- 
> 2.5.0
>
Julien Grall July 13, 2016, 7:12 p.m. UTC | #2
Hi Corneliu,

On 13/07/2016 15:18, Corneliu ZUZU wrote:
> Move duplicate macros between asm-arm/arm32/atomic.h and asm-arm/arm64/atomic.h
> to asm-arm/atomic.h.

asm-arm/arm*/atomic.h were a copy from Linux. I don't mind if we 
diverge, however the file xen/arch/arm/README.primitives needs to be 
update to mention the divergence with Linux.

Regards,
Corneliu ZUZU July 13, 2016, 7:36 p.m. UTC | #3
Hi Julien,

On 7/13/2016 10:12 PM, Julien Grall wrote:
> Hi Corneliu,
>
> On 13/07/2016 15:18, Corneliu ZUZU wrote:
>> Move duplicate macros between asm-arm/arm32/atomic.h and 
>> asm-arm/arm64/atomic.h
>> to asm-arm/atomic.h.
>
> asm-arm/arm*/atomic.h were a copy from Linux. I don't mind if we 
> diverge, however the file xen/arch/arm/README.primitives needs to be 
> update to mention the divergence with Linux.
>
> Regards,
>

Thanks for pointing that out, I didn't know these files were referred in 
such a way. What is the purpose of README.LinuxPrimitives and how must I 
update it to align with these patches?

Cheers,
Zuzu C.
Corneliu ZUZU July 14, 2016, 5:11 a.m. UTC | #4
On 7/13/2016 10:12 PM, Julien Grall wrote:
> Hi Corneliu,
>
> On 13/07/2016 15:18, Corneliu ZUZU wrote:
>> Move duplicate macros between asm-arm/arm32/atomic.h and 
>> asm-arm/arm64/atomic.h
>> to asm-arm/atomic.h.
>
> asm-arm/arm*/atomic.h were a copy from Linux. I don't mind if we 
> diverge, however the file xen/arch/arm/README.primitives needs to be 
> update to mention the divergence with Linux.
>
> Regards,
>

Julien,

AFAICT the README.LinuxPrimitives file specifies the Linux kernel 
version from which the arm{32,64}/atomic.h files were imported as well 
as the respective commit in the -Linux kernel- tree. I suppose that 
information needn't be updated.
Could you be more specific on how I should modify that file?

Thanks,
Zuzu C.
Julien Grall July 14, 2016, 9:26 a.m. UTC | #5
On 14/07/16 06:11, Corneliu ZUZU wrote:
> On 7/13/2016 10:12 PM, Julien Grall wrote:
>> Hi Corneliu,
>>
>> On 13/07/2016 15:18, Corneliu ZUZU wrote:
>>> Move duplicate macros between asm-arm/arm32/atomic.h and
>>> asm-arm/arm64/atomic.h
>>> to asm-arm/atomic.h.
>>
>> asm-arm/arm*/atomic.h were a copy from Linux. I don't mind if we
>> diverge, however the file xen/arch/arm/README.primitives needs to be
>> update to mention the divergence with Linux.
>>
>> Regards,
>>
>
> Julien,
>
> AFAICT the README.LinuxPrimitives file specifies the Linux kernel
> version from which the arm{32,64}/atomic.h files were imported as well
> as the respective commit in the -Linux kernel- tree. I suppose that
> information needn't be updated.
> Could you be more specific on how I should modify that file?

To specify which helpers has been taken from Linux in those files. Until 
now, it was quite easy to figure out that we took all atomic_* helpers.

Regards,
Corneliu ZUZU July 14, 2016, 10:11 a.m. UTC | #6
On 7/14/2016 12:26 PM, Julien Grall wrote:
>
>
> On 14/07/16 06:11, Corneliu ZUZU wrote:
>> On 7/13/2016 10:12 PM, Julien Grall wrote:
>>> Hi Corneliu,
>>>
>>> On 13/07/2016 15:18, Corneliu ZUZU wrote:
>>>> Move duplicate macros between asm-arm/arm32/atomic.h and
>>>> asm-arm/arm64/atomic.h
>>>> to asm-arm/atomic.h.
>>>
>>> asm-arm/arm*/atomic.h were a copy from Linux. I don't mind if we
>>> diverge, however the file xen/arch/arm/README.primitives needs to be
>>> update to mention the divergence with Linux.
>>>
>>> Regards,
>>>
>>
>> Julien,
>>
>> AFAICT the README.LinuxPrimitives file specifies the Linux kernel
>> version from which the arm{32,64}/atomic.h files were imported as well
>> as the respective commit in the -Linux kernel- tree. I suppose that
>> information needn't be updated.
>> Could you be more specific on how I should modify that file?
>
> To specify which helpers has been taken from Linux in those files. 
> Until now, it was quite easy to figure out that we took all atomic_* 
> helpers.
>
> Regards,


Ok, will look into that.

I suppose also adding:

diff -u linux/arch/arm64/include/asm/atomic.h 
xen/include/asm-arm/arm64/atomic.h
diff -u linux/arch/arm/include/asm/atomic.h 
xen/include/asm-arm/arm32/atomic.h

as it's done for the others helps?

Zuzu C.
Julien Grall July 14, 2016, 10:14 a.m. UTC | #7
On 14/07/16 11:11, Corneliu ZUZU wrote:
> On 7/14/2016 12:26 PM, Julien Grall wrote:
>>
>>
>> On 14/07/16 06:11, Corneliu ZUZU wrote:
>>> On 7/13/2016 10:12 PM, Julien Grall wrote:
>>>> Hi Corneliu,
>>>>
>>>> On 13/07/2016 15:18, Corneliu ZUZU wrote:
>>>>> Move duplicate macros between asm-arm/arm32/atomic.h and
>>>>> asm-arm/arm64/atomic.h
>>>>> to asm-arm/atomic.h.
>>>>
>>>> asm-arm/arm*/atomic.h were a copy from Linux. I don't mind if we
>>>> diverge, however the file xen/arch/arm/README.primitives needs to be
>>>> update to mention the divergence with Linux.
>>>>
>>>> Regards,
>>>>
>>>
>>> Julien,
>>>
>>> AFAICT the README.LinuxPrimitives file specifies the Linux kernel
>>> version from which the arm{32,64}/atomic.h files were imported as well
>>> as the respective commit in the -Linux kernel- tree. I suppose that
>>> information needn't be updated.
>>> Could you be more specific on how I should modify that file?
>>
>> To specify which helpers has been taken from Linux in those files.
>> Until now, it was quite easy to figure out that we took all atomic_*
>> helpers.
>>
>> Regards,
>
>
> Ok, will look into that.
>
> I suppose also adding:
>
> diff -u linux/arch/arm64/include/asm/atomic.h
> xen/include/asm-arm/arm64/atomic.h
> diff -u linux/arch/arm/include/asm/atomic.h
> xen/include/asm-arm/arm32/atomic.h
>
> as it's done for the others helps?

No, the other files are a verbatim copy of the Linux headers. It is not 
the case here.

Something like:

"Only the following functions were taken from Linux:
   - ...
   - ...
   - ...
"

Regards,
Corneliu ZUZU July 14, 2016, 4:40 p.m. UTC | #8
On 7/14/2016 1:14 PM, Julien Grall wrote:
>
>
> On 14/07/16 11:11, Corneliu ZUZU wrote:
>> On 7/14/2016 12:26 PM, Julien Grall wrote:
>>>
>>>
>>> On 14/07/16 06:11, Corneliu ZUZU wrote:
>>>> On 7/13/2016 10:12 PM, Julien Grall wrote:
>>>>> Hi Corneliu,
>>>>>
>>>>> On 13/07/2016 15:18, Corneliu ZUZU wrote:
>>>>>> Move duplicate macros between asm-arm/arm32/atomic.h and
>>>>>> asm-arm/arm64/atomic.h
>>>>>> to asm-arm/atomic.h.
>>>>>
>>>>> asm-arm/arm*/atomic.h were a copy from Linux. I don't mind if we
>>>>> diverge, however the file xen/arch/arm/README.primitives needs to be
>>>>> update to mention the divergence with Linux.
>>>>>
>>>>> Regards,
>>>>>
>>>>
>>>> Julien,
>>>>
>>>> AFAICT the README.LinuxPrimitives file specifies the Linux kernel
>>>> version from which the arm{32,64}/atomic.h files were imported as well
>>>> as the respective commit in the -Linux kernel- tree. I suppose that
>>>> information needn't be updated.
>>>> Could you be more specific on how I should modify that file?
>>>
>>> To specify which helpers has been taken from Linux in those files.
>>> Until now, it was quite easy to figure out that we took all atomic_*
>>> helpers.
>>>
>>> Regards,
>>
>>
>> Ok, will look into that.
>>
>> I suppose also adding:
>>
>> diff -u linux/arch/arm64/include/asm/atomic.h
>> xen/include/asm-arm/arm64/atomic.h
>> diff -u linux/arch/arm/include/asm/atomic.h
>> xen/include/asm-arm/arm32/atomic.h
>>
>> as it's done for the others helps?
>
> No, the other files are a verbatim copy of the Linux headers. It is 
> not the case here.
>
> Something like:
>
> "Only the following functions were taken from Linux:
>   - ...
>   - ...
>   - ...
> "
>
> Regards,
>

Well, weren't they all taken from Linux?..I just turned some of the 
macros into inline functions and implemented some missing (no 
additional) ones on the X86-side.

Corneliu.
Julien Grall July 14, 2016, 5:24 p.m. UTC | #9
On 14/07/16 17:40, Corneliu ZUZU wrote:
> On 7/14/2016 1:14 PM, Julien Grall wrote:
>>
>>
>> On 14/07/16 11:11, Corneliu ZUZU wrote:
>>> On 7/14/2016 12:26 PM, Julien Grall wrote:
>>>>
>>>>
>>>> On 14/07/16 06:11, Corneliu ZUZU wrote:
>>>>> On 7/13/2016 10:12 PM, Julien Grall wrote:
>>>>>> Hi Corneliu,
>>>>>>
>>>>>> On 13/07/2016 15:18, Corneliu ZUZU wrote:
>>>>>>> Move duplicate macros between asm-arm/arm32/atomic.h and
>>>>>>> asm-arm/arm64/atomic.h
>>>>>>> to asm-arm/atomic.h.
>>>>>>
>>>>>> asm-arm/arm*/atomic.h were a copy from Linux. I don't mind if we
>>>>>> diverge, however the file xen/arch/arm/README.primitives needs to be
>>>>>> update to mention the divergence with Linux.
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>
>>>>> Julien,
>>>>>
>>>>> AFAICT the README.LinuxPrimitives file specifies the Linux kernel
>>>>> version from which the arm{32,64}/atomic.h files were imported as well
>>>>> as the respective commit in the -Linux kernel- tree. I suppose that
>>>>> information needn't be updated.
>>>>> Could you be more specific on how I should modify that file?
>>>>
>>>> To specify which helpers has been taken from Linux in those files.
>>>> Until now, it was quite easy to figure out that we took all atomic_*
>>>> helpers.
>>>>
>>>> Regards,
>>>
>>>
>>> Ok, will look into that.
>>>
>>> I suppose also adding:
>>>
>>> diff -u linux/arch/arm64/include/asm/atomic.h
>>> xen/include/asm-arm/arm64/atomic.h
>>> diff -u linux/arch/arm/include/asm/atomic.h
>>> xen/include/asm-arm/arm32/atomic.h
>>>
>>> as it's done for the others helps?
>>
>> No, the other files are a verbatim copy of the Linux headers. It is
>> not the case here.
>>
>> Something like:
>>
>> "Only the following functions were taken from Linux:
>>   - ...
>>   - ...
>>   - ...
>> "
>>
>> Regards,
>>
>
> Well, weren't they all taken from Linux?..I just turned some of the
> macros into inline functions and implemented some missing (no
> additional) ones on the X86-side.

Yes, but you don't know why you have not taken the rest (the macros are 
not in atomic.h anymore...). The goal of this file is to keep track of 
the difference between Linux and Xen of file taken from the former.

Regards,
diff mbox

Patch

diff --git a/xen/include/asm-arm/arm32/atomic.h b/xen/include/asm-arm/arm32/atomic.h
index 7ec712f..be08ff1 100644
--- a/xen/include/asm-arm/arm32/atomic.h
+++ b/xen/include/asm-arm/arm32/atomic.h
@@ -149,17 +149,6 @@  static inline int __atomic_add_unless(atomic_t *v, int a, int u)
 
 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))
 
-#define atomic_inc(v)		atomic_add(1, v)
-#define atomic_dec(v)		atomic_sub(1, v)
-
-#define atomic_inc_and_test(v)	(atomic_add_return(1, v) == 0)
-#define atomic_dec_and_test(v)	(atomic_sub_return(1, v) == 0)
-#define atomic_inc_return(v)    (atomic_add_return(1, v))
-#define atomic_dec_return(v)    (atomic_sub_return(1, v))
-#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
-
-#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
-
 #endif /* __ARCH_ARM_ARM32_ATOMIC__ */
 /*
  * Local variables:
diff --git a/xen/include/asm-arm/arm64/atomic.h b/xen/include/asm-arm/arm64/atomic.h
index b49219e..80d07bf 100644
--- a/xen/include/asm-arm/arm64/atomic.h
+++ b/xen/include/asm-arm/arm64/atomic.h
@@ -125,17 +125,6 @@  static inline int __atomic_add_unless(atomic_t *v, int a, int u)
 	return c;
 }
 
-#define atomic_inc(v)		atomic_add(1, v)
-#define atomic_dec(v)		atomic_sub(1, v)
-
-#define atomic_inc_and_test(v)	(atomic_add_return(1, v) == 0)
-#define atomic_dec_and_test(v)	(atomic_sub_return(1, v) == 0)
-#define atomic_inc_return(v)    (atomic_add_return(1, v))
-#define atomic_dec_return(v)    (atomic_sub_return(1, v))
-#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
-
-#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
-
 #endif
 /*
  * Local variables:
diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h
index 29ab265..41d1b6c 100644
--- a/xen/include/asm-arm/atomic.h
+++ b/xen/include/asm-arm/atomic.h
@@ -138,6 +138,17 @@  static inline void _atomic_set(atomic_t *v, int i)
 # error "unknown ARM variant"
 #endif
 
+#define atomic_inc(v)       atomic_add(1, v)
+#define atomic_dec(v)       atomic_sub(1, v)
+
+#define atomic_inc_and_test(v)  (atomic_add_return(1, v) == 0)
+#define atomic_dec_and_test(v)  (atomic_sub_return(1, v) == 0)
+#define atomic_inc_return(v)    (atomic_add_return(1, v))
+#define atomic_dec_return(v)    (atomic_sub_return(1, v))
+#define atomic_sub_and_test(i, v) (atomic_sub_return(i, v) == 0)
+
+#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
+
 #endif /* __ARCH_ARM_ATOMIC__ */
 /*
  * Local variables: