Opened 3 years ago

Closed 18 months ago

#17287 closed bug (fixed)

DriveSetup hangs (in the kernel) with an unpopulated card reader present

Reported by: LSS37040 Owned by: nobody
Priority: normal Milestone: R1/beta5
Component: Drivers/Disk/USB Version: R1/Development
Keywords: Cc:
Blocked By: #16794 Blocking:
Platform: All

Description

I have a SD/MMC/MS card reader on my case that is connected to the motherboard (Asrock X570 Taichi Razer Edition) via USB header. When the card reader is unpopulated (empty), DriveSetup would not function correctly.

As of hrev55443, it takes about several minutes to show the main screen and even after that DriveSetup window looks totally frozen. I can't do anything with it, such as scrolling down to see how an empty card reader would look like, as well as closing the window. In some cases I get a vm_page_fault KDL (like this: https://dev.haiku-os.org/attachment/ticket/16794/IMG_20210921_204639.jpg).

As this appears to be caused by something different from #16794, this new ticket is created as a follow-up. For now the workaround would be to populate the card reader whenever I need to use DriveSetup (using a SD card inserted to the reader as installation medium would also do).

Attachments (1)

IMG_20211003_223427.jpg (1.8 MB ) - added by LSS37040 3 years ago.
DriveSetup KDL and syslog.

Download all attachments as: .zip

Change History (17)

comment:1 by waddlesplash, 3 years ago

Component: Applications/DriveSetupDrivers/Disk
Keywords: drivesetup card reader xhci removed
Owner: changed from stippi to nobody
Summary: DriveSetup would not function correctly with an unpopulated card reader present.DriveSetup hangs (in the kernel) with an unpopulated card reader present

This is definitely a kernel-space issue of some kind, either in the USB disk driver or somewhere else in the storage layers.

comment:2 by pulkomandy, 3 years ago

Is there anything happening in the syslog while this happens? I assume the usb_disk driver is trying to open the device and not detecting correctly that there is no media in it.

comment:3 by LSS37040, 3 years ago

How should I access syslog, especially when I'm inside a KDL?

I'm still new to this...

Not to mention that the usb_keyboard debugger add-on still needs to be disabled in this case, or the system would hang with a few white lines when it KDLs.

comment:4 by pulkomandy, 3 years ago

from inside KDL you can use the "syslog" command to show the syslog.

Before it crashes, you can do this:

  • Open a Terminal and run tail -f /var/log/syslog
  • Run DriveSetup

See if anything shows up in the Terminal.

by LSS37040, 3 years ago

Attachment: IMG_20211003_223427.jpg added

DriveSetup KDL and syslog.

comment:5 by LSS37040, 3 years ago

Attached a screenshot with the KDL and the syslog.

The syslog did mention some transaction errors when the SD card slot was unpopulated.

comment:6 by pulkomandy, 3 years ago

Milestone: UnscheduledR1/beta4
Resolution: fixed
Status: newclosed

(sorry, edited the wrong ticket)

Last edited 3 years ago by pulkomandy (previous) (diff)

comment:7 by pulkomandy, 3 years ago

Resolution: fixed
Status: closedreopened

comment:8 by pulkomandy, 3 years ago

The kernel stacktrace has open_vnode calling LegacyDevice::Open. I'm a bit confused, because as far as I can see, the only legacy driver we still have is the PS2 keyboard/mouse driver (I searched for calls of devfs_publish_device using a "hooks" argument, are there other places to look for?), and surely this shouldn't be involved in a scan of disk devices.

comment:9 by korli, 3 years ago

Legacy drivers are the ones which don't use the new driver API: everything except a few in disk/ power/ and input/

comment:10 by pulkomandy, 3 years ago

Yes, but I don't see the code path where they create a LegacyDevice instance, except for the PS2 one.

Anyway, what seems to happen is, the LegacyDevice instance ends up pointing to a "hooks" structure that doesn't exist anymore, I suspect the device hooks were released from memory because of the USB errors, but the LegacyDevice object still points to the released memory?

in reply to:  10 comment:11 by korli, 3 years ago

Replying to pulkomandy:

Yes, but I don't see the code path where they create a LegacyDevice instance, except for the PS2 one.

It happens in legacy_driver_probe(), calling publish_devices() and find_device() on each driver to see if they support the device path.

Anyway, what seems to happen is, the LegacyDevice instance ends up pointing to a "hooks" structure that doesn't exist anymore, I suspect the device hooks were released from memory because of the USB errors, but the LegacyDevice object still points to the released memory?

Quite possible.

comment:12 by pulkomandy, 3 years ago

Component: Drivers/DiskDrivers/Disk/USB

comment:13 by waddlesplash, 2 years ago

Milestone: R1/beta4Unscheduled

comment:14 by waddlesplash, 19 months ago

Please retest after hrev57051.

comment:15 by LSS37040, 18 months ago

Sorry for the hiatus.

Tested hrev57146 and can confirm DriveSetup is now working normally regardless of whether my card reader is populated or not.

Though I haven't done any in-depth test, at least the most critical part of the issue can be considered solved, so that now I can at least manage partitions for installing Haiku while my card reader is unpopulated.

Many thanks for the fix.

comment:16 by pulkomandy, 18 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: reopenedclosed
Note: See TracTickets for help on using tickets.