Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

intercommunications between Linux kernel modules

1,195 views
Skip to first unread message

Cyclonus J

unread,
Oct 6, 2011, 10:00:02 PM10/6/11
to
hi,

I am looking for a way to do an IPC-like communications between two
linux kernel modules, such as mqueue or shared memory. After searching
for a while, I can't find such information available inside existing
linux kernel or online.

So, my question is if this is something discussed before here and gets
rejected or still might be accepted in the mainstream kernel tree?

Thanks,
CJ
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Andi Kleen

unread,
Oct 6, 2011, 10:10:01 PM10/6/11
to
Cyclonus J <cycl...@gmail.com> writes:

> I am looking for a way to do an IPC-like communications between two
> linux kernel modules, such as mqueue or shared memory. After searching
> for a while, I can't find such information available inside existing
> linux kernel or online.
>
> So, my question is if this is something discussed before here and gets
> rejected or still might be accepted in the mainstream kernel tree?

All kernel memory is shared in Linux, so the concept doesn't make sense.

If you want to send messages or communicate inside the kernel there are
lots of different facilities available.

-Andi
--
a...@linux.intel.com -- Speaking for myself only

Cyclonus J

unread,
Oct 6, 2011, 11:10:02 PM10/6/11
to
On Thu, Oct 6, 2011 at 7:04 PM, Andi Kleen <an...@firstfloor.org> wrote:
> Cyclonus J <cycl...@gmail.com> writes:
>
>> I am looking for a way to do an IPC-like communications between two
>> linux kernel modules, such as mqueue or shared memory. After searching
>> for a while, I can't find such information available inside existing
>> linux kernel or online.
>>
>> So, my question is if this is something discussed before here and gets
>> rejected or still might be accepted in the mainstream kernel tree?
>
> All kernel memory is shared in Linux, so the concept doesn't make sense.
>
> If you want to send messages or communicate inside the kernel there are
> lots of different facilities available.

Andi,

That would be great! Could you point me to some facilities that can do
this message passing between kernels?

Thanks,
CJ

da...@lang.hm

unread,
Oct 7, 2011, 12:10:01 AM10/7/11
to
On Thu, 6 Oct 2011, Cyclonus J wrote:

> On Thu, Oct 6, 2011 at 7:04 PM, Andi Kleen <an...@firstfloor.org> wrote:
>> Cyclonus J <cycl...@gmail.com> writes:
>>
>>> I am looking for a way to do an IPC-like communications between two
>>> linux kernel modules, such as mqueue or shared memory. After searching
>>> for a while, I can't find such information available inside existing
>>> linux kernel or online.
>>>
>>> So, my question is if this is something discussed before here and gets
>>> rejected or still might be accepted in the mainstream kernel tree?
>>
>> All kernel memory is shared in Linux, so the concept doesn't make sense.
>>
>> If you want to send messages or communicate inside the kernel there are
>> lots of different facilities available.
>
> Andi,
>
> That would be great! Could you point me to some facilities that can do
> this message passing between kernels?

what you are missing is that there aren't two different kernels. it's one
big process. think multi-threaded programming instead of inter-process
communication. You don't even have well defined threads to work with so
you can't say "I'm in thread 1 and need to communicate with thread 2", you
need to think "I'm in this routine and I need to set a message in a way
that another routine will read it", this can be as simple as just setting
a variable (although you do need to make it the equivalent of 'thread
safe' through appropriate locking or lock-free protection)

David Lang

Cyclonus J

unread,
Oct 7, 2011, 12:20:01 AM10/7/11
to

David,

Yes, it is multi-threaded. I have two kernel modules and each of them will
create its own kernel thread just for communication purpose (message passing).

Do you know if there is any message primitves I can use to achieve this inside
kernel?

Thanks,
CJ

Christoph Lameter

unread,
Oct 7, 2011, 1:50:02 PM10/7/11
to
On Thu, 6 Oct 2011, Cyclonus J wrote:

> Yes, it is multi-threaded. I have two kernel modules and each of them will
> create its own kernel thread just for communication purpose (message passing).
>
> Do you know if there is any message primitves I can use to achieve this inside
> kernel?

F.e. Use the lockless lists in linux/include/llist.h?

Anything else will work too. Just declare a variable and access it from
both threads.
0 new messages