Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@freebsd.org>
To: gdb-patches@sourceware.org
Cc: Andreas Arnez <arnez@linux.vnet.ibm.com>,
	Yao Qi <qiyaoltc@gmail.com>,
	Philipp Rudo <prudo@linux.vnet.ibm.com>,
	Omair Javaid <omair.javaid@linaro.org>,
	Yao Qi <yao.qi@linaro.org>,
	Peter Griffin <peter.griffin@linaro.org>
Subject: Re: [RFC v3 3/8] Add basic Linux kernel support
Date: Fri, 19 May 2017 17:40:00 -0000	[thread overview]
Message-ID: <62347400.WPoiX4QSWM@ralph.baldwin.cx> (raw)
In-Reply-To: <m3mva8epzo.fsf@oc1027705133.ibm.com>

On Friday, May 19, 2017 07:05:47 PM Andreas Arnez wrote:
> On Fri, May 19 2017, John Baldwin wrote:
> 
> > FreeBSD's kernel GDB bits (which I maintain) have a similar issue, though for
> > now we only export kernel threads as threads in GDB and don't support CPUs as
> > a GDB-visible thing.  In some ways the model I would personally like would be
> > to have conceptual "layers" that you can bounce up and down between kind of
> > like a stack, but in this case a stack of thread targets, so that I could do
> > a kind of 'thread_down' and now 'info threads' would only show me CPUs, allow
> > me to select CPUs, etc. but then have a 'thread_up' to pop back up to the
> > kernel thread layer.
> 
> Exactly!  Note that GDB already has a stack of "layers" -- the target
> stack.  Thus I'm considering commands like "target up/down" for this
> purpose.  Of course this requires per-target thread lists.

Yes, a target up/down might work.  Right now you can push/pop targets so in
theory you can do this today with "target push kthread" and then "target pop".
I hadn't played with this enough to know if that would be sufficient or not
or if we wanted the targets to be more persistent to avoid having to recreate
the thread list during each push.  One thing I wanted to look at in more
detail is how this interaction worked for the older M:N threading targets.
FreeBSD used to use M:N threading in userland but abandoned that a while ago.
The old thread target for that used libthread_db and you only had the one
thread list, never a way to pop back down to the LWP view.

> > The best model I can think of is that this is similar to M:N
> > user-thread implementations where you have user threads multiplexed
> > onto LWPs.  In such a world (which I'm not sure many OS's use these
> > days) it would also be nice to kind of bounce between the worlds.
> 
> M:N user-thread implementations have probably become more popular with
> Go.  In that scenario we have the following layers:
> 
> * Threads == Goroutines (user-thread implementation)
> * Threads == OS threads

Hmm.

> > (In fact, the model I have been toying with but have not yet
> > implemented for adapting FreeBSD's current kernel target support to
> > qemu or the GDB stub I'm hacking on for FreeBSD's native bhyve
> > hypervisor would be to treat vCPUs as LWPs so their ptid would have
> > lwp == vcpu, and kernel-level threads as "threads", so their ptid
> > would have tid == kernel thread id).
> 
> So kernel-level threads can not be rescheduled on a different vCPU?

They definitely can.  The same is true for user-level thread with LWPs
on systems with M:N threading (e.g. scheduler activations on Solaris
or FreeBSD's old KSE M:N threading model).

-- 
John Baldwin


  reply	other threads:[~2017-05-19 17:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 16:57 [RFC v3 0/8] Support for Linux kernel debugging Philipp Rudo
2017-03-16 16:57 ` [RFC v3 1/8] Convert substitute_path_component to C++ Philipp Rudo
2017-04-20 20:02   ` Sergio Durigan Junior
2017-05-03 16:20     ` Philipp Rudo
2017-03-16 16:58 ` [RFC v3 2/8] Add libiberty/concat styled concat_path function Philipp Rudo
2017-03-16 16:58 ` [RFC v3 8/8] Add S390 support for linux-kernel target Philipp Rudo
2017-03-16 16:58 ` [RFC v3 4/8] Add kernel module " Philipp Rudo
2017-05-02 13:15   ` Yao Qi
2017-05-03 16:16     ` Philipp Rudo
2017-05-05 21:33       ` Yao Qi
2017-05-08  9:18         ` Philipp Rudo
2017-05-08 13:05           ` Yao Qi via gdb-patches
2017-03-16 16:58 ` [RFC v3 7/8] Add privileged registers for s390x Philipp Rudo
2017-03-16 16:58 ` [RFC v3 6/8] Seperate common s390-tdep.* from s390-linux-tdep.* Philipp Rudo
2017-03-16 16:58 ` [RFC v3 5/8] Add commands for linux-kernel target Philipp Rudo
2017-03-16 16:58 ` [RFC v3 3/8] Add basic Linux kernel support Philipp Rudo
2017-04-16 22:59   ` Omair Javaid
2017-05-03 14:38     ` Philipp Rudo
2017-04-20 11:09   ` Omair Javaid
2017-04-24 15:24     ` Andreas Arnez
2017-05-03 14:13       ` Omair Javaid
2017-05-03 15:20         ` Philipp Rudo
2017-05-03 14:38     ` Philipp Rudo
2017-05-02 11:14   ` Yao Qi
2017-05-03 15:36     ` Philipp Rudo
2017-05-07 23:54       ` Omair Javaid
     [not found]         ` <20170508132204.7a733dc2@ThinkPad>
     [not found]           ` <CADrjBPqijRQFH4jthAedFzOzMLchpyvM53aXc9grOCjS2YUNCw@mail.gmail.com>
2017-05-10  9:03             ` Philipp Rudo
2017-05-10  9:36           ` Philipp Rudo
2017-05-19  8:45           ` Yao Qi
2017-05-19 15:24             ` Andreas Arnez
2017-05-19 16:28               ` John Baldwin
2017-05-19 17:05                 ` Andreas Arnez
2017-05-19 17:40                   ` John Baldwin [this message]
2017-05-22 10:18                     ` Andreas Arnez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62347400.WPoiX4QSWM@ralph.baldwin.cx \
    --to=jhb@freebsd.org \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=omair.javaid@linaro.org \
    --cc=peter.griffin@linaro.org \
    --cc=prudo@linux.vnet.ibm.com \
    --cc=qiyaoltc@gmail.com \
    --cc=yao.qi@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox