diff mbox series

[v2,1/1] mmc: host: meson-gx-mmc: fix possible deadlock condition for preempt_rt

Message ID 20200927025418.12382-2-bjharper@gmail.com (mailing list archive)
State New, archived
Headers show
Series mmc: host: meson-gx-mmc: fix possible deadlock condition for preempt_rt | expand

Commit Message

Brad Harper Sept. 27, 2020, 2:54 a.m. UTC
---
 drivers/mmc/host/meson-gx-mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Sebastian Andrzej Siewior Sept. 28, 2020, 4:41 p.m. UTC | #1
On 2020-09-26 22:54:18 [-0400], Brad Harper wrote:
> ---

What happens if you boot this on a non-RT kernel with the `threadirqs'
command line option?

Sebastian
Kevin Hilman Sept. 29, 2020, 12:35 a.m. UTC | #2
Brad Harper <bjharper@gmail.com> writes:

> ---
>  drivers/mmc/host/meson-gx-mmc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)


This patch still needs changelog summarizing the problem and what is
being fixed by the patch.  Most of what's in the cover letter belongs
here.

The cover letter can be used to describe the history/background that you
don't want in the patch itself.  Alternatviely, you could include that
information in the a single patch email also because everything after
the "---" line does not end up in git history.

> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
> index 08a3b1c05..3ba8f988d 100644
> --- a/drivers/mmc/host/meson-gx-mmc.c
> +++ b/drivers/mmc/host/meson-gx-mmc.c
> @@ -146,6 +146,7 @@ struct sd_emmc_desc {
>  };
>  
>  struct meson_host {
> +	spinlock_t		lock;
>  	struct	device		*dev;
>  	struct	meson_mmc_data *data;
>  	struct	mmc_host	*mmc;
> @@ -1051,6 +1052,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
>  	host->mmc = mmc;
>  	host->dev = &pdev->dev;
>  	dev_set_drvdata(&pdev->dev, host);
> +	spin_lock_init(&host->lock);

I'm confused about what this lock is intended to do.  You init it here,
but it's never used anywhere.  

>  	/* The G12A SDIO Controller needs an SRAM bounce buffer */
>  	host->dram_access_quirk = device_property_read_bool(&pdev->dev,
> @@ -1139,7 +1141,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
>  	       host->regs + SD_EMMC_IRQ_EN);
>  
>  	ret = request_threaded_irq(host->irq, meson_mmc_irq,
> -				   meson_mmc_irq_thread, IRQF_ONESHOT,
> +				   meson_mmc_irq_thread, 0,
>  				   dev_name(&pdev->dev), host);
>  	if (ret)
>  		goto err_init_clk;

Kevin
Brad Harper Sept. 29, 2020, 8:32 a.m. UTC | #3
Hi Kevin,

     I think you are right,  I don't have a good enough understanding to 
make this work so please disregard the patch.  I will take on 
Sebastian's advice and do some testing with 'threadirqs' parameter 
enabled in standard kernel to see if I can reproduce my original issue 
there.  I'm hoping Jerome might also be able to help with some time to 
find proper solution.

Many Thanks,

Brad.

On 29/09/2020 10:35 am, Kevin Hilman wrote:
> Brad Harper <bjharper@gmail.com> writes:
>
>> ---
>>   drivers/mmc/host/meson-gx-mmc.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> This patch still needs changelog summarizing the problem and what is
> being fixed by the patch.  Most of what's in the cover letter belongs
> here.
>
> The cover letter can be used to describe the history/background that you
> don't want in the patch itself.  Alternatviely, you could include that
> information in the a single patch email also because everything after
> the "---" line does not end up in git history.
>
>> diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
>> index 08a3b1c05..3ba8f988d 100644
>> --- a/drivers/mmc/host/meson-gx-mmc.c
>> +++ b/drivers/mmc/host/meson-gx-mmc.c
>> @@ -146,6 +146,7 @@ struct sd_emmc_desc {
>>   };
>>   
>>   struct meson_host {
>> +	spinlock_t		lock;
>>   	struct	device		*dev;
>>   	struct	meson_mmc_data *data;
>>   	struct	mmc_host	*mmc;
>> @@ -1051,6 +1052,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
>>   	host->mmc = mmc;
>>   	host->dev = &pdev->dev;
>>   	dev_set_drvdata(&pdev->dev, host);
>> +	spin_lock_init(&host->lock);
> I'm confused about what this lock is intended to do.  You init it here,
> but it's never used anywhere.
>
>>   	/* The G12A SDIO Controller needs an SRAM bounce buffer */
>>   	host->dram_access_quirk = device_property_read_bool(&pdev->dev,
>> @@ -1139,7 +1141,7 @@ static int meson_mmc_probe(struct platform_device *pdev)
>>   	       host->regs + SD_EMMC_IRQ_EN);
>>   
>>   	ret = request_threaded_irq(host->irq, meson_mmc_irq,
>> -				   meson_mmc_irq_thread, IRQF_ONESHOT,
>> +				   meson_mmc_irq_thread, 0,
>>   				   dev_name(&pdev->dev), host);
>>   	if (ret)
>>   		goto err_init_clk;
> Kevin
diff mbox series

Patch

diff --git a/drivers/mmc/host/meson-gx-mmc.c b/drivers/mmc/host/meson-gx-mmc.c
index 08a3b1c05..3ba8f988d 100644
--- a/drivers/mmc/host/meson-gx-mmc.c
+++ b/drivers/mmc/host/meson-gx-mmc.c
@@ -146,6 +146,7 @@  struct sd_emmc_desc {
 };
 
 struct meson_host {
+	spinlock_t		lock;
 	struct	device		*dev;
 	struct	meson_mmc_data *data;
 	struct	mmc_host	*mmc;
@@ -1051,6 +1052,7 @@  static int meson_mmc_probe(struct platform_device *pdev)
 	host->mmc = mmc;
 	host->dev = &pdev->dev;
 	dev_set_drvdata(&pdev->dev, host);
+	spin_lock_init(&host->lock);
 
 	/* The G12A SDIO Controller needs an SRAM bounce buffer */
 	host->dram_access_quirk = device_property_read_bool(&pdev->dev,
@@ -1139,7 +1141,7 @@  static int meson_mmc_probe(struct platform_device *pdev)
 	       host->regs + SD_EMMC_IRQ_EN);
 
 	ret = request_threaded_irq(host->irq, meson_mmc_irq,
-				   meson_mmc_irq_thread, IRQF_ONESHOT,
+				   meson_mmc_irq_thread, 0,
 				   dev_name(&pdev->dev), host);
 	if (ret)
 		goto err_init_clk;