* [RFC] persistence of schedlock mode
@ 2010-05-12 18:08 Michael Snyder
2010-05-12 19:25 ` Pedro Alves
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Michael Snyder @ 2010-05-12 18:08 UTC (permalink / raw)
To: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 487 bytes --]
Bug 11580 points out a problem related to persistence of the
scheduler locking mode. If you set the mode to "on" (which
means that only one thread can run), and then kill and restart
your program, the mode persists and your program may deadlock.
I don't think this is a problem for mode "step", and it could
be argued that mode "on" is "use at your own risk". However
I've been thinking about how to resolve it, and this simple
but intrusive patch is what I come up with.
Comments?
[-- Attachment #2: schedlock.txt --]
[-- Type: text/plain, Size: 1236 bytes --]
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.438
diff -u -p -r1.438 infrun.c
--- infrun.c 6 May 2010 19:14:08 -0000 1.438
+++ infrun.c 12 May 2010 17:37:09 -0000
@@ -1416,6 +1416,18 @@ set_schedlock_func (char *args, int from
}
}
+/* reset_schedlock -- public */
+
+void
+reset_schedlock ()
+{
+ if (scheduler_mode == schedlock_on)
+ {
+ warning ("Resetting scheduler-lock mode to 'off'");
+ scheduler_mode = schedlock_off;
+ }
+}
+
/* True if execution commands resume all threads of all processes by
default; otherwise, resume only threads of the current inferior
process. */
Index: target.c
===================================================================
RCS file: /cvs/src/src/gdb/target.c,v
retrieving revision 1.250
diff -u -p -r1.250 target.c
--- target.c 6 May 2010 22:29:49 -0000 1.250
+++ target.c 12 May 2010 17:37:09 -0000
@@ -2231,6 +2231,10 @@ void
target_mourn_inferior (void)
{
struct target_ops *t;
+
+ /* Clear schedlock in infrun.c */
+ reset_schedlock ();
+
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_mourn_inferior != NULL)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] persistence of schedlock mode
2010-05-12 18:08 [RFC] persistence of schedlock mode Michael Snyder
@ 2010-05-12 19:25 ` Pedro Alves
2010-05-12 19:49 ` Mark Kettenis
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Pedro Alves @ 2010-05-12 19:25 UTC (permalink / raw)
To: gdb-patches; +Cc: Michael Snyder
On Wednesday 12 May 2010 19:08:48, Michael Snyder wrote:
> Bug 11580 points out a problem related to persistence of the
> scheduler locking mode. If you set the mode to "on" (which
> means that only one thread can run), and then kill and restart
> your program, the mode persists and your program may deadlock.
>
> I don't think this is a problem for mode "step", and it could
> be argued that mode "on" is "use at your own risk". However
> I've been thinking about how to resolve it, and this simple
> but intrusive patch is what I come up with.
>
> Comments?
I think this is not a good idea. (I added a larger comment on
the PR before noticing this email).
--
Pedro Alves
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] persistence of schedlock mode
2010-05-12 18:08 [RFC] persistence of schedlock mode Michael Snyder
2010-05-12 19:25 ` Pedro Alves
@ 2010-05-12 19:49 ` Mark Kettenis
2010-05-17 10:33 ` Pierre Muller
2010-05-17 13:20 ` Nathan Froyd
3 siblings, 0 replies; 7+ messages in thread
From: Mark Kettenis @ 2010-05-12 19:49 UTC (permalink / raw)
To: msnyder; +Cc: gdb-patches
> Date: Wed, 12 May 2010 11:08:48 -0700
> From: Michael Snyder <msnyder@vmware.com>
>
> Bug 11580 points out a problem related to persistence of the
> scheduler locking mode. If you set the mode to "on" (which
> means that only one thread can run), and then kill and restart
> your program, the mode persists and your program may deadlock.
>
> I don't think this is a problem for mode "step", and it could
> be argued that mode "on" is "use at your own risk". However
> I've been thinking about how to resolve it, and this simple
> but intrusive patch is what I come up with.
>
> Comments?
Ah, that's clever. The user will be notified, but doesn't have to
answer an additional question.
> Index: infrun.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/infrun.c,v
> retrieving revision 1.438
> diff -u -p -r1.438 infrun.c
> --- infrun.c 6 May 2010 19:14:08 -0000 1.438
> +++ infrun.c 12 May 2010 17:37:09 -0000
> @@ -1416,6 +1416,18 @@ set_schedlock_func (char *args, int from
> }
> }
>
> +/* reset_schedlock -- public */
> +
> +void
> +reset_schedlock ()
> +{
> + if (scheduler_mode == schedlock_on)
> + {
> + warning ("Resetting scheduler-lock mode to 'off'");
> + scheduler_mode = schedlock_off;
> + }
> +}
> +
> /* True if execution commands resume all threads of all processes by
> default; otherwise, resume only threads of the current inferior
> process. */
> Index: target.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/target.c,v
> retrieving revision 1.250
> diff -u -p -r1.250 target.c
> --- target.c 6 May 2010 22:29:49 -0000 1.250
> +++ target.c 12 May 2010 17:37:09 -0000
> @@ -2231,6 +2231,10 @@ void
> target_mourn_inferior (void)
> {
> struct target_ops *t;
> +
> + /* Clear schedlock in infrun.c */
> + reset_schedlock ();
> +
> for (t = current_target.beneath; t != NULL; t = t->beneath)
> {
> if (t->to_mourn_inferior != NULL)
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [RFC] persistence of schedlock mode
2010-05-12 18:08 [RFC] persistence of schedlock mode Michael Snyder
2010-05-12 19:25 ` Pedro Alves
2010-05-12 19:49 ` Mark Kettenis
@ 2010-05-17 10:33 ` Pierre Muller
2010-05-17 15:29 ` Joel Brobecker
2010-05-17 13:20 ` Nathan Froyd
3 siblings, 1 reply; 7+ messages in thread
From: Pierre Muller @ 2010-05-17 10:33 UTC (permalink / raw)
To: gdb-patches
Did I miss some part of the discussion here?
I really have the impression that this
patch went in by error in a long series of patches
from Michael all labeled with '[ob]... white space'
without the patch itself being approved on the main thread.
First reset_schedlock went in and generated a 'New ARI warning'
Jan replied to it
http://sourceware.org/ml/gdb-patches/2010-05/msg00320.html
Then, another commit of the same series
http://sourceware.org/ml/gdb-cvs/2010-05/msg00145.html
added a call to reset_schedlock in infrun.c.
as can be seen in
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/target.c.diff?cvsroot=src&r
1=1.250&r2=1.251
This lead to a compilation error that Hui
tried to fix, and Joel added a second patch to cleanup.
I have no opinion of the validity of the patch itself,
but the way it got into CVS leaves a strange impression to me.
Pierre Muller
Pascal language support maintainer for GDB
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Michael Snyder
> Envoyé : Wednesday, May 12, 2010 8:09 PM
> À : gdb-patches@sourceware.org
> Objet : [RFC] persistence of schedlock mode
>
> Bug 11580 points out a problem related to persistence of the
> scheduler locking mode. If you set the mode to "on" (which
> means that only one thread can run), and then kill and restart
> your program, the mode persists and your program may deadlock.
>
> I don't think this is a problem for mode "step", and it could
> be argued that mode "on" is "use at your own risk". However
> I've been thinking about how to resolve it, and this simple
> but intrusive patch is what I come up with.
>
> Comments?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] persistence of schedlock mode
2010-05-12 18:08 [RFC] persistence of schedlock mode Michael Snyder
` (2 preceding siblings ...)
2010-05-17 10:33 ` Pierre Muller
@ 2010-05-17 13:20 ` Nathan Froyd
3 siblings, 0 replies; 7+ messages in thread
From: Nathan Froyd @ 2010-05-17 13:20 UTC (permalink / raw)
To: Michael Snyder; +Cc: gdb-patches
On Wed, May 12, 2010 at 11:08:48AM -0700, Michael Snyder wrote:
> I don't think this is a problem for mode "step", and it could
> be argued that mode "on" is "use at your own risk". However
> I've been thinking about how to resolve it, and this simple
> but intrusive patch is what I come up with.
You should add a declaration for reset_schedlock someplace; otherwise,
you get:
gdb/target.c: In function 'target_mourn_inferior':
gdb/target.c:2249: error: implicit declaration of function 'reset_schedlock'
-Nathan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] persistence of schedlock mode
2010-05-17 10:33 ` Pierre Muller
@ 2010-05-17 15:29 ` Joel Brobecker
2010-05-17 17:34 ` Michael Snyder
0 siblings, 1 reply; 7+ messages in thread
From: Joel Brobecker @ 2010-05-17 15:29 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
> I really have the impression that this
> patch went in by error in a long series of patches
> from Michael all labeled with '[ob]... white space'
> without the patch itself being approved on the main thread.
Now sure how or why it got there, but I wanted to confirm that
all patches got reverted by Pedro (thanks Pedro!).
--
Joel
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC] persistence of schedlock mode
2010-05-17 15:29 ` Joel Brobecker
@ 2010-05-17 17:34 ` Michael Snyder
0 siblings, 0 replies; 7+ messages in thread
From: Michael Snyder @ 2010-05-17 17:34 UTC (permalink / raw)
To: Joel Brobecker; +Cc: Pierre Muller, gdb-patches
Joel Brobecker wrote:
>> I really have the impression that this
>> patch went in by error in a long series of patches
>> from Michael all labeled with '[ob]... white space'
>> without the patch itself being approved on the main thread.
>
> Now sure how or why it got there, but I wanted to confirm that
> all patches got reverted by Pedro (thanks Pedro!).
>
Sorry, this was an accident.
Thanks Pedro for reverting it.
Michael
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-05-17 17:34 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-12 18:08 [RFC] persistence of schedlock mode Michael Snyder
2010-05-12 19:25 ` Pedro Alves
2010-05-12 19:49 ` Mark Kettenis
2010-05-17 10:33 ` Pierre Muller
2010-05-17 15:29 ` Joel Brobecker
2010-05-17 17:34 ` Michael Snyder
2010-05-17 13:20 ` Nathan Froyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox