SD card initialization on insertion fails

Bug #1929444 reported by Gordon Lack
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Medium
Chris Chiu
Hirsute
Fix Released
Medium
Chris Chiu
Impish
Fix Released
Medium
Chris Chiu

Bug Description

[SRU Justification]

[Impact]
The memory card can be detected and mount correctly when the system starts with the card inserted. But it will fail to be detected at the subsequent re-plug. It only happens on particular Realtek older PCI interfaced card readers. The RTL8411B (10ec:5287) is reported problematic for this issue.

[Fix]
Found the commit 121e9c6b5c4c ("misc: rtsx: modify and fix init_hw function") in 5.11.0-rc1 introduces this regression. The fix from upstream use the old ASPM control for particular realtek card reader models: 8411 5209 5227 5229 5249 5250.

[Test]
Verified on the Realtek PCI interfaced card reader RTL8411B and verify whether the memory card can be detected for each re-plug.

[Where problem could occur]
The regression can be considered as low since the fix has specified separate ASPM control for particular Realtek Card Readers.

========== Original Bug Description ==========

If I boot my laptop with an SD card (actually SDXC) in the MMC slot the system sees it and I can mount and use it.

If I then unmount it, remove it then re-insert it I get this in the system ,og:

[ 194.673108] mmc0: card e624 removed
[ 205.462065] mmc0: cannot verify signal voltage switch
[ 205.567479] mmc0: error -84 whilst initialising SD card

and the card cannot then be used.

It was OK in groovy. It's failing in hirsute.

ProblemType: Bug
DistroRelease: Ubuntu 21.04
Package: linux-image-generic 5.11.0.17.18
ProcVersionSignature: Ubuntu 5.11.0-17.18-generic 5.11.12
Uname: Linux 5.11.0-17-generic x86_64
ApportVersion: 2.20.11-0ubuntu65
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: gml4410 4153 F.... pulseaudio
CasperMD5CheckResult: unknown
CurrentDesktop: KDE
Date: Mon May 24 17:36:49 2021
HibernationDevice: RESUME=UUID=03dec042-8ba2-48a8-8d19-373ca2e0829c
InstallationDate: Installed on 2020-08-13 (284 days ago)
InstallationMedia: Kubuntu 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
MachineType: PC Specialist LTD N150CU
ProcFB: 0 i915drmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.11.0-17-generic root=UUID=b21720c3-60bf-4298-9d73-743672f89216 ro quiet splash vt.handoff=7
RelatedPackageVersions:
 linux-restricted-modules-5.11.0-17-generic N/A
 linux-backports-modules-5.11.0-17-generic N/A
 linux-firmware 1.197
SourcePackage: linux
UpgradeStatus: Upgraded to hirsute on 2021-05-13 (11 days ago)
dmi.bios.date: 11/15/2019
dmi.bios.release: 7.7
dmi.bios.vendor: INSYDE Corp.
dmi.bios.version: 1.07.07TPCS2
dmi.board.asset.tag: Tag 12345
dmi.board.name: N151CU
dmi.board.vendor: CLEVO
dmi.board.version: Not Applicable
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 10
dmi.chassis.vendor: Notebook
dmi.chassis.version: N/A
dmi.ec.firmware.release: 7.7
dmi.modalias: dmi:bvnINSYDECorp.:bvr1.07.07TPCS2:bd11/15/2019:br7.7:efr7.7:svnPCSpecialistLTD:pnN150CU:pvrNotApplicable:rvnCLEVO:rnN151CU:rvrNotApplicable:cvnNotebook:ct10:cvrN/A:
dmi.product.family: Not Applicable
dmi.product.name: N150CU
dmi.product.sku: Not Applicable
dmi.product.version: Not Applicable
dmi.sys.vendor: PC Specialist LTD

CVE References

Revision history for this message
Gordon Lack (gordon-lack) wrote :
Revision history for this message
Gordon Lack (gordon-lack) wrote :

Further information:
Booting the same laptop into MSWindows lets me insert SD cards whilst the system is running and it all works as expected. (So not a hardware problem).

Revision history for this message
Chris Chiu (mschiu77) wrote :

I can't reproduce on my laptop with my card readers (rtsx_usb) on hirsute and even newer kernel. Could you try some other card readers (ex. USB interfaced card reader) and check if the same thing can be reproduced?

And can you please turn on the dynamic debug for the module "rtsx_pci" and "rtsx_pci_sdmmc" and post the dmesg here?

1. sudo su
2. echo "module rtsx_pci +p" > /sys/kernel/debug/dynamic_debug_control
3. echo "module rtsx_pci_sdmmc +p" > /sys/kernel/debug/dynamic_debug_control

Then unplug/plug the SD card and post the dmesg output here. Thanks.

Revision history for this message
Gordon Lack (gordon-lack) wrote :

I've tested plugging in an SD card to an older laptop (also on hirsute).
That is OK.

I've also noticed that the:
 mmc0: error -84 whilst initialising SD card
message appears at boot time if the mmc card slot is empty.

(the "mmc0: cannot verify signal voltage switch" message also appears on my old laptop, where things I working, so we can discount that).

I'll gather the debug info now.

Revision history for this message
Gordon Lack (gordon-lack) wrote :

Here's the debug data from card insertion/removal.

Revision history for this message
Gordon Lack (gordon-lack) wrote :

Further info

I've just rebooted the laptop using the kernel that was left over from the upgrade from groovy.
The mmc card reader works OK there.

A reboot back to the latest hirsute kernel has it failing again.

So:
   5.8.0-53-generic - mmc reader works
   5.11.0-17-generic - mmc reader fails

Revision history for this message
Chris Chiu (mschiu77) wrote :

Thanks for clarification and the log.
The failure is due to the SD/MMC CMD2 which tries to asks any card to send the CID numbers on the CMD line. I revert some rtsx_pci patches which is not in groovy yet to build the hirsute test kernel. Could you please verify the kernel in the https://people.canonical.com/~mschiu77/lp1929444/ whether the problem still persists? Thanks

Revision history for this message
Gordon Lack (gordon-lack) wrote :

I can confirm that that 5.11.0-18-generic kernel fixes the problem,
The SD card is now visible and mountable on insertion.

Revision history for this message
Chris Chiu (mschiu77) wrote :

Thanks. I'll need to do bisect to identify which patch cause this problem and report upstream. Could you help me verify the kernel in https://people.canonical.com/~mschiu77/lp1929444/v2? You will need to disable the Secure Boot in the BIOS menu. Please let me know if there's any problem.

Revision history for this message
Gordon Lack (gordon-lack) wrote :

I don't have Secure Boot enabled anyway, so that bit's easy.

As for the v2 kernel - it FAILS (with the -84 error).

Revision history for this message
Chris Chiu (mschiu77) wrote :

Thanks. Please try https://people.canonical.com/~mschiu77/lp1929444/v3/ and I can confirm which commits really cause the problem.

Revision history for this message
Gordon Lack (gordon-lack) wrote :

The v3 kernel WORKS.

The SD card insertion is detected correctly.

Revision history for this message
Chris Chiu (mschiu77) wrote :

Thanks for the confirmation. Please try https://people.canonical.com/~mschiu77/lp1929444/final/ which I revert only the suspicious commit and give me the result. I'll report upstream and ask for official fix.

Revision history for this message
Gordon Lack (gordon-lack) wrote :

Sorry for the delay - the notification mail seems to have gone missing. Good job I decided to look anyway.

The result is that final WORKS:

==========
root@gmllaptop:~# uname -a
Linux gmllaptop 5.11.0-19-generic #20 SMP Wed Jun 2 11:33:21 CST 2021 x86_64 x86_64 x86_64 GNU/Linux
root@gmllaptop:~# dmesg | tail -4
[ 114.286474] mmc0: cannot verify signal voltage switch
[ 114.410823] mmc0: new ultra high speed SDR50 SDHC card at address e624
[ 114.427153] mmcblk0: mmc0:e624 SD16G 14.8 GiB
[ 114.438100] mmcblk0: p1

Revision history for this message
Chris Chiu (mschiu77) wrote :

Thanks for that good news.

I've contact the commit author and he gave me a patch for test.
I built a kernel based on the patch from the author in https://people.canonical.com/~mschiu77/lp1929444/author/. Could you help me verify it also? If it's positive, he promised to release a formal patch for it. And we need your assistance for verification.

Revision history for this message
Chris Chiu (mschiu77) wrote :

Thanks for that good news.

I've contact the commit author and he gave me a patch for test.
I built a kernel based on the patch from the author in https://people.canonical.com/~mschiu77/lp1929444/author/. Could you help me verify it also? If it's positive, he promised to release a formal patch for it. And we need your assistance for verification.

tags: added: patch
Revision history for this message
Gordon Lack (gordon-lack) wrote :

I can confirm that the "author" kernel fixes the problem on my laptop.

(And for good measure I've also tested it on my old laptop, which didn't show the problem, and it still works there too).

Thanks....

Revision history for this message
Chris Chiu (mschiu77) wrote :

Thanks. The author is trying to send PATCH upstream and waiting for approval. Will keep u updated if there's a new version of Hirsute.

Changed in linux (Ubuntu Hirsute):
assignee: nobody → Chris Chiu (mschiu77)
Changed in linux (Ubuntu Impish):
assignee: nobody → Chris Chiu (mschiu77)
importance: Undecided → Medium
Changed in linux (Ubuntu Hirsute):
importance: Undecided → Medium
status: New → Triaged
Changed in linux (Ubuntu Impish):
status: New → Triaged
Revision history for this message
Chris Chiu (mschiu77) wrote :

https://lkml.org/lkml/2021/6/7/416 is accepted upstream. I'll backport it when it's in linux-next.

Chris Chiu (mschiu77)
description: updated
Chris Chiu (mschiu77)
Changed in linux (Ubuntu Hirsute):
status: Triaged → Fix Committed
Changed in linux (Ubuntu Impish):
status: Triaged → Fix Committed
Revision history for this message
Stefan Bader (smb) wrote :

Chris, fix committed is only set by us when we apply the patches.

Changed in linux (Ubuntu Hirsute):
status: Fix Committed → In Progress
Revision history for this message
Chris Chiu (mschiu77) wrote :

Understood. Thanks

Stefan Bader (smb)
Changed in linux (Ubuntu Hirsute):
status: In Progress → Fix Committed
Stefan Bader (smb)
Changed in linux (Ubuntu Impish):
status: Fix Committed → Triaged
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-hirsute' to 'verification-done-hirsute'. If the problem still exists, change the tag 'verification-needed-hirsute' to 'verification-failed-hirsute'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-hirsute
Chris Chiu (mschiu77)
tags: added: verification-done-hirsute
removed: verification-needed-hirsute
Chris Chiu (mschiu77)
Changed in linux (Ubuntu Impish):
status: Triaged → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (23.1 KiB)

This bug was fixed in the package linux - 5.11.0-25.27

---------------
linux (5.11.0-25.27) hirsute; urgency=medium

  * CVE-2021-33909
    - SAUCE: seq_file: Disallow extremely large seq buffer allocations

