Software Archive
Read-only legacy content
17061 Discussions

Kernel Mode SCIF

Wendy__C_
Beginner
428 Views

I can not figure this out from the tutorial. Hopefully folks can give me a hand ... So I have a set of client code resides inside MIC, and a set of server code lives in Xeon host - both allocate a piece of memory (kmalloc), described by a structure "mic_mem" as the following:

struct mic_mem {

void *base;    /* address returned from kmalloc */

off_t offset;

};

struct mic_mem lmem, rmem;

lmem.offset = scif_register(epd, lmem.base, 2*PAGE_SIZE, 0,
                        SCIF_PROT_READ|SCIF_PROT_WRITE,
                        SCIF_MAP_KERNEL);

/*

* then I use a pair of plain scif_send/scif_recv to exchange contents of mic_mem structure

 * local mem in lmem, and remote mem in rmem w/ peer ...

* ... so far so good ..

*/

...

ret = scif_writeto(epd, lmem.offset+PAGE_SIZE, PAGE_SIZE, rmem.offset,,
                                        SCIF_RMA_ORDERED);

/* I'm thinking to write to the bottom page of my local buffer to the remote upper page

* unfortunately, I always get "-6" back from scif_writeto.

* /

I must mis-understand the programming model. Could someone explain exactly what the "offset" implies here ?

Thanks,

Wendy

 

 

 

0 Kudos
2 Replies
Frances_R_Intel
Employee
428 Views

I don't see why this shouldn't work - assuming there were no other errors along the way. If you use:

ret = scif_writeto(epd, lmem.offset, 2*PAGE_SIZE, rmem.offset, SCIF_RMA_ORDERED);

does that write succeed? So it is only the offset addition that is messing up? (By the way, there is an extra comma in your scif_writeto statement. I'm assuming that was just a transcription error.)

0 Kudos
Wendy__C_
Beginner
428 Views

Thanks for the response. I've found the problem ... I used an “int” to store the return code from scif_register() before storing it to a permanent “off_t” field. The value got truncated to “0” and subsequently passed to scif_writeto().

 

 

 

0 Kudos
Reply