On Tue, Oct 16, 2018 at 1:01 AM Bart Van Assche <bvanassche@xxxxxxx> wrote: > > On Tue, 2018-10-16 at 00:44 +0200, Rafael J. Wysocki wrote: > > On Tue, Oct 16, 2018 at 12:19 AM Bart Van Assche <bvanassche@xxxxxxx> wrote: > > > > > > This patch avoids that the following warning is reported during hibernation: > > > > Well, what exactly is the problem and why is the patch the right way > > to address it? > > It is not safe to call ktime_get() after having called timekeeping_suspend(). > > > > /* > > > diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c > > > index 0da96268deb5..9dbea4549484 100644 > > > --- a/drivers/acpi/acpica/dscontrol.c > > > +++ b/drivers/acpi/acpica/dscontrol.c > > > @@ -84,8 +84,8 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state, > > > control_state->control.package_end = > > > walk_state->parser_state.pkg_end; > > > control_state->control.opcode = op->common.aml_opcode; > > > - control_state->control.loop_timeout = acpi_os_get_timer() + > > > - (u64)(acpi_gbl_max_loop_iterations * ACPI_100NSEC_PER_SEC); > > > + control_state->control.loop_timeout = jiffies + > > > + acpi_gbl_max_loop_iterations * HZ; > > > > jiffies is Linux-specific and so it should not be used in the ACPICA code. > > Really? There is plenty of other ACPI code that uses the jiffies counter directly. > Why wouldn't it be allowed to use the jiffies counter in this context since there > is so much other ACPI code that uses that counter? As Greg said, ACPICA special. It is part of the ACPI code (the code under drivers/acpi/acpica/ and some header files) acquired by the kernel from an external project. The upstream ACPICA code is maintained separately and has to work with multiple different OS kernels, so it cannot refer to any specific kernel. OTOH, it is better if the ACPICA code in Linux is as close to its upstream as reasonably possible. Thanks, Rafael