All of lore.kernel.org
 help / color / mirror / Atom feed
* In which library can I find these functions ?
@ 2013-01-29 15:59 Sébastien Frémal
  2013-01-30 21:30 ` Konrad Rzeszutek Wilk
  2013-01-31 13:41 ` Olaf Hering
  0 siblings, 2 replies; 5+ messages in thread
From: Sébastien Frémal @ 2013-01-29 15:59 UTC (permalink / raw)
  To: xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 1967 bytes --]

Hi,

I'm trying to build a module to implement a shared memory mechanism between
the dom0 and domU's.

To do so, I'm investigating the grant table mechanisms. I have wrote that
code (which is supposed to be the dom0-side of a module creating and
sharing 1 page) :

#undef __KERNEL__
#define __KERNEL__

#undef MODULE
#define MODULE

#include <xen/page.h>
#include <xen/grant_table.h>
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

unsigned long myPage;

static int __init hello_init(void){
//      int domB = atoi(argv[1]);
        printk(KERN_INFO "Test sur le partage de mémoire dans Xen \n");

        if((myPage = get_zeroed_page(GFP_KERNEL))==0)
                printk(KERN_INFO "Zeroed page\n");

        grant_ref_t gref;
        gref = gnttab_grant_foreign_access(1, virt_to_mfn(myPage), 0);

        if(gref < 0){
                printk(KERN_INFO "Grant failed\n");
                free_page(myPage);
        }
        return 0;
}

static void __exit hello_exit(void){
        free_page(myPage);
        printk(KERN_INFO "Cleaning module.\n");
}

module_init(hello_init);
module_exit(hello_exit);

The code is compiling, but when I try to launch the insert the module, I
get error messages :

[95265.790842] shmxen: Unknown symbol gnttab_grant_foreign_access (err 0)
[95265.790855] shmxen: Unknown symbol xen_features (err 0)
[95265.790865] shmxen: Unknown symbol get_phys_to_machine (err 0)

