linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Brian Gerst <brgerst@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	Ingo Molnar <mingo@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Borislav Petkov <bp@suse.de>, "H. Peter Anvin" <hpa@zytor.com>,
	X86 ML <x86@kernel.org>
Subject: Re: [PATCH 3/4] x86: Rewrite switch_to() code
Date: Mon, 23 May 2016 07:05:34 -0500	[thread overview]
Message-ID: <20160523120534.lzphuumzemvrmuwg@treble> (raw)
In-Reply-To: <CAMzpN2jbnCAN_xZbwdBziOEq_xebApNWyBN_vJ2s9z9RnXA7gg@mail.gmail.com>

On Mon, May 23, 2016 at 07:49:37AM -0400, Brian Gerst wrote:
> On Mon, May 23, 2016 at 7:40 AM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> > On Sun, May 22, 2016 at 09:47:22PM -0700, Andy Lutomirski wrote:
> >> On Sun, May 22, 2016 at 7:34 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >> > On Sun, May 22, 2016 at 10:59:38AM -0700, Andy Lutomirski wrote:
> >> >> cc: Josh Poimboeuf: do you care about the exact stack layout of the
> >> >> bottom of the stack of an inactive task?
> >> >
> >> > So there's one minor issue with this patch, relating to unwinding the
> >> > stack of a newly forked task.  For detecting reliable stacks, the
> >> > unwinder needs to unwind all the way to the syscall pt_regs to make sure
> >> > the stack is sane.  But for newly forked tasks, that won't be possible
> >> > here because the unwinding will stop at the fork_frame instead.
> >> >
> >> > So from an unwinder standpoint it might be nice for copy_thread_tls() to
> >> > place a frame pointer on the stack next to the ret_from_fork return
> >> > address, so that it would resemble an actual stack frame.  The frame
> >> > pointer could probably just be hard-coded to zero.  And then the first
> >> > bp in fork_frame would need to be a pointer to it instead of zero.  That
> >> > would make it nicely resemble the stack of any other task.
> >> >
> >> > Alternatively I could teach the unwinder that if the unwinding starts at
> >> > the fork_frame offset from the end of the stack page, and the saved rbp
> >> > is zero, it can assume that it's a newly forked task.  But that seems a
> >> > little more brittle to me, as it requires the unwinder to understand
> >> > more of the internal workings of the fork code.
> >> >
> >> > But overall I think this patch is a really nice cleanup, and other than
> >> > the above minor issue it should be fine with my reliable unwinder, since
> >> > rbp is still at the top of the stack.
> >>
> >> Is this a regression or is there some reason that it works right
> >> without the patch?
> >
> > Without the patch, it uses TIF_FORK to determine the stack is empty.
> 
> Where is this code?  I don't see it in the mainline kernel.

Yeah, it hasn't been merged.  Here's the last version:

  https://lkml.kernel.org/r/4d34d452bf8f85c7d6d5f93db1d3eeb4cba335c7.1461875890.git.jpoimboe@redhat.com

-- 
Josh

  reply	other threads:[~2016-05-23 12:05 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-21 16:04 [PATCH 0/4] x86: Rewrite switch_to() Brian Gerst
2016-05-21 16:04 ` [PATCH 1/4] x86: Save return value from kernel_thread Brian Gerst
2016-05-22  1:44   ` Andy Lutomirski
2016-05-22  2:19     ` Brian Gerst
2016-05-21 16:04 ` [PATCH 2/4] x86-32, kgdb: Don't use thread.ip in sleeping_thread_to_gdb_regs() Brian Gerst
2016-05-23 17:05   ` Andy Lutomirski
2016-05-21 16:04 ` [PATCH 3/4] x86: Rewrite switch_to() code Brian Gerst
2016-05-22 17:59   ` Andy Lutomirski
2016-05-22 19:31     ` Brian Gerst
2016-05-22 21:07       ` Andy Lutomirski
2016-05-23  2:34     ` Josh Poimboeuf
2016-05-23  4:47       ` Andy Lutomirski
2016-05-23 11:40         ` Josh Poimboeuf
2016-05-23 11:49           ` Brian Gerst
2016-05-23 12:05             ` Josh Poimboeuf [this message]
2016-05-23 11:14       ` Brian Gerst
2016-05-23 11:47         ` Josh Poimboeuf
2016-05-23 11:49           ` Josh Poimboeuf
2016-05-23 16:46             ` Josh Poimboeuf
2016-05-23 17:03               ` Andy Lutomirski
2016-05-23 18:44                 ` Josh Poimboeuf
2016-07-12 14:16                 ` Josh Poimboeuf
2016-06-15  1:31   ` Andy Lutomirski
2016-06-15  8:03     ` Ingo Molnar
2016-06-15 11:52       ` Brian Gerst
2016-05-21 16:04 ` [PATCH 4/4] x86: Pass kernel thread parameters in fork_frame Brian Gerst
2016-05-22 18:01   ` Andy Lutomirski
2016-05-22 19:21     ` Brian Gerst
2016-05-23 15:23   ` Josh Poimboeuf
2016-05-23 15:36     ` Andy Lutomirski
2016-05-23 21:04       ` Brian Gerst

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=20160523120534.lzphuumzemvrmuwg@treble \
    --to=jpoimboe@redhat.com \
    --cc=bp@suse.de \
    --cc=brgerst@gmail.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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;
as well as URLs for NNTP newsgroup(s).