Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freezes by using force feedback - Kernel bug? #27

Closed
fizzgigfuzzlehead opened this issue Sep 10, 2015 · 3 comments
Closed

Freezes by using force feedback - Kernel bug? #27

fizzgigfuzzlehead opened this issue Sep 10, 2015 · 3 comments

Comments

@fizzgigfuzzlehead
Copy link

Hey guys,

I got strange freezes while playing DiRT: Showdown with my wireless XBox 360 controller.

I posted this first here at Virtual Programming:
https://github.com/virtual-programming/dirtshowdown-linux/issues/5#issuecomment-139026856

Is it true that this could be a Kernel bug? Who would be able to fix this?

@ghost
Copy link

ghost commented Sep 14, 2015

Hi
The relevant part was this appearing in the kernel log:

Sep 6 12:55:31 steamos kernel: [ 287.145066] WARNING: at /usr/src/packages/BUILD/linux-3.10.60/drivers/usb/core/urb.c:327 usb_submit_urb+0x4e/0x2ba usbcore
Sep 6 12:55:31 steamos kernel: [ 287.145067] URB ffff880234edfb40 submitted while active
Sep 6 12:55:31 steamos kernel: [ 287.145068] Modules linked in: bnep rfcomm nls_utf8 nls_cp437 vfat fat snd_hda_codec_hdmi arc4 acpi_cpufreq mperf kvm_amd kvm crc32c$
Sep 6 12:55:31 steamos kernel: [ 287.145095] CPU: 2 PID: 4477 Comm: dirt.i386 Tainted: P O 3.10-5-amd64 #1 SteamOS 3.10.60-1+steamos1
Sep 6 12:55:31 steamos kernel: [ 287.145097] Hardware name: Gigabyte Technology Co., Ltd. To be filled by O.E.M./F2A88XN-WIFI, BIOS F4 05/28/2014
Sep 6 12:55:31 steamos kernel: [ 287.145098] ffffffff8138fb4c 0000000000000000 ffffffff8103cf89 ffff8800be45e360
Sep 6 12:55:31 steamos kernel: [ 287.145101] ffff880234443cc8 ffffffff8104908d 00000000fffffff0 0000000000000010
Sep 6 12:55:31 steamos kernel: [ 287.145103] ffff880231b8e400 00000000ffffff80 ffffffff8103d039 ffffffffa001df7a
Sep 6 12:55:31 steamos kernel: [ 287.145105] Call Trace:
Sep 6 12:55:31 steamos kernel: [ 287.145110] [] ? dump_stack+0xd/0x17
Sep 6 12:55:31 steamos kernel: [ 287.145114] [] ? warn_slowpath_common+0x5f/0x77
Sep 6 12:55:31 steamos kernel: [ 287.145117] [] ? internal_add_timer+0xd/0x28
Sep 6 12:55:31 steamos kernel: [ 287.145119] [] ? warn_slowpath_fmt+0x45/0x4a
Sep 6 12:55:31 steamos kernel: [ 287.145127] [] ? usb_submit_urb+0x4e/0x2ba [usbcore]
Sep 6 12:55:31 steamos kernel: [ 287.145130] [] ? ml_play_effects+0x3b/0x383 [ff_memless]
Sep 6 12:55:31 steamos kernel: [ 287.145132] [] ? ml_ff_playback+0x82/0x8c [ff_memless]
Sep 6 12:55:31 steamos kernel: [ 287.145135] [] ? input_ff_event+0x7c/0x80
Sep 6 12:55:31 steamos kernel: [ 287.145137] [] ? input_handle_event+0x367/0x44b
Sep 6 12:55:31 steamos kernel: [ 287.145139] [] ? input_inject_event+0x69/0x91
Sep 6 12:55:31 steamos kernel: [ 287.145142] [] ? should_resched+0x5/0x23
Sep 6 12:55:31 steamos kernel: [ 287.145145] [] ? evdev_write+0x89/0xc3 [evdev]
Sep 6 12:55:31 steamos kernel: [ 287.145148] [] ? spin_unlock+0x5/0x6
Sep 6 12:55:31 steamos kernel: [ 287.145151] [] ? vfs_write+0x9d/0x103
Sep 6 12:55:31 steamos kernel: [ 287.145154] [] ? SyS_write+0x51/0x80
Sep 6 12:55:31 steamos kernel: [ 287.145156] [] ? ia32_do_call+0x13/0x13
Sep 6 12:55:31 steamos kernel: [ 287.145157] ---[ end trace c7faa89af51267c4 ]---

when the user disabled force feedback in game, the problem went away. We cannot replicate this ourselves on Ubuntu 15.04, and we've had no other reports of it so far.

@Plagman
Copy link
Member

Plagman commented Sep 14, 2015

This is fixed in SteamOS 2.0, I recommend all users update to brewmaster ASAP.

