From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Thomas Gleixner <tglx@linutronix.de>, Len Brown <lenb@kernel.org>,
Yu Chen <yu.c.chen@intel.com>,
Fengguang Wu <fengguang.wu@intel.com>,
linux-acpi@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] ACPICA: Use 'jiffies' as the time bassis for acpi_os_get_timer()
Date: Fri, 19 Oct 2018 12:21:10 +0200 [thread overview]
Message-ID: <1574373.kKC8pbmcXO@aspire.rjw.lan> (raw)
In-Reply-To: <20181017202456.136616-1-bvanassche@acm.org>
On Wednesday, October 17, 2018 10:24:56 PM CEST Bart Van Assche wrote:
> Since acpi_os_get_timer() may be called after the timer subsystem has
> been suspended, use the jiffies counter instead of ktime_get(). This
> patch avoids that the following warning is reported during hibernation:
>
> WARNING: CPU: 0 PID: 612 at kernel/time/timekeeping.c:751 ktime_get+0x116/0x120
> RIP: 0010:ktime_get+0x116/0x120
> Call Trace:
> acpi_os_get_timer+0xe/0x30
> acpi_ds_exec_begin_control_op+0x175/0x1de
> acpi_ds_exec_begin_op+0x2c7/0x39a
> acpi_ps_create_op+0x573/0x5e4
> acpi_ps_parse_loop+0x349/0x1220
> acpi_ps_parse_aml+0x25b/0x6da
> acpi_ps_execute_method+0x327/0x41b
> acpi_ns_evaluate+0x4e9/0x6f5
> acpi_ut_evaluate_object+0xd9/0x2f2
> acpi_rs_get_method_data+0x8f/0x114
> acpi_walk_resources+0x122/0x1b6
> acpi_pci_link_get_current.isra.2+0x157/0x280
> acpi_pci_link_set+0x32f/0x4a0
> irqrouter_resume+0x58/0x80
> syscore_resume+0x84/0x380
> hibernation_snapshot+0x20c/0x4f0
> hibernate+0x22d/0x3a6
> state_store+0x99/0xa0
> kobj_attr_store+0x37/0x50
> sysfs_kf_write+0x87/0xa0
> kernfs_fop_write+0x1a5/0x240
> __vfs_write+0xd2/0x410
> vfs_write+0x101/0x250
> ksys_write+0xab/0x120
> __x64_sys_write+0x43/0x50
> do_syscall_64+0x71/0x220
> entry_SYSCALL_64_after_hwframe+0x49/0xbe
>
> Fixes: 164a08cee135 ("ACPICA: Dispatcher: Introduce timeout mechanism for infinite loop detection")
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>
> References: https://lists.01.org/pipermail/lkp/2018-April/008406.html
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Yu Chen <yu.c.chen@intel.com>
> Cc: Fengguang Wu <fengguang.wu@intel.com>
> Cc: linux-acpi@vger.kernel.org
> Cc: stable@vger.kernel.org
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> drivers/acpi/osl.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
> index 8df9abfa947b..ed73f6fb0779 100644
> --- a/drivers/acpi/osl.c
> +++ b/drivers/acpi/osl.c
> @@ -617,15 +617,18 @@ void acpi_os_stall(u32 us)
> }
>
> /*
> - * Support ACPI 3.0 AML Timer operand
> - * Returns 64-bit free-running, monotonically increasing timer
> - * with 100ns granularity
> + * Support ACPI 3.0 AML Timer operand. Returns a 64-bit free-running,
> + * monotonically increasing timer with 100ns granularity. Do not use
> + * ktime_get() to implement this function because this function may get
> + * called after timekeeping has been suspended. Note: calling this function
> + * after timekeeping has been suspended may lead to unexpected results
> + * because when timekeeping is suspended the jiffies counter is not
> + * incremented. See also timekeeping_suspend().
> */
> u64 acpi_os_get_timer(void)
> {
> - u64 time_ns = ktime_to_ns(ktime_get());
> - do_div(time_ns, 100);
> - return time_ns;
> + return (get_jiffies_64() - INITIAL_JIFFIES) *
> + (ACPI_100NSEC_PER_SEC / HZ);
> }
>
> acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width)
>
Applied, thanks!
prev parent reply other threads:[~2018-10-19 10:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-17 20:24 [PATCH] ACPICA: Use 'jiffies' as the time bassis for acpi_os_get_timer() Bart Van Assche
2018-10-19 10:21 ` Rafael J. Wysocki [this message]
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=1574373.kKC8pbmcXO@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=bvanassche@acm.org \
--cc=fengguang.wu@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=yu.c.chen@intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox