All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] lib: Allow for the DIM library to be modular
@ 2024-05-03  0:25 Florian Fainelli
  2024-05-03  0:58 ` Jakub Kicinski
  2024-05-04 20:16 ` Simon Horman
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Fainelli @ 2024-05-03  0:25 UTC (permalink / raw
  To: netdev
  Cc: kuba, jgg, leonro, Florian Fainelli, Andrew Morton, Tal Gilboa,
	open list:LIBRARY CODE

Allow the Dynamic Interrupt Moderation (DIM) library to be built as a
module. This is particularly useful in an Android GKI (Google Kernel
Image) configuration where everything is built as a module, including
Ethernet controller drivers. Having to build DIMLIB into the kernel
image with potentially no user is wasteful.

Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 lib/Kconfig      | 2 +-
 lib/dim/Makefile | 4 ++--
 lib/dim/dim.c    | 2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index 4557bb8a5256..d33a268bc256 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -628,7 +628,7 @@ config SIGNATURE
 	  Implementation is done using GnuPG MPI library
 
 config DIMLIB
-	bool
+	tristate
 	help
 	  Dynamic Interrupt Moderation library.
 	  Implements an algorithm for dynamically changing CQ moderation values
diff --git a/lib/dim/Makefile b/lib/dim/Makefile
index 1d6858a108cb..c4cc4026c451 100644
--- a/lib/dim/Makefile
+++ b/lib/dim/Makefile
@@ -2,6 +2,6 @@
 # DIM Dynamic Interrupt Moderation library
 #
 
-obj-$(CONFIG_DIMLIB) += dim.o
+obj-$(CONFIG_DIMLIB) += dimlib.o
 
-dim-y := dim.o net_dim.o rdma_dim.o
+dimlib-objs := dim.o net_dim.o rdma_dim.o
diff --git a/lib/dim/dim.c b/lib/dim/dim.c
index e89aaf07bde5..c50e5b4dc46e 100644
--- a/lib/dim/dim.c
+++ b/lib/dim/dim.c
@@ -82,3 +82,5 @@ bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
 	return true;
 }
 EXPORT_SYMBOL(dim_calc_stats);
+
+MODULE_LICENSE("Dual BSD/GPL");
-- 
2.34.1


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

* Re: [PATCH net-next] lib: Allow for the DIM library to be modular
  2024-05-03  0:25 [PATCH net-next] lib: Allow for the DIM library to be modular Florian Fainelli
@ 2024-05-03  0:58 ` Jakub Kicinski
  2024-05-03  3:19   ` Florian Fainelli
  2024-05-04 20:16 ` Simon Horman
  1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2024-05-03  0:58 UTC (permalink / raw
  To: Florian Fainelli
  Cc: netdev, jgg, leonro, Andrew Morton, Tal Gilboa,
	open list:LIBRARY CODE

On Thu,  2 May 2024 17:25:40 -0700 Florian Fainelli wrote:
> Allow the Dynamic Interrupt Moderation (DIM) library to be built as a
> module. This is particularly useful in an Android GKI (Google Kernel
> Image) configuration where everything is built as a module, including
> Ethernet controller drivers. Having to build DIMLIB into the kernel
> image with potentially no user is wasteful.

How big is it? Folks from Alibaba are trying to add the ability to
change the profiles, they'd need to change the calling conventions.
Which is not terrible, but also why make them suffer if the gain
isn't big..

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

* Re: [PATCH net-next] lib: Allow for the DIM library to be modular
  2024-05-03  0:58 ` Jakub Kicinski
@ 2024-05-03  3:19   ` Florian Fainelli
  2024-05-03 21:36     ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2024-05-03  3:19 UTC (permalink / raw
  To: Jakub Kicinski, Heng Qi
  Cc: netdev, jgg, leonro, Andrew Morton, Tal Gilboa,
	open list:LIBRARY CODE

[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]

+CC Heng,

On 5/2/2024 5:58 PM, Jakub Kicinski wrote:
> On Thu,  2 May 2024 17:25:40 -0700 Florian Fainelli wrote:
>> Allow the Dynamic Interrupt Moderation (DIM) library to be built as a
>> module. This is particularly useful in an Android GKI (Google Kernel
>> Image) configuration where everything is built as a module, including
>> Ethernet controller drivers. Having to build DIMLIB into the kernel
>> image with potentially no user is wasteful.
> 
> How big is it? Folks from Alibaba are trying to add the ability to
> change the profiles, they'd need to change the calling conventions.
> Which is not terrible, but also why make them suffer if the gain
> isn't big..

It is not too big (16KB as a module), however the issue is more 
logistical than the overall size of the kernel image (although that 
might be a concern, too).

The GKI default configuration would have to enable CONFIG_DIMLIB=y 
regardless of whether a driver makes use of it. They would not enable 
any hardware specific modules (e.g.: CONFIG_BCMGENET=m, CONFIG_STMMAC=m) 
in their configuration that is not common to a large number of 
platforms. So the result is that you end up with code being built-in 
that is potentially not used, and you may not have visibility into its 
usage because the model makes it that SoC vendors can built their 
modules against the GKI configuration. Arguably we can solve that within 
our "overlay" at the source level, but I would rather maintain as fewer 
patches as possible and it does not take away anything IMHO.

Looking at "[PATCH net-next v11 0/4] ethtool: provide the dim profile 
fine-tuning channel" it seems like Heng took care of making all of the 
newly added functions EXPORT_SYMBOL(). The only thing I see missing is a 
"select DIMLIB" from config ETHTOOL_NETLINK, do you see something else?
-- 
Florian

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

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

* Re: [PATCH net-next] lib: Allow for the DIM library to be modular
  2024-05-03  3:19   ` Florian Fainelli
