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

Utilite dt #16

Merged
merged 61 commits into from
Sep 20, 2015
Merged

Utilite dt #16

merged 61 commits into from
Sep 20, 2015

Conversation

tomlohave
Copy link

add support for Utilite from Compulab

Add initial support for cm-fx6 module.

This patch configures:
1) serial console
2) hearbeat led
3) FreeScale NIC
4) pcie
5) Intel I210 NIC
6) wif/bt
7) sata

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add default configuration file for the cm-fx6 module.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Enable random mac address in order to let the driver up
if eeprom values are incorrect.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Enable EM3027 RTC

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add HDMI and DVI support on IPU1 and IPU2, define two frame buffers.
Enable starting X with fbdev.
Add HDMI-Audio support.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add SPDIF support.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add "Power Button" by means of GPIO

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Enable ttymxc1 for use as a serial console:
1) Add the correct uart2 pinmux configuration.
2) Disable uart2 dte mode.
	It allows running 'getty' and 'login' on the ttymxc1.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add pcie power/reset gpio definition.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add onboard SSD pin configuration.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add onboard SSD power up sequence.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add audio mux pinmux configuration and enable audio mux.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
1) Add i2c analog audion device node definition.
2) Add wm8731 codec node definition.
3) Enable ssi2 in master mode.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
This is the initial imx-wm8731 device-tree-only machine driver working with
fsl_ssi driver. Works in the slave mode.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add imx-wm8731 master mode support.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Enable v4l2 output.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
1) Fixed the color depth value for both frame buffers.
2) Added a missing OTG pinmux definition.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
1) Define the device mac address node in the device tree.
2) Make the driver read the mac address from the device tree node.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Enable:
1) Analog audio
2) MRVL bluetooth
3) SATA AHCI
4) USB OTG
5) Board revision

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Separate the staff that belongs to SB-FX6 and SB-FX6m boards.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Refactoring device tree files:
1) Utilite:
+ imx6q.dtsi
+ imx6q-sb-fx6x.dtsi
+ imx6q-sb-fx6m.dtsi
+ imx6q-cm-fx6.dtsi
= imx6q-sbc-fx6m.dts

2) CM-FX6-EVAL:
+ imx6q.dtsi
+ imx6q-sb-fx6x.dtsi
+ imx6q-sb-fx6.dtsi
+ imx6q-cm-fx6.dtsi
= imx6q-sbc-fx6.dts

3) CM-FX6 Module:
+ imx6q.dtsi
+ imx6q-cm-fx6.dtsi
= imx6q-cm-fx6.dts

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Define pcie power-on-gpio as a fixed regulator.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Restore the i2c1 bus staus that has been deleted while refactoring.
It was the reason why em3027 stoped working.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add local-mac-address field for fec.
The board U-Boot is in charge to fill this field with a correct value.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Fix the cm-fx6 operation points. Remove settings for 1.2GHz.
The current ldo settings do not allow 1.2GHz cpu frequency.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Fix build warnings and update includes.

sound/soc/fsl/imx-wm8731.c: In function 'imx_hifi_hw_params_slv_mode':
sound/soc/fsl/imx-wm8731.c:357:3: warning: format '%u' expects type 'unsigned int', but argument 2 has type 'long int'
sound/soc/fsl/imx-wm8731.c: In function 'imx_hifi_hw_params_mst_mode':
sound/soc/fsl/imx-wm8731.c:414:3: warning: format '%u' expects type 'unsigned int', but argument 2 has type 'long int'

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Change the order in which GPIOs are toggled in SATA init sequence to
accomodate both SanDisk and Phison SSDs.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Set a correct mux mode for both:
WLAN_BT_nPD and WLAN_BT_nRESET.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Enable i2cmux in defconfig.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
vraevsky and others added 22 commits September 6, 2015 13:58
Enable can bus.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add tsc2046 touchscreen support.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add uhs pinctrl state for usdhc3.
This is needed for supporting ultra high speed cards.

Add cd/wp definitions.
Add a missing property no-1-8-v.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Fix up incorrect compatibilities.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Fix include file order.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
In preparation for DL/S support addition, we rename the files to better
describe the content and reuse the same DT code.
Rename the sb-fx6 board files' names

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
[grinberg@compulab.co.il: added a bit more descriptive commit message]
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
In preparation for DL/S support addition, we move the common code
to dtsi files for better reuse of the same DT code.
Refactor the sbc-fx6 target files.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
[grinberg@compulab.co.il: added a bit more descriptive commit message]
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Break down the cm-fx6 file into two files in order to
separate DL and Quad supported features.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
[grinberg@compulab.co.il: fix available memory size and
rename "dl" to "qdl"]
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Add initial support for cm-fx6 DL/S modules.

