[Xenial,SRU] tty: vt: Fix soft lockup in fbcon cursor blink timer.
diff mbox

Message ID 1464065754-19883-1-git-send-email-ming.lei@canonical.com
State New
Headers show

Commit Message

Ming Lei May 24, 2016, 4:55 a.m. UTC
From: David Daney <david.daney@cavium.com>

BugLink: http://bugs.launchpad.net/bugs/1574814

We are getting somewhat random soft lockups with this signature:

[   86.992215] [<fffffc00080935e0>] el1_irq+0xa0/0x10c
[   86.997082] [<fffffc000841822c>] cursor_timer_handler+0x30/0x54
[   87.002991] [<fffffc000810ec44>] call_timer_fn+0x54/0x1a8
[   87.008378] [<fffffc000810ef88>] run_timer_softirq+0x1c4/0x2bc
[   87.014200] [<fffffc000809077c>] __do_softirq+0x114/0x344
[   87.019590] [<fffffc00080af45c>] irq_exit+0x74/0x98
[   87.024458] [<fffffc00080fac20>] __handle_domain_irq+0x98/0xfc
[   87.030278] [<fffffc000809056c>] gic_handle_irq+0x94/0x190

This is caused by the vt visual_init() function calling into
fbcon_init() with a vc_cur_blink_ms value of zero.  This is a
transient condition, as it is later set to a non-zero value.  But, if
the timer happens to expire while the blink rate is zero, it goes into
an endless loop, and we get soft lockup.

The fix is to initialize vc_cur_blink_ms before calling the con_init()
function.

Tested-by: Ming Lei <ming.lei@canonical.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Scot Doyle <lkml14@scotdoyle.com>
Signed-off-by: David Daney <david.daney@cavium.com>
Cc: stable@vger.kernel.org
---
 drivers/tty/vt/vt.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Chris J Arges May 24, 2016, 11:11 a.m. UTC | #1
On Tue, May 24, 2016 at 12:55:54PM +0800, Ming Lei wrote:
> From: David Daney <david.daney@cavium.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1574814
> 
> We are getting somewhat random soft lockups with this signature:
> 
> [   86.992215] [<fffffc00080935e0>] el1_irq+0xa0/0x10c
> [   86.997082] [<fffffc000841822c>] cursor_timer_handler+0x30/0x54
> [   87.002991] [<fffffc000810ec44>] call_timer_fn+0x54/0x1a8
> [   87.008378] [<fffffc000810ef88>] run_timer_softirq+0x1c4/0x2bc
> [   87.014200] [<fffffc000809077c>] __do_softirq+0x114/0x344
> [   87.019590] [<fffffc00080af45c>] irq_exit+0x74/0x98
> [   87.024458] [<fffffc00080fac20>] __handle_domain_irq+0x98/0xfc
> [   87.030278] [<fffffc000809056c>] gic_handle_irq+0x94/0x190
> 
> This is caused by the vt visual_init() function calling into
> fbcon_init() with a vc_cur_blink_ms value of zero.  This is a
> transient condition, as it is later set to a non-zero value.  But, if
> the timer happens to expire while the blink rate is zero, it goes into
> an endless loop, and we get soft lockup.
> 
> The fix is to initialize vc_cur_blink_ms before calling the con_init()
> function.
> 
> Tested-by: Ming Lei <ming.lei@canonical.com>
> Acked-by: Pavel Machek <pavel@ucw.cz>
> Acked-by: Scot Doyle <lkml14@scotdoyle.com>
> Signed-off-by: David Daney <david.daney@cavium.com>
> Cc: stable@vger.kernel.org

When you cherry-pick onto Xenial can you also include the -x flag to append the
commit hash?
--chris

> ---
>  drivers/tty/vt/vt.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 4af9a8f..d80f4ec 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -761,6 +761,7 @@ static void visual_init(struct vc_data *vc, int num, int init)
>  	vc->vc_complement_mask = 0;
>  	vc->vc_can_do_color = 0;
>  	vc->vc_panic_force_write = false;
> +	vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS;
>  	vc->vc_sw->con_init(vc, init);
>  	if (!vc->vc_complement_mask)
>  		vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
> -- 
> 1.9.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Tim Gardner May 24, 2016, 12:52 p.m. UTC | #2
Needs to be an 'UBUNTU: SAUCE:' patch when applied.
Ming Lei May 24, 2016, 1:30 p.m. UTC | #3
On Tue, May 24, 2016 at 7:11 PM, Chris J Arges
<chris.j.arges@canonical.com> wrote:
> On Tue, May 24, 2016 at 12:55:54PM +0800, Ming Lei wrote:
>> From: David Daney <david.daney@cavium.com>
>>
>> BugLink: http://bugs.launchpad.net/bugs/1574814
>>
>> We are getting somewhat random soft lockups with this signature:
>>
>> [   86.992215] [<fffffc00080935e0>] el1_irq+0xa0/0x10c
>> [   86.997082] [<fffffc000841822c>] cursor_timer_handler+0x30/0x54
>> [   87.002991] [<fffffc000810ec44>] call_timer_fn+0x54/0x1a8
>> [   87.008378] [<fffffc000810ef88>] run_timer_softirq+0x1c4/0x2bc
>> [   87.014200] [<fffffc000809077c>] __do_softirq+0x114/0x344
>> [   87.019590] [<fffffc00080af45c>] irq_exit+0x74/0x98
>> [   87.024458] [<fffffc00080fac20>] __handle_domain_irq+0x98/0xfc
>> [   87.030278] [<fffffc000809056c>] gic_handle_irq+0x94/0x190
>>
>> This is caused by the vt visual_init() function calling into
>> fbcon_init() with a vc_cur_blink_ms value of zero.  This is a
>> transient condition, as it is later set to a non-zero value.  But, if
>> the timer happens to expire while the blink rate is zero, it goes into
>> an endless loop, and we get soft lockup.
>>
>> The fix is to initialize vc_cur_blink_ms before calling the con_init()
>> function.
>>
>> Tested-by: Ming Lei <ming.lei@canonical.com>
>> Acked-by: Pavel Machek <pavel@ucw.cz>
>> Acked-by: Scot Doyle <lkml14@scotdoyle.com>
>> Signed-off-by: David Daney <david.daney@cavium.com>
>> Cc: stable@vger.kernel.org
>
> When you cherry-pick onto Xenial can you also include the -x flag to append the
> commit hash?

This patch doesn't land linus tree yet, and it does block di installer &
mass enablement, so hope it can land xenial first.

Thanks,

> --chris
>
>> ---
>>  drivers/tty/vt/vt.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
>> index 4af9a8f..d80f4ec 100644
>> --- a/drivers/tty/vt/vt.c
>> +++ b/drivers/tty/vt/vt.c
>> @@ -761,6 +761,7 @@ static void visual_init(struct vc_data *vc, int num, int init)
>>       vc->vc_complement_mask = 0;
>>       vc->vc_can_do_color = 0;
>>       vc->vc_panic_force_write = false;
>> +     vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS;
>>       vc->vc_sw->con_init(vc, init);
>>       if (!vc->vc_complement_mask)
>>               vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
>> --
>> 1.9.1
>>
>>
>> --
>> kernel-team mailing list
>> kernel-team@lists.ubuntu.com
>> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Kamal Mostafa May 24, 2016, 3:21 p.m. UTC | #4
Applied this as:

    UBUNTU: SAUCE: tty: vt: Fix soft lockup in fbcon cursor blink timer.

and inserted LKML reference:

    Reference: https://lkml.org/lkml/2016/5/17/455

 -Kamal


On Tue, May 24, 2016 at 12:55:54PM +0800, Ming Lei wrote:
> From: David Daney <david.daney@cavium.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1574814
> 
> We are getting somewhat random soft lockups with this signature:
> 
> [   86.992215] [<fffffc00080935e0>] el1_irq+0xa0/0x10c
> [   86.997082] [<fffffc000841822c>] cursor_timer_handler+0x30/0x54
> [   87.002991] [<fffffc000810ec44>] call_timer_fn+0x54/0x1a8
> [   87.008378] [<fffffc000810ef88>] run_timer_softirq+0x1c4/0x2bc
> [   87.014200] [<fffffc000809077c>] __do_softirq+0x114/0x344
> [   87.019590] [<fffffc00080af45c>] irq_exit+0x74/0x98
> [   87.024458] [<fffffc00080fac20>] __handle_domain_irq+0x98/0xfc
> [   87.030278] [<fffffc000809056c>] gic_handle_irq+0x94/0x190
> 
> This is caused by the vt visual_init() function calling into
> fbcon_init() with a vc_cur_blink_ms value of zero.  This is a
> transient condition, as it is later set to a non-zero value.  But, if
> the timer happens to expire while the blink rate is zero, it goes into
> an endless loop, and we get soft lockup.
> 
> The fix is to initialize vc_cur_blink_ms before calling the con_init()
> function.
> 
> Tested-by: Ming Lei <ming.lei@canonical.com>
> Acked-by: Pavel Machek <pavel@ucw.cz>
> Acked-by: Scot Doyle <lkml14@scotdoyle.com>
> Signed-off-by: David Daney <david.daney@cavium.com>
> Cc: stable@vger.kernel.org
> ---
>  drivers/tty/vt/vt.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 4af9a8f..d80f4ec 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -761,6 +761,7 @@ static void visual_init(struct vc_data *vc, int num, int init)
>  	vc->vc_complement_mask = 0;
>  	vc->vc_can_do_color = 0;
>  	vc->vc_panic_force_write = false;
> +	vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS;
>  	vc->vc_sw->con_init(vc, init);
>  	if (!vc->vc_complement_mask)
>  		vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;
> -- 
> 1.9.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Patch
diff mbox

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 4af9a8f..d80f4ec 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -761,6 +761,7 @@  static void visual_init(struct vc_data *vc, int num, int init)
 	vc->vc_complement_mask = 0;
 	vc->vc_can_do_color = 0;
 	vc->vc_panic_force_write = false;
+	vc->vc_cur_blink_ms = DEFAULT_CURSOR_BLINK_MS;
 	vc->vc_sw->con_init(vc, init);
 	if (!vc->vc_complement_mask)
 		vc->vc_complement_mask = vc->vc_can_do_color ? 0x7700 : 0x0800;