ARM: multi_v7_defconfig: make USB_DWC3 as a module instead of built-in

Message ID 20230404084259.13752-1-rogerq@kernel.org
State New
Headers
Series ARM: multi_v7_defconfig: make USB_DWC3 as a module instead of built-in |

Commit Message

Roger Quadros April 4, 2023, 8:42 a.m. UTC
  USB_DWC3 is not required for boot on most platforms make it
as a module instead of built-in.

Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
 arch/arm/configs/multi_v7_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Arnd Bergmann April 4, 2023, 8:51 a.m. UTC | #1
On Tue, Apr 4, 2023, at 10:42, Roger Quadros wrote:
> USB_DWC3 is not required for boot on most platforms make it
> as a module instead of built-in.
>
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> ---

Does this save a significant amount of vmlinux size? Since this
is a fairly common USB driver, I think it does help to have it
built-in for users booting from USB_STORAGE or nfsroot over
USB_USBNET, which are both built-in and not uncommon.

     Arnd
  
Krzysztof Kozlowski April 4, 2023, 10:01 a.m. UTC | #2
On 04/04/2023 10:51, Arnd Bergmann wrote:
> On Tue, Apr 4, 2023, at 10:42, Roger Quadros wrote:
>> USB_DWC3 is not required for boot on most platforms make it
>> as a module instead of built-in.
>>
>> Signed-off-by: Roger Quadros <rogerq@kernel.org>
>> ---
> 
> Does this save a significant amount of vmlinux size? Since this
> is a fairly common USB driver, I think it does help to have it
> built-in for users booting from USB_STORAGE or nfsroot over
> USB_USBNET, which are both built-in and not uncommon.

Especially that sometimes, at least for arm64 defconfig, we added as
built-in less critical pieces (RENESAS_ETHER_SWITCH, MARVELL_10G_PHY,
HTE_TEGRA194, SM_VIDEOCC_8250 and other non-core clock controllers).
This change will require several systems to update their initrd to
include USB.

Best regards,
Krzysztof
  
Roger Quadros April 4, 2023, 11:46 a.m. UTC | #3
On 04/04/2023 13:01, Krzysztof Kozlowski wrote:
> On 04/04/2023 10:51, Arnd Bergmann wrote:
>> On Tue, Apr 4, 2023, at 10:42, Roger Quadros wrote:
>>> USB_DWC3 is not required for boot on most platforms make it
>>> as a module instead of built-in.
>>>
>>> Signed-off-by: Roger Quadros <rogerq@kernel.org>
>>> ---
>>
>> Does this save a significant amount of vmlinux size? Since this

vmlinux size reduces by ~529KB

>> is a fairly common USB driver, I think it does help to have it
>> built-in for users booting from USB_STORAGE or nfsroot over
>> USB_USBNET, which are both built-in and not uncommon.

OK.

> 
> Especially that sometimes, at least for arm64 defconfig, we added as
> built-in less critical pieces (RENESAS_ETHER_SWITCH, MARVELL_10G_PHY,
> HTE_TEGRA194, SM_VIDEOCC_8250 and other non-core clock controllers).
> This change will require several systems to update their initrd to
> include USB.

OK. Please ignore this patch and the arm64 defconfig one as well. ;)

cheers,
-roger
  
Arnd Bergmann April 4, 2023, 12:14 p.m. UTC | #4
On Tue, Apr 4, 2023, at 13:46, Roger Quadros wrote:
> On 04/04/2023 13:01, Krzysztof Kozlowski wrote:
>> On 04/04/2023 10:51, Arnd Bergmann wrote:
>>> On Tue, Apr 4, 2023, at 10:42, Roger Quadros wrote:
>>>> USB_DWC3 is not required for boot on most platforms make it
>>>> as a module instead of built-in.
>>>>
>>>> Signed-off-by: Roger Quadros <rogerq@kernel.org>
>>>> ---
>>>
>>> Does this save a significant amount of vmlinux size? Since this
>
> vmlinux size reduces by ~529KB

That seems really high, so I had a look at what's going on.

Testing this on multi_v7_defconfig with gcc-13, I only see
163KB difference in (uncompressed) vmlinux file size, or 140KB
in the output of 'size vmlinux'. This still seems high, and
looking more closely I find that a lot of that is for either
Gadget mode or debugfs, while the driver itself is not all
that big (most of the host logic is in the xhci driver).

