Skip to contentSkip to conversation

ARM*-EFI timers

PATCH Vladimir 'φ-coder/phcoder' Serbinenko 2 participants 3 messages Jan 7, 2016

lore
Share & tools
lore
#0 lore raw

Hello, all. In my automated tests I found out that on ARM64-EFI sleep 10 actually sleeps for 100s. The culprit is that EFI doesn't call our timer every 1ms but every 10ms. I propose time1.diff to correct: request EFI to call us every 10ms and increment timer variable by 10. For arm64 I propose to use CPU timer instead time2.diff. Can any of ARM guys comment on this?

grub-core/kern/arm/efi/init.c +2 -2
index 2572ca8..06df60e 100644
@@ -38,7 +38,7 @@ static void
 increment_timer (grub_efi_event_t event __attribute__ ((unused)),
 		 void *context __attribute__ ((unused)))
 {
-  tmr++;
+  tmr += 10;
 }
 
 void
@@ -52,7 +52,7 @@ grub_machine_init (void)
 
   efi_call_5 (b->create_event, GRUB_EFI_EVT_TIMER | GRUB_EFI_EVT_NOTIFY_SIGNAL,
 	      GRUB_EFI_TPL_CALLBACK, increment_timer, NULL, &tmr_evt);
-  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 10000);
+  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 100000);
 
   grub_install_get_time_ms (grub_efi_get_time_ms);
 }
grub-core/Makefile.core.def +1 -1
index 0cc40bb..0d5ab6f 100644
@@ -213,7 +213,7 @@ kernel = {
   arm_efi = kern/arm/efi/init.c;
   arm_efi = kern/arm/efi/misc.c;
 
-  arm64_efi = kern/arm/efi/init.c;
+  arm64_efi = kern/arm64/efi/init.c;
 
   i386_pc = kern/i386/pc/init.c;
   i386_pc = kern/i386/pc/mmap.c;
grub-core/kern/arm64/efi/init.c new file +60 -0

60 lines not on this page · raw message

#1 lore raw

07.01.2016 21:08, Vladimir 'φ-coder/phcoder' Serbinenko пишет:

Quoted 4 lines

Hello, all. In my automated tests I found out that on ARM64-EFI sleep 10 actually sleeps for 100s. The culprit is that EFI doesn't call our timer every 1ms but every 10ms. I propose time1.diff to correct: request EFI to call us every 10ms and increment timer variable by 10.

openSUSE carries similar patch for quite some time. Patch is authored by RH. So it can be considered tested in real life.

https://build.opensuse.org/package/view_file/Base:System/grub2/grub2-arm64-Reduce-timer-event-frequency-by-10.patch?expand=1

Quoted 10 lines

For arm64 I propose to use CPU timer instead time2.diff. Can any of ARM guys comment on this?

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#2 lore raw
Quoted 11 lines · Andrei Borzenkov

07.01.2016 21:08, Vladimir 'φ-coder/phcoder' Serbinenko пишет:

Quoted 4 lines

Hello, all. In my automated tests I found out that on ARM64-EFI sleep 10 actually sleeps for 100s. The culprit is that EFI doesn't call our timer every 1ms but every 10ms. I propose time1.diff to correct: request EFI to call us every 10ms and increment timer variable by 10.

openSUSE carries similar patch for quite some time. Patch is authored by RH. So it can be considered tested in real life.

https://build.opensuse.org/package/view_file/Base:System/grub2/grub2-arm64-Reduce-timer-event-frequency-by-10.patch?expand=1

Ok, I took RH patch. Now question is about the second patch

Quoted 19 lines
Quoted 10 lines

For arm64 I propose to use CPU timer instead time2.diff. Can any of ARM guys comment on this?

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel