diff mbox series

[3/5] media: coda: Replace the threaded interrupt with a hard interrupt

Message ID 20190425183546.16244-4-ezequiel@collabora.com (mailing list archive)
State New, archived
Headers show
Series Assorted CODA fixes | expand

Commit Message

Ezequiel Garcia April 25, 2019, 6:35 p.m. UTC
The current interrupt handler is doing very little, and not doing
any non-atomic operations. Pretty much all it does is accessing
a couple registers, taking a couple spinlocks and then signalling
a completion.

There is no reason this should be a threaded interrupt handler,
so move the handler to regular hard interrupt context.

Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
---
 drivers/media/platform/coda/coda-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philipp Zabel April 26, 2019, 7:59 a.m. UTC | #1
On Thu, 2019-04-25 at 15:35 -0300, Ezequiel Garcia wrote:
> The current interrupt handler is doing very little, and not doing
> any non-atomic operations. Pretty much all it does is accessing
> a couple registers, taking a couple spinlocks and then signalling
> a completion.
> 
> There is no reason this should be a threaded interrupt handler,
> so move the handler to regular hard interrupt context.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  drivers/media/platform/coda/coda-common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> index 1f53ca4effd2..617d4547ec82 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -2789,8 +2789,8 @@ static int coda_probe(struct platform_device *pdev)
>  		return irq;
>  	}
>  
> -	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, coda_irq_handler,
> -			IRQF_ONESHOT, dev_name(&pdev->dev), dev);
> +	ret = devm_request_irq(&pdev->dev, irq, coda_irq_handler, 0,
> +			       dev_name(&pdev->dev), dev);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed to request irq: %d\n", ret);
>  		return ret;

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp
Philipp Zabel April 26, 2019, 9:16 a.m. UTC | #2
On Thu, 2019-04-25 at 15:35 -0300, Ezequiel Garcia wrote:
> The current interrupt handler is doing very little, and not doing
> any non-atomic operations. Pretty much all it does is accessing
> a couple registers, taking a couple spinlocks and then signalling
> a completion.
> 
> There is no reason this should be a threaded interrupt handler,
> so move the handler to regular hard interrupt context.
> 
> Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> ---
>  drivers/media/platform/coda/coda-common.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> index 1f53ca4effd2..617d4547ec82 100644
> --- a/drivers/media/platform/coda/coda-common.c
> +++ b/drivers/media/platform/coda/coda-common.c
> @@ -2789,8 +2789,8 @@ static int coda_probe(struct platform_device *pdev)
>  		return irq;
>  	}
>  
> -	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, coda_irq_handler,
> -			IRQF_ONESHOT, dev_name(&pdev->dev), dev);
> +	ret = devm_request_irq(&pdev->dev, irq, coda_irq_handler, 0,
> +			       dev_name(&pdev->dev), dev);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "failed to request irq: %d\n", ret);
>  		return ret;

There is one thing that this would complicate. For at least H.264 I
know that we can pad the bitstream in reaction to a BIT_BUF_EMPTY
interrupt, to make a picture run finish successfully when it is stuck in
  buffer underrun condition. This would need to be done under the
bitstream_mutex in a threaded handler.

regards
Philipp
Ezequiel Garcia April 26, 2019, 5:56 p.m. UTC | #3
Hi Philipp,

Thanks for the quick review of the series.

