grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 0/3] Net fix and improvements


From: Glenn Washburn
Subject: [PATCH 0/3] Net fix and improvements
Date: Fri, 18 Mar 2022 01:51:30 -0500

v2 updates:
 * Use == NULL in conditionals
 * Update commit messages to have more context from previous cover letter

Glenn

Glenn Washburn (3):
  net: Unset grub_net_poll_cards_idle when net module has been unloaded
  net: Avoid unnecessary calls to grub_net_tcp_retransmit
  net/tcp: Only call grub_get_time_ms when there are sockets to
    potentially retransmit for

 grub-core/net/net.c | 5 +++--
 grub-core/net/tcp.c | 9 +++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

Range-diff:
1:  324f068453 ! 1:  76bbc12ed1 net: Unset grub_net_poll_cards_idle when net 
module has been unloaded
    @@ Metadata
      ## Commit message ##
         net: Unset grub_net_poll_cards_idle when net module has been unloaded
     
    +    This looks like it was a copy/paste error. If the net module is 
unloaded,
    +    grub_net_poll_cards_idle should be NULL so that GRUB does not try to 
call a
    +    function which now doesn't exist.
    +
      ## grub-core/net/net.c ##
     @@ grub-core/net/net.c: GRUB_MOD_FINI(net)
        grub_net_open = NULL;
2:  2e55f210c7 ! 2:  4efca58dab net: Avoid unnecessary calls to 
grub_net_tcp_retransmit
    @@ Commit message
     
         In grub_net_poll_cards_idle_real, only call grub_net_tcp_retransmit if 
there
         are network cards found. If there are no network card found, there can 
be no
    -    tcp sockets to transmit on.
    +    tcp sockets to transmit on. So no need to go through that logic.
     
      ## grub-core/net/net.c ##
     @@ grub-core/net/net.c: grub_net_poll_cards_idle_real (void)
    @@ grub-core/net/net.c: grub_net_poll_cards_idle_real (void)
            receive_packets (card, 0);
        }
     -  grub_net_tcp_retransmit ();
    -+  if (grub_net_cards)
    ++  if (grub_net_cards == NULL)
     +    grub_net_tcp_retransmit ();
      }
      
3:  7bef6e122f ! 3:  a6328b14cd net/tcp: Only call grub_get_time_ms when there 
are sockets to potentially retransmit for
    @@ Metadata
      ## Commit message ##
         net/tcp: Only call grub_get_time_ms when there are sockets to 
potentially retransmit for
     
    -    If there are no TCP sockets, this call to grub_get_time_ms is 
unneeded. This
    -    prevents a call into the firmware on some platforms.
    +    If the machine has network cards found, but there are no tcp open 
sockets
    +    (because the user doesn't use the network to boot), then
    +    grub_net_tcp_retransmit() should be a noop. Thus GRUB doesn't need to 
call
    +    grub_get_time_ms(), which does a call into firmware on 
powerpc-ieee1275,
    +    and probably other targets. So only call grub_get_time_ms() if there 
are tcp
    +    sockets.
    +
    +    Aside from improving performace, its also useful to stay out of the 
firmware
    +    as much as possible when debugging via QEMU because its a pain to get 
back
    +    in to GRUB execution. grub_net_tcp_retransmit() can get called very
    +    frequently via grub_net_poll_cards_idle() when GRUB is waiting for a
    +    keypress (grub_getkey_noblock() calls grub_net_poll_cards_idle()). 
This can
    +    be annoying when debugging an issue in GRUB on powerpc in QEMU with 
GDB when
    +    GRUB is waiting for a keypress because interrupting via GDB nearly 
always
    +    lands in the OpenBIOS firmware's milliseconds call.
     
      ## grub-core/net/tcp.c ##
     @@ grub-core/net/tcp.c: void
    @@ grub-core/net/tcp.c: void
     -  grub_uint64_t limit_time = ctime - TCP_RETRANSMISSION_TIMEOUT;
     +  grub_uint64_t ctime = 0, limit_time = 0;
     +
    -+  if (tcp_sockets)
    ++  if (tcp_sockets == NULL)
     +    {
     +      ctime = grub_get_time_ms ();
     +      limit_time = ctime - TCP_RETRANSMISSION_TIMEOUT;
-- 
2.27.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]