Juniper / contrail-vrouter

Contrail Virtual Router
BSD 2-Clause "Simplified" License
217 stars 169 forks source link

Porting vrouter.ko to powerPC platform #83

Open Dineshkumarparameswaran opened 9 years ago

Dineshkumarparameswaran commented 9 years ago

I am porting vrouter-agent to powerpc platform.While compiling the kernel module i am getting following warnings. While inserting the kernel module it throws the same error.

WARNING: "sync_fetch_and_add_8" undefined WARNING: "sync_sub_and_fetch_8" undefined

Can anyone please comment on this

pedro-r-marques commented 9 years ago

Dinesh, The dev mailing list (http://lists.opencontrail.org/mailman/listinfo/dev_lists.opencontrail.org) would be a better way to get help... if i recall correctly _sync_fetch_and_add are symbols for atomic instructions on x86. You will have to search for the equivalents in the architecture you are using.

srajag commented 9 years ago

From https://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Atomic-Builtins.html

"Not all operations are supported by all target processors. If a particular operation cannot be implemented on the target processor, a warning will be generated and a call an external function will be generated. The external function will carry the same name as the builtin, with an additional suffix `_n' where n is the size of the data type."

Looks like ppc is not supported by gcc for these atomic builtins.

VigneshwaranRM commented 9 years ago

Hi,

Where the definition of these two files, __sync_fetch_and_add and __sync_sub_and_fetch.. It is not present with the contrail-agent source code. If so it will in the kernel source code ??

srajag commented 9 years ago

Those are compiler built-ins i.e. gcc implements them.

VigneshwaranRM commented 9 years ago

So, we will not have any definition for this functions ??

srajag commented 9 years ago

yes

VigneshwaranRM commented 9 years ago

What I thought was, to see the definition of the function and change accordingly to support ppc.. If that is not possible, what could be the solution??

I saw in a forum like, by replacing syncfetch to atomic_ will solve this problem, will this work ??

or any other solution you know ?? If so please help

srajag commented 9 years ago

You can add an ifdef for PPC and add equivalent code.

VigneshwaranRM commented 9 years ago

ok let me try. thanks