Skip to content

Commit

Permalink
vgacon.c: add cond reschedule points in vgacon_do_font_op
Browse files Browse the repository at this point in the history
Booting a 64-vcpu KVM guest, with CONFIG_PREEMPT_VOLUNTARY,
can result in a soft lockup:

BUG: soft lockup - CPU#41 stuck for 67s! [setfont:1505]
 RIP: 0010:[<ffffffff812c48da>]
[<ffffffff812c48da>] vgacon_do_font_op.clone.0+0x1ba/0x550

This is due to the 8192 (cmapsz) IO operations taking longer than expected
due to lock contention in QEMU.

Add conditional resched points in between writes allowing other tasks to
execute.

Signed-off-by: Marcelo Tosatti <[email protected]>
Cc: [email protected]
Signed-off-by: Dave Airlie <[email protected]>
  • Loading branch information
matosatti authored and airlied committed Jun 26, 2013
1 parent 5cef29a commit 7e6d72c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions drivers/video/console/vgacon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,11 +1124,15 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)

if (arg) {
if (set)
for (i = 0; i < cmapsz; i++)
for (i = 0; i < cmapsz; i++) {
vga_writeb(arg[i], charmap + i);
cond_resched();
}
else
for (i = 0; i < cmapsz; i++)
for (i = 0; i < cmapsz; i++) {
arg[i] = vga_readb(charmap + i);
cond_resched();
}

/*
* In 512-character mode, the character map is not contiguous if
Expand All @@ -1139,11 +1143,15 @@ static int vgacon_do_font_op(struct vgastate *state,char *arg,int set,int ch512)
charmap += 2 * cmapsz;
arg += cmapsz;
if (set)
for (i = 0; i < cmapsz; i++)
for (i = 0; i < cmapsz; i++) {
vga_writeb(arg[i], charmap + i);
cond_resched();
}
else
for (i = 0; i < cmapsz; i++)
for (i = 0; i < cmapsz; i++) {
arg[i] = vga_readb(charmap + i);
cond_resched();
}
}
}

Expand Down

0 comments on commit 7e6d72c

Please sign in to comment.