netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] lib: Allow for the DIM library to be modular
@ 2024-05-06 17:50 Florian Fainelli
  2024-05-07 13:13 ` Alexander Lobakin
  2024-05-07 23:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 5+ messages in thread
From: Florian Fainelli @ 2024-05-06 17:50 UTC (permalink / raw)
  To: netdev
  Cc: kuba, jgg, leonro, horms, 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>
---
Changes in v2:

- Added MODULE_DESCRIPTION()

 lib/Kconfig      | 2 +-
 lib/dim/Makefile | 4 ++--
 lib/dim/dim.c    | 3 +++
 3 files changed, 6 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..83b65ac74d73 100644
--- a/lib/dim/dim.c
+++ b/lib/dim/dim.c
@@ -82,3 +82,6 @@ bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
 	return true;
 }
 EXPORT_SYMBOL(dim_calc_stats);
+
+MODULE_DESCRIPTION("Dynamic Interrupt Moderation (DIM) library");
+MODULE_LICENSE("Dual BSD/GPL");
-- 
2.34.1


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

* Re: [PATCH net-next v2] lib: Allow for the DIM library to be modular
  2024-05-06 17:50 [PATCH net-next v2] lib: Allow for the DIM library to be modular Florian Fainelli
@ 2024-05-07 13:13 ` Alexander Lobakin
  2024-05-07 17:08   ` Florian Fainelli
  2024-05-07 23:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Lobakin @ 2024-05-07 13:13 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, kuba, jgg, leonro, horms, Andrew Morton, Tal Gilboa,
	open list:LIBRARY CODE

From: Florian Fainelli <florian.fainelli@broadcom.com>
Date: Mon,  6 May 2024 10:50:40 -0700

> 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.

Some bloat-o-meter -c vmlinux.{before,after} would be good to have here.
The library is small, but I personally would like to see it modular.

> 
> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>

Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>

> ---
> Changes in v2:
> 
> - Added MODULE_DESCRIPTION()
> 
>  lib/Kconfig      | 2 +-
>  lib/dim/Makefile | 4 ++--
>  lib/dim/dim.c    | 3 +++
>  3 files changed, 6 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

I guess you renamed it due to that there's already a module named 'dim'?

>  
> -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..83b65ac74d73 100644
> --- a/lib/dim/dim.c
> +++ b/lib/dim/dim.c
> @@ -82,3 +82,6 @@ bool dim_calc_stats(struct dim_sample *start, struct dim_sample *end,
>  	return true;
>  }
>  EXPORT_SYMBOL(dim_calc_stats);
> +
> +MODULE_DESCRIPTION("Dynamic Interrupt Moderation (DIM) library");
> +MODULE_LICENSE("Dual BSD/GPL");

Thanks,
Olek

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

* Re: [PATCH net-next v2] lib: Allow for the DIM library to be modular
  2024-05-07 13:13 ` Alexander Lobakin
@ 2024-05-07 17:08   ` Florian Fainelli
  2024-05-08  9:17     ` Alexander Lobakin
  0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2024-05-07 17:08 UTC (permalink / raw)
  To: Alexander Lobakin
  Cc: netdev, kuba, jgg, leonro, horms, Andrew Morton, Tal Gilboa,
	open list:LIBRARY CODE

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

On 5/7/24 06:13, Alexander Lobakin wrote:
> From: Florian Fainelli <florian.fainelli@broadcom.com>
> Date: Mon,  6 May 2024 10:50:40 -0700
> 
>> 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.
> 
> Some bloat-o-meter -c vmlinux.{before,after} would be good to have here.
> The library is small, but I personally would like to see it modular.

./scripts/bloat-o-meter vmlinux vmlinux.after
add/remove: 1/16 grow/shrink: 0/0 up/down: 8/-1980 (-1972)
Function                                     old     new   delta
e843419@0740_00005048_4014                     -       8      +8
e843419@07b3_000055c6_5944                     8       -      -8
dim_park_on_top                                8       -      -8
dim_park_tired                                16       -     -16
net_dim_get_def_tx_moderation                 24       -     -24
net_dim_get_def_rx_moderation                 24       -     -24
dim_turn                                      52       -     -52
net_dim_get_rx_moderation                     60       -     -60
net_dim_get_tx_moderation                     64       -     -64
tx_profile                                    80       -     -80
rx_profile                                    80       -     -80
dim_on_top                                    84       -     -84
net_dim_step                                 132       -    -132
dim_calc_stats                               172       -    -172
net_dim_stats_compare                        176       -    -176
net_dim                                      464       -    -464
rdma_dim                                     536       -    -536
Total: Before=12668884, After=12666912, chg -0.02%

