Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-23 Thread Andy Lutomirski
On Thu, Jun 23, 2016 at 1:40 PM, Josh Poimboeuf wrote: > On Thu, Jun 23, 2016 at 01:31:32PM -0500, Josh Poimboeuf wrote: >> On Thu, Jun 23, 2016 at 09:35:29AM -0700, Andy Lutomirski wrote: >> > > So which is the least-bad option? To summarize: >> > > >> > > 1) task flag(s)

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-23 Thread Josh Poimboeuf
On Thu, Jun 23, 2016 at 01:31:32PM -0500, Josh Poimboeuf wrote: > On Thu, Jun 23, 2016 at 09:35:29AM -0700, Andy Lutomirski wrote: > > > So which is the least-bad option? To summarize: > > > > > > 1) task flag(s) for preemption and page faults > > > > > > 2) turn pt_regs into a stack frame >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-23 Thread Josh Poimboeuf
On Thu, Jun 23, 2016 at 09:35:29AM -0700, Andy Lutomirski wrote: > > So which is the least-bad option? To summarize: > > > > 1) task flag(s) for preemption and page faults > > > > 2) turn pt_regs into a stack frame > > > > 3) annotate all calls from entry code in a table > > > > 4) encode

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-23 Thread Andy Lutomirski
On Thu, Jun 23, 2016 at 9:19 AM, Josh Poimboeuf wrote: > On Wed, Jun 22, 2016 at 12:17:25PM -0700, Andy Lutomirski wrote: >> On Wed, Jun 22, 2016 at 11:40 AM, Josh Poimboeuf wrote: >> > On Wed, Jun 22, 2016 at 11:26:21AM -0700, Andy Lutomirski wrote: >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-23 Thread Josh Poimboeuf
On Wed, Jun 22, 2016 at 12:17:25PM -0700, Andy Lutomirski wrote: > On Wed, Jun 22, 2016 at 11:40 AM, Josh Poimboeuf wrote: > > On Wed, Jun 22, 2016 at 11:26:21AM -0700, Andy Lutomirski wrote: > >> > > >> > So are you suggesting something like: > >> > > >> > .macro

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-23 Thread Josh Poimboeuf
On Wed, Jun 22, 2016 at 05:09:11PM -0700, Andy Lutomirski wrote: > On Wed, Jun 22, 2016 at 9:30 AM, Josh Poimboeuf wrote: > > Andy, > > > > So I got a chance to look at this some more. I'm thinking that to make > > this feature more consistently useful, we shouldn't only

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-22 Thread Andy Lutomirski
On Wed, Jun 22, 2016 at 9:30 AM, Josh Poimboeuf wrote: > Andy, > > So I got a chance to look at this some more. I'm thinking that to make > this feature more consistently useful, we shouldn't only annotate > pt_regs frames for calls to handlers; other calls should be

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-22 Thread Andy Lutomirski
On Wed, Jun 22, 2016 at 11:40 AM, Josh Poimboeuf wrote: > On Wed, Jun 22, 2016 at 11:26:21AM -0700, Andy Lutomirski wrote: >> > >> > So are you suggesting something like: >> > >> > .macro ENTRY_CALL func pt_regs_offset=0 >> > call \func >> > 1:

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-22 Thread Josh Poimboeuf
On Wed, Jun 22, 2016 at 11:26:21AM -0700, Andy Lutomirski wrote: > On Wed, Jun 22, 2016 at 11:22 AM, Josh Poimboeuf wrote: > > On Wed, Jun 22, 2016 at 10:59:23AM -0700, Andy Lutomirski wrote: > >> > So I got a chance to look at this some more. I'm thinking that to make > >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-22 Thread Andy Lutomirski
On Wed, Jun 22, 2016 at 11:22 AM, Josh Poimboeuf wrote: > On Wed, Jun 22, 2016 at 10:59:23AM -0700, Andy Lutomirski wrote: >> > So I got a chance to look at this some more. I'm thinking that to make >> > this feature more consistently useful, we shouldn't only annotate >> >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-22 Thread Josh Poimboeuf
On Wed, Jun 22, 2016 at 10:59:23AM -0700, Andy Lutomirski wrote: > > So I got a chance to look at this some more. I'm thinking that to make > > this feature more consistently useful, we shouldn't only annotate > > pt_regs frames for calls to handlers; other calls should be annotated as > > well:

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-22 Thread Andy Lutomirski
On Wed, Jun 22, 2016 at 9:30 AM, Josh Poimboeuf wrote: > On Mon, May 23, 2016 at 08:52:12PM -0700, Andy Lutomirski wrote: >> On May 23, 2016 7:28 PM, "Josh Poimboeuf" wrote: >> > > Maybe I'm coming around to liking this idea. >> > >> > Ok, good :-) >> >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-06-22 Thread Josh Poimboeuf
On Mon, May 23, 2016 at 08:52:12PM -0700, Andy Lutomirski wrote: > On May 23, 2016 7:28 PM, "Josh Poimboeuf" wrote: > > > Maybe I'm coming around to liking this idea. > > > > Ok, good :-) > > > > > In an ideal world (DWARF support, high-quality unwinder, nice pretty > > >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-23 Thread Andy Lutomirski
On May 23, 2016 7:28 PM, "Josh Poimboeuf" wrote: > > Maybe I'm coming around to liking this idea. > > Ok, good :-) > > > In an ideal world (DWARF support, high-quality unwinder, nice pretty > > printer, etc), unwinding across a kernel exception would look like: > > > > -

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-23 Thread Josh Poimboeuf
On Mon, May 23, 2016 at 02:34:56PM -0700, Andy Lutomirski wrote: > On Thu, May 19, 2016 at 4:15 PM, Josh Poimboeuf wrote: > > On Mon, May 02, 2016 at 08:52:41AM -0700, Andy Lutomirski wrote: > >> On Mon, May 2, 2016 at 6:52 AM, Josh Poimboeuf wrote: > >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-23 Thread Andy Lutomirski
On Mon, May 23, 2016 at 4:02 PM, Jiri Kosina wrote: > On Fri, 20 May 2016, Andy Lutomirski wrote: > >> I think it would be negligible, at least for interrupts, since >> interrupts are already extremely expensive. But I don't love adding >> assembly code that makes them even

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-23 Thread Jiri Kosina
On Fri, 20 May 2016, Andy Lutomirski wrote: > I think it would be negligible, at least for interrupts, since > interrupts are already extremely expensive. But I don't love adding > assembly code that makes them even slower. The real thing I dislike > about this approach is that it's not a

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-23 Thread Andy Lutomirski
On Thu, May 19, 2016 at 4:15 PM, Josh Poimboeuf wrote: > On Mon, May 02, 2016 at 08:52:41AM -0700, Andy Lutomirski wrote: >> On Mon, May 2, 2016 at 6:52 AM, Josh Poimboeuf wrote: >> > On Fri, Apr 29, 2016 at 05:08:50PM -0700, Andy Lutomirski wrote: >> >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-20 Thread Josh Poimboeuf
On Fri, May 20, 2016 at 09:59:38AM -0700, Andy Lutomirski wrote: > On Fri, May 20, 2016 at 9:41 AM, Josh Poimboeuf wrote: > > On Fri, May 20, 2016 at 08:41:00AM -0700, Andy Lutomirski wrote: > >> On Fri, May 20, 2016 at 7:05 AM, Josh Poimboeuf > >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-20 Thread Andy Lutomirski
On Fri, May 20, 2016 at 9:41 AM, Josh Poimboeuf wrote: > On Fri, May 20, 2016 at 08:41:00AM -0700, Andy Lutomirski wrote: >> On Fri, May 20, 2016 at 7:05 AM, Josh Poimboeuf wrote: >> > On Thu, May 19, 2016 at 04:39:51PM -0700, Andy Lutomirski wrote: >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-20 Thread Josh Poimboeuf
On Fri, May 20, 2016 at 08:41:00AM -0700, Andy Lutomirski wrote: > On Fri, May 20, 2016 at 7:05 AM, Josh Poimboeuf wrote: > > On Thu, May 19, 2016 at 04:39:51PM -0700, Andy Lutomirski wrote: > >> On Thu, May 19, 2016 at 4:15 PM, Josh Poimboeuf > >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-20 Thread Andy Lutomirski
On Fri, May 20, 2016 at 7:05 AM, Josh Poimboeuf wrote: > On Thu, May 19, 2016 at 04:39:51PM -0700, Andy Lutomirski wrote: >> On Thu, May 19, 2016 at 4:15 PM, Josh Poimboeuf wrote: >> > Note this example is with today's unwinder. It could be made smarter

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-20 Thread Josh Poimboeuf
On Thu, May 19, 2016 at 04:39:51PM -0700, Andy Lutomirski wrote: > On Thu, May 19, 2016 at 4:15 PM, Josh Poimboeuf wrote: > > Note this example is with today's unwinder. It could be made smarter to > > get the RIP from the pt_regs so the '?' could be removed from > >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-19 Thread Andy Lutomirski
On Thu, May 19, 2016 at 4:15 PM, Josh Poimboeuf wrote: > On Mon, May 02, 2016 at 08:52:41AM -0700, Andy Lutomirski wrote: >> On Mon, May 2, 2016 at 6:52 AM, Josh Poimboeuf wrote: >> > On Fri, Apr 29, 2016 at 05:08:50PM -0700, Andy Lutomirski wrote: >> >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-19 Thread Josh Poimboeuf
On Mon, May 02, 2016 at 08:52:41AM -0700, Andy Lutomirski wrote: > On Mon, May 2, 2016 at 6:52 AM, Josh Poimboeuf wrote: > > On Fri, Apr 29, 2016 at 05:08:50PM -0700, Andy Lutomirski wrote: > >> On Apr 29, 2016 3:41 PM, "Josh Poimboeuf" wrote: > >> > >

RE: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-04 Thread David Laight
From: Andy Lutomirski > Sent: 02 May 2016 19:13 ... > I hope your plans include rewriting the current stack unwinder > completely. The thing in print_context_stack is (a) > hard-to-understand and hard-to-modify crap and (b) is called in a loop > from another file using totally ridiculous

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Andy Lutomirski
On Mon, May 2, 2016 at 1:00 PM, Jiri Kosina wrote: > On Mon, 2 May 2016, Jiri Kosina wrote: > >> > FWIW, I just tried this: >> > >> > static bool is_entry_text(unsigned long addr) >> > { >> > return addr >= (unsigned long)__entry_text_start && >> > addr < (unsigned

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Jiri Kosina
On Mon, 2 May 2016, Jiri Kosina wrote: > > FWIW, I just tried this: > > > > static bool is_entry_text(unsigned long addr) > > { > > return addr >= (unsigned long)__entry_text_start && > > addr < (unsigned long)__entry_text_end; > > } > > > > it works. So the entry code is already

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Jiri Kosina
On Mon, 2 May 2016, Andy Lutomirski wrote: > FWIW, I just tried this: > > static bool is_entry_text(unsigned long addr) > { > return addr >= (unsigned long)__entry_text_start && > addr < (unsigned long)__entry_text_end; > } > > it works. So the entry code is already annotated

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Josh Poimboeuf
On Mon, May 02, 2016 at 11:12:39AM -0700, Andy Lutomirski wrote: > On Mon, May 2, 2016 at 10:31 AM, Josh Poimboeuf wrote: > > On Mon, May 02, 2016 at 08:52:41AM -0700, Andy Lutomirski wrote: > >> On Mon, May 2, 2016 at 6:52 AM, Josh Poimboeuf wrote: > >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Ingo Molnar
* Andy Lutomirski wrote: > > Another idea to detect missing frames: for each return address on the > > stack, > > ensure there's a corresponding "call " instruction immediately > > preceding > > the return location, where matches what's on the stack. > > Hmm,

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Andy Lutomirski
On Mon, May 2, 2016 at 10:31 AM, Josh Poimboeuf wrote: > On Mon, May 02, 2016 at 08:52:41AM -0700, Andy Lutomirski wrote: >> On Mon, May 2, 2016 at 6:52 AM, Josh Poimboeuf wrote: >> > On Fri, Apr 29, 2016 at 05:08:50PM -0700, Andy Lutomirski wrote: >> >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Josh Poimboeuf
On Mon, May 02, 2016 at 08:52:41AM -0700, Andy Lutomirski wrote: > On Mon, May 2, 2016 at 6:52 AM, Josh Poimboeuf wrote: > > On Fri, Apr 29, 2016 at 05:08:50PM -0700, Andy Lutomirski wrote: > >> On Apr 29, 2016 3:41 PM, "Josh Poimboeuf" wrote: > >> > >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Andy Lutomirski
On Mon, May 2, 2016 at 6:52 AM, Josh Poimboeuf wrote: > On Fri, Apr 29, 2016 at 05:08:50PM -0700, Andy Lutomirski wrote: >> On Apr 29, 2016 3:41 PM, "Josh Poimboeuf" wrote: >> > >> > On Fri, Apr 29, 2016 at 02:37:41PM -0700, Andy Lutomirski wrote: >> > >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-05-02 Thread Josh Poimboeuf
On Fri, Apr 29, 2016 at 05:08:50PM -0700, Andy Lutomirski wrote: > On Apr 29, 2016 3:41 PM, "Josh Poimboeuf" wrote: > > > > On Fri, Apr 29, 2016 at 02:37:41PM -0700, Andy Lutomirski wrote: > > > On Fri, Apr 29, 2016 at 2:25 PM, Josh Poimboeuf > > >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Andy Lutomirski
On Apr 29, 2016 3:11 PM, "Jiri Kosina" wrote: > > On Fri, 29 Apr 2016, Andy Lutomirski wrote: > > > > NMI, MCE and interrupts aren't a problem because they have dedicated > > > stacks, which are easy to detect. If the tasks' stack is on an > > > exception stack or an irq stack,

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Andy Lutomirski
On Apr 29, 2016 3:41 PM, "Josh Poimboeuf" wrote: > > On Fri, Apr 29, 2016 at 02:37:41PM -0700, Andy Lutomirski wrote: > > On Fri, Apr 29, 2016 at 2:25 PM, Josh Poimboeuf wrote: > > > I think the easiest way to make it work would be to modify the idtentry

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Josh Poimboeuf
On Sat, Apr 30, 2016 at 12:11:45AM +0200, Jiri Kosina wrote: > On Fri, 29 Apr 2016, Andy Lutomirski wrote: > > > NMI, MCE and interrupts aren't a problem because they have dedicated > > > stacks, which are easy to detect. If the tasks' stack is on an > > > exception stack or an irq stack, we

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Josh Poimboeuf
On Fri, Apr 29, 2016 at 02:37:41PM -0700, Andy Lutomirski wrote: > On Fri, Apr 29, 2016 at 2:25 PM, Josh Poimboeuf wrote: > > I think the easiest way to make it work would be to modify the idtentry > > macro to put all the idt entries in a dedicated section. Then the > >

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Jiri Kosina
On Fri, 29 Apr 2016, Andy Lutomirski wrote: > > NMI, MCE and interrupts aren't a problem because they have dedicated > > stacks, which are easy to detect. If the tasks' stack is on an > > exception stack or an irq stack, we consider it unreliable. > > Only on x86_64. Well, MCEs are more or

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Andy Lutomirski
On Fri, Apr 29, 2016 at 2:25 PM, Josh Poimboeuf wrote: > On Fri, Apr 29, 2016 at 01:32:53PM -0700, Andy Lutomirski wrote: >> On Fri, Apr 29, 2016 at 1:27 PM, Josh Poimboeuf wrote: >> > On Fri, Apr 29, 2016 at 01:19:23PM -0700, Andy Lutomirski wrote: >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Josh Poimboeuf
On Fri, Apr 29, 2016 at 01:32:53PM -0700, Andy Lutomirski wrote: > On Fri, Apr 29, 2016 at 1:27 PM, Josh Poimboeuf wrote: > > On Fri, Apr 29, 2016 at 01:19:23PM -0700, Andy Lutomirski wrote: > >> On Fri, Apr 29, 2016 at 1:11 PM, Josh Poimboeuf > >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Andy Lutomirski
On Fri, Apr 29, 2016 at 1:27 PM, Josh Poimboeuf wrote: > On Fri, Apr 29, 2016 at 01:19:23PM -0700, Andy Lutomirski wrote: >> On Fri, Apr 29, 2016 at 1:11 PM, Josh Poimboeuf wrote: >> > On Fri, Apr 29, 2016 at 11:06:53AM -0700, Andy Lutomirski wrote: >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Josh Poimboeuf
On Fri, Apr 29, 2016 at 01:19:23PM -0700, Andy Lutomirski wrote: > On Fri, Apr 29, 2016 at 1:11 PM, Josh Poimboeuf wrote: > > On Fri, Apr 29, 2016 at 11:06:53AM -0700, Andy Lutomirski wrote: > >> On Thu, Apr 28, 2016 at 1:44 PM, Josh Poimboeuf > >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Andy Lutomirski
On Fri, Apr 29, 2016 at 1:11 PM, Josh Poimboeuf wrote: > On Fri, Apr 29, 2016 at 11:06:53AM -0700, Andy Lutomirski wrote: >> On Thu, Apr 28, 2016 at 1:44 PM, Josh Poimboeuf wrote: >> > A preempted function might not have had a chance to save the frame >>

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Josh Poimboeuf
On Fri, Apr 29, 2016 at 11:06:53AM -0700, Andy Lutomirski wrote: > On Thu, Apr 28, 2016 at 1:44 PM, Josh Poimboeuf wrote: > > A preempted function might not have had a chance to save the frame > > pointer to the stack yet, which can result in its caller getting skipped > > on

Re: [RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-29 Thread Andy Lutomirski
On Thu, Apr 28, 2016 at 1:44 PM, Josh Poimboeuf wrote: > A preempted function might not have had a chance to save the frame > pointer to the stack yet, which can result in its caller getting skipped > on a stack trace. > > Add a flag to indicate when the task has been

[RFC PATCH v2 05/18] sched: add task flag for preempt IRQ tracking

2016-04-28 Thread Josh Poimboeuf
A preempted function might not have had a chance to save the frame pointer to the stack yet, which can result in its caller getting skipped on a stack trace. Add a flag to indicate when the task has been preempted so that stack dump code can determine whether the stack trace is reliable.