This patch configures:
1) serial console
2) hearbeat led
3) FreeScale NIC
4) pcie
5) Intel I210 NIC
6) Analog audio wm8731-audio

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
[grinberg@compulab.co.il: fix dtsi file name as per previous patch]
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Add board files for sbc-fx6 DL/S modules and Utilite Value.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
[grinberg@compulab.co.il: fix dtsi files names as per previous patches]
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Add build targets for cm-fx6 flavour boards.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>

Conflicts:

	arch/arm/boot/dts/Makefile

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Change the hdmi_core ipu connection in order to
allow using the second IPU on quad SBC-FX6 boards with ldb devices.
SBC-FX6m boards still use an IPU per port.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add ldb support for SBC-FX6 boards.
LVDS1/0 ports of the SBC-FX6 are configured.
LVDS0 - IPU1:DISP0 - fb3
LVDS1 - IPU1:DISP1 - fb5

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Add IOMUXC_GPR1/6/7 registers to the iomux default pinctrl group.
The IOMUXC_GPR1 register must have default value in order to let the SoC boot up after a warm reboot.
IOMUXC_GPR6/7 registers must have a correct value for the ipu QoS priority.
Otherwise the SoC reports on:
1) the interrupt that is a result of a time out error during a read access via DIx.
2) a new frame starts before the previous end-of-frame event.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
The OF helpers have been moved to the core.
As a result the i2c_of.h does not exist anymore.
Fix i2c_of include with respect to the latest core implementation.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Fix missing defines that have been changed since 3.10.17

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
IMX6Q_GPR3_HDMI_MUX_CTL_SHIFT

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
Update the cm_fx6_defconfig with respect to
the kernel release after applying the 3.10.17 patches.

Signed-off-by: Valentin Raevsky <valentin@compulab.co.il>
original patch Valentin Raevsky <valentin@compulab.co.il>
linux4kix added a commit that referenced this pull request Sep 20, 2015
@linux4kix linux4kix merged commit 837f5a6 into SolidRun:3.14-1.0.x-mx6-sr Sep 20, 2015
@tomlohave tomlohave deleted the utilite-dt branch September 20, 2015 06:49
mk01 pushed a commit to mk01/linux-fslc that referenced this pull request Oct 9, 2015
commit ecf5fc6 upstream.

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
  SolidRun#1 schedule at ffffffff815ab76e
  SolidRun#2 schedule_timeout at ffffffff815ae5e5
  SolidRun#3 io_schedule_timeout at ffffffff815aad6a
  SolidRun#4 bit_wait_io at ffffffff815abfc6
  SolidRun#5 __wait_on_bit at ffffffff815abda5
  SolidRun#6 wait_on_page_bit at ffffffff8111fd4f
  SolidRun#7 shrink_page_list at ffffffff81135445
  SolidRun#8 shrink_inactive_list at ffffffff81135845
  SolidRun#9 shrink_lruvec at ffffffff81135ead
 SolidRun#10 shrink_zone at ffffffff811360c3
 SolidRun#11 shrink_zones at ffffffff81136eff
 SolidRun#12 do_try_to_free_pages at ffffffff8113712f
 SolidRun#13 try_to_free_mem_cgroup_pages at ffffffff811372be
 SolidRun#14 try_charge at ffffffff81189423
 SolidRun#15 mem_cgroup_try_charge at ffffffff8118c6f5
 SolidRun#16 __add_to_page_cache_locked at ffffffff8112137d
 SolidRun#17 add_to_page_cache_lru at ffffffff81121618
 SolidRun#18 pagecache_get_page at ffffffff8112170b
 SolidRun#19 grow_dev_page at ffffffff811c8297
 SolidRun#20 __getblk_slow at ffffffff811c91d6
 SolidRun#21 __getblk_gfp at ffffffff811c92c1
 SolidRun#22 ext4_ext_grow_indepth at ffffffff8124565c
 SolidRun#23 ext4_ext_create_new_leaf at ffffffff81246ca8
 SolidRun#24 ext4_ext_insert_extent at ffffffff81246f09
 SolidRun#25 ext4_ext_map_blocks at ffffffff8124a848
 SolidRun#26 ext4_map_blocks at ffffffff8121a5b7
 SolidRun#27 mpage_map_one_extent at ffffffff8121b1fa
 SolidRun#28 mpage_map_and_submit_extent at ffffffff8121f07b
 SolidRun#29 ext4_writepages at ffffffff8121f6d5
 SolidRun#30 do_writepages at ffffffff8112c490
 SolidRun#31 __filemap_fdatawrite_range at ffffffff81120199
 SolidRun#32 filemap_flush at ffffffff8112041c
 SolidRun#33 ext4_alloc_da_blocks at ffffffff81219da1
 SolidRun#34 ext4_rename at ffffffff81229b91
 SolidRun#35 ext4_rename2 at ffffffff81229e32
 SolidRun#36 vfs_rename at ffffffff811a08a5
 SolidRun#37 SYSC_renameat2 at ffffffff811a3ffc
 SolidRun#38 sys_renameat2 at ffffffff811a408e
 SolidRun#39 sys_rename at ffffffff8119e51e
 SolidRun#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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
