Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1402532 > unrolled thread

[PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer.

Started byDavid Daney <ddaney.cavm@gmail.com>
First post2016-05-17 20:50 +0200
Last post2016-05-28 13:50 +0200
Articles 5 on this page of 25 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer. David Daney <ddaney.cavm@gmail.com> - 2016-05-17 20:50 +0200
    Re: [PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer. Pavel Machek <pavel@ucw.cz> - 2016-05-17 22:50 +0200
      Re: [PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer. Ming Lei <ming.lei@canonical.com> - 2016-05-18 02:50 +0200
        Re: [PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer. Scot Doyle <lkml14@scotdoyle.com> - 2016-05-18 22:40 +0200
          Re: [PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer. Ming Lei <ming.lei@canonical.com> - 2016-05-19 02:30 +0200
            Re: [PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer. Pavel Machek <pavel@ucw.cz> - 2016-05-19 09:10 +0200
          [PATCH] fbcon: use default if cursor blink interval is not valid Scot Doyle <lkml14@scotdoyle.com> - 2016-05-19 06:30 +0200
            Re: [PATCH] fbcon: use default if cursor blink interval is not valid Jeremy Kerr <jk@ozlabs.org> - 2016-05-19 09:30 +0200
            Re: [PATCH] fbcon: use default if cursor blink interval is not valid Ming Lei <ming.lei@canonical.com> - 2016-05-19 10:40 +0200
            Re: [PATCH] fbcon: use default if cursor blink interval is not valid Pavel Machek <pavel@ucw.cz> - 2016-05-19 11:10 +0200
              Re: [PATCH] fbcon: use default if cursor blink interval is not  valid Scot Doyle <lkml14@scotdoyle.com> - 2016-05-19 16:30 +0200
                Re: [PATCH] fbcon: use default if cursor blink interval is not valid Ming Lei <ming.lei@canonical.com> - 2016-05-19 17:40 +0200
            Re: [PATCH] fbcon: use default if cursor blink interval is not  valid Scot Doyle <lkml14@scotdoyle.com> - 2016-05-20 00:30 +0200
              [PATCH] fbcon: warn on invalid cursor blink intervals Scot Doyle <lkml14@scotdoyle.com> - 2016-05-20 00:40 +0200
                Re: [PATCH] fbcon: warn on invalid cursor blink intervals Jeremy Kerr <jk@ozlabs.org> - 2016-05-20 03:30 +0200
                Re: [PATCH] fbcon: warn on invalid cursor blink intervals Ming Lei <ming.lei@canonical.com> - 2016-05-20 04:20 +0200
                  Re: [PATCH] fbcon: warn on invalid cursor blink intervals Jeremy Kerr <jk@ozlabs.org> - 2016-05-20 04:30 +0200
                    Re: [PATCH] fbcon: warn on invalid cursor blink intervals Ming Lei <ming.lei@canonical.com> - 2016-05-20 04:50 +0200
                      Re: [PATCH] fbcon: warn on invalid cursor blink intervals Jeremy Kerr <jk@ozlabs.org> - 2016-05-20 07:10 +0200
                        Re: [PATCH] fbcon: warn on invalid cursor blink intervals Scot Doyle <lkml14@scotdoyle.com> - 2016-05-20 18:30 +0200
                          Re: [PATCH] fbcon: warn on invalid cursor blink intervals Scot Doyle <lkml14@scotdoyle.com> - 2016-05-24 03:30 +0200
                          Re: [PATCH] fbcon: warn on invalid cursor blink intervals Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-05-28 13:50 +0200
                Re: [PATCH] fbcon: warn on invalid cursor blink intervals Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-05-28 13:50 +0200
    Re: [PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer. Scot Doyle <lkml14@scotdoyle.com> - 2016-05-20 00:40 +0200
    Re: [PATCH] tty: vt: Fix soft lockup in fbcon cursor blink timer. Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2016-05-28 13:50 +0200

Page 2 of 2 — ← Prev page 1 [2]


#1405759 — Re: [PATCH] fbcon: warn on invalid cursor blink intervals

FromScot Doyle <lkml14@scotdoyle.com>
Date2016-05-24 03:30 +0200
SubjectRe: [PATCH] fbcon: warn on invalid cursor blink intervals
Message-ID<rC9ku-4VI-3@gated-at.bofh.it>
In reply to#1404576
On Fri, 20 May 2016, Scot Doyle wrote:
> On Fri, 20 May 2016, Jeremy Kerr wrote:
> > Hi Ming,
> > 
> > >Then looks there are two fix patches acked & tested:
> > >
> > > - the patch in this thread
> > > - another one "[PATCH] tty: vt: Fix soft lockup in fbcon cursor
> > >blink timer."
> > > https://lkml.org/lkml/2016/5/17/455
> > >
> > >So which one will be pushed to linus?
> > 
> > Not that it's my call, but we may want both; the first as a safety
> > measure to prevent an invalid cur_blink_jiffies ever being set, and the
> > second one to actually fix the initialisation of vc_cur_blink_ms (and
> > address the warning introduced by the first).
> 
> Tomi / Greg,
> 
> I'd suggest
> - applying "tty: vt: Fix soft lockup in fbcon cursor blink timer." to 4.7 and stable[4.2]
> - applying "fbcon: warn on invalid cursor blink intervals" to 4.7
> - ignoring "fbcon: use default if cursor blink interval is not valid"
> 
> Note: the patches don't depend on each other

"tty: vt: Fix soft lockup..." should be applied first in order to avoid 
unnecessary reports due to the log warning in "fbcon: warn on invalid..."

> 
> > I guess we could just go with the latter for stable...
> >
> > Cheers,
> > 
> > Jeremy

[toc] | [prev] | [next] | [standalone]


#1408444 — Re: [PATCH] fbcon: warn on invalid cursor blink intervals

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2016-05-28 13:50 +0200
SubjectRe: [PATCH] fbcon: warn on invalid cursor blink intervals
Message-ID<rDKUF-8od-3@gated-at.bofh.it>
In reply to#1404576
On Fri, 20 May 2016, Scot Doyle wrote:
> On Fri, 20 May 2016, Jeremy Kerr wrote:
> > >Then looks there are two fix patches acked & tested:
> > >
> > > - the patch in this thread
> > > - another one "[PATCH] tty: vt: Fix soft lockup in fbcon cursor
> > >blink timer."
> > > https://lkml.org/lkml/2016/5/17/455
> > >
> > >So which one will be pushed to linus?
> > 
> > Not that it's my call, but we may want both; the first as a safety
> > measure to prevent an invalid cur_blink_jiffies ever being set, and the
> > second one to actually fix the initialisation of vc_cur_blink_ms (and
> > address the warning introduced by the first).
> 
> Tomi / Greg,
> 
> I'd suggest
> - applying "tty: vt: Fix soft lockup in fbcon cursor blink timer." to 4.7 and stable[4.2]
> - applying "fbcon: warn on invalid cursor blink intervals" to 4.7
> - ignoring "fbcon: use default if cursor blink interval is not valid"
> 
> Note: the patches don't depend on each other

I applied both recommended patches on top of 4.4.11 for testing, and they
made things a lot better here.

I suggest the second patch should be backported to stable too, might as well
fix this thing for good *and keep the door closed*.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

[toc] | [prev] | [next] | [standalone]


#1408446 — Re: [PATCH] fbcon: warn on invalid cursor blink intervals

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2016-05-28 13:50 +0200
SubjectRe: [PATCH] fbcon: warn on invalid cursor blink intervals
Message-ID<rDKUF-8od-7@gated-at.bofh.it>
In reply to#1404005
On Thu, 19 May 2016, Scot Doyle wrote:
> Two systems are locking on boot [1] because ops->cur_blink_jiffies
> is set to zero from vc->vc_cur_blink_ms.
> 
> Ignore such invalid intervals and log a warning.
> 
> [1] https://bugs.launchpad.net/bugs/1574814
> 
> Suggested-by: David Daney <david.daney@cavium.com>
> Signed-off-by: Scot Doyle <lkml14@scotdoyle.com>
> Cc: <stable@vger.kernel.org> [v4.2]

FWIW:
Tested-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> on top of 4.4.11.

And nothing caused it to issue warnings here, so far (with the other
recommended patch applied first).

> ---
>  drivers/video/console/fbcon.c | 14 ++++++++++++--
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
> index 6e92917..fad5b89 100644
> --- a/drivers/video/console/fbcon.c
> +++ b/drivers/video/console/fbcon.c
> @@ -1095,7 +1095,13 @@ static void fbcon_init(struct vc_data *vc, int init)
>  		con_copy_unimap(vc, svc);
>  
>  	ops = info->fbcon_par;
> -	ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
> +
> +	if (vc->vc_cur_blink_ms >= 50)
> +		ops->cur_blink_jiffies =
> +		    msecs_to_jiffies(vc->vc_cur_blink_ms);
> +	else
> +		WARN_ONCE(1, "blink interval < 50 ms");
> +
>  	p->con_rotate = initial_rotation;
>  	set_blitting_type(vc, info);
>  
> @@ -1309,7 +1315,11 @@ static void fbcon_cursor(struct vc_data *vc, int mode)
>  	int y;
>   	int c = scr_readw((u16 *) vc->vc_pos);
>  
> -	ops->cur_blink_jiffies = msecs_to_jiffies(vc->vc_cur_blink_ms);
> +	if (vc->vc_cur_blink_ms >= 50)
> +		ops->cur_blink_jiffies =
> +		    msecs_to_jiffies(vc->vc_cur_blink_ms);
> +	else
> +		WARN_ONCE(1, "blink interval < 50 ms");
>  
>  	if (fbcon_is_inactive(vc, info) || vc->vc_deccm != 1)
>  		return;

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

[toc] | [prev] | [next] | [standalone]


#1404002

FromScot Doyle <lkml14@scotdoyle.com>
Date2016-05-20 00:40 +0200
Message-ID<rAELL-5Nf-11@gated-at.bofh.it>
In reply to#1402532
On Tue, 17 May 2016, David Daney wrote:
> From: David Daney <david.daney@cavium.com>
> 
> 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.
> 
> Signed-off-by: David Daney <david.daney@cavium.com>
> Cc: stable@vger.kernel.org

Acked-by: Scot Doyle <lkml14@scotdoyle.com>

[toc] | [prev] | [next] | [standalone]


#1408445

FromHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Date2016-05-28 13:50 +0200
Message-ID<rDKUF-8od-5@gated-at.bofh.it>
In reply to#1402532
On Tue, 17 May 2016, David Daney wrote:
> From: David Daney <david.daney@cavium.com>
> 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.
> 
> Signed-off-by: David Daney <david.daney@cavium.com>
> Cc: stable@vger.kernel.org

Tested-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> on top of 4.4.11.

> ---
>  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 3e3c757..eef5c36 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -750,6 +750,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;

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web