<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/drivers, branch v3.13.2</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>target/iscsi: Fix network portal creation race</title>
<updated>2014-02-06T19:34:11+00:00</updated>
<author>
<name>Andy Grover</name>
<email>agrover@redhat.com</email>
</author>
<published>2014-01-25T00:18:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0bf44d6862c3d4551fa442b8913421d43933d067'/>
<id>0bf44d6862c3d4551fa442b8913421d43933d067</id>
<content type='text'>
commit ee291e63293146db64668e8d65eb35c97e8324f4 upstream.

When creating network portals rapidly, such as when restoring a
configuration, LIO's code to reuse existing portals can return a false
negative if the thread hasn't run yet and set np_thread_state to
ISCSI_NP_THREAD_ACTIVE. This causes an error in the network stack
when attempting to bind to the same address/port.

This patch sets NP_THREAD_ACTIVE before the np is placed on g_np_list,
so even if the thread hasn't run yet, iscsit_get_np will return the
existing np.

Also, convert np_lock -&gt; np_mutex + hold across adding new net portal
to g_np_list to prevent a race where two threads may attempt to create
the same network portal, resulting in one of them failing.

(nab: Add missing mutex_unlocks in iscsit_add_np failure paths)
(DanC: Fix incorrect spin_unlock -&gt; spin_unlock_bh)

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit ee291e63293146db64668e8d65eb35c97e8324f4 upstream.

When creating network portals rapidly, such as when restoring a
configuration, LIO's code to reuse existing portals can return a false
negative if the thread hasn't run yet and set np_thread_state to
ISCSI_NP_THREAD_ACTIVE. This causes an error in the network stack
when attempting to bind to the same address/port.

This patch sets NP_THREAD_ACTIVE before the np is placed on g_np_list,
so even if the thread hasn't run yet, iscsit_get_np will return the
existing np.

Also, convert np_lock -&gt; np_mutex + hold across adding new net portal
to g_np_list to prevent a race where two threads may attempt to create
the same network portal, resulting in one of them failing.

(nab: Add missing mutex_unlocks in iscsit_add_np failure paths)
(DanC: Fix incorrect spin_unlock -&gt; spin_unlock_bh)

Signed-off-by: Andy Grover &lt;agrover@redhat.com&gt;
Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>iscsi-target: Pre-allocate more tags to avoid ack starvation</title>
<updated>2014-02-06T19:34:11+00:00</updated>
<author>
<name>Nicholas Bellinger</name>
<email>nab@linux-iscsi.org</email>
</author>
<published>2014-01-10T02:06:59+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e00d98a6df6f455e790c3cef4e9e78926d6f6ba7'/>
<id>e00d98a6df6f455e790c3cef4e9e78926d6f6ba7</id>
<content type='text'>
commit 4a4caa29f1abcb14377e05d57c0793d338fb945d upstream.

This patch addresses an traditional iscsi-target fabric ack starvation
issue where iscsit_allocate_cmd() -&gt; percpu_ida_alloc_state() ends up
hitting slow path percpu-ida code, because iscsit_ack_from_expstatsn()
is expected to free ack'ed tags after tag allocation.

This is done to take into account the tags waiting to be acknowledged
and released in iscsit_ack_from_expstatsn(), but who's number are not
directly limited by the CmdSN Window queue_depth being enforced by
the target.

So that said, this patch bumps up the pre-allocated number of
per session tags to:

  (max(queue_depth, ISCSIT_MIN_TAGS) * 2) + ISCSIT_EXTRA_TAGS

for good measure to avoid the percpu_ida_alloc_state() slow path.

Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 4a4caa29f1abcb14377e05d57c0793d338fb945d upstream.

This patch addresses an traditional iscsi-target fabric ack starvation
issue where iscsit_allocate_cmd() -&gt; percpu_ida_alloc_state() ends up
hitting slow path percpu-ida code, because iscsit_ack_from_expstatsn()
is expected to free ack'ed tags after tag allocation.

This is done to take into account the tags waiting to be acknowledged
and released in iscsit_ack_from_expstatsn(), but who's number are not
directly limited by the CmdSN Window queue_depth being enforced by
the target.

So that said, this patch bumps up the pre-allocated number of
per session tags to:

  (max(queue_depth, ISCSIT_MIN_TAGS) * 2) + ISCSIT_EXTRA_TAGS

for good measure to avoid the percpu_ida_alloc_state() slow path.

Signed-off-by: Nicholas Bellinger &lt;nab@linux-iscsi.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>virtio-scsi: Fix hotcpu_notifier use-after-free with virtscsi_freeze</title>
<updated>2014-02-06T19:34:10+00:00</updated>
<author>
<name>Asias He</name>
<email>asias.hejun@gmail.com</email>
</author>
<published>2014-01-15T23:48:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f91c20513353a088257f2b1264d497b3dcfe81de'/>
<id>f91c20513353a088257f2b1264d497b3dcfe81de</id>
<content type='text'>
commit f466f75385369a181409e46da272db3de6f5c5cb upstream.

vqs are freed in virtscsi_freeze but the hotcpu_notifier is not
unregistered. We will have a use-after-free usage when the notifier
callback is called after virtscsi_freeze.

Fixes: 285e71ea6f3583a85e27cb2b9a7d8c35d4c0d558
("virtio-scsi: reset virtqueue affinity when doing cpu hotplug")

Signed-off-by: Asias He &lt;asias.hejun@gmail.com&gt;
Reviewed-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit f466f75385369a181409e46da272db3de6f5c5cb upstream.

vqs are freed in virtscsi_freeze but the hotcpu_notifier is not
unregistered. We will have a use-after-free usage when the notifier
callback is called after virtscsi_freeze.

Fixes: 285e71ea6f3583a85e27cb2b9a7d8c35d4c0d558
("virtio-scsi: reset virtqueue affinity when doing cpu hotplug")

Signed-off-by: Asias He &lt;asias.hejun@gmail.com&gt;
Reviewed-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Signed-off-by: Jason Wang &lt;jasowang@redhat.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>SCSI: qla4xxx: overflow in qla4xxx_set_chap_entry()</title>
<updated>2014-02-06T19:34:10+00:00</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2013-11-13T07:48:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8507df5828d2335c6a07c87804e18df0ff2a4af1'/>
<id>8507df5828d2335c6a07c87804e18df0ff2a4af1</id>
<content type='text'>
commit 3c60cfd73966797746530768d66597d025a69804 upstream.

We should cap the size of memcpy() because it comes from the network
and can't be trusted.

Fixes: 26ffd7b45fe9 ('[SCSI] qla4xxx: Add support to set CHAP entries')
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Acked-by: Vikas Chaudhary &lt;vikas.chaudhary@qlogic.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 3c60cfd73966797746530768d66597d025a69804 upstream.

We should cap the size of memcpy() because it comes from the network
and can't be trusted.

Fixes: 26ffd7b45fe9 ('[SCSI] qla4xxx: Add support to set CHAP entries')
Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Acked-by: Vikas Chaudhary &lt;vikas.chaudhary@qlogic.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>SCSI: bfa: Chinook quad port 16G FC HBA claim issue</title>
<updated>2014-02-06T19:34:10+00:00</updated>
<author>
<name>Vijaya Mohan Guvva</name>
<email>vmohan@brocade.com</email>
</author>
<published>2013-12-04T13:43:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e88f3608e8230b5d82353701656e0f60166114b6'/>
<id>e88f3608e8230b5d82353701656e0f60166114b6</id>
<content type='text'>
commit dcaf9aed995c2b2a49fb86bbbcfa2f92c797ab5d upstream.

Bfa driver crash is observed while pushing the firmware on to chinook
quad port card due to uninitialized bfi_image_ct2 access which gets
initialized only for CT2 ASIC based cards after request_firmware().
For quard port chinook (CT2 ASIC based), bfi_image_ct2 is not getting
initialized as there is no check for chinook PCI device ID before
request_firmware and instead bfi_image_cb is initialized as it is the
default case for card type check.

This patch includes changes to read the right firmware for quad port chinook.

Signed-off-by: Vijaya Mohan Guvva &lt;vmohan@brocade.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit dcaf9aed995c2b2a49fb86bbbcfa2f92c797ab5d upstream.

Bfa driver crash is observed while pushing the firmware on to chinook
quad port card due to uninitialized bfi_image_ct2 access which gets
initialized only for CT2 ASIC based cards after request_firmware().
For quard port chinook (CT2 ASIC based), bfi_image_ct2 is not getting
initialized as there is no check for chinook PCI device ID before
request_firmware and instead bfi_image_cb is initialized as it is the
default case for card type check.

This patch includes changes to read the right firmware for quad port chinook.

Signed-off-by: Vijaya Mohan Guvva &lt;vmohan@brocade.com&gt;
Signed-off-by: James Bottomley &lt;JBottomley@Parallels.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>usb: core: get config and string descriptors for unauthorized devices</title>
<updated>2014-02-06T19:34:10+00:00</updated>
<author>
<name>Thomas Pugliese</name>
<email>thomas.pugliese@gmail.com</email>
</author>
<published>2013-12-09T19:40:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=6d9541431906f495c56ffaf0d5f9c62b919b8491'/>
<id>6d9541431906f495c56ffaf0d5f9c62b919b8491</id>
<content type='text'>
commit 83e83ecb79a8225e79bc8e54e9aff3e0e27658a2 upstream.

There is no need to skip querying the config and string descriptors for
unauthorized WUSB devices when usb_new_device is called.  It is allowed
by WUSB spec.  The only action that needs to be delayed until
authorization time is the set config.  This change allows user mode
tools to see the config and string descriptors earlier in enumeration
which is needed for some WUSB devices to function properly on Android
systems.  It also reduces the amount of divergent code paths needed
for WUSB devices.

Signed-off-by: Thomas Pugliese &lt;thomas.pugliese@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 83e83ecb79a8225e79bc8e54e9aff3e0e27658a2 upstream.