linux4kix pushed a commit that referenced this pull request Jan 26, 2016
Mike Galbraith captered the following:
| >#11 [ffff88017b243e90] _raw_spin_lock at ffffffff815d2596
| >#12 [ffff88017b243e90] rt_mutex_trylock at ffffffff815d15be
| >#13 [ffff88017b243eb0] get_next_timer_interrupt at ffffffff81063b42
| >#14 [ffff88017b243f00] tick_nohz_stop_sched_tick at ffffffff810bd1fd
| >#15 [ffff88017b243f70] tick_nohz_irq_exit at ffffffff810bd7d2
| >#16 [ffff88017b243f90] irq_exit at ffffffff8105b02d
| >#17 [ffff88017b243fb0] reschedule_interrupt at ffffffff815db3dd
| >--- <IRQ stack> ---
| >#18 [ffff88017a2a9bc8] reschedule_interrupt at ffffffff815db3dd
| >    [exception RIP: task_blocks_on_rt_mutex+51]
| >#19 [ffff88017a2a9ce0] rt_spin_lock_slowlock at ffffffff815d183c
| >#20 [ffff88017a2a9da0] lock_timer_base.isra.35 at ffffffff81061cbf
| >#21 [ffff88017a2a9dd0] schedule_timeout at ffffffff815cf1ce
| >#22 [ffff88017a2a9e50] rcu_gp_kthread at ffffffff810f9bbb
| >#23 [ffff88017a2a9ed0] kthread at ffffffff810796d5
| >#24 [ffff88017a2a9f50] ret_from_fork at ffffffff815da04c

lock_timer_base() does a try_lock() which deadlocks on the waiter lock
not the lock itself.
This patch takes the waiter_lock with trylock so it should work from interrupt
context as well. If the fastpath doesn't work and the waiter_lock itself is
taken then it seems that the lock itself taken.
This patch also adds "rt_spin_unlock_after_trylock_in_irq" to keep lockdep
happy. If we managed to take the wait_lock in the first place we should also
be able to take it in the unlock path.

Cc: stable-rt@vger.kernel.org
Reported-by: Mike Galbraith <bitbucket@online.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
jnettlet pushed a commit that referenced this pull request Mar 23, 2018
commit efdab99 upstream.

syzkaller reported:

   WARNING: CPU: 0 PID: 12927 at arch/x86/kernel/traps.c:780 do_debug+0x222/0x250
   CPU: 0 PID: 12927 Comm: syz-executor Tainted: G           OE    4.15.0-rc2+ #16
   RIP: 0010:do_debug+0x222/0x250
   Call Trace:
    <#DB>
    debug+0x3e/0x70
   RIP: 0010:copy_user_enhanced_fast_string+0x10/0x20
    </#DB>
    _copy_from_user+0x5b/0x90
    SyS_timer_create+0x33/0x80
    entry_SYSCALL_64_fastpath+0x23/0x9a

The testcase sets a watchpoint (with perf_event_open) on a buffer that is
passed to timer_create() as the struct sigevent argument.  In timer_create(),
copy_from_user()'s rep movsb triggers the BP.  The testcase also sets
the debug registers for the guest.

However, KVM only restores host debug registers when the host has active
watchpoints, which triggers a race condition when running the testcase with
multiple threads.  The guest's DR6.BS bit can escape to the host before
another thread invokes timer_create(), and do_debug() complains.

The fix is to respect do_debug()'s dr6 invariant when leaving KVM.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
jnettlet pushed a commit that referenced this pull request Mar 23, 2018
[ Upstream commit 5811767 ]

