Could you be so kind and test attached patch? It basically reverses
priority of PCI accessors and helps a lot my Thinkpad T400/T500 where
BIOS accessors are slow and I/O are fast. I've been hit by the issue not
on network, but while BSP tries to initialize its console -- it tries to
find all the possible PCI UARTs and this hurt time-wise a lot.

Please report if this helps or not. I've not submitted the patch as all
my other machines do not provide PCI BIOS in RTEMS friendly way and
RTEMS is using PCI I/O accessors by default on them -- so speed access.

I've neither tested on qemu with nic so your report will be appreciated
here.

Thanks,
Karel

On 9/28/20 9:43 PM, junkes wrote:
> I have a problem with rtems_bsd_initialize() in POSIX_Init() and qemu.
> 
> call of
>     sc = rtems_bsd_initialize();
>     assert(sc == RTEMS_SUCCESSFUL);
> always takes about 45 seconds until it is finished.
> 
> The output of
> 
> nexus0: <RTEMS Nexus device>
> pcib0 pcibus 0 on motherboard
> pci0: <PCI bus> on pcib0
> pci0: <bridge, HOST-PCI> at device 0.0 (no driver attached)
> pci0: <bridge, PCI-ISA> at device 1.0 (no driver attached)
> pci0: <mass storage, ATA> at device 1.1 (no driver attached)
> pci0: <bridge> at device 1.3 (no driver attached)
> pci0: <display, VGA> at device 2.0 (no driver attached)
> em0: <Intel(R) PRO/1000 Network Connection> port 0xc000-0xc03f mem
> 0xfebc0000-0xfebdffff irq 11 at device 3.0 on pci0
> 
> comes very fast, but then the system is "frozen" for about 45 seconds.
> Then this output appears:
> 
> info: em0: Ethernet address: 0e:b0:ba:5e:ba:11
> cpu0 on motherboard
> 
> The setting of
>     default_network_set_self_prio(RTEMS_MAXIMUM_PRIORITY - 1U);
> seems to have no influence. I also did not understand the setting of
> priorities.
> 
> -------------------------------------------------------------------------------
> 
>                               CPU USAGE BY THREAD
> ------------+----------------------------------------+---------------+---------
> 
>  ID         | NAME                                   | SECONDS       |
> PERCENT
> ------------+----------------------------------------+---------------+---------
> 
>  0x09010001 | IDLE                                   |     46.042360 | 
> 98.800
>  0x0a010001 | TIME                                   |      0.000067 |  
> 0.000
>  0x0a010002 | IRQS                                   |      0.000969 |  
> 0.002
>  0x0a010003 | swi6: task queu                        |      0.000000 |  
> 0.000
>  0x0a010004 | config_0                               |      0.000000 |  
> 0.000
>  0x0a010005 | swi5: fast task                        |      0.000000 |  
> 0.000
>  0x0a010006 | kqueue_ctx task                        |      0.000000 |  
> 0.000
>  0x0a010007 | thread taskq                           |      0.000000 |  
> 0.000
>  0x0a010008 | swi6: Giant tas                        |      0.000000 |  
> 0.000
>  0x0a010009 | swi1: netisr 0                         |      0.000000 |  
> 0.000
>  0x0a01000a | if_io_tqg_0                            |      0.000000 |  
> 0.000
>  0x0a01000b | if_config_tqg_0                        |      0.000000 |  
> 0.000
>  0x0a01000c | softirq_0                              |      0.000000 |  
> 0.000
>  0x0b010001 |                                        |      0.561695 |  
> 1.205
>  0x0b010003 |                                        |      0.001552 |  
> 0.003
> ------------+----------------------------------------+---------------+---------
> 
>  TIME SINCE LAST CPU USAGE RESET IN SECONDS:                        
> 46.608912
> -------------------------------------------------------------------------------
> 
> Task control block(Nr.: 1)
> task control block at 0x006b33c0
> task ID: 0x09010001
> name_32: -- ELDI --
> ID=0x09010001 name=IDLE
> 
> --Info (hpj)-- task Nr: 1
>  id=151060481, name=IDLE, prio = 255
> -----
> Task control block(Nr.: 2)
> task control block at 0x006ab8a0
> task ID: 0x0a010001
> name_32: -- EMIT --
> ID=0x0a010001 name=TIME
> 
> --Info (hpj)-- task Nr: 2
>  id=167837697, name=TIME, prio = 98
> -----
> Task control block(Nr.: 3)
> task control block at 0x006abc38
> task ID: 0x0a010002
> name_32: -- SQRI --
> ID=0x0a010002 name=IRQS
> 
> --Info (hpj)-- task Nr: 3
>  id=167837698, name=IRQS, prio = 96
> -----
> Task control block(Nr.: 4)
> task control block at 0x006abfd0
> task ID: 0x0a010003
> name_32: -- DSB_ --
> ID=0x0a010003 name=_BSD
> 
> --Info (hpj)-- task Nr: 4
>  id=167837699, name=swi6: task queu, prio = 100
> -----
> Task control block(Nr.: 5)
> task control block at 0x006ac368
> task ID: 0x0a010004
> name_32: -- DSB_ --
> ID=0x0a010004 name=_BSD
> 
> --Info (hpj)-- task Nr: 5
>  id=167837700, name=config_0, prio = 100
> -----
> Task control block(Nr.: 6)
> task control block at 0x006ac700
> task ID: 0x0a010005
> name_32: -- DSB_ --
> ID=0x0a010005 name=_BSD
> 
> --Info (hpj)-- task Nr: 6
>  id=167837701, name=swi5: fast task, prio = 100
> -----
> Task control block(Nr.: 7)
> task control block at 0x006aca98
> task ID: 0x0a010006
> name_32: -- DSB_ --
> ID=0x0a010006 name=_BSD
> 
> --Info (hpj)-- task Nr: 7
>  id=167837702, name=kqueue_ctx task, prio = 100
> -----
> Task control block(Nr.: 8)
> task control block at 0x006ace30
> task ID: 0x0a010007
> name_32: -- DSB_ --
> ID=0x0a010007 name=_BSD
> 
> --Info (hpj)-- task Nr: 8
>  id=167837703, name=thread taskq, prio = 100
> -----
> Task control block(Nr.: 9)
> task control block at 0x006ad1c8
> task ID: 0x0a010008
> name_32: -- DSB_ --
> ID=0x0a010008 name=_BSD
> 
> --Info (hpj)-- task Nr: 9
>  id=167837704, name=swi6: Giant tas, prio = 100
> -----
> Task control block(Nr.: 10)
> task control block at 0x006ad560
> task ID: 0x0a010009
> name_32: -- DSB_ --
> ID=0x0a010009 name=_BSD
> 
> --Info (hpj)-- task Nr: 10
>  id=167837705, name=swi1: netisr 0, prio = 100
> -----
> Task control block(Nr.: 11)
> task control block at 0x006ad8f8
> task ID: 0x0a01000a
> name_32: -- DSB_ --
> ID=0x0a01000a name=_BSD
> 
> --Info (hpj)-- task Nr: 11
>  id=167837706, name=if_io_tqg_0, prio = 100
> -----
> Task control block(Nr.: 12)
> task control block at 0x006adc90
> task ID: 0x0a01000b
> name_32: -- DSB_ --
> ID=0x0a01000b name=_BSD
> 
> --Info (hpj)-- task Nr: 12
>  id=167837707, name=if_config_tqg_0, prio = 100
> -----
> Task control block(Nr.: 13)
> task control block at 0x006ae028
> task ID: 0x0a01000c
> name_32: -- DSB_ --
> ID=0x0a01000c name=_BSD
> 
> --Info (hpj)-- task Nr: 13
>  id=167837708, name=softirq_0, prio = 100
> -----
> Task control block(Nr.: 14)
> task control block at 0x006a3d20
> task ID: 0x0b010001
> name_32: --  --
> ID=0x0b010001 name=
> 
> --Info (hpj)-- task Nr: 14
>  id=184614913, name=, prio = 30
> -----
> Task control block(Nr.: 15)
> task control block at 0x006a4450
> task ID: 0x0b010003
> name_32: --  --
> ID=0x0b010003 name=
> 
> --Info (hpj)-- task Nr: 15
>  id=184614915, name=, prio = 229
> -----
> :
> qemu is called with:
> 
> qemu-system-i386 -m 64 -no-reboot -serial stdio -display none -net
> nic,model=e1000,macaddr=0e:b0:ba:5e:ba:11 -net user,restrict=yes -append
> "--video=off --console=/dev/com1" -kernel libComTestHarness
> 
> Heinz
> 
> _______________________________________________
> users mailing list
> users@rtems.org
> http://lists.rtems.org/mailman/listinfo/users

