From: Glenn Washburn <development@efficientek.com>
To: Daniel Kiper <dkiper@net-space.pl>, grub-devel@gnu.org
Cc: Glenn Washburn <development@efficientek.com>
Subject: [PATCH 0/3] Net fix and improvements
Date: Fri, 18 Mar 2022 01:51:30 -0500 [thread overview]
Message-ID: <cover.1647586160.git.development@efficientek.com> (raw)
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
next reply other threads:[~2022-03-18 6:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-18 6:51 Glenn Washburn [this message]
2022-03-18 6:51 ` [PATCH 1/3] net: Unset grub_net_poll_cards_idle when net module has been unloaded Glenn Washburn
2022-03-18 6:51 ` [PATCH 2/3] net: Avoid unnecessary calls to grub_net_tcp_retransmit Glenn Washburn
2022-03-18 6:51 ` [PATCH 3/3] net/tcp: Only call grub_get_time_ms when there are sockets to potentially retransmit for Glenn Washburn
2022-03-22 16:52 ` [PATCH 0/3] Net fix and improvements Daniel Kiper
-- strict thread matches above, loose matches on Subject: below --
2022-03-08 21:20 Glenn Washburn
2022-03-17 22:21 ` Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1647586160.git.development@efficientek.com \
--to=development@efficientek.com \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.