There is no need to skip querying the config and string descriptors for
unauthorized WUSB devices when usb_new_device is called.  It is allowed
by WUSB spec.  The only action that needs to be delayed until
authorization time is the set config.  This change allows user mode
tools to see the config and string descriptors earlier in enumeration
which is needed for some WUSB devices to function properly on Android
systems.  It also reduces the amount of divergent code paths needed
for WUSB devices.

Signed-off-by: Thomas Pugliese &lt;thomas.pugliese@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>parisc/sti_console: prefer Linux fonts over built-in ROM fonts</title>
<updated>2014-02-06T19:34:09+00:00</updated>
<author>
<name>Helge Deller</name>
<email>deller@gmx.de</email>
</author>
<published>2014-01-31T14:39:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=3b11ff52d571e4bac05c33c64653afdf36c5d63d'/>
<id>3b11ff52d571e4bac05c33c64653afdf36c5d63d</id>
<content type='text'>
commit 8a10bc9d27ceb084b0d8be621a033a475eb9fdfd upstream.

The built-in ROM fonts lack many necessary ASCII characters, which is
why it makes sens to prefer the Linux fonts instead if they are
available.  This makes consoles on STI graphics cards which are not
supported by the stifb driver (e.g. Visualize FXe) looks much nicer.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 8a10bc9d27ceb084b0d8be621a033a475eb9fdfd upstream.

The built-in ROM fonts lack many necessary ASCII characters, which is
why it makes sens to prefer the Linux fonts instead if they are
available.  This makes consoles on STI graphics cards which are not
supported by the stifb driver (e.g. Visualize FXe) looks much nicer.

Signed-off-by: Helge Deller &lt;deller@gmx.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sdhci-esdhc-imx: fix access hardirq-unsafe lock in atomic context</title>
<updated>2014-02-06T19:34:09+00:00</updated>
<author>
<name>Dong Aisheng</name>
<email>b29396@freescale.com</email>
</author>
<published>2013-12-26T07:23:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8fabad704e223548edb974819d2bd5d942d049b6'/>
<id>8fabad704e223548edb974819d2bd5d942d049b6</id>
<content type='text'>
commit a974862faee199cba3ff36b5a148df5fd34bd1e7 upstream.

Sometimes we may meet the following lockdep issue.
The root cause is .set_clock callback is executed with spin_lock_irqsave
in sdhci_do_set_ios. However, the IMX set_clock callback will try to access
clk_get_rate which is using a mutex lock.

The fix avoids access mutex in .set_clock callback by initializing the
pltfm_host-&gt;clock at probe time and use it later instead of calling
clk_get_rate again in atomic context.

[ INFO: HARDIRQ-safe -&gt; HARDIRQ-unsafe lock order detected ]
3.13.0-rc1+ #285 Not tainted
------------------------------------------------------
kworker/u8:1/29 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
 (prepare_lock){+.+...}, at: [&lt;80480b08&gt;] clk_prepare_lock+0x44/0xe4

and this task is already holding:
 (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...}, at: [&lt;804611f4&gt;] sdhci_do_set_ios+0x20/0x720
which would create a new lock dependency:
 (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...} -&gt; (prepare_lock){+.+...}

but this new dependency connects a HARDIRQ-irq-safe lock:
 (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...}
... which became HARDIRQ-irq-safe at:
  [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
  [&lt;80060760&gt;] __lock_acquire+0xb30/0x1cbc
  [&lt;800620d0&gt;] lock_acquire+0x70/0x84
  [&lt;8061d2f0&gt;] _raw_spin_lock+0x30/0x40
  [&lt;80460668&gt;] sdhci_irq+0x24/0xa68
  [&lt;8006b1d4&gt;] handle_irq_event_percpu+0x54/0x18c
  [&lt;8006b350&gt;] handle_irq_event+0x44/0x64
  [&lt;8006e50c&gt;] handle_fasteoi_irq+0xa0/0x170
  [&lt;8006a8f0&gt;] generic_handle_irq+0x30/0x44
  [&lt;8000f238&gt;] handle_IRQ+0x54/0xbc
  [&lt;8000864c&gt;] gic_handle_irq+0x30/0x64
  [&lt;80013024&gt;] __irq_svc+0x44/0x5c
  [&lt;80614c58&gt;] printk+0x38/0x40
  [&lt;804622a8&gt;] sdhci_add_host+0x844/0xbcc
  [&lt;80464948&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
  [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
  [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
  [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
  [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
  [&lt;8032cf44&gt;] driver_attach+0x20/0x28
  [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
  [&lt;8032dce0&gt;] driver_register+0x80/0x100
  [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
  [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
  [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
  [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
  [&lt;80611c50&gt;] kernel_init+0x10/0x120
  [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c

to a HARDIRQ-irq-unsafe lock:
 (prepare_lock){+.+...}
... which became HARDIRQ-irq-unsafe at:
...  [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
  [&lt;8005f604&gt;] mark_held_locks+0x68/0x12c
  [&lt;8005f780&gt;] trace_hardirqs_on_caller+0xb8/0x1d8
  [&lt;8005f8b4&gt;] trace_hardirqs_on+0x14/0x18
  [&lt;8061a130&gt;] mutex_trylock+0x180/0x20c
  [&lt;80480ad8&gt;] clk_prepare_lock+0x14/0xe4
  [&lt;804816a4&gt;] clk_notifier_register+0x28/0xf0
  [&lt;80015120&gt;] twd_clk_init+0x50/0x68
  [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
  [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
  [&lt;80611c50&gt;] kernel_init+0x10/0x120
  [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c

other info that might help us debug this:

 Possible interrupt unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(prepare_lock);
                               local_irq_disable();
                               lock(&amp;(&amp;host-&gt;lock)-&gt;rlock#2);
                               lock(prepare_lock);
  &lt;Interrupt&gt;
    lock(&amp;(&amp;host-&gt;lock)-&gt;rlock#2);

 *** DEADLOCK ***

3 locks held by kworker/u8:1/29:
 #0:  (kmmcd){.+.+.+}, at: [&lt;8003db18&gt;] process_one_work+0x128/0x468
 #1:  ((&amp;(&amp;host-&gt;detect)-&gt;work)){+.+.+.}, at: [&lt;8003db18&gt;] process_one_work+0x128/0x468
 #2:  (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...}, at: [&lt;804611f4&gt;] sdhci_do_set_ios+0x20/0x720

the dependencies between HARDIRQ-irq-safe lock and the holding lock:
-&gt; (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...} ops: 330 {
   IN-HARDIRQ-W at:
                    [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                    [&lt;80060760&gt;] __lock_acquire+0xb30/0x1cbc
                    [&lt;800620d0&gt;] lock_acquire+0x70/0x84
                    [&lt;8061d2f0&gt;] _raw_spin_lock+0x30/0x40
                    [&lt;80460668&gt;] sdhci_irq+0x24/0xa68
                    [&lt;8006b1d4&gt;] handle_irq_event_percpu+0x54/0x18c
                    [&lt;8006b350&gt;] handle_irq_event+0x44/0x64
                    [&lt;8006e50c&gt;] handle_fasteoi_irq+0xa0/0x170
                    [&lt;8006a8f0&gt;] generic_handle_irq+0x30/0x44
                    [&lt;8000f238&gt;] handle_IRQ+0x54/0xbc
                    [&lt;8000864c&gt;] gic_handle_irq+0x30/0x64
                    [&lt;80013024&gt;] __irq_svc+0x44/0x5c
                    [&lt;80614c58&gt;] printk+0x38/0x40
                    [&lt;804622a8&gt;] sdhci_add_host+0x844/0xbcc
                    [&lt;80464948&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
                    [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
                    [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
                    [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
                    [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
                    [&lt;8032cf44&gt;] driver_attach+0x20/0x28
                    [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
                    [&lt;8032dce0&gt;] driver_register+0x80/0x100
                    [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
                    [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
                    [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                    [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                    [&lt;80611c50&gt;] kernel_init+0x10/0x120
                    [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
   IN-SOFTIRQ-W at:
                    [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                    [&lt;80060204&gt;] __lock_acquire+0x5d4/0x1cbc
                    [&lt;800620d0&gt;] lock_acquire+0x70/0x84
                    [&lt;8061d40c&gt;] _raw_spin_lock_irqsave+0x40/0x54
                    [&lt;8045e4a4&gt;] sdhci_tasklet_finish+0x1c/0x120
                    [&lt;8002b538&gt;] tasklet_action+0xa0/0x15c
                    [&lt;8002b778&gt;] __do_softirq+0x118/0x290
                    [&lt;8002bcf4&gt;] irq_exit+0xb4/0x10c
                    [&lt;8000f240&gt;] handle_IRQ+0x5c/0xbc
                    [&lt;8000864c&gt;] gic_handle_irq+0x30/0x64
                    [&lt;80013024&gt;] __irq_svc+0x44/0x5c
                    [&lt;80614c58&gt;] printk+0x38/0x40
                    [&lt;804622a8&gt;] sdhci_add_host+0x844/0xbcc
                    [&lt;80464948&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
                    [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
                    [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
                    [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
                    [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
                    [&lt;8032cf44&gt;] driver_attach+0x20/0x28
                    [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
                    [&lt;8032dce0&gt;] driver_register+0x80/0x100
                    [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
                    [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
                    [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                    [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                    [&lt;80611c50&gt;] kernel_init+0x10/0x120
                    [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
   INITIAL USE at:
                   [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                   [&lt;8005ff0c&gt;] __lock_acquire+0x2dc/0x1cbc
                   [&lt;800620d0&gt;] lock_acquire+0x70/0x84
                   [&lt;8061d40c&gt;] _raw_spin_lock_irqsave+0x40/0x54
                   [&lt;804611f4&gt;] sdhci_do_set_ios+0x20/0x720
                   [&lt;80461924&gt;] sdhci_set_ios+0x30/0x3c
                   [&lt;8044cea0&gt;] mmc_power_up+0x6c/0xd0
                   [&lt;8044dac4&gt;] mmc_start_host+0x60/0x70
                   [&lt;8044eb3c&gt;] mmc_add_host+0x60/0x88
                   [&lt;8046225c&gt;] sdhci_add_host+0x7f8/0xbcc
                   [&lt;80464948&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
                   [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
                   [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
                   [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
                   [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
                   [&lt;8032cf44&gt;] driver_attach+0x20/0x28
                   [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
                   [&lt;8032dce0&gt;] driver_register+0x80/0x100
                   [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
                   [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
                   [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                   [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                   [&lt;80611c50&gt;] kernel_init+0x10/0x120
                   [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
 }
 ... key      at: [&lt;80e040e8&gt;] __key.26952+0x0/0x8
 ... acquired at:
   [&lt;8005eb60&gt;] check_usage+0x3d0/0x5c0
   [&lt;8005edac&gt;] check_irq_usage+0x5c/0xb8
   [&lt;80060d38&gt;] __lock_acquire+0x1108/0x1cbc
   [&lt;800620d0&gt;] lock_acquire+0x70/0x84
   [&lt;8061a210&gt;] mutex_lock_nested+0x54/0x3c0
   [&lt;80480b08&gt;] clk_prepare_lock+0x44/0xe4
   [&lt;8048188c&gt;] clk_get_rate+0x14/0x64
   [&lt;8046374c&gt;] esdhc_pltfm_set_clock+0x20/0x2a4
   [&lt;8045d70c&gt;] sdhci_set_clock+0x4c/0x498
   [&lt;80461518&gt;] sdhci_do_set_ios+0x344/0x720
   [&lt;80461924&gt;] sdhci_set_ios+0x30/0x3c
   [&lt;8044c390&gt;] __mmc_set_clock+0x44/0x60
   [&lt;8044cd4c&gt;] mmc_set_clock+0x10/0x14
   [&lt;8044f8f4&gt;] mmc_init_card+0x1b4/0x1520
   [&lt;80450f00&gt;] mmc_attach_mmc+0xb4/0x194
   [&lt;8044da08&gt;] mmc_rescan+0x294/0x2f0
   [&lt;8003db94&gt;] process_one_work+0x1a4/0x468
   [&lt;8003e850&gt;] worker_thread+0x118/0x3e0
   [&lt;80044de0&gt;] kthread+0xd4/0xf0
   [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c

the dependencies between the lock to be acquired and HARDIRQ-irq-unsafe lock:
-&gt; (prepare_lock){+.+...} ops: 395 {
   HARDIRQ-ON-W at:
                    [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                    [&lt;8005f604&gt;] mark_held_locks+0x68/0x12c
                    [&lt;8005f780&gt;] trace_hardirqs_on_caller+0xb8/0x1d8
                    [&lt;8005f8b4&gt;] trace_hardirqs_on+0x14/0x18
                    [&lt;8061a130&gt;] mutex_trylock+0x180/0x20c
                    [&lt;80480ad8&gt;] clk_prepare_lock+0x14/0xe4
                    [&lt;804816a4&gt;] clk_notifier_register+0x28/0xf0
                    [&lt;80015120&gt;] twd_clk_init+0x50/0x68
                    [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                    [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                    [&lt;80611c50&gt;] kernel_init+0x10/0x120
                    [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
   SOFTIRQ-ON-W at:
                    [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                    [&lt;8005f604&gt;] mark_held_locks+0x68/0x12c
                    [&lt;8005f7c8&gt;] trace_hardirqs_on_caller+0x100/0x1d8
                    [&lt;8005f8b4&gt;] trace_hardirqs_on+0x14/0x18
                    [&lt;8061a130&gt;] mutex_trylock+0x180/0x20c
                    [&lt;80480ad8&gt;] clk_prepare_lock+0x14/0xe4
                    [&lt;804816a4&gt;] clk_notifier_register+0x28/0xf0
                    [&lt;80015120&gt;] twd_clk_init+0x50/0x68
                    [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                    [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                    [&lt;80611c50&gt;] kernel_init+0x10/0x120
                    [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
   INITIAL USE at:
                   [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                   [&lt;8005ff0c&gt;] __lock_acquire+0x2dc/0x1cbc
                   [&lt;800620d0&gt;] lock_acquire+0x70/0x84
                   [&lt;8061a0c8&gt;] mutex_trylock+0x118/0x20c
                   [&lt;80480ad8&gt;] clk_prepare_lock+0x14/0xe4
                   [&lt;80482af8&gt;] __clk_init+0x1c/0x45c
                   [&lt;8048306c&gt;] _clk_register+0xd0/0x170
                   [&lt;80483148&gt;] clk_register+0x3c/0x7c
                   [&lt;80483b4c&gt;] clk_register_fixed_rate+0x88/0xd8
                   [&lt;80483c04&gt;] of_fixed_clk_setup+0x68/0x94
                   [&lt;8084c6fc&gt;] of_clk_init+0x44/0x68
                   [&lt;808202b0&gt;] time_init+0x2c/0x38
                   [&lt;8081ca14&gt;] start_kernel+0x1e4/0x368
                   [&lt;10008074&gt;] 0x10008074
 }
 ... key      at: [&lt;808afebc&gt;] prepare_lock+0x38/0x48
 ... acquired at:
   [&lt;8005eb94&gt;] check_usage+0x404/0x5c0
   [&lt;8005edac&gt;] check_irq_usage+0x5c/0xb8
   [&lt;80060d38&gt;] __lock_acquire+0x1108/0x1cbc
   [&lt;800620d0&gt;] lock_acquire+0x70/0x84
   [&lt;8061a210&gt;] mutex_lock_nested+0x54/0x3c0
   [&lt;80480b08&gt;] clk_prepare_lock+0x44/0xe4
   [&lt;8048188c&gt;] clk_get_rate+0x14/0x64
   [&lt;8046374c&gt;] esdhc_pltfm_set_clock+0x20/0x2a4
   [&lt;8045d70c&gt;] sdhci_set_clock+0x4c/0x498
   [&lt;80461518&gt;] sdhci_do_set_ios+0x344/0x720
   [&lt;80461924&gt;] sdhci_set_ios+0x30/0x3c
   [&lt;8044c390&gt;] __mmc_set_clock+0x44/0x60
   [&lt;8044cd4c&gt;] mmc_set_clock+0x10/0x14
   [&lt;8044f8f4&gt;] mmc_init_card+0x1b4/0x1520
   [&lt;80450f00&gt;] mmc_attach_mmc+0xb4/0x194
   [&lt;8044da08&gt;] mmc_rescan+0x294/0x2f0
   [&lt;8003db94&gt;] process_one_work+0x1a4/0x468
   [&lt;8003e850&gt;] worker_thread+0x118/0x3e0
   [&lt;80044de0&gt;] kthread+0xd4/0xf0
   [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c

stack backtrace:
CPU: 2 PID: 29 Comm: kworker/u8:1 Not tainted 3.13.0-rc1+ #285
Workqueue: kmmcd mmc_rescan
Backtrace:
[&lt;80012160&gt;] (dump_backtrace+0x0/0x10c) from [&lt;80012438&gt;] (show_stack+0x18/0x1c)
 r6:00000000 r5:00000000 r4:8088ecc8 r3:bfa11200
[&lt;80012420&gt;] (show_stack+0x0/0x1c) from [&lt;80616b14&gt;] (dump_stack+0x84/0x9c)
[&lt;80616a90&gt;] (dump_stack+0x0/0x9c) from [&lt;8005ebb4&gt;] (check_usage+0x424/0x5c0)
 r5:80979940 r4:bfa29b44
[&lt;8005e790&gt;] (check_usage+0x0/0x5c0) from [&lt;8005edac&gt;] (check_irq_usage+0x5c/0xb8)
[&lt;8005ed50&gt;] (check_irq_usage+0x0/0xb8) from [&lt;80060d38&gt;] (__lock_acquire+0x1108/0x1cbc)
 r8:bfa115e8 r7:80df9884 r6:80dafa9c r5:00000003 r4:bfa115d0
[&lt;8005fc30&gt;] (__lock_acquire+0x0/0x1cbc) from [&lt;800620d0&gt;] (lock_acquire+0x70/0x84)
[&lt;80062060&gt;] (lock_acquire+0x0/0x84) from [&lt;8061a210&gt;] (mutex_lock_nested+0x54/0x3c0)
 r7:bfa11200 r6:80dafa9c r5:00000000 r4:80480b08
[&lt;8061a1bc&gt;] (mutex_lock_nested+0x0/0x3c0) from [&lt;80480b08&gt;] (clk_prepare_lock+0x44/0xe4)
[&lt;80480ac4&gt;] (clk_prepare_lock+0x0/0xe4) from [&lt;8048188c&gt;] (clk_get_rate+0x14/0x64)
 r6:03197500 r5:bf0e9aa8 r4:bf827400 r3:808ae128
[&lt;80481878&gt;] (clk_get_rate+0x0/0x64) from [&lt;8046374c&gt;] (esdhc_pltfm_set_clock+0x20/0x2a4)
 r5:bf0e9aa8 r4:bf0e9c40
[&lt;8046372c&gt;] (esdhc_pltfm_set_clock+0x0/0x2a4) from [&lt;8045d70c&gt;] (sdhci_set_clock+0x4c/0x498)
[&lt;8045d6c0&gt;] (sdhci_set_clock+0x0/0x498) from [&lt;80461518&gt;] (sdhci_do_set_ios+0x344/0x720)
 r8:0000003b r7:20000113 r6:bf0e9d68 r5:bf0e9aa8 r4:bf0e9c40
r3:00000000
[&lt;804611d4&gt;] (sdhci_do_set_ios+0x0/0x720) from [&lt;80461924&gt;] (sdhci_set_ios+0x30/0x3c)
 r9:00000004 r8:bf131000 r7:bf131048 r6:00000000 r5:bf0e9aa8
r4:bf0e9800
[&lt;804618f4&gt;] (sdhci_set_ios+0x0/0x3c) from [&lt;8044c390&gt;] (__mmc_set_clock+0x44/0x60)
 r5:03197500 r4:bf0e9800
[&lt;8044c34c&gt;] (__mmc_set_clock+0x0/0x60) from [&lt;8044cd4c&gt;] (mmc_set_clock+0x10/0x14)
 r5:00000000 r4:bf0e9800
[&lt;8044cd3c&gt;] (mmc_set_clock+0x0/0x14) from [&lt;8044f8f4&gt;] (mmc_init_card+0x1b4/0x1520)
[&lt;8044f740&gt;] (mmc_init_card+0x0/0x1520) from [&lt;80450f00&gt;] (mmc_attach_mmc+0xb4/0x194)
[&lt;80450e4c&gt;] (mmc_attach_mmc+0x0/0x194) from [&lt;8044da08&gt;] (mmc_rescan+0x294/0x2f0)
 r5:8065f358 r4:bf0e9af8
[&lt;8044d774&gt;] (mmc_rescan+0x0/0x2f0) from [&lt;8003db94&gt;] (process_one_work+0x1a4/0x468)
 r8:00000000 r7:bfa29eb0 r6:bf80dc00 r5:bf0e9af8 r4:bf9e3f00
r3:8044d774
[&lt;8003d9f0&gt;] (process_one_work+0x0/0x468) from [&lt;8003e850&gt;] (worker_thread+0x118/0x3e0)
[&lt;8003e738&gt;] (worker_thread+0x0/0x3e0) from [&lt;80044de0&gt;] (kthread+0xd4/0xf0)
[&lt;80044d0c&gt;] (kthread+0x0/0xf0) from [&lt;8000e9c8&gt;] (ret_from_fork+0x14/0x2c)
 r7:00000000 r6:00000000 r5:80044d0c r4:bf9e7f00

Fixes: 0ddf03c mmc: esdhc-imx: parse max-frequency from devicetree
Signed-off-by: Dong Aisheng &lt;b29396@freescale.com&gt;
Acked-by: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Tested-by: Philippe De Muyter &lt;phdm@macqel.be&gt;
Signed-off-by: Chris Ball &lt;chris@printf.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit a974862faee199cba3ff36b5a148df5fd34bd1e7 upstream.

Sometimes we may meet the following lockdep issue.
The root cause is .set_clock callback is executed with spin_lock_irqsave
in sdhci_do_set_ios. However, the IMX set_clock callback will try to access
clk_get_rate which is using a mutex lock.

The fix avoids access mutex in .set_clock callback by initializing the
pltfm_host-&gt;clock at probe time and use it later instead of calling
clk_get_rate again in atomic context.

[ INFO: HARDIRQ-safe -&gt; HARDIRQ-unsafe lock order detected ]
3.13.0-rc1+ #285 Not tainted
------------------------------------------------------
kworker/u8:1/29 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
 (prepare_lock){+.+...}, at: [&lt;80480b08&gt;] clk_prepare_lock+0x44/0xe4

and this task is already holding:
 (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...}, at: [&lt;804611f4&gt;] sdhci_do_set_ios+0x20/0x720
which would create a new lock dependency:
 (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...} -&gt; (prepare_lock){+.+...}

but this new dependency connects a HARDIRQ-irq-safe lock:
 (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...}
... which became HARDIRQ-irq-safe at:
  [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
  [&lt;80060760&gt;] __lock_acquire+0xb30/0x1cbc
  [&lt;800620d0&gt;] lock_acquire+0x70/0x84
  [&lt;8061d2f0&gt;] _raw_spin_lock+0x30/0x40
  [&lt;80460668&gt;] sdhci_irq+0x24/0xa68
  [&lt;8006b1d4&gt;] handle_irq_event_percpu+0x54/0x18c
  [&lt;8006b350&gt;] handle_irq_event+0x44/0x64
  [&lt;8006e50c&gt;] handle_fasteoi_irq+0xa0/0x170
  [&lt;8006a8f0&gt;] generic_handle_irq+0x30/0x44
  [&lt;8000f238&gt;] handle_IRQ+0x54/0xbc
  [&lt;8000864c&gt;] gic_handle_irq+0x30/0x64
  [&lt;80013024&gt;] __irq_svc+0x44/0x5c
  [&lt;80614c58&gt;] printk+0x38/0x40
  [&lt;804622a8&gt;] sdhci_add_host+0x844/0xbcc
  [&lt;80464948&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
  [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
  [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
  [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
  [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
  [&lt;8032cf44&gt;] driver_attach+0x20/0x28
  [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
  [&lt;8032dce0&gt;] driver_register+0x80/0x100
  [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
  [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
  [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
  [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
  [&lt;80611c50&gt;] kernel_init+0x10/0x120
  [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c

to a HARDIRQ-irq-unsafe lock:
 (prepare_lock){+.+...}
... which became HARDIRQ-irq-unsafe at:
...  [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
  [&lt;8005f604&gt;] mark_held_locks+0x68/0x12c
  [&lt;8005f780&gt;] trace_hardirqs_on_caller+0xb8/0x1d8
  [&lt;8005f8b4&gt;] trace_hardirqs_on+0x14/0x18
  [&lt;8061a130&gt;] mutex_trylock+0x180/0x20c
  [&lt;80480ad8&gt;] clk_prepare_lock+0x14/0xe4
  [&lt;804816a4&gt;] clk_notifier_register+0x28/0xf0
  [&lt;80015120&gt;] twd_clk_init+0x50/0x68
  [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
  [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
  [&lt;80611c50&gt;] kernel_init+0x10/0x120
  [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c

other info that might help us debug this:

 Possible interrupt unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(prepare_lock);
                               local_irq_disable();
                               lock(&amp;(&amp;host-&gt;lock)-&gt;rlock#2);
                               lock(prepare_lock);
  &lt;Interrupt&gt;
    lock(&amp;(&amp;host-&gt;lock)-&gt;rlock#2);

 *** DEADLOCK ***

3 locks held by kworker/u8:1/29:
 #0:  (kmmcd){.+.+.+}, at: [&lt;8003db18&gt;] process_one_work+0x128/0x468
 #1:  ((&amp;(&amp;host-&gt;detect)-&gt;work)){+.+.+.}, at: [&lt;8003db18&gt;] process_one_work+0x128/0x468
 #2:  (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...}, at: [&lt;804611f4&gt;] sdhci_do_set_ios+0x20/0x720

the dependencies between HARDIRQ-irq-safe lock and the holding lock:
-&gt; (&amp;(&amp;host-&gt;lock)-&gt;rlock#2){-.-...} ops: 330 {
   IN-HARDIRQ-W at:
                    [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                    [&lt;80060760&gt;] __lock_acquire+0xb30/0x1cbc
                    [&lt;800620d0&gt;] lock_acquire+0x70/0x84
                    [&lt;8061d2f0&gt;] _raw_spin_lock+0x30/0x40
                    [&lt;80460668&gt;] sdhci_irq+0x24/0xa68
                    [&lt;8006b1d4&gt;] handle_irq_event_percpu+0x54/0x18c
                    [&lt;8006b350&gt;] handle_irq_event+0x44/0x64
                    [&lt;8006e50c&gt;] handle_fasteoi_irq+0xa0/0x170
                    [&lt;8006a8f0&gt;] generic_handle_irq+0x30/0x44
                    [&lt;8000f238&gt;] handle_IRQ+0x54/0xbc
                    [&lt;8000864c&gt;] gic_handle_irq+0x30/0x64
                    [&lt;80013024&gt;] __irq_svc+0x44/0x5c
                    [&lt;80614c58&gt;] printk+0x38/0x40
                    [&lt;804622a8&gt;] sdhci_add_host+0x844/0xbcc
                    [&lt;80464948&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
                    [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
                    [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
                    [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
                    [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
                    [&lt;8032cf44&gt;] driver_attach+0x20/0x28
                    [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
                    [&lt;8032dce0&gt;] driver_register+0x80/0x100
                    [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
                    [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
                    [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                    [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                    [&lt;80611c50&gt;] kernel_init+0x10/0x120
                    [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
   IN-SOFTIRQ-W at:
                    [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                    [&lt;80060204&gt;] __lock_acquire+0x5d4/0x1cbc
                    [&lt;800620d0&gt;] lock_acquire+0x70/0x84
                    [&lt;8061d40c&gt;] _raw_spin_lock_irqsave+0x40/0x54
                    [&lt;8045e4a4&gt;] sdhci_tasklet_finish+0x1c/0x120
                    [&lt;8002b538&gt;] tasklet_action+0xa0/0x15c
                    [&lt;8002b778&gt;] __do_softirq+0x118/0x290
                    [&lt;8002bcf4&gt;] irq_exit+0xb4/0x10c
                    [&lt;8000f240&gt;] handle_IRQ+0x5c/0xbc
                    [&lt;8000864c&gt;] gic_handle_irq+0x30/0x64
                    [&lt;80013024&gt;] __irq_svc+0x44/0x5c
                    [&lt;80614c58&gt;] printk+0x38/0x40
                    [&lt;804622a8&gt;] sdhci_add_host+0x844/0xbcc
                    [&lt;80464948&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
                    [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
                    [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
                    [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
                    [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
                    [&lt;8032cf44&gt;] driver_attach+0x20/0x28
                    [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
                    [&lt;8032dce0&gt;] driver_register+0x80/0x100
                    [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
                    [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
                    [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                    [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                    [&lt;80611c50&gt;] kernel_init+0x10/0x120
                    [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
   INITIAL USE at:
                   [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                   [&lt;8005ff0c&gt;] __lock_acquire+0x2dc/0x1cbc
                   [&lt;800620d0&gt;] lock_acquire+0x70/0x84
                   [&lt;8061d40c&gt;] _raw_spin_lock_irqsave+0x40/0x54
                   [&lt;804611f4&gt;] sdhci_do_set_ios+0x20/0x720
                   [&lt;80461924&gt;] sdhci_set_ios+0x30/0x3c
                   [&lt;8044cea0&gt;] mmc_power_up+0x6c/0xd0
                   [&lt;8044dac4&gt;] mmc_start_host+0x60/0x70
                   [&lt;8044eb3c&gt;] mmc_add_host+0x60/0x88
                   [&lt;8046225c&gt;] sdhci_add_host+0x7f8/0xbcc
                   [&lt;80464948&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
                   [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
                   [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
                   [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
                   [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
                   [&lt;8032cf44&gt;] driver_attach+0x20/0x28
                   [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
                   [&lt;8032dce0&gt;] driver_register+0x80/0x100
                   [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
                   [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
                   [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                   [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                   [&lt;80611c50&gt;] kernel_init+0x10/0x120
                   [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
 }
 ... key      at: [&lt;80e040e8&gt;] __key.26952+0x0/0x8
 ... acquired at:
   [&lt;8005eb60&gt;] check_usage+0x3d0/0x5c0
   [&lt;8005edac&gt;] check_irq_usage+0x5c/0xb8
   [&lt;80060d38&gt;] __lock_acquire+0x1108/0x1cbc
   [&lt;800620d0&gt;] lock_acquire+0x70/0x84
   [&lt;8061a210&gt;] mutex_lock_nested+0x54/0x3c0
   [&lt;80480b08&gt;] clk_prepare_lock+0x44/0xe4
   [&lt;8048188c&gt;] clk_get_rate+0x14/0x64
   [&lt;8046374c&gt;] esdhc_pltfm_set_clock+0x20/0x2a4
   [&lt;8045d70c&gt;] sdhci_set_clock+0x4c/0x498
   [&lt;80461518&gt;] sdhci_do_set_ios+0x344/0x720
   [&lt;80461924&gt;] sdhci_set_ios+0x30/0x3c
   [&lt;8044c390&gt;] __mmc_set_clock+0x44/0x60
   [&lt;8044cd4c&gt;] mmc_set_clock+0x10/0x14
   [&lt;8044f8f4&gt;] mmc_init_card+0x1b4/0x1520
   [&lt;80450f00&gt;] mmc_attach_mmc+0xb4/0x194
   [&lt;8044da08&gt;] mmc_rescan+0x294/0x2f0
   [&lt;8003db94&gt;] process_one_work+0x1a4/0x468
   [&lt;8003e850&gt;] worker_thread+0x118/0x3e0
   [&lt;80044de0&gt;] kthread+0xd4/0xf0
   [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c

the dependencies between the lock to be acquired and HARDIRQ-irq-unsafe lock:
-&gt; (prepare_lock){+.+...} ops: 395 {
   HARDIRQ-ON-W at:
                    [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                    [&lt;8005f604&gt;] mark_held_locks+0x68/0x12c
                    [&lt;8005f780&gt;] trace_hardirqs_on_caller+0xb8/0x1d8
                    [&lt;8005f8b4&gt;] trace_hardirqs_on+0x14/0x18
                    [&lt;8061a130&gt;] mutex_trylock+0x180/0x20c
                    [&lt;80480ad8&gt;] clk_prepare_lock+0x14/0xe4
                    [&lt;804816a4&gt;] clk_notifier_register+0x28/0xf0
                    [&lt;80015120&gt;] twd_clk_init+0x50/0x68
                    [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                    [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                    [&lt;80611c50&gt;] kernel_init+0x10/0x120
                    [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
   SOFTIRQ-ON-W at:
                    [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                    [&lt;8005f604&gt;] mark_held_locks+0x68/0x12c
                    [&lt;8005f7c8&gt;] trace_hardirqs_on_caller+0x100/0x1d8
                    [&lt;8005f8b4&gt;] trace_hardirqs_on+0x14/0x18
                    [&lt;8061a130&gt;] mutex_trylock+0x180/0x20c
                    [&lt;80480ad8&gt;] clk_prepare_lock+0x14/0xe4
                    [&lt;804816a4&gt;] clk_notifier_register+0x28/0xf0
                    [&lt;80015120&gt;] twd_clk_init+0x50/0x68
                    [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
                    [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
                    [&lt;80611c50&gt;] kernel_init+0x10/0x120
                    [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
   INITIAL USE at:
                   [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
                   [&lt;8005ff0c&gt;] __lock_acquire+0x2dc/0x1cbc
                   [&lt;800620d0&gt;] lock_acquire+0x70/0x84
                   [&lt;8061a0c8&gt;] mutex_trylock+0x118/0x20c
                   [&lt;80480ad8&gt;] clk_prepare_lock+0x14/0xe4
                   [&lt;80482af8&gt;] __clk_init+0x1c/0x45c
                   [&lt;8048306c&gt;] _clk_register+0xd0/0x170
                   [&lt;80483148&gt;] clk_register+0x3c/0x7c
                   [&lt;80483b4c&gt;] clk_register_fixed_rate+0x88/0xd8
                   [&lt;80483c04&gt;] of_fixed_clk_setup+0x68/0x94
                   [&lt;8084c6fc&gt;] of_clk_init+0x44/0x68
                   [&lt;808202b0&gt;] time_init+0x2c/0x38
                   [&lt;8081ca14&gt;] start_kernel+0x1e4/0x368
                   [&lt;10008074&gt;] 0x10008074
 }
 ... key      at: [&lt;808afebc&gt;] prepare_lock+0x38/0x48
 ... acquired at:
   [&lt;8005eb94&gt;] check_usage+0x404/0x5c0
   [&lt;8005edac&gt;] check_irq_usage+0x5c/0xb8
   [&lt;80060d38&gt;] __lock_acquire+0x1108/0x1cbc
   [&lt;800620d0&gt;] lock_acquire+0x70/0x84
   [&lt;8061a210&gt;] mutex_lock_nested+0x54/0x3c0
   [&lt;80480b08&gt;] clk_prepare_lock+0x44/0xe4
   [&lt;8048188c&gt;] clk_get_rate+0x14/0x64
   [&lt;8046374c&gt;] esdhc_pltfm_set_clock+0x20/0x2a4
   [&lt;8045d70c&gt;] sdhci_set_clock+0x4c/0x498
   [&lt;80461518&gt;] sdhci_do_set_ios+0x344/0x720
   [&lt;80461924&gt;] sdhci_set_ios+0x30/0x3c
   [&lt;8044c390&gt;] __mmc_set_clock+0x44/0x60
   [&lt;8044cd4c&gt;] mmc_set_clock+0x10/0x14
   [&lt;8044f8f4&gt;] mmc_init_card+0x1b4/0x1520
   [&lt;80450f00&gt;] mmc_attach_mmc+0xb4/0x194
   [&lt;8044da08&gt;] mmc_rescan+0x294/0x2f0
   [&lt;8003db94&gt;] process_one_work+0x1a4/0x468
   [&lt;8003e850&gt;] worker_thread+0x118/0x3e0
   [&lt;80044de0&gt;] kthread+0xd4/0xf0
   [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c

stack backtrace:
CPU: 2 PID: 29 Comm: kworker/u8:1 Not tainted 3.13.0-rc1+ #285
Workqueue: kmmcd mmc_rescan
Backtrace:
[&lt;80012160&gt;] (dump_backtrace+0x0/0x10c) from [&lt;80012438&gt;] (show_stack+0x18/0x1c)
 r6:00000000 r5:00000000 r4:8088ecc8 r3:bfa11200
[&lt;80012420&gt;] (show_stack+0x0/0x1c) from [&lt;80616b14&gt;] (dump_stack+0x84/0x9c)
[&lt;80616a90&gt;] (dump_stack+0x0/0x9c) from [&lt;8005ebb4&gt;] (check_usage+0x424/0x5c0)
 r5:80979940 r4:bfa29b44
[&lt;8005e790&gt;] (check_usage+0x0/0x5c0) from [&lt;8005edac&gt;] (check_irq_usage+0x5c/0xb8)
[&lt;8005ed50&gt;] (check_irq_usage+0x0/0xb8) from [&lt;80060d38&gt;] (__lock_acquire+0x1108/0x1cbc)
 r8:bfa115e8 r7:80df9884 r6:80dafa9c r5:00000003 r4:bfa115d0
[&lt;8005fc30&gt;] (__lock_acquire+0x0/0x1cbc) from [&lt;800620d0&gt;] (lock_acquire+0x70/0x84)
[&lt;80062060&gt;] (lock_acquire+0x0/0x84) from [&lt;8061a210&gt;] (mutex_lock_nested+0x54/0x3c0)
 r7:bfa11200 r6:80dafa9c r5:00000000 r4:80480b08
[&lt;8061a1bc&gt;] (mutex_lock_nested+0x0/0x3c0) from [&lt;80480b08&gt;] (clk_prepare_lock+0x44/0xe4)
[&lt;80480ac4&gt;] (clk_prepare_lock+0x0/0xe4) from [&lt;8048188c&gt;] (clk_get_rate+0x14/0x64)
 r6:03197500 r5:bf0e9aa8 r4:bf827400 r3:808ae128
[&lt;80481878&gt;] (clk_get_rate+0x0/0x64) from [&lt;8046374c&gt;] (esdhc_pltfm_set_clock+0x20/0x2a4)
 r5:bf0e9aa8 r4:bf0e9c40
[&lt;8046372c&gt;] (esdhc_pltfm_set_clock+0x0/0x2a4) from [&lt;8045d70c&gt;] (sdhci_set_clock+0x4c/0x498)
[&lt;8045d6c0&gt;] (sdhci_set_clock+0x0/0x498) from [&lt;80461518&gt;] (sdhci_do_set_ios+0x344/0x720)
 r8:0000003b r7:20000113 r6:bf0e9d68 r5:bf0e9aa8 r4:bf0e9c40
r3:00000000
[&lt;804611d4&gt;] (sdhci_do_set_ios+0x0/0x720) from [&lt;80461924&gt;] (sdhci_set_ios+0x30/0x3c)
 r9:00000004 r8:bf131000 r7:bf131048 r6:00000000 r5:bf0e9aa8
r4:bf0e9800
[&lt;804618f4&gt;] (sdhci_set_ios+0x0/0x3c) from [&lt;8044c390&gt;] (__mmc_set_clock+0x44/0x60)
 r5:03197500 r4:bf0e9800
[&lt;8044c34c&gt;] (__mmc_set_clock+0x0/0x60) from [&lt;8044cd4c&gt;] (mmc_set_clock+0x10/0x14)
 r5:00000000 r4:bf0e9800
[&lt;8044cd3c&gt;] (mmc_set_clock+0x0/0x14) from [&lt;8044f8f4&gt;] (mmc_init_card+0x1b4/0x1520)
[&lt;8044f740&gt;] (mmc_init_card+0x0/0x1520) from [&lt;80450f00&gt;] (mmc_attach_mmc+0xb4/0x194)
[&lt;80450e4c&gt;] (mmc_attach_mmc+0x0/0x194) from [&lt;8044da08&gt;] (mmc_rescan+0x294/0x2f0)
 r5:8065f358 r4:bf0e9af8
[&lt;8044d774&gt;] (mmc_rescan+0x0/0x2f0) from [&lt;8003db94&gt;] (process_one_work+0x1a4/0x468)
 r8:00000000 r7:bfa29eb0 r6:bf80dc00 r5:bf0e9af8 r4:bf9e3f00
r3:8044d774
[&lt;8003d9f0&gt;] (process_one_work+0x0/0x468) from [&lt;8003e850&gt;] (worker_thread+0x118/0x3e0)
[&lt;8003e738&gt;] (worker_thread+0x0/0x3e0) from [&lt;80044de0&gt;] (kthread+0xd4/0xf0)
[&lt;80044d0c&gt;] (kthread+0x0/0xf0) from [&lt;8000e9c8&gt;] (ret_from_fork+0x14/0x2c)
 r7:00000000 r6:00000000 r5:80044d0c r4:bf9e7f00

Fixes: 0ddf03c mmc: esdhc-imx: parse max-frequency from devicetree
Signed-off-by: Dong Aisheng &lt;b29396@freescale.com&gt;
Acked-by: Shawn Guo &lt;shawn.guo@linaro.org&gt;
Tested-by: Philippe De Muyter &lt;phdm@macqel.be&gt;
Signed-off-by: Chris Ball &lt;chris@printf.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sdhci: fix lockdep error in tuning routine</title>
<updated>2014-02-06T19:34:09+00:00</updated>
<author>
<name>Aisheng Dong</name>
<email>b29396@freescale.com</email>
</author>
<published>2013-12-23T11:13:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=ee02211febfb1dc0ee77e2b641d48910422ed872'/>
<id>ee02211febfb1dc0ee77e2b641d48910422ed872</id>
<content type='text'>
commit 2b35bd83467df6f8284b9148d6f768148c3a5e5f upstream.

The sdhci_execute_tuning routine gets lock separately by
disable_irq(host-&gt;irq);
spin_lock(&amp;host-&gt;lock);
It will cause the following lockdep error message since the &amp;host-&gt;lock
could also be got in irq context.
Use spin_lock_irqsave/spin_unlock_restore instead to get rid of
this error message.

[ INFO: inconsistent lock state ]
3.13.0-rc1+ #287 Not tainted
---------------------------------
inconsistent {IN-HARDIRQ-W} -&gt; {HARDIRQ-ON-W} usage.
kworker/u2:1/33 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (&amp;(&amp;host-&gt;lock)-&gt;rlock){?.-...}, at: [&lt;8045f7f4&gt;] sdhci_execute_tuning+0x4c/0x710
{IN-HARDIRQ-W} state was registered at:
  [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
  [&lt;80060760&gt;] __lock_acquire+0xb30/0x1cbc
  [&lt;800620d0&gt;] lock_acquire+0x70/0x84
  [&lt;8061d1c8&gt;] _raw_spin_lock+0x30/0x40
  [&lt;804605cc&gt;] sdhci_irq+0x24/0xa68
  [&lt;8006b1d4&gt;] handle_irq_event_percpu+0x54/0x18c
  [&lt;8006b350&gt;] handle_irq_event+0x44/0x64
  [&lt;8006e50c&gt;] handle_fasteoi_irq+0xa0/0x170
  [&lt;8006a8f0&gt;] generic_handle_irq+0x30/0x44
  [&lt;8000f238&gt;] handle_IRQ+0x54/0xbc
  [&lt;8000864c&gt;] gic_handle_irq+0x30/0x64
  [&lt;80013024&gt;] __irq_svc+0x44/0x5c
  [&lt;80329bf4&gt;] dev_vprintk_emit+0x50/0x58
  [&lt;80329c24&gt;] dev_printk_emit+0x28/0x30
  [&lt;80329fec&gt;] __dev_printk+0x4c/0x90
  [&lt;8032a180&gt;] dev_err+0x3c/0x48
  [&lt;802dd4f0&gt;] _regulator_get+0x158/0x1cc
  [&lt;802dd5b4&gt;] regulator_get_optional+0x18/0x1c
  [&lt;80461df4&gt;] sdhci_add_host+0x42c/0xbd8
  [&lt;80464820&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
  [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
  [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
  [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
  [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
  [&lt;8032cf44&gt;] driver_attach+0x20/0x28
  [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
  [&lt;8032dce0&gt;] driver_register+0x80/0x100
  [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
  [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
  [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
  [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
  [&lt;80611b28&gt;] kernel_init+0x10/0x120
  [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
irq event stamp: 805
hardirqs last  enabled at (805): [&lt;8061d43c&gt;] _raw_spin_unlock_irqrestore+0x38/0x4c
hardirqs last disabled at (804): [&lt;8061d2c8&gt;] _raw_spin_lock_irqsave+0x24/0x54
softirqs last  enabled at (570): [&lt;8002b824&gt;] __do_softirq+0x1c4/0x290
softirqs last disabled at (561): [&lt;8002bcf4&gt;] irq_exit+0xb4/0x10c

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&amp;(&amp;host-&gt;lock)-&gt;rlock);
  &lt;Interrupt&gt;
    lock(&amp;(&amp;host-&gt;lock)-&gt;rlock);

 *** DEADLOCK ***

2 locks held by kworker/u2:1/33:
 #0:  (kmmcd){.+.+..}, at: [&lt;8003db18&gt;] process_one_work+0x128/0x468
 #1:  ((&amp;(&amp;host-&gt;detect)-&gt;work)){+.+...}, at: [&lt;8003db18&gt;] process_one_work+0x128/0x468

stack backtrace:
CPU: 0 PID: 33 Comm: kworker/u2:1 Not tainted 3.13.0-rc1+ #287
Workqueue: kmmcd mmc_rescan
Backtrace:
[&lt;80012160&gt;] (dump_backtrace+0x0/0x10c) from [&lt;80012438&gt;] (show_stack+0x18/0x1c)
 r6:bfad0900 r5:00000000 r4:8088ecc8 r3:bfad0900
[&lt;80012420&gt;] (show_stack+0x0/0x1c) from [&lt;806169ec&gt;] (dump_stack+0x84/0x9c)
[&lt;80616968&gt;] (dump_stack+0x0/0x9c) from [&lt;806147b4&gt;] (print_usage_bug+0x260/0x2d0)
 r5:8076ba88 r4:80977410
[&lt;80614554&gt;] (print_usage_bug+0x0/0x2d0) from [&lt;8005f0d0&gt;] (mark_lock+0x1e0/0x6ac)
 r9:8005e678 r8:00000000 r7:bfad0900 r6:00001015 r5:bfad0cd0
r4:00000002
[&lt;8005eef0&gt;] (mark_lock+0x0/0x6ac) from [&lt;80060234&gt;] (__lock_acquire+0x604/0x1cbc)
[&lt;8005fc30&gt;] (__lock_acquire+0x0/0x1cbc) from [&lt;800620d0&gt;] (lock_acquire+0x70/0x84)
[&lt;80062060&gt;] (lock_acquire+0x0/0x84) from [&lt;8061d1c8&gt;] (_raw_spin_lock+0x30/0x40)
 r7:00000000 r6:bfb63000 r5:00000000 r4:bfb60568
[&lt;8061d198&gt;] (_raw_spin_lock+0x0/0x40) from [&lt;8045f7f4&gt;] (sdhci_execute_tuning+0x4c/0x710)
 r4:bfb60000
[&lt;8045f7a8&gt;] (sdhci_execute_tuning+0x0/0x710) from [&lt;80453454&gt;] (mmc_sd_init_card+0x5f8/0x660)
[&lt;80452e5c&gt;] (mmc_sd_init_card+0x0/0x660) from [&lt;80453748&gt;] (mmc_attach_sd+0xb4/0x180)
 r9:bf92d400 r8:8065f364 r7:00061a80 r6:bfb60000 r5:8065f358
r4:bfb60000
[&lt;80453694&gt;] (mmc_attach_sd+0x0/0x180) from [&lt;8044d9f8&gt;] (mmc_rescan+0x284/0x2f0)
 r5:8065f358 r4:bfb602f8
[&lt;8044d774&gt;] (mmc_rescan+0x0/0x2f0) from [&lt;8003db94&gt;] (process_one_work+0x1a4/0x468)
 r8:00000000 r7:bfb55eb0 r6:bf80dc00 r5:bfb602f8 r4:bfb35980
r3:8044d774
[&lt;8003d9f0&gt;] (process_one_work+0x0/0x468) from [&lt;8003e850&gt;] (worker_thread+0x118/0x3e0)
[&lt;8003e738&gt;] (worker_thread+0x0/0x3e0) from [&lt;80044de0&gt;] (kthread+0xd4/0xf0)
[&lt;80044d0c&gt;] (kthread+0x0/0xf0) from [&lt;8000e9c8&gt;] (ret_from_fork+0x14/0x2c)
 r7:00000000 r6:00000000 r5:80044d0c r4:bfb37b40

Signed-off-by: Dong Aisheng &lt;b29396@freescale.com&gt;
Signed-off-by: Chris Ball &lt;chris@printf.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 2b35bd83467df6f8284b9148d6f768148c3a5e5f upstream.

The sdhci_execute_tuning routine gets lock separately by
disable_irq(host-&gt;irq);
spin_lock(&amp;host-&gt;lock);
It will cause the following lockdep error message since the &amp;host-&gt;lock
could also be got in irq context.
Use spin_lock_irqsave/spin_unlock_restore instead to get rid of
this error message.

[ INFO: inconsistent lock state ]
3.13.0-rc1+ #287 Not tainted
---------------------------------
inconsistent {IN-HARDIRQ-W} -&gt; {HARDIRQ-ON-W} usage.
kworker/u2:1/33 [HC0[0]:SC0[0]:HE1:SE1] takes:
 (&amp;(&amp;host-&gt;lock)-&gt;rlock){?.-...}, at: [&lt;8045f7f4&gt;] sdhci_execute_tuning+0x4c/0x710
{IN-HARDIRQ-W} state was registered at:
  [&lt;8005f030&gt;] mark_lock+0x140/0x6ac
  [&lt;80060760&gt;] __lock_acquire+0xb30/0x1cbc
  [&lt;800620d0&gt;] lock_acquire+0x70/0x84
  [&lt;8061d1c8&gt;] _raw_spin_lock+0x30/0x40
  [&lt;804605cc&gt;] sdhci_irq+0x24/0xa68
  [&lt;8006b1d4&gt;] handle_irq_event_percpu+0x54/0x18c
  [&lt;8006b350&gt;] handle_irq_event+0x44/0x64
  [&lt;8006e50c&gt;] handle_fasteoi_irq+0xa0/0x170
  [&lt;8006a8f0&gt;] generic_handle_irq+0x30/0x44
  [&lt;8000f238&gt;] handle_IRQ+0x54/0xbc
  [&lt;8000864c&gt;] gic_handle_irq+0x30/0x64
  [&lt;80013024&gt;] __irq_svc+0x44/0x5c
  [&lt;80329bf4&gt;] dev_vprintk_emit+0x50/0x58
  [&lt;80329c24&gt;] dev_printk_emit+0x28/0x30
  [&lt;80329fec&gt;] __dev_printk+0x4c/0x90
  [&lt;8032a180&gt;] dev_err+0x3c/0x48
  [&lt;802dd4f0&gt;] _regulator_get+0x158/0x1cc
  [&lt;802dd5b4&gt;] regulator_get_optional+0x18/0x1c
  [&lt;80461df4&gt;] sdhci_add_host+0x42c/0xbd8
  [&lt;80464820&gt;] sdhci_esdhc_imx_probe+0x378/0x67c
  [&lt;8032ee88&gt;] platform_drv_probe+0x20/0x50
  [&lt;8032d48c&gt;] driver_probe_device+0x118/0x234
  [&lt;8032d690&gt;] __driver_attach+0x9c/0xa0
  [&lt;8032b89c&gt;] bus_for_each_dev+0x68/0x9c
  [&lt;8032cf44&gt;] driver_attach+0x20/0x28
  [&lt;8032cbc8&gt;] bus_add_driver+0x148/0x1f4
  [&lt;8032dce0&gt;] driver_register+0x80/0x100
  [&lt;8032ee54&gt;] __platform_driver_register+0x50/0x64
  [&lt;8084b094&gt;] sdhci_esdhc_imx_driver_init+0x18/0x20
  [&lt;80008980&gt;] do_one_initcall+0x108/0x16c
  [&lt;8081cca4&gt;] kernel_init_freeable+0x10c/0x1d0
  [&lt;80611b28&gt;] kernel_init+0x10/0x120
  [&lt;8000e9c8&gt;] ret_from_fork+0x14/0x2c
irq event stamp: 805
hardirqs last  enabled at (805): [&lt;8061d43c&gt;] _raw_spin_unlock_irqrestore+0x38/0x4c
hardirqs last disabled at (804): [&lt;8061d2c8&gt;] _raw_spin_lock_irqsave+0x24/0x54
softirqs last  enabled at (570): [&lt;8002b824&gt;] __do_softirq+0x1c4/0x290
softirqs last disabled at (561): [&lt;8002bcf4&gt;] irq_exit+0xb4/0x10c

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&amp;(&amp;host-&gt;lock)-&gt;rlock);
  &lt;Interrupt&gt;
    lock(&amp;(&amp;host-&gt;lock)-&gt;rlock);

 *** DEADLOCK ***

2 locks held by kworker/u2:1/33:
 #0:  (kmmcd){.+.+..}, at: [&lt;8003db18&gt;] process_one_work+0x128/0x468
 #1:  ((&amp;(&amp;host-&gt;detect)-&gt;work)){+.+...}, at: [&lt;8003db18&gt;] process_one_work+0x128/0x468

stack backtrace:
CPU: 0 PID: 33 Comm: kworker/u2:1 Not tainted 3.13.0-rc1+ #287
Workqueue: kmmcd mmc_rescan
Backtrace:
[&lt;80012160&gt;] (dump_backtrace+0x0/0x10c) from [&lt;80012438&gt;] (show_stack+0x18/0x1c)
 r6:bfad0900 r5:00000000 r4:8088ecc8 r3:bfad0900
[&lt;80012420&gt;] (show_stack+0x0/0x1c) from [&lt;806169ec&gt;] (dump_stack+0x84/0x9c)
[&lt;80616968&gt;] (dump_stack+0x0/0x9c) from [&lt;806147b4&gt;] (print_usage_bug+0x260/0x2d0)
 r5:8076ba88 r4:80977410
[&lt;80614554&gt;] (print_usage_bug+0x0/0x2d0) from [&lt;8005f0d0&gt;] (mark_lock+0x1e0/0x6ac)
 r9:8005e678 r8:00000000 r7:bfad0900 r6:00001015 r5:bfad0cd0
r4:00000002
[&lt;8005eef0&gt;] (mark_lock+0x0/0x6ac) from [&lt;80060234&gt;] (__lock_acquire+0x604/0x1cbc)
[&lt;8005fc30&gt;] (__lock_acquire+0x0/0x1cbc) from [&lt;800620d0&gt;] (lock_acquire+0x70/0x84)
[&lt;80062060&gt;] (lock_acquire+0x0/0x84) from [&lt;8061d1c8&gt;] (_raw_spin_lock+0x30/0x40)
 r7:00000000 r6:bfb63000 r5:00000000 r4:bfb60568
[&lt;8061d198&gt;] (_raw_spin_lock+0x0/0x40) from [&lt;8045f7f4&gt;] (sdhci_execute_tuning+0x4c/0x710)
 r4:bfb60000
[&lt;8045f7a8&gt;] (sdhci_execute_tuning+0x0/0x710) from [&lt;80453454&gt;] (mmc_sd_init_card+0x5f8/0x660)
[&lt;80452e5c&gt;] (mmc_sd_init_card+0x0/0x660) from [&lt;80453748&gt;] (mmc_attach_sd+0xb4/0x180)
 r9:bf92d400 r8:8065f364 r7:00061a80 r6:bfb60000 r5:8065f358
r4:bfb60000
[&lt;80453694&gt;] (mmc_attach_sd+0x0/0x180) from [&lt;8044d9f8&gt;] (mmc_rescan+0x284/0x2f0)
 r5:8065f358 r4:bfb602f8
[&lt;8044d774&gt;] (mmc_rescan+0x0/0x2f0) from [&lt;8003db94&gt;] (process_one_work+0x1a4/0x468)
 r8:00000000 r7:bfb55eb0 r6:bf80dc00 r5:bfb602f8 r4:bfb35980
r3:8044d774
[&lt;8003d9f0&gt;] (process_one_work+0x0/0x468) from [&lt;8003e850&gt;] (worker_thread+0x118/0x3e0)
[&lt;8003e738&gt;] (worker_thread+0x0/0x3e0) from [&lt;80044de0&gt;] (kthread+0xd4/0xf0)
[&lt;80044d0c&gt;] (kthread+0x0/0xf0) from [&lt;8000e9c8&gt;] (ret_from_fork+0x14/0x2c)
 r7:00000000 r6:00000000 r5:80044d0c r4:bfb37b40

Signed-off-by: Dong Aisheng &lt;b29396@freescale.com&gt;
Signed-off-by: Chris Ball &lt;chris@printf.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
<entry>
<title>mmc: sdhci-pci: add broken HS200 quirk for Intel Merrifield</title>
<updated>2014-02-06T19:34:08+00:00</updated>
<author>
<name>David Cohen</name>
<email>david.a.cohen@linux.intel.com</email>
</author>
<published>2013-10-29T17:58:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=8a6551ad7cd0751319efbc75e0b5ad884cb06fdb'/>
<id>8a6551ad7cd0751319efbc75e0b5ad884cb06fdb</id>
<content type='text'>
commit 390145f9adcf2730fcee81c8a51fd7c6c08f705f upstream.

Due to unknown hw issue so far, Merrifield is unable to enable HS200
support. This patch adds quirk to avoid SDHCI to initialize with error
below:

[   53.850132] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W
3.12.0-rc6-00037-g3d7c8d9-dirty #36
[   53.850150] Hardware name: Intel Corporation Merrifield/SALT BAY,
BIOS 397 2013.09.12:11.51.40
[   53.850167]  00000000 00000000 ee409e48 c18816d2 00000000 ee409e78
c123e254 c1acc9b0
[   53.850227]  00000000 00000000 c1b14148 000003de c16c03bf c16c03bf
ee75b480 ed97c54c
[   53.850282]  ee75b480 ee409e88 c123e292 00000009 00000000 ee409ef8
c16c03bf c1207fac
[   53.850339] Call Trace:
[   53.850376]  [&lt;c18816d2&gt;] dump_stack+0x4b/0x79
[   53.850408]  [&lt;c123e254&gt;] warn_slowpath_common+0x84/0xa0
[   53.850436]  [&lt;c16c03bf&gt;] ? sdhci_send_command+0xb4f/0xc50
[   53.850462]  [&lt;c16c03bf&gt;] ? sdhci_send_command+0xb4f/0xc50
[   53.850490]  [&lt;c123e292&gt;] warn_slowpath_null+0x22/0x30
[   53.850516]  [&lt;c16c03bf&gt;] sdhci_send_command+0xb4f/0xc50
[   53.850545]  [&lt;c1207fac&gt;] ? native_sched_clock+0x2c/0xb0
[   53.850575]  [&lt;c14c1f93&gt;] ? delay_tsc+0x73/0xb0
[   53.850601]  [&lt;c14c1ebe&gt;] ? __const_udelay+0x1e/0x20
[   53.850626]  [&lt;c16bdeb3&gt;] ? sdhci_reset+0x93/0x190
[   53.850654]  [&lt;c16c05b0&gt;] sdhci_finish_data+0xf0/0x2e0
[   53.850683]  [&lt;c16c130f&gt;] sdhci_irq+0x31f/0x930
[   53.850713]  [&lt;c12cb080&gt;] ? __buffer_unlock_commit+0x10/0x20
[   53.850740]  [&lt;c12cbcd7&gt;] ? trace_buffer_unlock_commit+0x37/0x50
[   53.850773]  [&lt;c1288f3c&gt;] handle_irq_event_percpu+0x5c/0x220
[   53.850800]  [&lt;c128bc96&gt;] ? handle_fasteoi_irq+0x16/0xd0
[   53.850827]  [&lt;c128913a&gt;] handle_irq_event+0x3a/0x60
[   53.850852]  [&lt;c128bc80&gt;] ? unmask_irq+0x30/0x30
[   53.850878]  [&lt;c128bcce&gt;] handle_fasteoi_irq+0x4e/0xd0
[   53.850895]  &lt;IRQ&gt;  [&lt;c1890b52&gt;] ? do_IRQ+0x42/0xb0
[   53.850943]  [&lt;c1890a31&gt;] ? common_interrupt+0x31/0x38
[   53.850973]  [&lt;c12b00d8&gt;] ? cgroup_mkdir+0x4e8/0x580
[   53.851001]  [&lt;c1208d32&gt;] ? default_idle+0x22/0xf0
[   53.851029]  [&lt;c1209576&gt;] ? arch_cpu_idle+0x26/0x30
[   53.851054]  [&lt;c1288505&gt;] ? cpu_startup_entry+0x65/0x240
[   53.851082]  [&lt;c18793d5&gt;] ? rest_init+0xb5/0xc0
[   53.851108]  [&lt;c1879320&gt;] ? __read_lock_failed+0x18/0x18
[   53.851138]  [&lt;c1bf6a15&gt;] ? start_kernel+0x31b/0x321
[   53.851164]  [&lt;c1bf652f&gt;] ? repair_env_string+0x51/0x51
[   53.851190]  [&lt;c1bf6363&gt;] ? i386_start_kernel+0x139/0x13c
[   53.851209] ---[ end trace 92777f5fe48d33f2 ]---
[   53.853449] mmcblk0: error -84 transferring data, sector 11142162, nr
304, cmd response 0x0, card status 0x0
[   53.853476] mmcblk0: retrying using single block read
[   55.937863] sdhci: Timeout waiting for Buffer Read Ready interrupt
during tuning procedure, falling back to fixed sampling clock
[   56.207951] sdhci: Timeout waiting for Buffer Read Ready interrupt
during tuning procedure, falling back to fixed sampling clock
[   66.228785] mmc0: Timeout waiting for hardware interrupt.
[   66.230855] ------------[ cut here ]------------

Signed-off-by: David Cohen &lt;david.a.cohen@linux.intel.com&gt;
Reviewed-by: Chuanxiao Dong &lt;chuanxiao.dong@intel.com&gt;
Acked-by: Dong Aisheng &lt;b29396@freescale.com&gt;
Signed-off-by: Chris Ball &lt;chris@printf.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
commit 390145f9adcf2730fcee81c8a51fd7c6c08f705f upstream.

Due to unknown hw issue so far, Merrifield is unable to enable HS200
support. This patch adds quirk to avoid SDHCI to initialize with error
below:

[   53.850132] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W
3.12.0-rc6-00037-g3d7c8d9-dirty #36
[   53.850150] Hardware name: Intel Corporation Merrifield/SALT BAY,
BIOS 397 2013.09.12:11.51.40
[   53.850167]  00000000 00000000 ee409e48 c18816d2 00000000 ee409e78
c123e254 c1acc9b0
[   53.850227]  00000000 00000000 c1b14148 000003de c16c03bf c16c03bf
ee75b480 ed97c54c
[   53.850282]  ee75b480 ee409e88 c123e292 00000009 00000000 ee409ef8
c16c03bf c1207fac
[   53.850339] Call Trace:
[   53.850376]  [&lt;c18816d2&gt;] dump_stack+0x4b/0x79
[   53.850408]  [&lt;c123e254&gt;] warn_slowpath_common+0x84/0xa0
[   53.850436]  [&lt;c16c03bf&gt;] ? sdhci_send_command+0xb4f/0xc50
[   53.850462]  [&lt;c16c03bf&gt;] ? sdhci_send_command+0xb4f/0xc50
[   53.850490]  [&lt;c123e292&gt;] warn_slowpath_null+0x22/0x30
[   53.850516]  [&lt;c16c03bf&gt;] sdhci_send_command+0xb4f/0xc50
[   53.850545]  [&lt;c1207fac&gt;] ? native_sched_clock+0x2c/0xb0
[   53.850575]  [&lt;c14c1f93&gt;] ? delay_tsc+0x73/0xb0
[   53.850601]  [&lt;c14c1ebe&gt;] ? __const_udelay+0x1e/0x20
[   53.850626]  [&lt;c16bdeb3&gt;] ? sdhci_reset+0x93/0x190
[   53.850654]  [&lt;c16c05b0&gt;] sdhci_finish_data+0xf0/0x2e0
[   53.850683]  [&lt;c16c130f&gt;] sdhci_irq+0x31f/0x930
[   53.850713]  [&lt;c12cb080&gt;] ? __buffer_unlock_commit+0x10/0x20
[   53.850740]  [&lt;c12cbcd7&gt;] ? trace_buffer_unlock_commit+0x37/0x50
[   53.850773]  [&lt;c1288f3c&gt;] handle_irq_event_percpu+0x5c/0x220
[   53.850800]  [&lt;c128bc96&gt;] ? handle_fasteoi_irq+0x16/0xd0
[   53.850827]  [&lt;c128913a&gt;] handle_irq_event+0x3a/0x60
[   53.850852]  [&lt;c128bc80&gt;] ? unmask_irq+0x30/0x30
[   53.850878]  [&lt;c128bcce&gt;] handle_fasteoi_irq+0x4e/0xd0
[   53.850895]  &lt;IRQ&gt;  [&lt;c1890b52&gt;] ? do_IRQ+0x42/0xb0
[   53.850943]  [&lt;c1890a31&gt;] ? common_interrupt+0x31/0x38
[   53.850973]  [&lt;c12b00d8&gt;] ? cgroup_mkdir+0x4e8/0x580
[   53.851001]  [&lt;c1208d32&gt;] ? default_idle+0x22/0xf0
[   53.851029]  [&lt;c1209576&gt;] ? arch_cpu_idle+0x26/0x30
[   53.851054]  [&lt;c1288505&gt;] ? cpu_startup_entry+0x65/0x240
[   53.851082]  [&lt;c18793d5&gt;] ? rest_init+0xb5/0xc0
[   53.851108]  [&lt;c1879320&gt;] ? __read_lock_failed+0x18/0x18
[   53.851138]  [&lt;c1bf6a15&gt;] ? start_kernel+0x31b/0x321
[   53.851164]  [&lt;c1bf652f&gt;] ? repair_env_string+0x51/0x51
[   53.851190]  [&lt;c1bf6363&gt;] ? i386_start_kernel+0x139/0x13c
[   53.851209] ---[ end trace 92777f5fe48d33f2 ]---
[   53.853449] mmcblk0: error -84 transferring data, sector 11142162, nr
304, cmd response 0x0, card status 0x0
[   53.853476] mmcblk0: retrying using single block read
[   55.937863] sdhci: Timeout waiting for Buffer Read Ready interrupt
during tuning procedure, falling back to fixed sampling clock
[   56.207951] sdhci: Timeout waiting for Buffer Read Ready interrupt
during tuning procedure, falling back to fixed sampling clock
[   66.228785] mmc0: Timeout waiting for hardware interrupt.
[   66.230855] ------------[ cut here ]------------

Signed-off-by: David Cohen &lt;david.a.cohen@linux.intel.com&gt;
Reviewed-by: Chuanxiao Dong &lt;chuanxiao.dong@intel.com&gt;
Acked-by: Dong Aisheng &lt;b29396@freescale.com&gt;
Signed-off-by: Chris Ball &lt;chris@printf.net&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</pre>
</div>
</content>
</entry>
</feed>
