On Wed, Sep 10, 2014 at 3:58 PM, Andy Zhou <az...@nicira.com> wrote:
> Current autoconfig detection logic for HAVE_PER_CPU_PTR is not robust.
> Depends on linux kernel version, the definition can be in either
> linux/percpu.h or asm/percpu.h
>
I could not find kernel with this_cpu_ptr () definition in
linux/percpu.h, is it distribution kernel?

> Turns out it is simpler and safer to handle missing percpu.h
> definitions in linux/percpu.h rather than asm/percpu.h. With this
> change, there is no need for the autoconfig detection logic above.
>
> Signed-off-by: Andy Zhou <az...@nicira.com>
> ---
>  acinclude.m4                                 |  2 --
>  datapath/linux/Modules.mk                    |  1 -
>  datapath/linux/compat/include/asm/percpu.h   | 10 ----------
>  datapath/linux/compat/include/linux/percpu.h |  4 ++++
>  4 files changed, 4 insertions(+), 13 deletions(-)
>  delete mode 100644 datapath/linux/compat/include/asm/percpu.h
>
> diff --git a/acinclude.m4 b/acinclude.m4
> index b0794d2..ae0f8d8 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -359,8 +359,6 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [
>    OVS_GREP_IFELSE([$KSRC/include/linux/if_vlan.h], [ADD_ALL_VLANS_CMD],
>                    [OVS_DEFINE([HAVE_VLAN_BUG_WORKAROUND])])
>
> -  OVS_GREP_IFELSE([$KSRC/include/linux/percpu.h], [this_cpu_ptr])
> -
>    OVS_GREP_IFELSE([$KSRC/include/linux/u64_stats_sync.h], 
> [u64_stats_fetch_begin_irq])
>
>    OVS_GREP_IFELSE([$KSRC/include/linux/openvswitch.h], 
> [openvswitch_handle_frame_hook],
> diff --git a/datapath/linux/Modules.mk b/datapath/linux/Modules.mk
> index 00922ed..f7c64e2 100644
> --- a/datapath/linux/Modules.mk
> +++ b/datapath/linux/Modules.mk
> @@ -18,7 +18,6 @@ openvswitch_sources += \
>  openvswitch_headers += \
>         linux/compat/gso.h \
>         linux/compat/include/asm/hash.h \
> -       linux/compat/include/asm/percpu.h \
>         linux/compat/include/linux/percpu.h \
>         linux/compat/include/linux/bug.h \
>         linux/compat/include/linux/compiler.h \
> diff --git a/datapath/linux/compat/include/asm/percpu.h 
> b/datapath/linux/compat/include/asm/percpu.h
> deleted file mode 100644
> index 65bce08..0000000
> --- a/datapath/linux/compat/include/asm/percpu.h
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -#ifndef __ASM_PERCPU_WRAPPER_H
> -#define __ASM_PERCPU_WRAPPER_H 1
> -
> -#include_next <asm/percpu.h>
> -
> -#if !defined this_cpu_ptr && !defined HAVE_THIS_CPU_PTR
> -#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
> -#endif
> -
> -#endif
> diff --git a/datapath/linux/compat/include/linux/percpu.h 
> b/datapath/linux/compat/include/linux/percpu.h
> index 9bd6801..e0941f7 100644
> --- a/datapath/linux/compat/include/linux/percpu.h
> +++ b/datapath/linux/compat/include/linux/percpu.h
> @@ -3,6 +3,10 @@
>
>  #include_next <linux/percpu.h>
>
> +#if !defined this_cpu_ptr
> +#define this_cpu_ptr(ptr) per_cpu_ptr(ptr, smp_processor_id())
> +#endif
> +
>  #if !defined this_cpu_read
>  #define this_cpu_read(ptr) percpu_read(ptr)
>  #endif
> --
> 1.9.1
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to