@ghost
Copy link

ghost commented Sep 14, 2015

OK, cool.. we will advise that :)

Plagman pushed a commit that referenced this issue Sep 16, 2015
[ Upstream commit ecf5fc6 ]

Nikolay has reported a hang when a memcg reclaim got stuck with the
following backtrace:

PID: 18308  TASK: ffff883d7c9b0a30  CPU: 1   COMMAND: "rsync"
  #0 __schedule at ffffffff815ab152
  #1 schedule at ffffffff815ab76e
  #2 schedule_timeout at ffffffff815ae5e5
  #3 io_schedule_timeout at ffffffff815aad6a
  #4 bit_wait_io at ffffffff815abfc6
  #5 __wait_on_bit at ffffffff815abda5
  #6 wait_on_page_bit at ffffffff8111fd4f
  #7 shrink_page_list at ffffffff81135445
  #8 shrink_inactive_list at ffffffff81135845
  #9 shrink_lruvec at ffffffff81135ead
 #10 shrink_zone at ffffffff811360c3
 #11 shrink_zones at ffffffff81136eff
 #12 do_try_to_free_pages at ffffffff8113712f
 #13 try_to_free_mem_cgroup_pages at ffffffff811372be
 #14 try_charge at ffffffff81189423
 #15 mem_cgroup_try_charge at ffffffff8118c6f5
 #16 __add_to_page_cache_locked at ffffffff8112137d
 #17 add_to_page_cache_lru at ffffffff81121618
 #18 pagecache_get_page at ffffffff8112170b
 #19 grow_dev_page at ffffffff811c8297
 #20 __getblk_slow at ffffffff811c91d6
 #21 __getblk_gfp at ffffffff811c92c1
 #22 ext4_ext_grow_indepth at ffffffff8124565c
 #23 ext4_ext_create_new_leaf at ffffffff81246ca8
 #24 ext4_ext_insert_extent at ffffffff81246f09
 #25 ext4_ext_map_blocks at ffffffff8124a848
 #26 ext4_map_blocks at ffffffff8121a5b7
 #27 mpage_map_one_extent at ffffffff8121b1fa
 #28 mpage_map_and_submit_extent at ffffffff8121f07b
 #29 ext4_writepages at ffffffff8121f6d5
 #30 do_writepages at ffffffff8112c490
 #31 __filemap_fdatawrite_range at ffffffff81120199
 #32 filemap_flush at ffffffff8112041c
 #33 ext4_alloc_da_blocks at ffffffff81219da1
 #34 ext4_rename at ffffffff81229b91
 #35 ext4_rename2 at ffffffff81229e32
 #36 vfs_rename at ffffffff811a08a5
 #37 SYSC_renameat2 at ffffffff811a3ffc
 #38 sys_renameat2 at ffffffff811a408e
 #39 sys_rename at ffffffff8119e51e
 #40 system_call_fastpath at ffffffff815afa89

Dave Chinner has properly pointed out that this is a deadlock in the
reclaim code because ext4 doesn't submit pages which are marked by
PG_writeback right away.

The heuristic was introduced by commit e62e384 ("memcg: prevent OOM
with too many dirty pages") and it was applied only when may_enter_fs
was specified.  The code has been changed by c3b94f4 ("memcg:
further prevent OOM with too many dirty pages") which has removed the
__GFP_FS restriction with a reasoning that we do not get into the fs
code.  But this is not sufficient apparently because the fs doesn't
necessarily submit pages marked PG_writeback for IO right away.

ext4_bio_write_page calls io_submit_add_bh but that doesn't necessarily
submit the bio.  Instead it tries to map more pages into the bio and
mpage_map_one_extent might trigger memcg charge which might end up
waiting on a page which is marked PG_writeback but hasn't been submitted
yet so we would end up waiting for something that never finishes.

Fix this issue by replacing __GFP_IO by may_enter_fs check (for case 2)
before we go to wait on the writeback.  The page fault path, which is
the only path that triggers memcg oom killer since 3.12, shouldn't
require GFP_NOFS and so we shouldn't reintroduce the premature OOM
killer issue which was originally addressed by the heuristic.

As per David Chinner the xfs is doing similar thing since 2.6.15 already
so ext4 is not the only affected filesystem.  Moreover he notes:

: For example: IO completion might require unwritten extent conversion
: which executes filesystem transactions and GFP_NOFS allocations. The
: writeback flag on the pages can not be cleared until unwritten
: extent conversion completes. Hence memory reclaim cannot wait on
: page writeback to complete in GFP_NOFS context because it is not
: safe to do so, memcg reclaim or otherwise.

Cc: stable@vger.kernel.org # 3.9+
[tytso@mit.edu: corrected the control flow]
Fixes: c3b94f4 ("memcg: further prevent OOM with too many dirty pages")
Reported-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants