radeon: Use mdelay() instead of msleep() in atom_op_delay().
Subsystems (2)
PATCH 1/1 radeon: Use mdelay() instead of msleep() in atom_op_delay().
From: Michel Dänzer <[email protected]>
It can be called from atomic context, e.g. when switching to console for panic output.
--- drivers/gpu/drm/radeon/atom.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/atom.c +1 -1
@@ -666,7 +666,7 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)if (arg ==ATOM_UNIT_MICROSEC )udelay (count);else -msleep (count); +mdelay (count); }static void atom_op_div (atom_exec_context *ctx,int *ptr,int arg)
Signature · 6 lines
1.7.7.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · On Tue, 3 Jan 2012 19:04:00 +0100 Michel Dänzer <[email protected]> wrote:
From: Michel Dänzer <[email protected]>
It can be called from atomic context, e.g. when switching to console for panic output.
Is this only special cases like a panic - if so can it not be called in a way that distinguishes between normality and nasty cases. mS plus spin loops are horrendous for anyone trying to do real time, or even for keeping the clock straight.
Quoted 10 lines · Alan Cox
Quoted 4 lines · On Tue, 3 Jan 2012 19:04:00 +0100 Michel Dänzer <[email protected]> wrote:
From: Michel Dänzer <[email protected]>
It can be called from atomic context, e.g. when switching to console for panic output.
Is this only special cases like a panic - if so can it not be called in a way that distinguishes between normality and nasty cases.
No idea, to be honest. It's an ATOM BIOS interpreter opcode, so in theory it could be indirectly called from anywhere that uses ATOM BIOS.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines · On Tue, 03 Jan 2012 19:25:46 +0100 Michel Dänzer <[email protected]> wrote:
Quoted 5 lines · Alan Cox
Quoted 2 lines · On Tue, 3 Jan 2012 19:04:00 +0100 Michel Dänzer <[email protected]> wrote:
From: Michel Dänzer <[email protected]>
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
It can be called from atomic context, e.g. when switching to console for panic output.
Is this only special cases like a panic - if so can it not be called in a way that distinguishes between normality and nasty cases.
No idea, to be honest. It's an ATOM BIOS interpreter opcode, so in theory it could be indirectly called from anywhere that uses ATOM BIOS.
So lets stick to practice, and the real world. Screwing up everything else because of a crappy problem in your Atom BIOS code sucks but hey it happens. screwing up everything because of a theoretical concern is just dumb.
I would start by making it some kind of context flag for your interpreter and making people involve the interpreter with a different function call if they can't sleep. At that point you'll be able to define the problem in the real kernel, document the rule and spot further people trying to jump off cliffs before they do.
Alan
Quoted 14 lines · Alan Cox
Quoted 12 lines · On Tue, 03 Jan 2012 19:25:46 +0100 Michel Dänzer <[email protected]> wrote:
Quoted 10 lines · Alan Cox
Quoted 4 lines · On Tue, 3 Jan 2012 19:04:00 +0100 Michel Dänzer <[email protected]> wrote:
From: Michel Dänzer <[email protected]>
It can be called from atomic context, e.g. when switching to console for panic output.
Is this only special cases like a panic - if so can it not be called in a way that distinguishes between normality and nasty cases.
Quoted 7 lines
Quoted 2 lines
No idea, to be honest. It's an ATOM BIOS interpreter opcode, so in theory it could be indirectly called from anywhere that uses ATOM BIOS.
So lets stick to practice, and the real world. Screwing up everything else because of a crappy problem in your Atom BIOS code sucks but hey it happens. screwing up everything because of a theoretical concern is just dumb.
Thanks for the flowers, but it's not just a theoretical concern, see the bug report.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines
Quoted 4 lines
So lets stick to practice, and the real world. Screwing up everything else because of a crappy problem in your Atom BIOS code sucks but hey it happens. screwing up everything because of a theoretical concern is just dumb.
Thanks for the flowers, but it's not just a theoretical concern, see the bug report.
The bug report is a single specific case. Figure out the calling paths afflicted by it, don't be lazy and just dump on everyone on every path because of a special case you apparently can't be bothered to root cause.
Alan
Dave Airlie
maintainer2012/1/4 Alan Cox <[email protected]>:
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
So lets stick to practice, and the real world. Screwing up everything else because of a crappy problem in your Atom BIOS code sucks but hey it happens. screwing up everything because of a theoretical concern is just dumb.
Quoted 8 lines
Quoted 2 lines
Thanks for the flowers, but it's not just a theoretical concern, see the bug report.
The bug report is a single specific case. Figure out the calling paths afflicted by it, don't be lazy and just dump on everyone on every path because of a special case you apparently can't be bothered to root cause.
I'm not sure what we'd gain by passing the atomic context information in from the top of the atom interpreter and using it in this one place vs getting the atomic info in this one place.
Every modesetting operation can happen in atomic context or not in atomic context, thanks to the wonder of oops printing and also kgdb, trying to figure out which table in this one person's bios is the "root" cause and special casing for it is insane since tomorrow 20 other BIOSes could contain that table or a new variant we haven't seen before.
Unless one of us is totally misinterpreting what the other is saying or what the atombios interpreter is.
Dave.
Quoted 9 lines
Every modesetting operation can happen in atomic context or not in atomic context, thanks to the wonder of oops printing and also kgdb, trying to figure out which table in this one person's bios is the "root" cause and special casing for it is insane since tomorrow 20 other BIOSes could contain that table or a new variant we haven't seen before.
Unless one of us is totally misinterpreting what the other is saying or what the atombios interpreter is.
Its a sort of bytecode engine that allows the BIOS to describe to the OS how the GPU should be handled. So what we want to avoid is accidentally having some other path become spinlock based due to a random unrelated change and ending up doing 20mS spinning delays without us getting a warning.
Explicitly calling out that mode setting does this isn't a big deal - we don't modeset often while doing stuff that is latency sensitive (gaming, live music, telephony, etc) and if you have the in_atomic check as well we'd probably only hit it on panic().
The problem is if we just band-aid it without doing this it will (and always has) ended in tears later.
So as per the other mail all I'm really saying is we want something like
radeon_atom_mode_atomic_begin(rdev)
{
rdev->mode_info.atom_context->atomic = 1;
}
radeon_atom_mode_atomic_end(rdev)
{
rdev->mode_info.atom_context->atomic = 0;
}
/* above maybe with sanity checks to stop missed ones */
and to do
else {
if (!in_atomic())
msleep(count);
else {
WARN_ON(!ctx->atomic);
mdelay(count);
}
}so that we know it isn't getting hit in places we've not carefully considered the impact of a huge stall.
Alan
Dave Airlie
maintainer2012/1/3 Michel Dänzer <[email protected]>:
Quoted 6 lines
From: Michel Dänzer <[email protected]>
It can be called from atomic context, e.g. when switching to console for panic output.
I wonder how ugly it would be to check for atomic context or not, mdelay is quite a long busy delay to take a CPU, esp wrt to async driver loading stuff.
Dave.
Quoted 9 lines · Dave Airlie
2012/1/3 Michel Dänzer <[email protected]>:
Quoted 6 lines
From: Michel Dänzer <[email protected]>
It can be called from atomic context, e.g. when switching to console for panic output.
I wonder how ugly it would be to check for atomic context or not,
So do I. :) The comment in include/linux/hardirq.h that ends in 'Do not use in_atomic() in driver code.' sounds rathery scary...
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines · Michel Dänzer
Quoted 6 lines · Dave Airlie
2012/1/3 Michel Dänzer <[email protected]>:
Quoted 5 lines
From: Michel Dänzer <[email protected]>
It can be called from atomic context, e.g. when switching to console for panic output.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I wonder how ugly it would be to check for atomic context or not,
So do I. :) The comment in
include/linux/hardirq.hthat ends in 'Do not usein_atomic()in driver code.' sounds rathery scary...
We already use in_atomic checks in similar delay code in drm/i915 for the same reasons. I think the ugly mess that results from the panic notifier calling into kms code is justification enough to neglect the the comment about not using in_atomic in drivers.
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Michel Dänzer
Quoted 9 lines · Dave Airlie
2012/1/3 Michel Dänzer <[email protected]>:
Quoted 6 lines
From: Michel Dänzer <[email protected]>
It can be called from atomic context, e.g. when switching to console for panic output.
I wonder how ugly it would be to check for atomic context or not,
Quoted 7 lines
Quoted 2 lines
So do I. :) The comment in
include/linux/hardirq.hthat ends in 'Do not usein_atomic()in driver code.' sounds rathery scary...We already use
in_atomicchecks in similar delay code in drm/i915 for the same reasons. I think the ugly mess that results from the panic notifier calling into kms code is justification enough to neglect the the comment about not usingin_atomicin drivers.
Okay, v2 sent.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/1 radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
In reply to Michel DänzerFrom: Michel Dänzer <[email protected]>
It can be the case e.g. when switching to console for panic output.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
---
v2: Still call msleep() in the normal case. Only compile tested.
drivers/gpu/drm/radeon/atom.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/atom.c +2 -0
@@ -665,6 +665,8 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)SDEBUG (" count: %d\n" , count);if (arg ==ATOM_UNIT_MICROSEC )udelay (count); +else if (in_interrupt () ||irqs_disabled () ||in_atomic ()) +mdelay (count);else msleep (count); }
Signature · 6 lines
1.7.7.3 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
Quoted 19 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
It can be the case e.g. when switching to console for panic output.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
Signed-off-by Michel Dänzer <[email protected]>---
v2: Still call
msleep()in the normal case. Only compile tested.drivers/gpu/drm/radeon/atom.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/gpu/drm/radeon/atom.c +0
-0
drivers/gpu/drm/radeon/atom.c static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) · line 669
Quoted 5 lines
drivers/gpu/drm/radeon/atom.c +2
-0@@ -665,6 +665,8 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)SDEBUG (" count: %d\n" , count);if (arg ==ATOM_UNIT_MICROSEC )udelay (count); +else if (in_interrupt () ||irqs_disabled () ||in_atomic ()) +mdelay (count);
Afaics in_atomic subsumes in_interrupt. irqs_disabled looks like a nice addition to cover up the !CONFIG_PREEMPT case. i915 (in intel_drv.h) also checks for in_dbg_master() to take care of kdbg.
Can I bother you to create a small helper like in_atomic_kms_context that checks these three things (and also use it in drm/i915)?
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
Quoted 30 lines · Daniel Vetter
Quoted 19 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
It can be the case e.g. when switching to console for panic output.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
Signed-off-by Michel Dänzer <[email protected]>---
v2: Still call
msleep()in the normal case. Only compile tested.drivers/gpu/drm/radeon/atom.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/gpu/drm/radeon/atom.c +0
-0drivers/gpu/drm/radeon/atom.c static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) · line 669
Quoted 5 lines
drivers/gpu/drm/radeon/atom.c +2
-0@@ -665,6 +665,8 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)SDEBUG (" count: %d\n" , count);if (arg ==ATOM_UNIT_MICROSEC )udelay (count); +else if (in_interrupt () ||irqs_disabled () ||in_atomic ()) +mdelay (count);Afaics
in_atomicsubsumesin_interrupt.irqs_disabledlooks like a nice addition to cover up the !CONFIG_PREEMPT case. i915 (inintel_drv.h) also checks forin_dbg_master()to take care of kdbg.
Quoted 2 lines
Can I bother you to create a small helper like
in_atomic_kms_contextthat checks these three things (and also use it in drm/i915)?
Sorry, I've already spent way more time on this than I meant to, and Alan just killed what little motivation I still had to spend more.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
Quoted 31 lines · Michel Dänzer
Quoted 30 lines · Daniel Vetter
Quoted 19 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
It can be the case e.g. when switching to console for panic output.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
Signed-off-by Michel Dänzer <[email protected]>---
v2: Still call
msleep()in the normal case. Only compile tested.drivers/gpu/drm/radeon/atom.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/gpu/drm/radeon/atom.c +0
-0drivers/gpu/drm/radeon/atom.c static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) · line 669
Quoted 5 lines
drivers/gpu/drm/radeon/atom.c +2
-0@@ -665,6 +665,8 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)SDEBUG (" count: %d\n" , count);if (arg ==ATOM_UNIT_MICROSEC )udelay (count); +else if (in_interrupt () ||irqs_disabled () ||in_atomic ()) +mdelay (count);Afaics
in_atomicsubsumesin_interrupt.irqs_disabledlooks like a nice addition to cover up the !CONFIG_PREEMPT case. i915 (inintel_drv.h) also checks forin_dbg_master()to take care of kdbg.
Quoted 5 lines
Quoted 2 lines
Can I bother you to create a small helper like
in_atomic_kms_contextthat checks these three things (and also use it in drm/i915)?Sorry, I've already spent way more time on this than I meant to, and Alan just killed what little motivation I still had to spend more.
I think Alan's simply wrong. The msleep checks in i915 are only used for two cases:
- when using kdbg
- when displaying a panic
Afaics radeon has the exact same issue, at least I've seen my radeon machine here go down after an oops. Splattering the entire driver for these two corner cases which don't happen at all under normal circumstances is imho utter nonsense.
I.e. I'd be very happy to smash a r-b onto your patch if you unifiy the magical checks with i915 in a common function and add a small comment. Does the prospect of an up-front r-b and me promising to harass Dave to merge it restore your motivation?
Cheers, Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
Quoted 47 lines · Daniel Vetter
Quoted 31 lines · Michel Dänzer
Quoted 30 lines · Daniel Vetter
Quoted 19 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
It can be the case e.g. when switching to console for panic output.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43941
Signed-off-by Michel Dänzer <[email protected]>---
v2: Still call
msleep()in the normal case. Only compile tested.drivers/gpu/drm/radeon/atom.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)drivers/gpu/drm/radeon/atom.c +0
-0drivers/gpu/drm/radeon/atom.c static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg) · line 669
Quoted 5 lines
drivers/gpu/drm/radeon/atom.c +2
-0@@ -665,6 +665,8 @@ static void atom_op_delay(atom_exec_context *ctx, int *ptr, int arg)SDEBUG (" count: %d\n" , count);if (arg ==ATOM_UNIT_MICROSEC )udelay (count); +else if (in_interrupt () ||irqs_disabled () ||in_atomic ()) +mdelay (count);Afaics
in_atomicsubsumesin_interrupt.irqs_disabledlooks like a nice addition to cover up the !CONFIG_PREEMPT case. i915 (inintel_drv.h) also checks forin_dbg_master()to take care of kdbg.Quoted 5 lines
Quoted 2 lines
Can I bother you to create a small helper like
in_atomic_kms_contextthat checks these three things (and also use it in drm/i915)?Sorry, I've already spent way more time on this than I meant to, and Alan just killed what little motivation I still had to spend more.
I think Alan's simply wrong. The msleep checks in i915 are only used for two cases:
- when using kdbg
- when displaying a panic
Afaics radeon has the exact same issue, at least I've seen my radeon machine here go down after an oops. Splattering the entire driver for these two corner cases which don't happen at all under normal circumstances is imho utter nonsense.
Quoted 4 lines
I.e. I'd be very happy to smash a r-b onto your patch if you unifiy the magical checks with i915 in a common function and add a small comment. Does the prospect of an up-front r-b and me promising to harass Dave to merge it restore your motivation?
It's certainly helping. :) I'll see what I can do.
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
In reply to Daniel VetterQuoted 1 line
I think Alan's simply wrong.
In what way ? You stated this, then go on below to say what I did ?
Quoted 3 lines
Splattering the entire driver for
these two corner cases which don't happen at all under normal circumstances is imho utter nonsense.
Which is what I said
| > > Is this only special cases like a panic - if so can it not be called in a
| > > way that distinguishes between normality and nasty cases. | > | > No idea, to be honest. It's an ATOM BIOS interpreter opcode, so in | > theory it could be indirectly called from anywhere that uses ATOM
BIOS.
| So lets stick to practice, and the real world. Screwing up everything | else because of a crappy problem in your Atom BIOS code sucks but hey it | happens. screwing up everything because of a theoretical concern is just | dumb.
We don't want to do mdelays when they are not needed just because it is theoretically possible they are not needed. There are several ways to fix it, one is to stuff in_atomic() etc in the awkward spots. However if you've got something where you have lots of call points to an interface this is actually a bad idea, because you grow more insidiously, or a change elsewhere in the kernel silently turns all your sleeps into delays and things like live music work stop being doable with radeon graphics.
So the better way to fix it is to actually have an interface
atom_execute_table_atomic()
so that such situations are called out clearly, and any change elsewhere that messes it all up causes kernel spewage that can be dealt with properly - either by using _atomic if its something obscure like a panic, fixing the issue or reverting the problematic change further up the tree.
Another way to approach it would be to have
radeon_atom_atomic(rdev); radeon_atom_whateverfoo(rdev, ...) radeon_atom_atomic_end(rdev);
which set and cleared a bitflag that the mdelay/msleep opcode tested.
That's quicker to implement but a spot less clean. Again it calls out any such cases and makes them explicit. It also means any accidental changes that affect this will result in spewage and debugging not silent trashing of performance for stuff like machine control, music and some gaming.
It should only be for panic, although accel calls for printk spewage can hit in atomic context in some situations but I don't think that becomes an atombios path ?
Alan
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
Quoted 49 lines · Alan Cox
Quoted 1 line
I think Alan's simply wrong.
In what way ? You stated this, then go on below to say what I did ?
Quoted 3 lines
Splattering the entire driver for
these two corner cases which don't happen at all under normal circumstances is imho utter nonsense.Which is what I said
| > > Is this only special cases like a panic - if so can it not be called in a
| > > way that distinguishes between normality and nasty cases. | > | > No idea, to be honest. It's an ATOM BIOS interpreter opcode, so in | > theory it could be indirectly called from anywhere that uses ATOMBIOS.
| So lets stick to practice, and the real world. Screwing up everything | else because of a crappy problem in your Atom BIOS code sucks but hey it | happens. screwing up everything because of a theoretical concern is just | dumb.We don't want to do mdelays when they are not needed just because it is theoretically possible they are not needed. There are several ways to fix it, one is to stuff
in_atomic()etc in the awkward spots. However if you've got something where you have lots of call points to an interface this is actually a bad idea, because you grow more insidiously, or a change elsewhere in the kernel silently turns all your sleeps into delays and things like live music work stop being doable with radeon graphics.So the better way to fix it is to actually have an interface
atom_execute_table_atomic()so that such situations are called out clearly, and any change elsewhere that messes it all up causes kernel spewage that can be dealt with properly - either by using
_atomicif its something obscure like a panic, fixing the issue or reverting the problematic change further up the tree.Another way to approach it would be to have
radeon_atom_atomic(rdev); radeon_atom_whateverfoo(rdev, ...) radeon_atom_atomic_end(rdev);which set and cleared a bitflag that the mdelay/msleep opcode tested.
Quoted 8 lines
That's quicker to implement but a spot less clean. Again it calls out any such cases and makes them explicit. It also means any accidental changes that affect this will result in spewage and debugging not silent trashing of performance for stuff like machine control, music and some gaming.
It should only be for panic, although accel calls for printk spewage can hit in atomic context in some situations but I don't think that becomes an atombios path ?
Well, if your dear X server changed the modesetting layout we need to change it back to the kms fb layout so that we can properly display the panic. Which is done by atombios calls afaik (and in i915 has tons of rather long delays, too).
I agree with you that we should have a decent grip on where we can actually end up in atomic modeset calls (or for radeon, atombios in general), which imo should only be the panic handler and kdbg (and similar unnusual contexts). I'm not sure whether your proposed instrumentation is really worth it though - in i915-land we don't bother with this. But maybe with the firmware provided and randomly b0rked atombios tables it might make sense to add the WARN_ON_ONCE you've proposed in the other mail -Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
Quoted 2 lines
unnusual contexts). I'm not sure whether your proposed instrumentation is really worth it though - in i915-land we don't bother with this. But maybe
In i915 land it's specific code paths so effectively it is marked up. We don't do it for every random delay in all the connectors and other bits. The bits of code believing they are safe use sleeping locks and we'll get spewage if that breaks. Ditto at this point I hope gma500 although I would not be surpised to find ones I still need to fix from being mdelay.
Quoted 2 lines
with the firmware provided and randomly b0rked atombios tables it might make sense to add the
WARN_ON_ONCEyou've proposed in the other mail
I think we need it because it can be added by firmware, it could be silently done and the atombios paths cover so many different things beyond modesetting using that exact same function we need the mark up.
If some vendor puts a 100ms delay in a connector related hotplug check we are going to have a horrible time debugging 'bugzilla #zillion, 'poor performance in OpenGL game with Radeon foozillion'
Alan
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
Quoted 8 lines · Alan Cox
Quoted 2 lines
unnusual contexts). I'm not sure whether your proposed instrumentation is really worth it though - in i915-land we don't bother with this. But maybe
In i915 land it's specific code paths so effectively it is marked up. We don't do it for every random delay in all the connectors and other bits. The bits of code believing they are safe use sleeping locks and we'll get spewage if that breaks. Ditto at this point I hope gma500 although I would not be surpised to find ones I still need to fix from being mdelay.
The atomic context check is in the _wait_for macro in intel_drv.h which is used all over the place. Like in the wait_for_vblank function. So I don't think you can use i915.ko as a shiny beacon of how to do it ;-)
Quoted 10 lines
Quoted 2 lines
with the firmware provided and randomly b0rked atombios tables it might make sense to add the
WARN_ON_ONCEyou've proposed in the other mailI think we need it because it can be added by firmware, it could be silently done and the atombios paths cover so many different things beyond modesetting using that exact same function we need the mark up.
If some vendor puts a 100ms delay in a connector related hotplug check we are going to have a horrible time debugging 'bugzilla #zillion, 'poor performance in OpenGL game with Radeon foozillion'
Well, hotplug is alreay a giant pain because of the single lock to rule them all design of the current kms code: Long delays already stall everything else (well, cursor updates and pageflips) and we have tons of bugreports that complain about it. In a sense your example undermines my point that we have lower hanger fruit to fix all over the place already ...
But as I've said I like the WARN_ON you want to add, but otoh hand think it shouldn't be used to stall the small&hackish fix of adding the relevant in_atomic checks.
-Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
Quoted 3 lines
Well, hotplug is alreay a giant pain because of the single lock to rule them all design of the current kms code: Long delays already stall everything else (well, cursor updates and pageflips) and we have tons of
Yes I hit this with the gma500, it's one reason I did the GTT based scrolling.
Quoted 2 lines
bugreports that complain about it. In a sense your example undermines my point that we have lower hanger fruit to fix all over the place already ...
Yes.. I'm trying to stop the rotting fruit getting any further down the tree!
The KMS locking isn't just a KMS problem, KMS inherits some of it from the framebuffer which inherits some of it from printk which gets some of it from panic an in IRQ error handling. It's all very messy as a result.
I keep poking at the vt and tty layer end of this to try and sort it out from the bottom but it's like a bad cess pit, every time you poke it the smell drives you back to other things.
Quoted 3 lines
But as I've said I like the
WARN_ONyou want to add, but otoh hand think it shouldn't be used to stall the small&hackish fix of adding the relevantin_atomicchecks.
Then I think we basically agree.
Alan
Re: [PATCH v2] radeon: Use mdelay() instead of msleep() when we can't sleep in atom_op_delay().
In reply to Alan CoxQuoted 16 lines · Alan Cox
Quoted 1 line
I think Alan's simply wrong.
In what way ? You stated this, then go on below to say what I did ?
Quoted 3 lines
Splattering the entire driver for
these two corner cases which don't happen at all under normal circumstances is imho utter nonsense.Which is what I said
| > > Is this only special cases like a panic - if so can it not be called in a
| > > way that distinguishes between normality and nasty cases. | > | > No idea, to be honest. It's an ATOM BIOS interpreter opcode, so in | > theory it could be indirectly called from anywhere that uses ATOM
Quoted 6 lines
BIOS.
| So lets stick to practice, and the real world. Screwing up everything | else because of a crappy problem in your Atom BIOS code sucks but hey it | happens. screwing up everything because of a theoretical concern is just | dumb.
Meh, missed the first part of your mail here. Looks like a misunderstanding on my side, I was assuming you're proposing to add an atom_exec_atomic thing which
- would unconditionally do the spinning delay (by completely abolishing the in_atomic checks) and
- which would require to pass around a flag from at least the panic handler throught the entire modeset code.
Your actual proposal makes much more sense, and as I've said I kinda like the warning, altough I'm not really sold on the usefulness of it all. After all we already have all the nice ftrace instrumentation to put blame for hoggin the cpu in atomic contexts where it needs to be put. -Daniel
Signature · 3 lines
Daniel Vetter Mail: [email protected] Mobile: +41 (0)79 365 57 48