Linux kernel -stable discussions
 help / color / mirror / Atom feed
* 4.14 stable missing 3054426dc68e "sched, trace: Fix prev_state output in sched_switch tracepoint"
@ 2019-02-15 12:26 Chris Redpath
  2019-02-18  2:06 ` Sasha Levin
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Redpath @ 2019-02-15 12:26 UTC (permalink / raw)
  To: stable@vger.kernel.org
  Cc: nd, pkondeti@codeaurora.org, rostedt@goodmis.org, Todd Kjos

Hi Greg et al.

A user of android-4.14 has pointed the following missing commit out.

Commit 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") was put into linux-4.20 around rc5 to fix an issue in a tracepoint. According to the patch itself, the broken commit was 3f5fe9fef5b2 ("sched/debug: Fix task state recording/printout") which was merged at what looks like 4.15-rc2. The broken commit was also picked for 4.14.64 as 13f12749af15 ("sched/debug: Fix task state recording/printout"). The fix (3054426dc68e) was pulled into 4.19. but was not called out as needing to go back to 4.14.

Is it possible to pick 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") for the next stable 4.14 release? If not I can do a backport for android-4.14, just let me know.

Best Regards,
Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 4.14 stable missing 3054426dc68e "sched, trace: Fix prev_state output in sched_switch tracepoint"
  2019-02-15 12:26 4.14 stable missing 3054426dc68e "sched, trace: Fix prev_state output in sched_switch tracepoint" Chris Redpath
@ 2019-02-18  2:06 ` Sasha Levin
  2019-02-18  9:14   ` Sudip Mukherjee
  0 siblings, 1 reply; 5+ messages in thread
From: Sasha Levin @ 2019-02-18  2:06 UTC (permalink / raw)
  To: Chris Redpath
  Cc: stable@vger.kernel.org, nd, pkondeti@codeaurora.org,
	rostedt@goodmis.org, Todd Kjos, sudipm.mukherjee

On Fri, Feb 15, 2019 at 12:26:35PM +0000, Chris Redpath wrote:
>Hi Greg et al.
>
>A user of android-4.14 has pointed the following missing commit out.
>
>Commit 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") was put into linux-4.20 around rc5 to fix an issue in a tracepoint. According to the patch itself, the broken commit was 3f5fe9fef5b2 ("sched/debug: Fix task state recording/printout") which was merged at what looks like 4.15-rc2. The broken commit was also picked for 4.14.64 as 13f12749af15 ("sched/debug: Fix task state recording/printout"). The fix (3054426dc68e) was pulled into 4.19. but was not called out as needing to go back to 4.14.
>
>Is it possible to pick 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") for the next stable 4.14 release? If not I can do a backport for android-4.14, just let me know.

It wasn't backported because it didn't apply cleanly, since 4.4's
backport of 3f5fe9fef5b2 differs from Linus's tree.

The backport for that commit was done by Sudip (Cc'ed). I'll be happy to
take a backport of 3054426dc68e if someone sense one my way.

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 4.14 stable missing 3054426dc68e "sched, trace: Fix prev_state output in sched_switch tracepoint"
  2019-02-18  2:06 ` Sasha Levin
