Patch "ASoC: ti: davinci-mcasp: Fix race condition during probe" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: ti: davinci-mcasp: Fix race condition during probe

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-ti-davinci-mcasp-fix-race-condition-during-prob.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 9d27672e7586556b4817f9d2c95ffff76e45b3f3
Author: Joao Paulo Goncalves <joao.goncalves@xxxxxxxxxxx>
Date:   Wed Apr 17 15:41:38 2024 -0300

    ASoC: ti: davinci-mcasp: Fix race condition during probe
    
    [ Upstream commit d18ca8635db2f88c17acbdf6412f26d4f6aff414 ]
    
    When using davinci-mcasp as CPU DAI with simple-card, there are some
    conditions that cause simple-card to finish registering a sound card before
    davinci-mcasp finishes registering all sound components. This creates a
    non-working sound card from userspace with no problem indication apart
    from not being able to play/record audio on a PCM stream. The issue
    arises during simultaneous probe execution of both drivers. Specifically,
    the simple-card driver, awaiting a CPU DAI, proceeds as soon as
    davinci-mcasp registers its DAI. However, this process can lead to the
    client mutex lock (client_mutex in soc-core.c) being held or davinci-mcasp
    being preempted before PCM DMA registration on davinci-mcasp finishes.
    This situation occurs when the probes of both drivers run concurrently.
    Below is the code path for this condition. To solve the issue, defer
    davinci-mcasp CPU DAI registration to the last step in the audio part of
    it. This way, simple-card CPU DAI parsing will be deferred until all
    audio components are registered.
    
    Fail Code Path:
    
    simple-card.c: probe starts
    simple-card.c: simple_dai_link_of: simple_parse_node(..,cpu,..) returns EPROBE_DEFER, no CPU DAI yet
    davinci-mcasp.c: probe starts
    davinci-mcasp.c: devm_snd_soc_register_component() register CPU DAI
    simple-card.c: probes again, finish CPU DAI parsing and call devm_snd_soc_register_card()
    simple-card.c: finish probe
    davinci-mcasp.c: *dma_pcm_platform_register() register PCM  DMA
    davinci-mcasp.c: probe finish
    
    Cc: stable@xxxxxxxxxxxxxxx
    Fixes: 9fbd58cf4ab0 ("ASoC: davinci-mcasp: Choose PCM driver based on configured DMA controller")
    Signed-off-by: Joao Paulo Goncalves <joao.goncalves@xxxxxxxxxxx>
    Acked-by: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxx>
    Reviewed-by: Jai Luthra <j-luthra@xxxxxx>
    Link: https://lore.kernel.org/r/20240417184138.1104774-1-jpaulo.silvagoncalves@xxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index 633cd7fd3dcf3..dc40b5c5d501e 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -2270,12 +2270,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 
 	mcasp_reparent_fck(pdev);
 
-	ret = devm_snd_soc_register_component(&pdev->dev, &davinci_mcasp_component,
-					      &davinci_mcasp_dai[mcasp->op_mode], 1);
-
-	if (ret != 0)
-		goto err;
-
 	ret = davinci_mcasp_get_dma_type(mcasp);
 	switch (ret) {
 	case PCM_EDMA:
@@ -2296,6 +2290,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		goto err;
 	}
 
+	ret = devm_snd_soc_register_component(&pdev->dev, &davinci_mcasp_component,
+					      &davinci_mcasp_dai[mcasp->op_mode], 1);
+
+	if (ret != 0)
+		goto err;
+
 no_audio:
 	ret = davinci_mcasp_init_gpiochip(mcasp);
 	if (ret) {




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux