Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

how to use ippcp in linux kernel-mode

huang__zhongqiang
1,717 Views

I only called ippcpGetLibVersion in the kernel-level source file test.c,

/* Some other headers */

#include "ippcp.h"
#include "ippcpdefs.h"

MODULE_DESCRIPTION("ipp sm3 test for crypto module");
MODULE_LICENSE("GPL");

static int __init ipp_sm3_test_init(void)
{ 
    const IppLibraryVersion* lib = ippcpGetLibVersion();
    printk("get ippcp version:\n%s %s %d.%d.%d.%d\n\n", lib->Name, lib->Version, lib->major, lib->minor, lib->majorBuild, lib->build);
    return 0;
}    
    
static void __exit ipp_sm3_test_free(void)
{        
        printk("ipp_sm3_test_free.\n");
}

module_init(ipp_sm3_test_init); 
module_exit(ipp_sm3_test_free);

And in Makefile:

TARGET = test.ko
test-objs := /nonpic/libippcp.a
ccflags-y += $(FLAG) -I$(KERNELDIR)/include -D__KERNEL__ -DMODULE -fno-pic -DEXPORT_SYMTAB -mcmodel=kernel

 

After excuting 'insmod test.ko', the console outputs:

overflow in relocation type 10 val ****
'test' likely not compiled with -mcmodel=kernel

How do I resolve this issue? Can ippcp be used in linux kernel-mode?

 

Some informations:

ippcpGetLibVersion in user mode returns: 
  ippCP AVX (e9) 2019.0.0 (r0x438f167) 2019.0.0.7084067

ippcp version: l_ippcp_2019.0.117
     Compiler: cc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
 Architecture: Linux 3.4.87 x86_64
           OS: CentOS release 6.4 (Final)
          CPU: Intel(R) Xeon(R) CPU E3-1275 V2 @ 3.50GHz

 

----

I installed different versions of ippcp library in two machines. The other machine is Linux algo 3.13.0-32-generic #57-Ubuntu x86_64 GNU/Linux.

  1. If I copied libippcp.a (version 2019.0.117) to the other machine, same error occurs ('likely not compiled with mcmodel=kernel').
  2. But if I copied libippcp.a (version 2018.1.176) from the other machine to this one, it works!!

Now my module can be successfully loaded.

 

0 Kudos
6 Replies
Igor_A_Intel
Employee
1,717 Views

Hi,

please provide all output from the ippcpGetLibVersion() (guess you can run it in the user mode), or please provide: library version, architecture (ia32 or x64), cpu, OS, cctools version, etc.

regards, Igor

0 Kudos
Pavel_B_Intel1
Employee
1,717 Views

Hi,

also please provide part of code where you call the IPP function.

Pavel

0 Kudos
huang__zhongqiang
1,717 Views

Hi Igor, Pavel,

I've added more details to my question.

Maybe I should recompile the ippcp library with mcmodel=kernel, but I didn't see any configuration about mcmodel in the installation process.

0 Kudos
Pavel_B_Intel1
Employee
1,717 Views

Hi,

thanks for information. Please give us some time to investigate the problem. I will return 2-3 weeks late.

Pavel

0 Kudos
Pavel_B_Intel1
Employee
1,717 Views

We found a problem, thank you for the reporting. The problem will be fixed in next release.

Pavel

0 Kudos
Sergey_K_Intel4
Employee
1,717 Views

Hi, Huang,

Thanks you for reporting of the problem. Definitely, wrong tool has been used inside IPP Crypto build procedures. Believe I've fixed that.

I've successfully re-build your sample using updated library. I don't have root rights and our IT guys did the insertion of the "test_kernel" into the Linux kernel. Seems, the module has been inserted. At least "lsmod" reports:

-bash-4.2$ lsmod | grep test
test_kernel             8255  0

Both Open Source and commercial version of IPP Crypto will be updated soon. I'll inform you as soon as update will be available,

Regards, Sergey

0 Kudos
Reply