On Fri, 2019-04-26 at 11:16 +0200, Philipp Zabel wrote:
> On Thu, 2019-04-25 at 15:35 -0300, Ezequiel Garcia wrote:
> > The current interrupt handler is doing very little, and not doing
> > any non-atomic operations. Pretty much all it does is accessing
> > a couple registers, taking a couple spinlocks and then signalling
> > a completion.
> > 
> > There is no reason this should be a threaded interrupt handler,
> > so move the handler to regular hard interrupt context.
> > 
> > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> > ---
> >  drivers/media/platform/coda/coda-common.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> > index 1f53ca4effd2..617d4547ec82 100644
> > --- a/drivers/media/platform/coda/coda-common.c
> > +++ b/drivers/media/platform/coda/coda-common.c
> > @@ -2789,8 +2789,8 @@ static int coda_probe(struct platform_device *pdev)
> >  		return irq;
> >  	}
> >  
> > -	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, coda_irq_handler,
> > -			IRQF_ONESHOT, dev_name(&pdev->dev), dev);
> > +	ret = devm_request_irq(&pdev->dev, irq, coda_irq_handler, 0,
> > +			       dev_name(&pdev->dev), dev);
> >  	if (ret < 0) {
> >  		dev_err(&pdev->dev, "failed to request irq: %d\n", ret);
> >  		return ret;
> 
> There is one thing that this would complicate. For at least H.264 I
> know that we can pad the bitstream in reaction to a BIT_BUF_EMPTY
> interrupt, to make a picture run finish successfully when it is stuck in
>   buffer underrun condition. This would need to be done under the
> bitstream_mutex in a threaded handler.
> 

In this case, a top-half handler would still stand in good stead,
as it would check the interrupt status, and fire the bottom-half
threaded interrupt to handle the buffer underrun.

Thanks,
Ezequiel
Philipp Zabel April 29, 2019, 9:13 a.m. UTC | #4
On Fri, 2019-04-26 at 14:56 -0300, Ezequiel Garcia wrote:
> Hi Philipp,
> 
> Thanks for the quick review of the series.
> 
> On Fri, 2019-04-26 at 11:16 +0200, Philipp Zabel wrote:
> > On Thu, 2019-04-25 at 15:35 -0300, Ezequiel Garcia wrote:
> > > The current interrupt handler is doing very little, and not doing
> > > any non-atomic operations. Pretty much all it does is accessing
> > > a couple registers, taking a couple spinlocks and then signalling
> > > a completion.
> > > 
> > > There is no reason this should be a threaded interrupt handler,
> > > so move the handler to regular hard interrupt context.
> > > 
> > > Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com>
> > > ---
> > >  drivers/media/platform/coda/coda-common.c | 4 ++--
> > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
> > > index 1f53ca4effd2..617d4547ec82 100644
> > > --- a/drivers/media/platform/coda/coda-common.c
> > > +++ b/drivers/media/platform/coda/coda-common.c
> > > @@ -2789,8 +2789,8 @@ static int coda_probe(struct platform_device *pdev)
> > >  		return irq;
> > >  	}
> > >  
> > > -	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, coda_irq_handler,
> > > -			IRQF_ONESHOT, dev_name(&pdev->dev), dev);
> > > +	ret = devm_request_irq(&pdev->dev, irq, coda_irq_handler, 0,
> > > +			       dev_name(&pdev->dev), dev);
> > >  	if (ret < 0) {
> > >  		dev_err(&pdev->dev, "failed to request irq: %d\n", ret);
> > >  		return ret;
> > 
> > There is one thing that this would complicate. For at least H.264 I
> > know that we can pad the bitstream in reaction to a BIT_BUF_EMPTY
> > interrupt, to make a picture run finish successfully when it is stuck in
> >   buffer underrun condition. This would need to be done under the
> > bitstream_mutex in a threaded handler.
> > 
> 
> In this case, a top-half handler would still stand in good stead,
> as it would check the interrupt status, and fire the bottom-half
> threaded interrupt to handle the buffer underrun.

I agree, and the R-b stands.

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 1f53ca4effd2..617d4547ec82 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -2789,8 +2789,8 @@  static int coda_probe(struct platform_device *pdev)
 		return irq;
 	}
 
-	ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, coda_irq_handler,
-			IRQF_ONESHOT, dev_name(&pdev->dev), dev);
+	ret = devm_request_irq(&pdev->dev, irq, coda_irq_handler, 0,
+			       dev_name(&pdev->dev), dev);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "failed to request irq: %d\n", ret);
 		return ret;