This is on arm64 FWIW.

> 
>>
>> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
> 
> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
> 
>> ---
>> Changes in v2:
>>
>> - Added MODULE_DESCRIPTION()
>>
>>   lib/Kconfig      | 2 +-
>>   lib/dim/Makefile | 4 ++--
>>   lib/dim/dim.c    | 3 +++
>>   3 files changed, 6 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
> 
> I guess you renamed it due to that there's already a module named 'dim'?

This is required to avoid the follow recursive dependency:

make[4]: Circular lib/dim/dim.o <- lib/dim/dim.o dependency dropped.
-- 
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 v2] lib: Allow for the DIM library to be modular
  2024-05-06 17:50 [PATCH net-next v2] lib: Allow for the DIM library to be modular Florian Fainelli
  2024-05-07 13:13 ` Alexander Lobakin
@ 2024-05-07 23:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-05-07 23:50 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, kuba, jgg, leonro, horms, akpm, talgi, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon,  6 May 2024 10:50:40 -0700 you 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>
> 
> [...]

Here is the summary with links:
  - [net-next,v2] lib: Allow for the DIM library to be modular
    https://git.kernel.org/netdev/net-next/c/0d5044b4e774

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

* Re: [PATCH net-next v2] lib: Allow for the DIM library to be modular
  2024-05-07 17:08   ` Florian Fainelli
@ 2024-05-08  9:17     ` Alexander Lobakin
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Lobakin @ 2024-05-08  9:17 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, kuba, jgg, leonro, horms, Andrew Morton, Tal Gilboa,
	open list:LIBRARY CODE

From: Florian Fainelli <florian.fainelli@broadcom.com>
Date: Tue, 7 May 2024 10:08:19 -0700

> On 5/7/24 06:13, Alexander Lobakin wrote:
>> From: Florian Fainelli <florian.fainelli@broadcom.com>
>> Date: Mon,  6 May 2024 10:50:40 -0700
>>
>>> 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.
>>
>> Some bloat-o-meter -c vmlinux.{before,after} would be good to have here.
>> The library is small, but I personally would like to see it modular.
> 
> ./scripts/bloat-o-meter vmlinux vmlinux.after
> add/remove: 1/16 grow/shrink: 0/0 up/down: 8/-1980 (-1972)
> Function                                     old     new   delta
> e843419@0740_00005048_4014                     -       8      +8
> e843419@07b3_000055c6_5944                     8       -      -8
> dim_park_on_top                                8       -      -8
> dim_park_tired                                16       -     -16
> net_dim_get_def_tx_moderation                 24       -     -24
> net_dim_get_def_rx_moderation                 24       -     -24
> dim_turn                                      52       -     -52
> net_dim_get_rx_moderation                     60       -     -60
> net_dim_get_tx_moderation                     64       -     -64
> tx_profile                                    80       -     -80
> rx_profile                                    80       -     -80
> dim_on_top                                    84       -     -84
> net_dim_step                                 132       -    -132
> dim_calc_stats                               172       -    -172
> net_dim_stats_compare                        176       -    -176
> net_dim                                      464       -    -464
> rdma_dim                                     536       -    -536
> Total: Before=12668884, After=12666912, chg -0.02%
> 
> This is on arm64 FWIW.

-2 Kb sounds reasonable I'd say. This doesn't even require adding new
exports, nice.

> 
>>
>>>
>>> Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
>>
>> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
>>
>>> ---
>>> Changes in v2:
>>>
>>> - Added MODULE_DESCRIPTION()
>>>
>>>   lib/Kconfig      | 2 +-
>>>   lib/dim/Makefile | 4 ++--
>>>   lib/dim/dim.c    | 3 +++
>>>   3 files changed, 6 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
>>
>> I guess you renamed it due to that there's already a module named 'dim'?
> 
> This is required to avoid the follow recursive dependency:
> 
> make[4]: Circular lib/dim/dim.o <- lib/dim/dim.o dependency dropped.

Aaah I see!

Thanks,
Olek

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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-06 17:50 [PATCH net-next v2] lib: Allow for the DIM library to be modular Florian Fainelli
2024-05-07 13:13 ` Alexander Lobakin
2024-05-07 17:08   ` Florian Fainelli
2024-05-08  9:17     ` Alexander Lobakin
2024-05-07 23:50 ` patchwork-bot+netdevbpf

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).