Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3492178imu; Sun, 11 Nov 2018 16:19:16 -0800 (PST) X-Google-Smtp-Source: AJdET5fb4cG+Q4UoUeSStJA+aXbvH1WQuldoV4lLRb/ExeKU2njuKyTrOMjpU2+pycf3KmsrrM45 X-Received: by 2002:a63:6045:: with SMTP id u66mr15765057pgb.204.1541981956218; Sun, 11 Nov 2018 16:19:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541981956; cv=none; d=google.com; s=arc-20160816; b=AzLMDI5VocCfMk87nGAnrSTU/ahCmndvQhXGwyxGb3Nwd0yGiPo7xEAiFD/g2gpfNB Fcjl7OLy8/tsNQF+xAJyLylf1NlLGtKG+FCBG0tsOGdj/sxUtJoIhzzSPX60Az6BJGt0 kBYe9OKa5ONmGQvB3NyIaWMBLyOluShA3xHu5uMQxaJPGus2Dy0s24VZnZPX9M7lcF2y LkPpFRzDld8Dhf5s7ZZ20wzjkUHhqj9ZI5tJ6QE8AB8eU52LFTgmdAT+eC7trOQ7Px7v xDTdMIccbQGQor7roaw04WreqwJ7cEFcfuHayuKK5eLWAW5FIq0sr8IQIFIfYo7cm2pm sUDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vdjdt/eWqMcGWm3ENlSnaxN2uiRQeEY14iBE9gNYgYk=; b=IvKUblruZVPgfZMYzAynaTvY8igN/cBX81tcxVIC41Uhb3S9pNBwL1kL1jSPi8bn6z vcVtMyEjo3vzdZiQrbWij9U2Wl4opSd+9VkaMKFcwn7Mv5sdk9vCnTfscQCZ9XOmIq4M zAVGSWm99n2UG/NaOcL6cg5wdi8KU30p5QanLUVotX3nGk5wuJ6A4DFNhe9PUP2bEvzu Nrv/7ZEqEVMXM6T5k0yhnrJkJGvCCDMAAa2gJHLInnN1Fq7EVcw0drBZ6jvOSBx35sa0 4HvXGLJEJ5UVg6v0z0dncPm34szM2fyvkT+hZzjXWjAX9XOhvf4U/9qnazzbAihqMtIb x6MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=INSN20MK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si14616684pgc.237.2018.11.11.16.19.01; Sun, 11 Nov 2018 16:19:16 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=INSN20MK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729980AbeKLIQ6 (ORCPT + 99 others); Mon, 12 Nov 2018 03:16:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:58720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729840AbeKLIQ4 (ORCPT ); Mon, 12 Nov 2018 03:16:56 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 805352154B; Sun, 11 Nov 2018 22:27:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975220; bh=kR/Q53iGENTfqcSkL8Kf8DGLzpHwms52L5sT2h5jeFM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=INSN20MKcnoz7Au8CS82KimiN3pAHrNem2h/gW5ZQ8f9Z0mgfN20B/NYL2pcJWUzk 7cI+GBT2i7ljGiGALEei4vo4xT3+Wcwv9IS4cBWQrbjaImwVrqUhDThA5Mfqdk0ybN KUn4XWrcFctQXq35XQoIQSIIEw5ibLn87CeoV3As= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fengguang Wu , Bart Van Assche , "Rafael J. Wysocki" Subject: [PATCH 4.19 024/361] ACPI / OSL: Use jiffies as the time bassis for acpi_os_get_timer() Date: Sun, 11 Nov 2018 14:16:11 -0800 Message-Id: <20181111221623.058842637@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche commit 83b2348e2755db48fa8f40fdb791f366fabc0ba0 upstream. 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 References: https://lists.01.org/pipermail/lkp/2018-April/008406.html Signed-off-by: Bart Van Assche Cc: 4.16+ # 4.16+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/osl.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- 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)