From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17860 invoked by alias); 7 Jan 2003 20:39:29 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17826 invoked from network); 7 Jan 2003 20:39:28 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by 209.249.29.67 with SMTP; 7 Jan 2003 20:39:28 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h07KBbB12952 for ; Tue, 7 Jan 2003 15:11:37 -0500 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h07KdFn31205; Tue, 7 Jan 2003 15:39:15 -0500 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h07KdFn00770; Tue, 7 Jan 2003 12:39:15 -0800 Message-ID: <3E1B3AF2.762A2138@redhat.com> Date: Tue, 07 Jan 2003 20:39:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: Daniel Jacobowitz CC: gdb-patches@sources.redhat.com Subject: Re: [RFC] lin-lwp.c prelim changes for new thread model References: <3E1A14C5.77F6C2DF@redhat.com> <20030107033133.GB5132@nevyn.them.org> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2003-01/txt/msg00291.txt.bz2 Daniel Jacobowitz wrote: > > On Mon, Jan 06, 2003 at 03:44:05PM -0800, Michael Snyder wrote: > > Hi folks, > > > > The up and coming kernel (2.4.20, I believe?) and the next glibc (2.3.1) > > both bring some drastic changes to linux threads. The current gdb thread > > debugging code will not handle them as is. > > > > This is a smallish change that I propose as a preliminary step; > > it'll get things partly working in the new world, without breaking > > them in the old. > > > > Here's the rationalle. > > > > In the old/current model, when one thread gets a signal (such as TRAP), > > we (gdb) have to call kill (SIGSTOP, pid) for every other thread > > (excepting the event thread), and then do a waitpid on each of them. > > > > In the new model, when one thread gets a signal, we only have to > > send kill(SIGSTOP, pid) to _one_ thread, and the kernel will then > > propagate the signal to all of them (_including_ the one that has > > already stopped with eg. SIGTRAP). We must still do a waitpid on > > each and every thread -- however, that now _includes_ the one that > > stopped in the first place (and which we've already done one waitpid on). > > > > I know, you're thinking "wasn't this supposed to get simpler?" > > > > The minimal change I propose below is as follows: > > When we send kill(SIGSTOP) to all the threads, we now include > > the event thread, where previously we had made him a special case. > > That way, whether in the new model or the old one, we can now do > > a waitpid on every thread including the event thread. > > > > What do you think? > > To be honest, I don't like this very much. You're hurting performance > in the current case (whose performance is already quite bad enough, > thank you!). I don't think that the additional complexity/waiting is > worthwhile. Well, your feedback is high on the priority list. > If we detect CLONE_THREAD (how do we detect CLONE_THREAD?) That I don't know. Because I don't know, and because CLONE_THREAD represents an entirely new approach, I was looking for something that I could get working quickly on both models, using mostly the existing code and approach. > we can mark > the new LWP as having a pending stop based on that. Or, Roland has a > kernel patch that's stewing in my mailbox which provides a better way > to handle this entire thing than sending SIGSTOP. I don't think he > ever tested it, and I know I haven't had time, but let me know if you > want a copy. I'm not as kernel-hackerish as you. I'll discuss with Roland whether he thinks he can get that patch into the kernel in the near term (and how it will help).