According to LS1021A RM, the value of PAL can be set so that the start of the
IP header in the receive data buffer is aligned to a 32-bit boundary. Normally,
setting PAL = 2 provides minimal padding to ensure such alignment of the IP
header.

However every incoming packet's 8-byte time stamp will be inserted into the
packet data buffer as padding alignment bytes when hardware time stamping is
enabled.

So we set the padding 8+2 here to avoid the flooded alignment faults:

root@128:~# cat /proc/cpu/alignment
User:           0
System:         17539 (inet_gro_receive+0x114/0x2c0)
Skipped:        0
Half:           0
Word:           0
DWord:          0
Multi:          17539
User faults:    2 (fixup)

Also shown when exception report enablement

CPU: 0 PID: 161 Comm: irq/66-eth1_g0_ Not tainted 4.1.21-rt13-WR8.0.0.0_preempt-rt #16
Hardware name: Freescale LS1021A
[<8001b420>] (unwind_backtrace) from [<8001476c>] (show_stack+0x20/0x24)
[<8001476c>] (show_stack) from [<807cfb48>] (dump_stack+0x94/0xac)
[<807cfb48>] (dump_stack) from [<80025d70>] (do_alignment+0x720/0x958)
[<80025d70>] (do_alignment) from [<80009224>] (do_DataAbort+0x40/0xbc)
[<80009224>] (do_DataAbort) from [<80015398>] (__dabt_svc+0x38/0x60)
Exception stack(0x86ad1cc0 to 0x86ad1d08)
1cc0: f9b3e080 86b3d072 2d78d287 00000000 866816c0 86b3d05e 86e785d0 00000000
1ce0: 00000011 0000000e 80840ab0 86ad1d3c 86ad1d08 86ad1d08 806d7fc0 806d806c
1d00: 40070013 ffffffff
[<80015398>] (__dabt_svc) from [<806d806c>] (inet_gro_receive+0x114/0x2c0)
[<806d806c>] (inet_gro_receive) from [<80660eec>] (dev_gro_receive+0x21c/0x3c0)
[<80660eec>] (dev_gro_receive) from [<8066133c>] (napi_gro_receive+0x44/0x17c)
[<8066133c>] (napi_gro_receive) from [<804f0538>] (gfar_clean_rx_ring+0x39c/0x7d4)
[<804f0538>] (gfar_clean_rx_ring) from [<804f0bf4>] (gfar_poll_rx_sq+0x58/0xe0)
[<804f0bf4>] (gfar_poll_rx_sq) from [<80660b10>] (net_rx_action+0x27c/0x43c)
[<80660b10>] (net_rx_action) from [<80033638>] (do_current_softirqs+0x1e0/0x3dc)
[<80033638>] (do_current_softirqs) from [<800338c4>] (__local_bh_enable+0x90/0xa8)
[<800338c4>] (__local_bh_enable) from [<8008025c>] (irq_forced_thread_fn+0x70/0x84)
[<8008025c>] (irq_forced_thread_fn) from [<800805e8>] (irq_thread+0x16c/0x244)
[<800805e8>] (irq_thread) from [<8004e490>] (kthread+0xe8/0x104)
[<8004e490>] (kthread) from [<8000fda8>] (ret_from_fork+0x14/0x2c)

Signed-off-by: Zumeng Chen <zumeng.chen@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
jnettlet pushed a commit that referenced this pull request Sep 3, 2018
[ Upstream commit 2bbea6e ]

when mounting an ISO filesystem sometimes (very rarely)
the system hangs because of a race condition between two tasks.

PID: 6766   TASK: ffff88007b2a6dd0  CPU: 0   COMMAND: "mount"
 #0 [ffff880078447ae0] __schedule at ffffffff8168d605
 #1 [ffff880078447b48] schedule_preempt_disabled at ffffffff8168ed49
 #2 [ffff880078447b58] __mutex_lock_slowpath at ffffffff8168c995
 #3 [ffff880078447bb8] mutex_lock at ffffffff8168bdef
 #4 [ffff880078447bd0] sr_block_ioctl at ffffffffa00b6818 [sr_mod]
 #5 [ffff880078447c10] blkdev_ioctl at ffffffff812fea50
 #6 [ffff880078447c70] ioctl_by_bdev at ffffffff8123a8b3
 #7 [ffff880078447c90] isofs_fill_super at ffffffffa04fb1e1 [isofs]
 #8 [ffff880078447da8] mount_bdev at ffffffff81202570
 #9 [ffff880078447e18] isofs_mount at ffffffffa04f9828 [isofs]