@ 2024-05-03 21:36     ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2024-05-03 21:36 UTC (permalink / raw
  To: Florian Fainelli
  Cc: Heng Qi, netdev, jgg, leonro, Andrew Morton, Tal Gilboa,
	open list:LIBRARY CODE

On Thu, 2 May 2024 20:19:27 -0700 Florian Fainelli wrote:
> Looking at "[PATCH net-next v11 0/4] ethtool: provide the dim profile 
> fine-tuning channel" it seems like Heng took care of making all of the 
> newly added functions EXPORT_SYMBOL(). The only thing I see missing is a 
> "select DIMLIB" from config ETHTOOL_NETLINK, do you see something else?

I think we refer to the default DIM tables from net/core/ to clone
them at init time. But we can move the init function into DIM itself.
That's probably for the better.

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

* Re: [PATCH net-next] lib: Allow for the DIM library to be modular
  2024-05-03  0:25 [PATCH net-next] lib: Allow for the DIM library to be modular Florian Fainelli
  2024-05-03  0:58 ` Jakub Kicinski
@ 2024-05-04 20:16 ` Simon Horman
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Horman @ 2024-05-04 20:16 UTC (permalink / raw
  To: Florian Fainelli
  Cc: netdev, kuba, jgg, leonro, Andrew Morton, Tal Gilboa,
	open list:LIBRARY CODE

On Thu, May 02, 2024 at 05:25:40PM -0700, Florian Fainelli wrote:
> Allow the Dynamic Interrupt Moderation (DIM) library to be built as a
> module. This is particularly useful in an Android GKI (Google Kernel
> Image) configuration where everything is built as a module, including
> Ethernet controller drivers. Having to build DIMLIB into the kernel
> image with potentially no user is wasteful.
> 
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> ---
>  lib/Kconfig      | 2 +-
>  lib/dim/Makefile | 4 ++--
>  lib/dim/dim.c    | 2 ++
>  3 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/Kconfig b/lib/Kconfig
> index 4557bb8a5256..d33a268bc256 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -628,7 +628,7 @@ config SIGNATURE
>  	  Implementation is done using GnuPG MPI library
>  
>  config DIMLIB
> -	bool
> +	tristate
>  	help
>  	  Dynamic Interrupt Moderation library.
>  	  Implements an algorithm for dynamically changing CQ moderation values
> diff --git a/lib/dim/Makefile b/lib/dim/Makefile
> index 1d6858a108cb..c4cc4026c451 100644
> --- a/lib/dim/Makefile
> +++ b/lib/dim/Makefile
> @@ -2,6 +2,6 @@
>  # DIM Dynamic Interrupt Moderation library
>  #
>  
> -obj-$(CONFIG_DIMLIB) += dim.o
> +obj-$(CONFIG_DIMLIB) += dimlib.o
>  
> -dim-y := dim.o net_dim.o rdma_dim.o
> +dimlib-objs := dim.o net_dim.o rdma_dim.o
> diff --git a/lib/dim/dim.c b/lib/dim/dim.c
> index e89aaf07bde5..c50e5b4dc46e 100644
> --- a/lib/dim/dim.c
> +++ b/lib/dim/dim.c
> @@ -82,3 +82,5 @@ bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
>  	return true;
>  }
>  EXPORT_SYMBOL(dim_calc_stats);
> +
> +MODULE_LICENSE("Dual BSD/GPL");

nit: If we follow this route then MODULE_DESCRIPTION should be added too,
     right?

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

end of thread, other threads:[~2024-05-04 20:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03  0:25 [PATCH net-next] lib: Allow for the DIM library to be modular Florian Fainelli
2024-05-03  0:58 ` Jakub Kicinski
2024-05-03  3:19   ` Florian Fainelli
2024-05-03 21:36     ` Jakub Kicinski
2024-05-04 20:16 ` Simon Horman

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.