>From a240453d70494df793975cc59a9008a05c6c3e2c Mon Sep 17 00:00:00 2001
From: Karel Gardas <karel.gar...@centrum.cz>
Date: Mon, 31 Aug 2020 14:35:28 +0200
Subject: [PATCH] pc386 BSP: try first PCI I/O interface instead of PCI BIOS
 interface

This patch changes ordering of PCI bus initialization in pc386 BSP. Instead
of PCI BIOS access we first attempt PCI I/O access and if it is successful
we use that. The reason for this is that some system (old Lenovo T400/T500)
provides both BIOS and I/O access method, but BIOS is ridiculous slow. When
BSP was using this, then T400/T500 waited minutes on PCI UART scanning before
continuing with RTEMS application code. With this patch applied, both
T500 and T400 works fine.
---
 bsps/i386/pc386/start/bspstart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bsps/i386/pc386/start/bspstart.c b/bsps/i386/pc386/start/bspstart.c
index db1ca90cf4..d204359569 100644
--- a/bsps/i386/pc386/start/bspstart.c
+++ b/bsps/i386/pc386/start/bspstart.c
@@ -51,16 +51,16 @@ static void bsp_pci_initialize_helper(void)
 {
   const pci_config_access_functions *pci_accessors;
 
-  pci_accessors = pci_bios_initialize();
+  pci_accessors = pci_io_initialize();
   if (pci_accessors != NULL) {
-    printk("PCI bus: using PCI BIOS interface\n");
+    printk("PCI bus: using PCI I/O interface\n");
     BSP_pci_configuration.pci_functions = pci_accessors;
     return;
   }
 
-  pci_accessors = pci_io_initialize();
+  pci_accessors = pci_bios_initialize();
   if (pci_accessors != NULL) {
-    printk("PCI bus: using PCI I/O interface\n");
+    printk("PCI bus: using PCI BIOS interface\n");
     BSP_pci_configuration.pci_functions = pci_accessors;
     return;
   }
-- 
2.17.1

_______________________________________________
users mailing list
users@rtems.org
http://lists.rtems.org/mailman/listinfo/users

Reply via email to