Re: [PATCH] ACPICA: Fix dispatcher timeout mechanism

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2018-10-16 at 09:54 +-0200, Rafael J. Wysocki wrote:
+AD4  drivers/acpi/osl.c +AHw    3 +-+--
+AD4  1 file changed, 2 insertions(+-), 1 deletion(-)
+AD4 
+AD4 Index: linux-pm/drivers/acpi/osl.c
+AD4 +AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0APQA9AD0
+AD4 --- linux-pm.orig/drivers/acpi/osl.c
+AD4 +-+-+- linux-pm/drivers/acpi/osl.c
+AD4 +AEAAQA -623,7 +-623,8 +AEAAQA void acpi+AF8-os+AF8-stall(u32 us)
+AD4   +ACo-/
+AD4  u64 acpi+AF8-os+AF8-get+AF8-timer(void)
+AD4  +AHs
+AD4 -	u64 time+AF8-ns +AD0 ktime+AF8-to+AF8-ns(ktime+AF8-get())+ADs
+AD4 +-	u64 time+AF8-ns +AD0 ktime+AF8-to+AF8-ns(unlikely(system+AF8-state +AD0APQ SYSTEM+AF8-SUSPEND) ?
+AD4 +-				  ktime+AF8-get+AF8-mono+AF8-fast+AF8-ns() : ktime+AF8-get())+ADs
+AD4  	do+AF8-div(time+AF8-ns, 100)+ADs
+AD4  	return time+AF8-ns+ADs
+AD4  +AH0

>From the Documentation/core-api/timekeeping.rst section about
ktime+AF8-get+AF8-mono+AF8-fast+AF8-ns(): +ACI-most drivers should never call them, since the
time is allowed to jump under certain conditions+ACI. How about the following,
also untested patch?

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 8df9abfa947b..2fb7911b3a28 100644
--- a/drivers/acpi/osl.c
+-+-+- b/drivers/acpi/osl.c
+AEAAQA -623,9 +-623,8 +AEAAQA void acpi+AF8-os+AF8-stall(u32 us)
  +ACo-/
 u64 acpi+AF8-os+AF8-get+AF8-timer(void)
 +AHs
-	u64 time+AF8-ns +AD0 ktime+AF8-to+AF8-ns(ktime+AF8-get())+ADs
-	do+AF8-div(time+AF8-ns, 100)+ADs
-	return time+AF8-ns+ADs
+-	return (get+AF8-jiffies+AF8-64() - INITIAL+AF8-JIFFIES) +ACo
+-		(ACPI+AF8-100NSEC+AF8-PER+AF8-SEC / HZ)+ADs
 +AH0
 
 acpi+AF8-status acpi+AF8-os+AF8-read+AF8-port(acpi+AF8-io+AF8-address port, u32 +ACo value, u32 width)

I think that there are already multiple functions in the kernel tree that
subtract the initial value of the jiffies variable from that variable:

+ACQ git grep -nH ' - INITIAL+AF8-JIFFIES'
arch/x86/kernel/tsc.c:228:	return (jiffies+AF8-64 - INITIAL+AF8-JIFFIES) +ACo (1000000000 / HZ)+ADs
drivers/net/wan/hdlc+AF8-cisco.c:119:	data-+AD4-time +AD0 htonl((jiffies - INITIAL+AF8-JIFFIES) +ACo (1000 / HZ))+ADs
kernel/sched/clock.c:65:	return (unsigned long long)(jiffies - INITIAL+AF8-JIFFIES)
kernel/time/sched+AF8-clock.c:83:	return (u64)(jiffies - INITIAL+AF8-JIFFIES)+ADs
kernel/trace/trace+AF8-clock.c:72:	return jiffies+AF8-64+AF8-to+AF8-clock+AF8-t(jiffies+AF8-64 - INITIAL+AF8-JIFFIES)+ADs
net/ipv4/devinet.c:1570:	return (cstamp - INITIAL+AF8-JIFFIES) +ACo 100UL / HZ+ADs
net/ipv6/addrconf.c:104:	return (cstamp - INITIAL+AF8-JIFFIES) +ACo 100UL / HZ+ADs

Thanks,

Bart.




[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux