kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Tomek The Messenger <tomekthemessenger@gmail.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: the cost of EXPORT_SYMBOL_GPL
Date: Tue, 16 Jun 2020 15:27:14 +0200	[thread overview]
Message-ID: <20200616132714.GA4019625@kroah.com> (raw)
In-Reply-To: <CAA4NGytH45vE3DgGuqxFDmROcnZEwAQPMMCvkJCh8mRURp7eCg@mail.gmail.com>

On Tue, Jun 16, 2020 at 03:18:02PM +0200, Tomek The Messenger wrote:
> Hi
> I am in the middle of implementation of various external kernel modules.
> All kernel modules touch some board specific registers. For example let's
> say we have 3 groups of register areas:
> #define REG1_ADDR (0xFDEA7000)
> #define REG1 _SIZE (0x3C0)
> #define REG2_ADDR (0xFDEC4000)
> #define REG2 _SIZE (0xFF8)
> #define REG3_ADDR (0xFDEA6000)
> #define REG3_SIZE (0x80)
> And let's say we have 5 kernel modules:
> A
> B
> C
> D
> E
> 
> Kernel module A touches only one 32-bit register X from REG1 space and a
> lot of registers from REG2 space.
> Kernel modules B,C,D touches various registers from REG1 and REG2 space but
> not this one which kernel module A touches.
> Kernel module E is the only one who touches registers from REG3 space. No
> other kernel module touches REG3 space.
> 
> If I would implement the code in C++ in user space I would create dynamic
> library for access to REG1,REG2,REG3 register space. Each 32-bit register
> would have his own separate function to read,write to register. And then
> each user space process A-E would be linked against this library during
> compilation.
> When programming in kernel I don't know what I should do.
> Should I implement 6th external kernel module which implements all
> operations on access to registers REG1,REG2,REG3??? There will be a lot of
> EXPORT_SYMBOL_GPL. Or maybe this approach is NOK, I mean it is good but I
> should only place in 6th helper kernel module functions which are used by
> more than one kernel module. So for example functions for getting access to
> REG3 address space or reg X from REG1 space should be not there. They
> should be only in kernel module code A/E. Currently this is code which I
> implemented. In 6th helper kernel module there are only registers which are
> used by more than one kernel module. But I am not sure if it is good
> approach. Maybe there should be there all registers access?
> 
> Could anybody help how to organize code here.

Why is this so many different modules?  Why not just make it one?

thanks,

greg k-h

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2020-06-16 13:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 13:18 the cost of EXPORT_SYMBOL_GPL Tomek The Messenger
2020-06-16 13:27 ` Greg KH [this message]
2020-06-17  7:58   ` Tomek The Messenger
2020-06-17  8:55     ` Greg KH
2020-06-17  9:17       ` Tomek The Messenger
2020-06-17  9:28         ` Tomek The Messenger
2020-06-17  9:41         ` Greg KH
2020-06-17 10:39           ` Tomek The Messenger
2020-06-17 12:24             ` Valdis Klētnieks
2020-06-17 12:31               ` Greg KH
2020-06-17 12:35           ` Martin Kaiser
2020-06-17 12:48             ` Tomek The Messenger
2020-06-17 13:20               ` Valdis Klētnieks
2020-06-17 13:34               ` Ahmad Fatoum
2020-06-17 14:26                 ` Tomek The Messenger
2020-06-17 15:08                   ` Greg KH
2020-06-17 18:33                   ` Valdis Klētnieks
2020-06-17 13:31             ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200616132714.GA4019625@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=tomekthemessenger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).