@ 2019-02-18  9:14   ` Sudip Mukherjee
  2019-02-18 12:19     ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2019-02-18  9:14 UTC (permalink / raw)
  To: Sasha Levin
  Cc: Chris Redpath, stable@vger.kernel.org, nd,
	pkondeti@codeaurora.org, rostedt@goodmis.org, Todd Kjos

[-- Attachment #1: Type: text/plain, Size: 1481 bytes --]

Hi Sasha,

On Sun, Feb 17, 2019 at 09:06:36PM -0500, Sasha Levin wrote:
> On Fri, Feb 15, 2019 at 12:26:35PM +0000, Chris Redpath wrote:
> > Hi Greg et al.
> > 
> > A user of android-4.14 has pointed the following missing commit out.
> > 
> > Commit 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") was put into linux-4.20 around rc5 to fix an issue in a tracepoint. According to the patch itself, the broken commit was 3f5fe9fef5b2 ("sched/debug: Fix task state recording/printout") which was merged at what looks like 4.15-rc2. The broken commit was also picked for 4.14.64 as 13f12749af15 ("sched/debug: Fix task state recording/printout"). The fix (3054426dc68e) was pulled into 4.19. but was not called out as needing to go back to 4.14.
> > 
> > Is it possible to pick 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") for the next stable 4.14 release? If not I can do a backport for android-4.14, just let me know.
> 
> It wasn't backported because it didn't apply cleanly, since 4.4's
> backport of 3f5fe9fef5b2 differs from Linus's tree.
> 
> The backport for that commit was done by Sudip (Cc'ed). I'll be happy to
> take a backport of 3054426dc68e if someone sense one my way.

Happy to do a backport for 4.14-stable. :)

It did not apply before as the function was only renamed by:
1d48b080bcce ("sched/debug: Rename task-state printing helpers")

There was no other functionality change.


--
Regards
Sudip

[-- Attachment #2: 0001-sched-trace-Fix-prev_state-output-in-sched_switch-tr.patch --]
[-- Type: text/x-diff, Size: 2277 bytes --]

From f8c12fb36c1164fbd1ffaabd9898dfb2af1ee28a Mon Sep 17 00:00:00 2001
From: Pavankumar Kondeti <pkondeti@codeaurora.org>
Date: Tue, 30 Oct 2018 12:24:33 +0530
Subject: [PATCH] sched, trace: Fix prev_state output in sched_switch tracepoint

commit 3054426dc68e5d63aa6a6e9b91ac4ec78e3f3805 upstream

commit 3f5fe9fef5b2 ("sched/debug: Fix task state recording/printout")
tried to fix the problem introduced by a previous commit efb40f588b43
("sched/tracing: Fix trace_sched_switch task-state printing"). However
the prev_state output in sched_switch is still broken.

task_state_index() uses fls() which considers the LSB as 1. Left
shifting 1 by this value gives an incorrect mapping to the task state.
Fix this by decrementing the value returned by __get_task_state()
before shifting.

Link: http://lkml.kernel.org/r/1540882473-1103-1-git-send-email-pkondeti@codeaurora.org

Cc: stable@vger.kernel.org
Fixes: 3f5fe9fef5b2 ("sched/debug: Fix task state recording/printout")
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 include/trace/events/sched.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 0812cd5408c9..6e692a52936c 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -107,6 +107,8 @@ DEFINE_EVENT(sched_wakeup_template, sched_wakeup_new,
 #ifdef CREATE_TRACE_POINTS
 static inline long __trace_sched_switch_state(bool preempt, struct task_struct *p)
 {
+	unsigned int state;
+
 #ifdef CONFIG_SCHED_DEBUG
 	BUG_ON(p != current);
 #endif /* CONFIG_SCHED_DEBUG */
@@ -118,7 +120,15 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *
 	if (preempt)
 		return TASK_REPORT_MAX;
 
-	return 1 << __get_task_state(p);
+	/*
+	 * task_state_index() uses fls() and returns a value from 0-8 range.
+	 * Decrement it by 1 (except TASK_RUNNING state i.e 0) before using
+	 * it for left shift operation to get the correct task->state
+	 * mapping.
+	 */
+	state = __get_task_state(p);
+
+	return state ? (1 << (state - 1)) : state;
 }
 #endif /* CREATE_TRACE_POINTS */
 
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: 4.14 stable missing 3054426dc68e "sched, trace: Fix prev_state output in sched_switch tracepoint"
  2019-02-18  9:14   ` Sudip Mukherjee
@ 2019-02-18 12:19     ` Greg KH
  2019-02-18 12:34       ` Chris Redpath
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-02-18 12:19 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Sasha Levin, Chris Redpath, stable@vger.kernel.org, nd,
	pkondeti@codeaurora.org, rostedt@goodmis.org, Todd Kjos

