URL: <https://savannah.gnu.org/bugs/?66257>
Summary: grub menu gets stuck due to unreliable rdtsc instruction Group: GNU GRUB Submitter: will_duan Submitted: Thu 26 Sep 2024 07:42:55 AM UTC Category: Booting Severity: Major Priority: 5 - Normal Item Group: Software Error Status: None Privacy: Public Assigned to: None Originator Name: Originator Email: Open/Closed: Open Discussion Lock: Any Release: Git master Release: Reproducibility: Intermittent Planned Release: None _______________________________________________________ Follow-up Comments: ------------------------------------------------------- Date: Thu 26 Sep 2024 07:42:55 AM UTC By: Will Duan <will_duan> "grub_tsc_init" function will init tsc by setting grub_tsc_rate, which call stack is: grub_tsc_init -> grub_tsc_calibrate_from_pmtimer -> grub_divmod64 Among, "grub_divmod64" function needs "tsc_diff" as the second parameter. In "grub_pmtimer_wait_count_tsc", we will call "grub_get_tsc" function to get time stamp counter value to assign to "start_tsc" variable, and get into "while(1)" loop space to get "end_tsc" variable value with same function, after 3580 ticks, return "end_tsc - start_tsc". Actually, "rdtsc" instruction will be called in "grub_get_tsc", but "rdtsc" instruction is not reliable(for the reason see the next question), which will cause "tsc_diff" to be a very big number larger than (1UL << 32) or a negative number, so that grub_tsc_rate will be zero. When "run_menu" function is startup, and calls "grub_tsc_get_time_ms" function to get current time to check if timeout time reach, at this time, "grub_tsc_get_time_ms" function will return zero due to zero "grub_tsc_rate" variable, then grub menu gets stuck... _______________________________________________________ File Attachments: ------------------------------------------------------- Name: 0001-BugFix-grub-menu-gets-stuck-due-to-unreliable-rdtsc-.patch Size: 6KiB <https://file.savannah.gnu.org/file/0001-BugFix-grub-menu-gets-stuck-due-to-unreliable-rdtsc-.patch?file_id=56456> ------------------------------------------------------- Name: grub-menu.png Size: 316KiB <https://file.savannah.gnu.org/file/grub-menu.png?file_id=56457> AGPL NOTICE These attachments are served by Savane. You can download the corresponding source code of Savane at https://git.savannah.nongnu.org/cgit/administration/savane.git/snapshot/savane-14b38883ab957b38c0a68af9e7ebdf6fc3130a94.tar.gz _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?66257> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/
signature.asc
Description: PGP signature