Module Name: src Committed By: riastradh Date: Sun May 24 17:26:18 UTC 2020
Modified Files: src/sys/dev/sdmmc: if_bwfm_sdio.c ld_sdmmc.c sdmmc.c sdmmc_io.c sdmmcvar.h Log Message: Fix races in sdmmc tasks and teach ld@sdmmc to abort xfers on detach. - Teach sdmmc_add_task to queue it only if not already queued. - Remove now-redundant logic to avoid repeated queueing elsewhere. - Teach sdmmc_del_task to wait until task has completed. - Call sdmmc_del_task in various needful places. - Replace abuse of pcq by a lock and a tailq. (pcq is multi-producer, _single_-consumer, but there are potentially multiple consumers here and really only one producer.) - Teach ld_sdmmc to abort xfers on detach. (Mechanism is kinda kludgey but it'll do for now; any effort one is tempted to spend overhauling this should be spent overhauling sdmmc to support proper asynchronous commands.) - Make sure ld_sdmmc_discard either returns failure or eventually calls ldenddiscard. XXX Currently ld_sdmmc_detach aborts xfers _before_ ldbegindetach has has committed to detaching or not. This is currently necessary to avoid a deadlock because ldbegindetach waits for xfers to drain -- which strikes me as wrong; ldbegindetach shouldn't wait for anything, and should only make the decision to commit to detaching or not so the caller can decide whether to abort xfers before we actually wait for them in ldenddetach. XXX pullup -- although this changes some kernel symbols (sdmmc_add_task and sdmmc_del_task), it shouldn't affect any existing modules; the only module that uses sdmmc is ld_sdmmc.kmod, which is `.if 0' in the build so there shouldn't be any of them floating around. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/sdmmc/if_bwfm_sdio.c cvs rdiff -u -r1.37 -r1.38 src/sys/dev/sdmmc/ld_sdmmc.c cvs rdiff -u -r1.39 -r1.40 src/sys/dev/sdmmc/sdmmc.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/sdmmc/sdmmc_io.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/sdmmc/sdmmcvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.