On Mon, Feb 18, 2019 at 09:14:03AM +0000, Sudip Mukherjee wrote:
> Hi Sasha,
> 
> On Sun, Feb 17, 2019 at 09:06:36PM -0500, Sasha Levin wrote:
> > On Fri, Feb 15, 2019 at 12:26:35PM +0000, Chris Redpath wrote:
> > > Hi Greg et al.
> > > 
> > > A user of android-4.14 has pointed the following missing commit out.
> > > 
> > > Commit 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") was put into linux-4.20 around rc5 to fix an issue in a tracepoint. According to the patch itself, the broken commit was 3f5fe9fef5b2 ("sched/debug: Fix task state recording/printout") which was merged at what looks like 4.15-rc2. The broken commit was also picked for 4.14.64 as 13f12749af15 ("sched/debug: Fix task state recording/printout"). The fix (3054426dc68e) was pulled into 4.19. but was not called out as needing to go back to 4.14.
> > > 
> > > Is it possible to pick 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") for the next stable 4.14 release? If not I can do a backport for android-4.14, just let me know.
> > 
> > It wasn't backported because it didn't apply cleanly, since 4.4's
> > backport of 3f5fe9fef5b2 differs from Linus's tree.
> > 
> > The backport for that commit was done by Sudip (Cc'ed). I'll be happy to
> > take a backport of 3054426dc68e if someone sense one my way.
> 
> Happy to do a backport for 4.14-stable. :)
> 
> It did not apply before as the function was only renamed by:
> 1d48b080bcce ("sched/debug: Rename task-state printing helpers")
> 
> There was no other functionality change.

Now queued up, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 4.14 stable missing 3054426dc68e "sched, trace: Fix prev_state output in sched_switch tracepoint"
  2019-02-18 12:19     ` Greg KH
@ 2019-02-18 12:34       ` Chris Redpath
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Redpath @ 2019-02-18 12:34 UTC (permalink / raw)
  To: Greg KH, Sudip Mukherjee
  Cc: Sasha Levin, stable@vger.kernel.org, pkondeti@codeaurora.org,
	rostedt@goodmis.org, Todd Kjos

On 18/02/2019 12:19, Greg KH wrote:
> On Mon, Feb 18, 2019 at 09:14:03AM +0000, Sudip Mukherjee wrote:
>> Hi Sasha,
>>
>> On Sun, Feb 17, 2019 at 09:06:36PM -0500, Sasha Levin wrote:
>>> On Fri, Feb 15, 2019 at 12:26:35PM +0000, Chris Redpath wrote:
>>>> Hi Greg et al.
>>>>
>>>> A user of android-4.14 has pointed the following missing commit out.
>>>>
>>>> Commit 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") was put into linux-4.20 around rc5 to fix an issue in a tracepoint. According to the patch itself, the broken commit was 3f5fe9fef5b2 ("sched/debug: Fix task state recording/printout") which was merged at what looks like 4.15-rc2. The broken commit was also picked for 4.14.64 as 13f12749af15 ("sched/debug: Fix task state recording/printout"). The fix (3054426dc68e) was pulled into 4.19. but was not called out as needing to go back to 4.14.
>>>>
>>>> Is it possible to pick 3054426dc68e ("sched, trace: Fix prev_state output in sched_switch tracepoint") for the next stable 4.14 release? If not I can do a backport for android-4.14, just let me know.
>>>
>>> It wasn't backported because it didn't apply cleanly, since 4.4's
>>> backport of 3f5fe9fef5b2 differs from Linus's tree.
>>>
>>> The backport for that commit was done by Sudip (Cc'ed). I'll be happy to
>>> take a backport of 3054426dc68e if someone sense one my way.
>>
>> Happy to do a backport for 4.14-stable. :)
>>
>> It did not apply before as the function was only renamed by:
>> 1d48b080bcce ("sched/debug: Rename task-state printing helpers")
>>
>> There was no other functionality change.
> 
> Now queued up, thanks.
> 
> greg k-h
> 
Thanks everyone, much appreciated!
--Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-18 12:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-15 12:26 4.14 stable missing 3054426dc68e "sched, trace: Fix prev_state output in sched_switch tracepoint" Chris Redpath
2019-02-18  2:06 ` Sasha Levin
2019-02-18  9:14   ` Sudip Mukherjee
2019-02-18 12:19     ` Greg KH
2019-02-18 12:34       ` Chris Redpath

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox