Skip to contentSkip to conversation

ACPI / osl: implement acpi_os_sleep() with msleep()

PATCH In review Chuansheng Liu 2 participants 4 messages Sep 11, 2013 – Sep 12, 2013 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI / osl: implement acpi_os_sleep() with msleep()

Currently the acpi_os_sleep() is using the schedule_timeout_interruptible(), which can be interrupted by signal, which causes the real sleep time is shorter.

According to the ACPI spec:
The Sleep term is used to implement long-term timing requirements. Execution is delayed for at least the required number of milliseconds.

The sleeping time should be at least of the required number msecs, here using msleep() to implement it.

Also if the real time is shorter, we meet the device POWER ON issue.

---
 drivers/acpi/osl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/osl.c +1 -1
index e5f416c..b1629b5 100644
@@ -820,7 +820,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
 
 void acpi_os_sleep(u64 ms)
 {
-	schedule_timeout_interruptible(msecs_to_jiffies(ms));
+	msleep(ms);
 }
 
 void acpi_os_stall(u32 us)
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 4 lines · Chuansheng Liu

Currently the acpi_os_sleep() is using the schedule_timeout_interruptible(), which can be interrupted by signal, which causes the real sleep time is shorter.

Quoted 8 lines

According to the ACPI spec:
The Sleep term is used to implement long-term timing requirements. Execution is delayed for at least the required number of milliseconds.

The sleeping time should be at least of the required number msecs, here using msleep() to implement it.

Also if the real time is shorter, we meet the device POWER ON issue.

What exactly is the "power on" issue?

Rafael

Quoted 21 lines
---
 drivers/acpi/osl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/osl.c +1 -1
index e5f416c..b1629b5 100644
@@ -820,7 +820,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
 
 void acpi_os_sleep(u64 ms)
 {
-	schedule_timeout_interruptible(msecs_to_jiffies(ms));
+	msleep(ms);
 }
 
 void acpi_os_stall(u32 us)
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
#2 lore raw

Hello Rafael,

Quoted 18 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Wednesday, September 11, 2013 8:37 PM
To: Liu, Chuansheng
Cc: [email protected]; [email protected]; [email protected]; Li, Zhuangzhi; Li, Fei
Subject: Re: [PATCH] ACPI / osl: implement acpi_os_sleep() with msleep()

Quoted 3 lines · Chuansheng Liu

Currently the acpi_os_sleep() is using the schedule_timeout_interruptible(), which can be interrupted by signal, which causes the real sleep time is

shorter.

Quoted 5 lines

According to the ACPI spec:
The Sleep term is used to implement long-term timing requirements. Execution is delayed for at least the required number of milliseconds.

Quoted 6 lines
Quoted 4 lines

The sleeping time should be at least of the required number msecs, here using msleep() to implement it.

Also if the real time is shorter, we meet the device POWER ON issue.

What exactly is the "power on" issue?

The case is we have one device _PS0 method in platform.asl like below:
Write the pmcsr REG to power on;
Sleep 10ms;
Read some registers;
...

Here sometimes the actual sleeping time is < 10ms, it causes the following actions failed due this device need 10ms to power on successfully.

Quoted 29 lines

Rafael

drivers/acpi/osl.c acpi_status acpi_os_remove_interrupt_handler(u32

Quoted 12 lines
---
 drivers/acpi/osl.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/acpi/osl.c +0 -0
index e5f416c..b1629b5 100644
@@ -820,7 +820,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32

irq, acpi_osd_handler handler)

drivers/acpi/osl.c acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)

Quoted 9 lines
drivers/acpi/osl.c +1 -1
 void acpi_os_sleep(u64 ms)
 {
-	schedule_timeout_interruptible(msecs_to_jiffies(ms));
+	msleep(ms);
 }
 
 void acpi_os_stall(u32 us)
 

--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

#3 lore raw
Quoted 32 lines · Chuansheng

Hello Rafael,

Quoted 18 lines

-----Original Message-----
From: Rafael J. Wysocki [mailto:[email protected]]
Sent: Wednesday, September 11, 2013 8:37 PM
To: Liu, Chuansheng
Cc: [email protected]; [email protected]; [email protected]; Li, Zhuangzhi; Li, Fei
Subject: Re: [PATCH] ACPI / osl: implement acpi_os_sleep() with msleep()

Quoted 3 lines · Chuansheng Liu

Currently the acpi_os_sleep() is using the schedule_timeout_interruptible(), which can be interrupted by signal, which causes the real sleep time is

shorter.

Quoted 5 lines

According to the ACPI spec:
The Sleep term is used to implement long-term timing requirements. Execution is delayed for at least the required number of milliseconds.

Quoted 6 lines
Quoted 4 lines

The sleeping time should be at least of the required number msecs, here using msleep() to implement it.

Also if the real time is shorter, we meet the device POWER ON issue.

What exactly is the "power on" issue?

The case is we have one device _PS0 method in platform.asl like below:
Write the pmcsr REG to power on;
Sleep 10ms;
Read some registers;
...

Quoted 3 lines

Here sometimes the actual sleeping time is < 10ms, it causes the following actions failed due this device
need 10ms to power on successfully.

I see.

OK, I'll queue up your patch for 3.13.

Thanks,
Rafael