ACPICA: don't cond_resched() when irq_disabled or in_atomic
Subsystems (2)
PATCH 1/1 ACPICA: don't cond_resched() when irq_disabled or in_atomic
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't cond_resched when irq_disabled. But recent commit 138d156 changes the behaviour to don't cond_resched when in_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.
The fix is to cond_sched() only when preemptible, which means not in irq_disabled or in_atomic.
--- include/acpi/platform/aclinux.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/platform/aclinux.h +1 -1
@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0)
Signature · 1 line
1.6.5.2
CC Alexey.
And this is also the fix for
http://bugzilla.kernel.org/show_bug.cgi?id=14483
thanks,
rui
Quoted 30 lines · Xiaotian Feng
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.The fix is to
cond_sched()only when preemptible, which means not inirq_disabledorin_atomic.Reported-and-bisected-by Larry Finger <[email protected]>Signed-off-by Xiaotian Feng <[email protected]>--- include/acpi/platform/aclinux.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/platform/aclinux.h +1
-1@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0)
Quoted 45 lines · Zhang Rui
CC Alexey.
And this is also the fix for
http://bugzilla.kernel.org/show_bug.cgi?id=14483thanks,
ruiQuoted 22 lines · Xiaotian Feng
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.The fix is to
cond_sched()only when preemptible, which means not inirq_disabledorin_atomic.Reported-and-bisected-by Larry Finger <[email protected]>Signed-off-by Xiaotian Feng <[email protected]>--- include/acpi/platform/aclinux.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/platform/aclinux.h +0
-0include/acpi/platform/aclinux.h static inline void *acpi_os_acquire_object(acpi_cache_t * cache) · line 158
Quoted 8 lines
include/acpi/platform/aclinux.h +1
-1@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0)--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 33 lines · Xiaotian Feng
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.The fix is to
cond_sched()only when preemptible, which means not inirq_disabledorin_atomic.Reported-and-bisected-by Larry Finger <[email protected]>Signed-off-by Xiaotian Feng <[email protected]>---
include/acpi/platform/aclinux.h | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/platform/aclinux.h +1
-2@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache) #include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT() \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0) --1.6.5.2
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
looks good
kernel compiled without any issues,
echo mem > /sys/power/state
reported no warning message.
Also if you don't mind add:
Id like to get some kind of credit for this b*tch.
Signature · 5 lines
Justin P. Mattock -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 46 lines · Justin Mattock
Quoted 33 lines · Xiaotian Feng
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.The fix is to
cond_sched()only when preemptible, which means not inirq_disabledorin_atomic.Reported-and-bisected-by Larry Finger<[email protected]>Signed-off-by Xiaotian Feng<[email protected]>--- include/acpi/platform/aclinux.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/platform/aclinux.h +1
-2@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0) --1.6.5.2
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/looks good
kernel compiled without any issues,
echo mem>/sys/power/state
reported no warning message.
Quoted 3 lines
Also if you don't mind add:
Reported-and-bisected-by Justin P. Mattock<[email protected]>
Sure, sorry for I had missed thread for
http://bugzilla.kernel.org/show_bug.cgi?id=14483
Quoted 2 lines
Id like to get some kind of credit for this b*tch.
Quoted 50 lines · Danny Feng
Quoted 49 lines · Justin Mattock
Quoted 35 lines · Xiaotian Feng
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.The fix is to
cond_sched()only when preemptible, which means not inirq_disabledorin_atomic.Reported-and-bisected-by Larry Finger<[email protected]>Signed-off-by Xiaotian Feng<[email protected]>---
include/acpi/platform/aclinux.h| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/platform/aclinux.h +1
-2@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0) --1.6.5.2
Quoted 7 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/looks good
kernel compiled without any issues,
echo mem>/sys/power/state
reported no warning message.
Quoted 11 lines
Quoted 3 lines
Also if you don't mind add:
Reported-and-bisected-by Justin P. Mattock<[email protected]>Sure, sorry for I had missed thread for
http://bugzilla.kernel.org/show_bug.cgi?id=14483
Quoted 2 lines
Id like to get some kind of credit for this b*tch.
no worries.. I'll run
my system with this change to see if anything happens.
As for the bug, leave it open until this makes it's way into the main kernel, then rafael can close it
Justin P. Mattock
Quoted 58 lines · Justin P. Mattock
Quoted 57 lines · Danny Feng
Quoted 49 lines · Justin Mattock
Quoted 42 lines · Xiaotian Feng
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.The fix is to
cond_sched()only when preemptible, which means not inirq_disabledorin_atomic.Reported-and-bisected-by Larry Finger<[email protected]>Signed-off-by Xiaotian Feng<[email protected]>---
include/acpi/platform/aclinux.h| 2 +-1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/platform/aclinux.h +1
-1@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0)Signature · 9 lines
-- 1.6.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/looks good
kernel compiled without any issues,
echo mem>/sys/power/state
reported no warning message.Quoted 3 lines
Also if you don't mind add:
Reported-and-bisected-by Justin P. Mattock<[email protected]>Sure, sorry for I had missed thread for
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
Id like to get some kind of credit for this b*tch.
no worries.. I'll run
my system with this change to see if anything happens.
Any feedbacks?
Regards
Xiaotian
Quoted 7 lines
As for the bug, leave it open until this makes it's way into the main kernel, then rafael can close it
Justin P. Mattock
Quoted 12 lines · Xiaotian Feng
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.The fix is to
cond_sched()only when preemptible, which means not inirq_disabledorin_atomic.
include/acpi/platform/aclinux.h static inline void *acpi_os_acquire_object(acpi_cache_t * cache) · line 157
Quoted 7 lines
include/acpi/platform/aclinux.h +1
-1@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0)
Note that this is ugly as hell. It means we have two acpi interpretters in kernel, one for preemptible, one for non-preemptible, with very different behaviour.
It would be slightly nicer to pass the "preemptible" info explicitely, as function parameters.
It would be even better not to need that difference.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
PATCH 1/1 acpi: don't cond_resched if irq is disabled
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't cond_resched when irq_disabled. But recent commit 138d156 changes the behaviour to don't cond_resched when in_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.
This patch also fixes http://bugzilla.kernel.org/show_bug.cgi?id=14483
--- include/acpi/platform/aclinux.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/acpi/platform/aclinux.h +1 -1
@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (!in_atomic_preempt_off() && !irqs_disabled()) \ cond_resched(); \ } while (0)
Signature · 1 line
1.6.5.2
Re: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Hi Xiaotian,
I think, this is another round of "armor vs. bullet" race... It will hold until might_sleep() logic changes again.
Please consider using preemptible() -- IMHO this is the check we should perform in our case of voluntary preemption.
Regards,
Alex.
Xiaotian Feng пишет:
Quoted 27 lines
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.This patch also fixes http://bugzilla.kernel.org/show_bug.cgi?id=14483
Reported-and-bisected-by Larry Finger <[email protected]>Reported-and-bisected-by Justin P. Mattock <[email protected]>Signed-off-by Xiaotian Feng <[email protected]>Cc Len Brown <[email protected]>Cc Bob Moore <[email protected]>Cc Lin Ming <[email protected]>Cc Alexey Starikovskiy <[email protected]>Cc Pavel Machek <[email protected]>--- include/acpi/platform/aclinux.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/acpi/platform/aclinux.h +0
-0
include/acpi/platform/aclinux.h static inline void *acpi_os_acquire_object(acpi_cache_t * cache) · line 158
Quoted 8 lines
include/acpi/platform/aclinux.h +1
-1@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (!in_atomic_preempt_off() && !irqs_disabled()) \ cond_resched(); \ } while (0)
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Quoted 7 lines · Alexey Starikovskiy
Hi Xiaotian,
I think, this is another round of "armor vs. bullet" race... It will hold until
might_sleep()logic changes again.Please consider using
preemptible()-- IMHO this is the check we should perform in our case of voluntary preemption.
preemptible() may not work here because it always returns 0 for non-preemptible kernel.
#ifdef CONFIG_PREEMPT
# define preemptible() (preempt_count() == 0 && !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else # define preemptible() 0 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endif
Lin Ming
Quoted 28 lines
Regards,
Alex.Xiaotian Feng пишет:
Quoted 22 lines
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.This patch also fixes http://bugzilla.kernel.org/show_bug.cgi?id=14483
Reported-and-bisected-by Larry Finger <[email protected]>Reported-and-bisected-by Justin P. Mattock <[email protected]>Signed-off-by Xiaotian Feng <[email protected]>Cc Len Brown <[email protected]>Cc Bob Moore <[email protected]>Cc Lin Ming <[email protected]>Cc Alexey Starikovskiy <[email protected]>Cc Pavel Machek <[email protected]>--- include/acpi/platform/aclinux.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 14 lines
include/acpi/platform/aclinux.h static inline void *acpi_os_acquire_object(acpi_cache_t * cache) · line 158
Quoted 13 lines
include/acpi/platform/aclinux.h +1
-1@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (!in_atomic_preempt_off() && !irqs_disabled()) \ cond_resched(); \ } while (0)
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Lin Ming пишет:
Quoted 11 lines · Alexey Starikovskiy
Quoted 7 lines
Hi Xiaotian,
I think, this is another round of "armor vs. bullet" race... It will hold until
might_sleep()logic changes again.Please consider using
preemptible()-- IMHO this is the check we should perform in our case of voluntary preemption.
preemptible()may not work here because it always returns 0 for non-preemptible kernel.
Right, and it means that this machine does not care about low latency that much. The reason we introduced the preemption point in the first place, was unacceptable latency due to very long AML methods on some machines. We don't need this preemption point for normal operation, this is exactly what voluntary preemption does -- allows those in hurry to pass by. If there are none, fine.
Quoted 9 lines
#ifdef
CONFIG_PREEMPT# define preemptible() (preempt_count() == 0 && !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else # define preemptible() 0 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endif
Regards,
Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Quoted 10 lines · Alexey Starikovskiy
Lin Ming ??????????:
Quoted 9 lines · Alexey Starikovskiy
Quoted 7 lines
Hi Xiaotian,
I think, this is another round of "armor vs. bullet" race... It will hold until
might_sleep()logic changes again.Please consider using
preemptible()-- IMHO this is the check we should perform in our case of voluntary preemption.
Quoted 15 lines
Quoted 2 lines
preemptible()may not work here because it always returns 0 for non-preemptible kernel.Right, and it means that this machine does not care about low latency that much. The reason we introduced the preemption point in the first place, was unacceptable latency due to very long AML methods on some machines. We don't need this preemption point for normal operation, this is exactly what voluntary preemption does -- allows those in hurry to pass by. If there are none, fine.
Quoted 8 lines
#ifdef
CONFIG_PREEMPT# define preemptible() (preempt_count() == 0 && !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else # define preemptible() 0 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endif
Well, normally we want low latency even for !CONFIG_PREEMPT kernels.
Actually, explicit preemption points are NOPs for CONFIG_PREEMPT kernels, right?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Pavel Machek пишет:
Quoted 32 lines · Alexey Starikovskiy
Quoted 13 lines
Lin Ming ??????????:
Quoted 10 lines · Alexey Starikovskiy
Quoted 9 lines
Hi Xiaotian,
I think, this is another round of "armor vs. bullet" race... It will hold until
might_sleep()logic changes again.Please consider using
preemptible()-- IMHO this is the check we should perform in our case of voluntary preemption.Quoted 17 lines
Quoted 3 lines
preemptible()may not work here because it always returns 0 for non-preemptible kernel.Right, and it means that this machine does not care about low latency that much. The reason we introduced the preemption point in the first place, was unacceptable latency due to very long AML methods on some machines. We don't need this preemption point for normal operation, this is exactly what voluntary preemption does -- allows those in hurry to pass by. If there are none, fine.
Quoted 8 lines
#ifdef
CONFIG_PREEMPT# define preemptible() (preempt_count() == 0 && !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else # define preemptible() 0 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endif
Quoted 6 lines
Well, normally we want low latency even for !CONFIG_PREEMPT kernels.
Actually, explicit preemption points are NOPs for
CONFIG_PREEMPTkernels, right?
Pavel
Right. Do you have code?
Thanks,
Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
If there are none, fine.
Quoted 8 lines
#ifdef
CONFIG_PREEMPT# define preemptible() (preempt_count() == 0 && !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else # define preemptible() 0 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endif
Quoted 6 lines
Quoted 4 lines
Well, normally we want low latency even for !CONFIG_PREEMPT kernels.
Actually, explicit preemption points are NOPs for
CONFIG_PREEMPTkernels, right?Right. Do you have code?
I'd prefer to spend my time with patches to areas that actually do take cleanup patches.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Quoted 14 lines · Pavel Machek
Quoted 14 lines
Quoted 14 lines
Quoted 11 lines
If there are none, fine.
Quoted 8 lines
#ifdef
CONFIG_PREEMPT# define preemptible() (preempt_count() == 0&& !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else # define preemptible() 0 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endifWell, normally we want low latency even for !CONFIG_PREEMPT kernels.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Actually, explicit preemption points are NOPs for
CONFIG_PREEMPTkernels, right?Right. Do you have code?
I'd prefer to spend my time with patches to areas that actually do take cleanup patches.
What's the status of this now? We can still see the sleeping function call warning or enable irq at resume stage. If acpi wants low latency even for !CONFIG_PREEMPT kernels, what's wrong with V2 patch?
We should not set any preemption points in irq or atomic. Since we have a simple fix, and it did fix bugs, why should we make things more complex?
Quoted 1 line
Pavel
Re: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Xiaotian Feng пишет:
Quoted 23 lines · Pavel Machek
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 11 lines
If there are none, fine.
Quoted 8 lines
#ifdef
CONFIG_PREEMPT# define preemptible() (preempt_count() == 0&& !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1) #else # define preemptible() 0 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET #endifWell, normally we want low latency even for !CONFIG_PREEMPT kernels.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Actually, explicit preemption points are NOPs for
CONFIG_PREEMPTkernels, right?Right. Do you have code?
I'd prefer to spend my time with patches to areas that actually do take cleanup patches.
Quoted 8 lines
What's the status of this now? We can still see the sleeping function call warning or enable irq at resume stage.
If acpi wants low latency even for !CONFIG_PREEMPT kernels, what's wrong with V2 patch?We should not set any preemption points in irq or atomic. Since we have a simple fix, and it did fix bugs, why should
we make things more complex?
We should not do anything complex here, you are right. Consider me ACK your patch.
Thanks,
Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Len Brown
reviewerRe: [PATCH -V2] acpi: don't cond_resched if irq is disabled
Quoted 7 lines · Alexey Starikovskiy
Xiaotian Feng пишет:
Quoted 5 lines
What's the status of this now? We can still see the sleeping function call warning or enable irq at resume stage.
If acpi wants low latency even for !CONFIG_PREEMPT kernels, what's wrong with V2 patch?
Quoted 6 lines
Quoted 3 lines
We should not set any preemption points in irq or atomic. Since we have a simple fix, and it did fix bugs, why should
we make things more complex?We should not do anything complex here, you are right. Consider me ACK your patch.
This patch has been in the acpi-test tree for a while and I'll push it upstream with the next batch.
thanks,
Len Brown, Intel Open Source Technology Center
Hi Pavel,
Please elaborate... Your comments "ugly as hell" are too often to be specific...
There is only one use of ACPI_PREEMPTION_POINT(), and it is in the ACPICA code,
which we all agreed to keep OS independent, thus the need for #define. Do you see any other way to add preemption point without introducing Linux-specific
code into ACPICA?
Thanks,
Alex.
Pavel Machek пишет:
Quoted 27 lines · Xiaotian Feng
Quoted 13 lines
commit 8bd108d adds preemption point after each opcode parse, then a sleeping function called from invalid context bug was founded during suspend/resume stage. this was fixed in commit abe1dfa by don't
cond_reschedwhenirq_disabled. But recent commit 138d156 changes the behaviour to don'tcond_reschedwhenin_atomic. This makes the sleeping function called from invalid context bug happen again, which is reported in http://lkml.org/lkml/2009/12/1/371.The fix is to
cond_sched()only when preemptible, which means not inirq_disabledorin_atomic.include/acpi/platform/aclinux.h static inline void *acpi_os_acquire_object(acpi_cache_t * cache) · line 158
Quoted 8 lines
include/acpi/platform/aclinux.h +1
-1@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)#include <linux/hardirq.h> #define ACPI_PREEMPTION_POINT () \ do { \ - if (!in_atomic_preempt_off()) \ + if (preemptible()) \ cond_resched(); \ } while (0)Note that this is ugly as hell. It means we have two acpi interpretters in kernel, one for preemptible, one for non-preemptible, with very different behaviour.
Quoted 7 lines
It would be slightly nicer to pass the "preemptible" info explicitely, as function parameters.
It would be even better not to need that difference.
Pavel
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Alexey Starikovskiy
Hi Pavel,
Please elaborate... Your comments "ugly as hell" are too often to be specific...
There is only one use ofACPI_PREEMPTION_POINT(), and it is in the ACPICA code,
which we all agreed to keep OS independent, thus the need for #define. Do you see any other way to add preemption point without introducing Linux-specific
code into ACPICA?
I believe we want linux-specific code in acpica at this point.
(Or maybe... I guess other systems have concept of preemption and not all actions are permitted from all contexts, so maybe something like that would be important for them, too?)
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Pavel Machek пишет:
Quoted 14 lines · Alexey Starikovskiy
Quoted 12 lines
Hi Pavel,
Please elaborate... Your comments "ugly as hell" are too often to be specific...
There is only one use ofACPI_PREEMPTION_POINT(), and it is in the ACPICA code,
which we all agreed to keep OS independent, thus the need for #define. Do you see any other way to add preemption point without introducing Linux-specific
code into ACPICA?
Quoted 3 lines
I believe we want linux-specific code in acpica at this point.
The point there we call cond_resched() in ACPICA is an interpreter parse loop. This parse loop may be executed from within atomic context and even with interrupts off. In this case, cond_resched() should not be called to not makemight_sleep() guards angry.
Please post the code, which will do the above and will not look "ugly as hell".
I still don't follow your vague comments.
Quoted 4 lines
(Or maybe... I guess other systems have concept of preemption and not all actions are permitted from all contexts, so maybe something like that would be important for them, too?)
None of them cared about it up to this point.
With the macro above we allowed them to follow Linux, but to go or not is their call.
Regards,
Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 35 lines · Alexey Starikovskiy
Pavel Machek пишет:
Quoted 14 lines · Alexey Starikovskiy
Quoted 12 lines
Hi Pavel,
Please elaborate... Your comments "ugly as hell" are too often to be specific...
There is only one use ofACPI_PREEMPTION_POINT(), and it is in the ACPICA code,
which we all agreed to keep OS independent, thus the need for #define. Do you see any other way to add preemption point without introducing Linux-specific
code into ACPICA?Quoted 3 lines
I believe we want linux-specific code in acpica at this point.
The point there we call
cond_resched()in ACPICA is an interpreter parse loop. This parse loop may be executed from within atomic context and even with interrupts off. In this case,cond_resched()should not be called to not makemight_sleep()guards angry.Please post the code, which will do the above and will not look "ugly as hell".
I still don't follow your vague comments.Quoted 4 lines
(Or maybe... I guess other systems have concept of preemption and not all actions are permitted from all contexts, so maybe something like that would be important for them, too?)
None of them cared about it up to this point.
With the macro above we allowed them to follow Linux, but to go or not is their call.
Quoted 8 lines
Regards,
Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
o.k. I went did a pull to update
the kernel, and then changedaclinux.h to the above post.
I'm am not seeing this warning message
upon wake-up.
but with the acpi merge stuff withacpi_walk_namespace seems to break nvidia
(nvidia's problem now)
there is also some thing where the machine
takes a good 30 secs or so to wake up
(not sure if this is from the updated patch)
in dmesg I see:
platform microcode: firmware requesting intel-ucode/06-17-0a firmware microcode: parent mocrocode should not be sleeping.
I'm thinking I need something in /lib/firmare
Justin P. Mattock
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Let me know when you guys have finalized any changes to aclinux.h, and I will update this file in the base ACPICA code.
Bob
Quoted 70 lines
-----Original Message-----
From: Justin P. Mattock [mailto:[email protected]]
Sent: Thursday, December 10, 2009 2:46 PM
To: Alexey Starikovskiy
Cc: Pavel Machek; Xiaotian Feng; [email protected]; Lin, Ming M; Moore, Robert; [email protected]; [email protected]
Subject: Re: [PATCH] ACPICA: don'tcond_resched()whenirq_disabledorin_atomicQuoted 31 lines · Alexey Starikovskiy
Pavel Machek пишет:
Quoted 14 lines · Alexey Starikovskiy
Quoted 12 lines
Hi Pavel,
Please elaborate... Your comments "ugly as hell" are too often to be specific...
There is only one use ofACPI_PREEMPTION_POINT(), and it is in the ACPICA code,
which we all agreed to keep OS independent, thus the need for #define. Do you see any other way to add preemption point without introducing Linux-specific
code into ACPICA?Quoted 3 lines
I believe we want linux-specific code in acpica at this point.
The point there we call
cond_resched()in ACPICA is an interpreter parse loop. This parse loop may be executed from within atomic context and even with interrupts off. In this case,cond_resched()should not be called to not makemight_sleep()guards angry.Please post the code, which will do the above and will not look "ugly as hell".
I still don't follow your vague comments.Quoted 4 lines
(Or maybe... I guess other systems have concept of preemption and not all actions are permitted from all contexts, so maybe something like that would be important for them, too?)
Quoted 8 lines
None of them cared about it up to this point.
With the macro above we allowed them to follow Linux, but to go or not is their call.Regards,
Alex.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel"in
Quoted 4 lines
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/o.k. I went did a pull to update
the kernel, and then changedaclinux.hto the above post.I'm am not seeing this warning message
upon wake-up.
but with the acpi merge stuff withacpi_walk_namespaceseems to break nvidia
(nvidia's problem now)there is also some thing where the machine
takes a good 30 secs or so to wake up
(not sure if this is from the updated patch)
in dmesg I see:
Quoted 6 lines
platform microcode: firmware requesting intel-ucode/06-17-0a firmware microcode: parent mocrocode should not be sleeping.
I'm thinking I need something in
/lib/firmareJustin P. Mattock
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Len Brown
reviewerQuoted 1 line · Robert
Let me know when you guys have finalized any changes to
aclinux.h, and I will update this file in the base ACPICA code.
I think the v2 patch will go upstream.
Not super-critical to have ACPICA sync with Linux's aclinux.h, since Linux has it already, but good hygine, I guess.
thanks,
-Len Brown, Intel Open Source Technology Center
Quoted 15 lines · Alexey Starikovskiy
Pavel Machek ??????????:
Quoted 14 lines · Alexey Starikovskiy
Quoted 12 lines
Hi Pavel,
Please elaborate... Your comments "ugly as hell" are too often to be specific...
There is only one use ofACPI_PREEMPTION_POINT(), and it is in the ACPICA code,
which we all agreed to keep OS independent, thus the need for #define. Do you see any other way to add preemption point without introducing Linux-specific
code into ACPICA?
Quoted 8 lines
Quoted 3 lines
I believe we want linux-specific code in acpica at this point.
The point there we call
cond_resched()in ACPICA is an interpreter parse loop. This parse loop may be executed from within atomic context and even with interrupts off. In this case,cond_resched()should not be called to not makemight_sleep()guards angry.
Yes, so pass explicit argument to the interpretter, telling it what kind of context it runs on. Similar to kmalloc's GFP_KERNEL vs. GFP_ATOMIC.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html