linux (5.11.0-24.25) hirsute; urgency=medium

  * test_pmtu_vti4_link_add_mtu() test from net/pmtu.sh in
    ubuntu_kernel_selftests cannot finish properly on 5.11 and 5.8
    (LP: #1933969)
    - ip6_gre: proper dev_{hold|put} in ndo_[un]init methods
    - sit: proper dev_{hold|put} in ndo_[un]init methods
    - ip6_tunnel: sit: proper dev_{hold|put} in ndo_[un]init methods
    - ipv6: remove extra dev_hold() for fallback tunnels

linux (5.11.0-23.24) hirsute; urgency=medium

  * hirsute/linux: 5.11.0-23.24 -proposed tracker (LP: #1932420)

  * Packaging resync (LP: #1786013)
    - [Packaging] resync getabis
    - [Packaging] update helper scripts
    - update dkms package versions

  * Disable hv-kvp-daemon.service on certain instance types (LP: #1932081)
    - [Packaging]: Add kernel command line condition to hv-kvp-daemon service

  * Add support for IO functions of AAEON devices (LP: #1929504)
    - ODM: mfd: Add support for IO functions of AAEON devices
    - ODM: gpio: add driver for AAEON devices
    - ODM: watchdog: add driver for AAEON devices
    - ODM: hwmon: add driver for AAEON devices
    - ODM: leds: add driver for AAEON devices
    - ODM: [Config] update config for AAEON devices

  * Add support for selective build of special drivers (LP: #1912789)
    - [Packaging] Add support for ODM drivers
    - [Packaging] Turn on ODM support for amd64
    - [Packaging] Fix ODM support in actual build
    - [Packaging] Fix ODM DRIVERS Kconfig

  * Mute/Mic mute LEDs and right speaker are not work on HP platforms
    (LP: #1932055)
    - ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Elite Dragonfly
      G2
    - ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP EliteBook x360
      1040 G8
    - ALSA: hda/realtek: fix mute/micmute LEDs for HP EliteBook 840 Aero G8
    - ALSA: hda/realtek: fix mute/micmute LEDs for HP ZBook Power G8

  * SD card initialization on insertion fails (LP: #1929444)
    - misc: rtsx: separate aspm mode into MODE_REG and MODE_CFG

  * Fix non-working GPU on Some HP desktops (LP: #1931147)
    - PCI: Coalesce host bridge contiguous apertures

  * CirrusLogic: The default input volume is "0%" on Dell Warlock (LP: #1929803)
    - ALSA: hda/cirrus: Set Initial DMIC volume to -26 dB

  * Mic-mute/mute LEDs not work on some HP platforms (LP: #1930707)
    - ALSA: hda/realtek: fix mute/micmute LEDs for HP 855 G8
    - ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook G8
    - ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook Fury 15 G8
    - ALSA: hda/realtek: fix mute/micmute LEDs and speaker for HP Zbook Fury 17 G8

  * [UBUNTU 21.04] tools/kvm_stat: Add restart delay (LP: #1921870)
    - [Packaging] install kvm_stat systemd service

  * Fix ICL PCH no picture after S3 (LP: #1930582)
    - drm/i915/icp+: Use icp_hpd_irq_setup() instead of spt_hpd_irq_setup()

  * Hirsute update: v5.11.22 upstream stable release (LP: #1931292)
    - KEYS: trusted: Fix memory...

Changed in linux (Ubuntu Hirsute):
status: Fix Committed → Fix Released
Revision history for this message
Gordon Lack (gordon-lack) wrote :

I've updated to 5.11.0-25-generic and can confirm that my laptop now sees SDH/XC cards OK.

Thanks.

Revision history for this message
omarly666 (omarly666) wrote :

It's back in kinetic

Hit:1 http://no.mirrors.blix.com/ubuntu kinetic InRelease

From log

mmc0: error -110 whilst initialising SD card

and

mmc0: card never left busy state

Revision history for this message
Gordon Lack (gordon-lack) wrote (last edit ):

Might be something different then.

I can insert and mount SD cards on the laptop I originally reported this for (in #2).

I'm on kinetic, kernel 5.19.0-35-generic.

Revision history for this message
Chris (mail-christianmayer) wrote :

I've got a similar problem with Ubuntu 22.04.3 LTS and kernel 6.2.0-31-generic -> https://bugs.launchpad.net/ubuntu/+source/linux-signed-hwe-6.2/+bug/2033553

Revision history for this message
Gordon Lack (gordon-lack) wrote :

I've just tested the laptop where this problem was originally seen and it's still OK there.

That is now running 23.04 (Lunar) with kernel 6.2.0-33-generic.

So may be similar, but is not the same.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.