#10 [ffff880078447e28] mount_fs at ffffffff81202d09
#11 [ffff880078447e70] vfs_kern_mount at ffffffff8121ea8f
#12 [ffff880078447ea8] do_mount at ffffffff81220fee
#13 [ffff880078447f28] sys_mount at ffffffff812218d6
#14 [ffff880078447f80] system_call_fastpath at ffffffff81698c49
    RIP: 00007fd9ea914e9a  RSP: 00007ffd5d9bf648  RFLAGS: 00010246
    RAX: 00000000000000a5  RBX: ffffffff81698c49  RCX: 0000000000000010
    RDX: 00007fd9ec2bc210  RSI: 00007fd9ec2bc290  RDI: 00007fd9ec2bcf30
    RBP: 0000000000000000   R8: 0000000000000000   R9: 0000000000000010
    R10: 00000000c0ed0001  R11: 0000000000000206  R12: 00007fd9ec2bc040
    R13: 00007fd9eb6b2380  R14: 00007fd9ec2bc210  R15: 00007fd9ec2bcf30
    ORIG_RAX: 00000000000000a5  CS: 0033  SS: 002b

This task was trying to mount the cdrom.  It allocated and configured a
super_block struct and owned the write-lock for the super_block->s_umount
rwsem. While exclusively owning the s_umount lock, it called
sr_block_ioctl and waited to acquire the global sr_mutex lock.

PID: 6785   TASK: ffff880078720fb0  CPU: 0   COMMAND: "systemd-udevd"
 #0 [ffff880078417898] __schedule at ffffffff8168d605
 #1 [ffff880078417900] schedule at ffffffff8168dc59
 #2 [ffff880078417910] rwsem_down_read_failed at ffffffff8168f605
 #3 [ffff880078417980] call_rwsem_down_read_failed at ffffffff81328838
 #4 [ffff8800784179d0] down_read at ffffffff8168cde0
 #5 [ffff8800784179e8] get_super at ffffffff81201cc7
 #6 [ffff880078417a10] __invalidate_device at ffffffff8123a8de
 #7 [ffff880078417a40] flush_disk at ffffffff8123a94b
 #8 [ffff880078417a88] check_disk_change at ffffffff8123ab50
 #9 [ffff880078417ab0] cdrom_open at ffffffffa00a29e1 [cdrom]
#10 [ffff880078417b68] sr_block_open at ffffffffa00b6f9b [sr_mod]
#11 [ffff880078417b98] __blkdev_get at ffffffff8123ba86
#12 [ffff880078417bf0] blkdev_get at ffffffff8123bd65
#13 [ffff880078417c78] blkdev_open at ffffffff8123bf9b
#14 [ffff880078417c90] do_dentry_open at ffffffff811fc7f7
#15 [ffff880078417cd8] vfs_open at ffffffff811fc9cf
#16 [ffff880078417d00] do_last at ffffffff8120d53d
#17 [ffff880078417db0] path_openat at ffffffff8120e6b2
#18 [ffff880078417e48] do_filp_open at ffffffff8121082b
#19 [ffff880078417f18] do_sys_open at ffffffff811fdd33
#20 [ffff880078417f70] sys_open at ffffffff811fde4e
#21 [ffff880078417f80] system_call_fastpath at ffffffff81698c49
    RIP: 00007f29438b0c20  RSP: 00007ffc76624b78  RFLAGS: 00010246
    RAX: 0000000000000002  RBX: ffffffff81698c49  RCX: 0000000000000000
    RDX: 00007f2944a5fa70  RSI: 00000000000a0800  RDI: 00007f2944a5fa70
    RBP: 00007f2944a5f540   R8: 0000000000000000   R9: 0000000000000020
    R10: 00007f2943614c40  R11: 0000000000000246  R12: ffffffff811fde4e
    R13: ffff880078417f78  R14: 000000000000000c  R15: 00007f2944a4b010
    ORIG_RAX: 0000000000000002  CS: 0033  SS: 002b

This task tried to open the cdrom device, the sr_block_open function
acquired the global sr_mutex lock. The call to check_disk_change()
then saw an event flag indicating a possible media change and tried
to flush any cached data for the device.
As part of the flush, it tried to acquire the super_block->s_umount
lock associated with the cdrom device.
This was the same super_block as created and locked by the previous task.

The first task acquires the s_umount lock and then the sr_mutex_lock;
the second task acquires the sr_mutex_lock and then the s_umount lock.

This patch fixes the issue by moving check_disk_change() out of
cdrom_open() and let the caller take care of it.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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

Successfully merging this pull request may close these issues.

4 participants