I'm searching for libraries to link with the module so it can use these
functions but I can't find those. Can you please help me ? I searched in
project like Xen VMSocket to look after their way of dealing the problem,
but the Makefile doesn't point out directories containing the included
headers or libraries having implemented functions (I don't understand how
it's suppose to compile).

I thank you for your help.

Best regards,

Fremal S.

[-- Attachment #1.2: Type: text/html, Size: 2851 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: In which library can I find these functions ?
  2013-01-29 15:59 In which library can I find these functions ? Sébastien Frémal
@ 2013-01-30 21:30 ` Konrad Rzeszutek Wilk
  2013-01-31 12:53   ` Sébastien Frémal
  2013-01-31 13:41 ` Olaf Hering
  1 sibling, 1 reply; 5+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-01-30 21:30 UTC (permalink / raw)
  To: Sébastien Frémal; +Cc: xen-devel

On Tue, Jan 29, 2013 at 04:59:39PM +0100, Sébastien Frémal wrote:
> Hi,
> 
> I'm trying to build a module to implement a shared memory mechanism between
> the dom0 and domU's.
> 
> To do so, I'm investigating the grant table mechanisms. I have wrote that
> code (which is supposed to be the dom0-side of a module creating and
> sharing 1 page) :
> 
> #undef __KERNEL__
> #define __KERNEL__
> 
> #undef MODULE
> #define MODULE
> 
> #include <xen/page.h>
> #include <xen/grant_table.h>
> #include <linux/gfp.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/init.h>
> 
> unsigned long myPage;
> 
> static int __init hello_init(void){
> //      int domB = atoi(argv[1]);
>         printk(KERN_INFO "Test sur le partage de mémoire dans Xen \n");
> 
>         if((myPage = get_zeroed_page(GFP_KERNEL))==0)
>                 printk(KERN_INFO "Zeroed page\n");
> 
>         grant_ref_t gref;
>         gref = gnttab_grant_foreign_access(1, virt_to_mfn(myPage), 0);
> 
>         if(gref < 0){
>                 printk(KERN_INFO "Grant failed\n");
>                 free_page(myPage);
>         }
>         return 0;
> }
> 
> static void __exit hello_exit(void){
>         free_page(myPage);
>         printk(KERN_INFO "Cleaning module.\n");
> }
> 
> module_init(hello_init);
> module_exit(hello_exit);
> 
> The code is compiling, but when I try to launch the insert the module, I
> get error messages :
> 
> [95265.790842] shmxen: Unknown symbol gnttab_grant_foreign_access (err 0)
> [95265.790855] shmxen: Unknown symbol xen_features (err 0)
> [95265.790865] shmxen: Unknown symbol get_phys_to_machine (err 0)
> 
> I'm searching for libraries to link with the module so it can use these
> functions but I can't find those. Can you please help me ? I searched in
> project like Xen VMSocket to look after their way of dealing the problem,
> but the Makefile doesn't point out directories containing the included
> headers or libraries having implemented functions (I don't understand how
> it's suppose to compile).

cscope is quite good at finding these things. You just need
xen/grant_table.h and xen/xen.h
> 
> I thank you for your help.
> 
> Best regards,
> 
> Fremal S.

> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: In which library can I find these functions ?
  2013-01-30 21:30 ` Konrad Rzeszutek Wilk
@ 2013-01-31 12:53   ` Sébastien Frémal
  0 siblings, 0 replies; 5+ messages in thread
From: Sébastien Frémal @ 2013-01-31 12:53 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 3433 bytes --]

Thank you for your answer, I tried it but it doesn't solve my problem.
Maybe I'm wrong, but i think headers are useful to include function
prototypes (i. e. gnttab_grant_foreign_access or virt_to_mfn) but it
doesn't include the code of these functions. So, when the module is
launched, the system doesn't know what to do with the symbols
gnttab_grant_foreign_access,
xen_features and get_phys_to_machine because implementations of these
functions are not linked with the module.

That's why I'm searching for the library including these implementations. I
have to link them with the module so it's stop failing when launched.

Best regards,

Sebastien

*U*MONS
*
**Ir Doctorant S. Frémal
**Université de Mons
*Service d'Informatique
Rue de Houdain,  n°9
7000 Mons
+32(0)65/37.40.51

www.umons.ac.be


2013/1/30 Konrad Rzeszutek Wilk <konrad@kernel.org>

> On Tue, Jan 29, 2013 at 04:59:39PM +0100, Sébastien Frémal wrote:
> > Hi,
> >
> > I'm trying to build a module to implement a shared memory mechanism
> between
> > the dom0 and domU's.
> >
> > To do so, I'm investigating the grant table mechanisms. I have wrote that
> > code (which is supposed to be the dom0-side of a module creating and
> > sharing 1 page) :
> >
> > #undef __KERNEL__
> > #define __KERNEL__
> >
> > #undef MODULE
> > #define MODULE
> >
> > #include <xen/page.h>
> > #include <xen/grant_table.h>
> > #include <linux/gfp.h>
> > #include <linux/module.h>
> > #include <linux/kernel.h>
> > #include <linux/init.h>
> >
> > unsigned long myPage;
> >
> > static int __init hello_init(void){
> > //      int domB = atoi(argv[1]);
> >         printk(KERN_INFO "Test sur le partage de mémoire dans Xen \n");
> >
> >         if((myPage = get_zeroed_page(GFP_KERNEL))==0)
> >                 printk(KERN_INFO "Zeroed page\n");
> >
> >         grant_ref_t gref;
> >         gref = gnttab_grant_foreign_access(1, virt_to_mfn(myPage), 0);
> >
> >         if(gref < 0){
> >                 printk(KERN_INFO "Grant failed\n");
> >                 free_page(myPage);
> >         }
> >         return 0;
> > }
> >
> > static void __exit hello_exit(void){
> >         free_page(myPage);
> >         printk(KERN_INFO "Cleaning module.\n");
> > }
> >
> > module_init(hello_init);
> > module_exit(hello_exit);
> >
> > The code is compiling, but when I try to launch the insert the module, I
> > get error messages :
> >
> > [95265.790842] shmxen: Unknown symbol gnttab_grant_foreign_access (err 0)
> > [95265.790855] shmxen: Unknown symbol xen_features (err 0)
> > [95265.790865] shmxen: Unknown symbol get_phys_to_machine (err 0)
> >
> > I'm searching for libraries to link with the module so it can use these
> > functions but I can't find those. Can you please help me ? I searched in
> > project like Xen VMSocket to look after their way of dealing the problem,
> > but the Makefile doesn't point out directories containing the included
> > headers or libraries having implemented functions (I don't understand how
> > it's suppose to compile).
>
> cscope is quite good at finding these things. You just need
> xen/grant_table.h and xen/xen.h
> >
> > I thank you for your help.
> >
> > Best regards,
> >
> > Fremal S.
>
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xen.org
> > http://lists.xen.org/xen-devel
>
>

[-- Attachment #1.2: Type: text/html, Size: 5984 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: In which library can I find these functions ?
  2013-01-29 15:59 In which library can I find these functions ? Sébastien Frémal
  2013-01-30 21:30 ` Konrad Rzeszutek Wilk
@ 2013-01-31 13:41 ` Olaf Hering
  2013-01-31 14:13   ` Sébastien Frémal
  1 sibling, 1 reply; 5+ messages in thread
From: Olaf Hering @ 2013-01-31 13:41 UTC (permalink / raw)
  To: Sébastien Frémal; +Cc: xen-devel

On Tue, Jan 29, Sébastien Frémal wrote:

> The code is compiling, but when I try to launch the insert the module, I get
> error messages :
> 
> [95265.790842] shmxen: Unknown symbol gnttab_grant_foreign_access (err 0)
> [95265.790855] shmxen: Unknown symbol xen_features (err 0)
> [95265.790865] shmxen: Unknown symbol get_phys_to_machine (err 0)
>                                             
> I'm searching for libraries to link with the module so it can use these

drivers/xen/grant-table.c:EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access);
drivers/xen/features.c:EXPORT_SYMBOL_GPL(xen_features);
arch/x86/xen/p2m.c:EXPORT_SYMBOL_GPL(get_phys_to_machine);

The posted code is not marked as GPL, so the module linking code will
not consider the required functions.

Olaf

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: In which library can I find these functions ?
  2013-01-31 13:41 ` Olaf Hering
@ 2013-01-31 14:13   ` Sébastien Frémal
  0 siblings, 0 replies; 5+ messages in thread
From: Sébastien Frémal @ 2013-01-31 14:13 UTC (permalink / raw)
  To: Olaf Hering, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 2094 bytes --]

Thank you, it works !! I didn't knew this functionnality.

I attach the working code for example in case of somebody have the same
issue.

#undef __KERNEL__
#define __KERNEL__

#undef MODULE
#define MODULE

#include <xen/page.h>
#include <xen/grant_table.h>
#include <linux/gfp.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>

MODULE_LICENSE("GPL");

unsigned long myPage;

static int __init hello_init(void){
//      int domB = atoi(argv[1]);
        printk(KERN_INFO "Test sur le partage de mémoire dans Xen \n");

        if((myPage = get_zeroed_page(GFP_KERNEL))==0)
                printk(KERN_INFO "Zeroed page\n");

        grant_ref_t gref;
        gref = gnttab_grant_foreign_access(1, virt_to_mfn(myPage), 0);

        if(gref < 0){
                printk(KERN_INFO "Grant failed\n");
                free_page(myPage);
        }
        return 0;
}

static void __exit hello_exit(void){
        free_page(myPage);
        printk(KERN_INFO "Cleaning module.\n");
}

module_init(hello_init);
module_exit(hello_exit);


*U*MONS
*
**Ir Doctorant S. Frémal
**Université de Mons
*Service d'Informatique
Rue de Houdain,  n°9
7000 Mons
+32(0)65/37.40.51

www.umons.ac.be


2013/1/31 Olaf Hering <olaf@aepfle.de>

> On Tue, Jan 29, Sébastien Frémal wrote:
>
> > The code is compiling, but when I try to launch the insert the module, I
> get
> > error messages :
> >
> > [95265.790842] shmxen: Unknown symbol gnttab_grant_foreign_access (err 0)
> > [95265.790855] shmxen: Unknown symbol xen_features (err 0)
> > [95265.790865] shmxen: Unknown symbol get_phys_to_machine (err 0)
> >
> > I'm searching for libraries to link with the module so it can use these
>
> drivers/xen/grant-table.c:EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access);
> drivers/xen/features.c:EXPORT_SYMBOL_GPL(xen_features);
> arch/x86/xen/p2m.c:EXPORT_SYMBOL_GPL(get_phys_to_machine);
>
> The posted code is not marked as GPL, so the module linking code will
> not consider the required functions.
>
> Olaf
>

[-- Attachment #1.2: Type: text/html, Size: 6184 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-31 14:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-29 15:59 In which library can I find these functions ? Sébastien Frémal
2013-01-30 21:30 ` Konrad Rzeszutek Wilk
2013-01-31 12:53   ` Sébastien Frémal
2013-01-31 13:41 ` Olaf Hering
2013-01-31 14:13   ` Sébastien Frémal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.