Turning off gadget mode altogether would save 248KB
in 'size vmlinux' output, but would also prevent us
from enabling gadget driver modules, which is not great
either.

I tried setting CONFIG_USB_GADGET=m, but that makes
DWC3 and DWC2 host-only and turns CHIPIDEA into a loadable
module, so we probably don't want to do that either:

-CONFIG_USB_EHCI_HCD_OMAP=y
+CONFIG_USB_EHCI_HCD_OMAP=m
-CONFIG_USB_DWC3_DUAL_ROLE=y
+CONFIG_USB_DWC3_HOST=y
+CONFIG_USB_DWC2_HOST=y
-CONFIG_USB_DWC2_DUAL_ROLE=y
-CONFIG_USB_CHIPIDEA=y
+CONFIG_USB_CHIPIDEA=m
-CONFIG_USB_ISP1761_UDC=y
-CONFIG_USB_ISP1760_DUAL_ROLE=y
+CONFIG_USB_ISP1760_HOST_ROLE=y

    Arnd
  
Roger Quadros April 4, 2023, 12:59 p.m. UTC | #5
On 04/04/2023 15:14, Arnd Bergmann wrote:
> On Tue, Apr 4, 2023, at 13:46, Roger Quadros wrote:
>> On 04/04/2023 13:01, Krzysztof Kozlowski wrote:
>>> On 04/04/2023 10:51, Arnd Bergmann wrote:
>>>> On Tue, Apr 4, 2023, at 10:42, Roger Quadros wrote:
>>>>> USB_DWC3 is not required for boot on most platforms make it
>>>>> as a module instead of built-in.
>>>>>
>>>>> Signed-off-by: Roger Quadros <rogerq@kernel.org>
>>>>> ---
>>>>
>>>> Does this save a significant amount of vmlinux size? Since this
>>
>> vmlinux size reduces by ~529KB
> 
> That seems really high, so I had a look at what's going on.

It was based on the configuration we are using at TI.

(as built-in)

$ size vmlinux
   text	   data	    bss	    dec	    hex	filename
14616949	5285870	 491776	20394595	1373263	vmlinux
$ ls -l vmlinux
-rwxrwxr-x 1 roger roger 120866544 Apr  4 15:54 vmlinux

(as module)

$ size vmlinux
   text	   data	    bss	    dec	    hex	filename
14550571	5258106	 491776	20300453	135c2a5	vmlinux
$ ls -l vmlinux
-rwxrwxr-x 1 roger roger 120324528 Apr  4 15:52 vmlinux


$ diff built-in-config module-config
5547c5547
< CONFIG_USB_XHCI_PLATFORM=y
---
> CONFIG_USB_XHCI_PLATFORM=m
5614c5614
< CONFIG_USB_DWC3=y
---
> CONFIG_USB_DWC3=m


> 
> Testing this on multi_v7_defconfig with gcc-13, I only see
> 163KB difference in (uncompressed) vmlinux file size, or 140KB
> in the output of 'size vmlinux'. This still seems high, and
> looking more closely I find that a lot of that is for either
> Gadget mode or debugfs, while the driver itself is not all
> that big (most of the host logic is in the xhci driver).
> 
> Turning off gadget mode altogether would save 248KB
> in 'size vmlinux' output, but would also prevent us
> from enabling gadget driver modules, which is not great
> either.
> 
> I tried setting CONFIG_USB_GADGET=m, but that makes
> DWC3 and DWC2 host-only and turns CHIPIDEA into a loadable
> module, so we probably don't want to do that either:
> 
> -CONFIG_USB_EHCI_HCD_OMAP=y
> +CONFIG_USB_EHCI_HCD_OMAP=m
> -CONFIG_USB_DWC3_DUAL_ROLE=y
> +CONFIG_USB_DWC3_HOST=y
> +CONFIG_USB_DWC2_HOST=y
> -CONFIG_USB_DWC2_DUAL_ROLE=y
> -CONFIG_USB_CHIPIDEA=y
> +CONFIG_USB_CHIPIDEA=m
> -CONFIG_USB_ISP1761_UDC=y
> -CONFIG_USB_ISP1760_DUAL_ROLE=y
> +CONFIG_USB_ISP1760_HOST_ROLE=y
> 
>     Arnd

