Dear All,
I am trying to implement prefetching using machine learning in the kernel. I need some data from the kernel directly. In this regard I have got very useful comment that 

> Don't do that (directly).  Pass the data to userspace via netlink or debugfs or shared
memory or other means, and have userspace handle it.  

      I am trying to pass data to the kernel space using netlink. Following this link, I have developed kernel space, and user space programs.  Kernel and user space programs working perfectly when I load and run these modules from the terminal using “sudo insmod kernelmodule.ko”, and “./userspaceApp” respectively.  But, when I try to use kernel program  (directly as a header file #include "kernelmodule.h") with the kernel original file that is “vmx.c” then it returns “NULL” while creating socket (nl_sk = NULL in nl_sk = netlink_kernel_create(&init_net, NETLINK_USER, &cfg);) .  I call  user defined function, i.e., create_socket(unsigned long int addr) of kernelmodule.h from handle_ept_voilation() in vmx.c. handle_ept_voilation()  is called when ept fault occurs in case of virtual machine.
Furthermore,  I have observed one weird behaviour: if I put 1-3 seconds sleep just before the socket creating statement , then it works just during booting of my virtual machine, after successful boot I get the same socket NULL error. 
Thank you for your help.
  


--
Best Regards,


Mr. Irfan Ullah
PhD Candidate
Data and Knowledge Engineering(DKE) Lab
Department of Computer Science and Engineering
Kyung Hee University, South Korea.
 sahibzada_irfanullah