cheers,
-roger
  
Arnd Bergmann April 4, 2023, 1:08 p.m. UTC | #6
On Tue, Apr 4, 2023, at 14:59, Roger Quadros wrote:
> On 04/04/2023 15:14, Arnd Bergmann wrote:
>> On Tue, Apr 4, 2023, at 13:46, Roger Quadros wrote:
>> That seems really high, so I had a look at what's going on.
>
> It was based on the configuration we are using at TI.
>
> (as built-in)
>
> $ size vmlinux
>    text	   data	    bss	    dec	    hex	filename
> 14616949	5285870	 491776	20394595	1373263	vmlinux
> $ ls -l vmlinux
> -rwxrwxr-x 1 roger roger 120866544 Apr  4 15:54 vmlinux
>
> (as module)
>
> $ size vmlinux
>    text	   data	    bss	    dec	    hex	filename
> 14550571	5258106	 491776	20300453	135c2a5	vmlinux
> $ ls -l vmlinux
> -rwxrwxr-x 1 roger roger 120324528 Apr  4 15:52 vmlinux
>
>
> $ diff built-in-config module-config
> 5547c5547
> < CONFIG_USB_XHCI_PLATFORM=y
> ---
>> CONFIG_USB_XHCI_PLATFORM=m
> 5614c5614
> < CONFIG_USB_DWC3=y
> ---
>> CONFIG_USB_DWC3=m

Ok, so the size difference here is only 94KB, presumably
because have the non-TI variants as well as debugfs and/or
gadget mode disabled. For the file size, my guess is that
you have CONFIG_DEBUG_INFO enabled in your config, which
drastically increases the size of the vmlinux file, but
not the in-memory size, or the size of the stripped and
compressed zImage.

      Arnd
  
Roger Quadros April 4, 2023, 3:09 p.m. UTC | #7
On 04/04/2023 16:08, Arnd Bergmann wrote:
> On Tue, Apr 4, 2023, at 14:59, Roger Quadros wrote:
>> On 04/04/2023 15:14, Arnd Bergmann wrote:
>>> On Tue, Apr 4, 2023, at 13:46, Roger Quadros wrote:
>>> That seems really high, so I had a look at what's going on.
>>
>> It was based on the configuration we are using at TI.
>>
>> (as built-in)
>>
>> $ size vmlinux
>>    text	   data	    bss	    dec	    hex	filename
>> 14616949	5285870	 491776	20394595	1373263	vmlinux
>> $ ls -l vmlinux
>> -rwxrwxr-x 1 roger roger 120866544 Apr  4 15:54 vmlinux
>>
>> (as module)
>>
>> $ size vmlinux
>>    text	   data	    bss	    dec	    hex	filename
>> 14550571	5258106	 491776	20300453	135c2a5	vmlinux
>> $ ls -l vmlinux
>> -rwxrwxr-x 1 roger roger 120324528 Apr  4 15:52 vmlinux
>>
>>
>> $ diff built-in-config module-config
>> 5547c5547
>> < CONFIG_USB_XHCI_PLATFORM=y
>> ---
>>> CONFIG_USB_XHCI_PLATFORM=m
>> 5614c5614
>> < CONFIG_USB_DWC3=y
>> ---
>>> CONFIG_USB_DWC3=m
> 
> Ok, so the size difference here is only 94KB, presumably
> because have the non-TI variants as well as debugfs and/or
> gadget mode disabled. For the file size, my guess is that
> you have CONFIG_DEBUG_INFO enabled in your config, which

That's right.

> drastically increases the size of the vmlinux file, but
> not the in-memory size, or the size of the stripped and
> compressed zImage.

Image file diff is ~128K.
Image.gz diff is ~33K.

--
cheers,
-roger
  

Patch

diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index 084cc612ea23..755cc96f23c5 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -855,7 +855,7 @@  CONFIG_USB_UX500_DMA=y
 CONFIG_USB_INVENTRA_DMA=y
 CONFIG_USB_TI_CPPI41_DMA=y
 CONFIG_USB_TUSB_OMAP_DMA=y
-CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3=m
 CONFIG_USB_DWC2=y
 CONFIG_USB_CHIPIDEA=y
 CONFIG_USB_CHIPIDEA_UDC=y