All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Codrin.Ciubotariu@microchip.com
Cc: Ludovic.Desroches@microchip.com, dmaengine@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: dmaengine: at_xdmac: Fix wrongfull report of a channel as in use
Date: Wed, 23 Jan 2019 17:46:41 +0530	[thread overview]
Message-ID: <20190123121641.GN4635@vkoul-mobl> (raw)

On 21-01-19, 14:38, Codrin.Ciubotariu@microchip.com wrote:
> On 20.01.2019 13:04, Vinod Koul wrote:
> > Hi Codrin,
> > 
> > On 17-01-19, 16:10, Codrin.Ciubotariu@microchip.com wrote:
> >> From: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
> >>
> >> atchan->status is used for two things:
> >>   - pass channel interrupts status from interrupt handler to tasklet;
> >>   - channel information like whether it is cyclic or paused;
> >>
> >> Since these operations have nothing in common, this patch adds a
> >> different struct member to keep the interrupts status.
> >>
> >> Fixes a bug in which a channel is wrongfully reported as in use when
> >> trying to obtain a new descriptior for a previously used cyclic channel.
> > 
> > This looks reasonable but am unable to see how the bug is fixed. Perhaps
> > would be great to split the bug part (which can go to fixes) and remove
> > the reuse of variable as a subsequent patch..
> 
> Hi Vinod,
> 
> This patch is the fix, since it moves the operations on atchan->status, 
> in which the interrupt status register is saved, to a different member 
> (irq_status). The AT_XDMAC_CHAN_IS_CYCLIC and AT_XDMAC_CHAN_IS_PAUSED 
> bits have nothing in common with the interrupt status register.
> 
> The bug reproduces when a device_terminate_all() is called, 
> (AT_XDMAC_CHAN_IS_CYCLIC cleared on atchan->status) and then a late End 
> of Block interrupt arrives (AT_XDMAC_CIS_BIS), which sets bit 0 of 
> atchan->status. Bit 0 is also used for AT_XDMAC_CHAN_IS_CYCLIC, so when 
> a new descriptor for a cyclic transfer is created, the driver reports 
> the channel as in use:
> 
> if (test_and_set_bit(AT_XDMAC_CHAN_IS_CYCLIC, &atchan->status)) {
> 	dev_err(chan2dev(chan), "channel currently used\n");
> 	return NULL;
> }
> 
> I can send v2 if you consider the commit message misleading.

Yes please, that would be better and pls add fixes as suggested by
Ludovic along with his ack

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org>
To: Codrin.Ciubotariu@microchip.com
Cc: Ludovic.Desroches@microchip.com, dmaengine@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: at_xdmac: Fix wrongfull report of a channel as in use
Date: Wed, 23 Jan 2019 17:46:41 +0530	[thread overview]
Message-ID: <20190123121641.GN4635@vkoul-mobl> (raw)
In-Reply-To: <450ee975-a603-cf89-0000-13156c1cb5e8@microchip.com>

On 21-01-19, 14:38, Codrin.Ciubotariu@microchip.com wrote:
> On 20.01.2019 13:04, Vinod Koul wrote:
> > Hi Codrin,
> > 
> > On 17-01-19, 16:10, Codrin.Ciubotariu@microchip.com wrote:
> >> From: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
> >>
> >> atchan->status is used for two things:
> >>   - pass channel interrupts status from interrupt handler to tasklet;
> >>   - channel information like whether it is cyclic or paused;
> >>
> >> Since these operations have nothing in common, this patch adds a
> >> different struct member to keep the interrupts status.
> >>
> >> Fixes a bug in which a channel is wrongfully reported as in use when
> >> trying to obtain a new descriptior for a previously used cyclic channel.
> > 
> > This looks reasonable but am unable to see how the bug is fixed. Perhaps
> > would be great to split the bug part (which can go to fixes) and remove
> > the reuse of variable as a subsequent patch..
> 
> Hi Vinod,
> 
> This patch is the fix, since it moves the operations on atchan->status, 
> in which the interrupt status register is saved, to a different member 
> (irq_status). The AT_XDMAC_CHAN_IS_CYCLIC and AT_XDMAC_CHAN_IS_PAUSED 
> bits have nothing in common with the interrupt status register.
> 
> The bug reproduces when a device_terminate_all() is called, 
> (AT_XDMAC_CHAN_IS_CYCLIC cleared on atchan->status) and then a late End 
> of Block interrupt arrives (AT_XDMAC_CIS_BIS), which sets bit 0 of 
> atchan->status. Bit 0 is also used for AT_XDMAC_CHAN_IS_CYCLIC, so when 
> a new descriptor for a cyclic transfer is created, the driver reports 
> the channel as in use:
> 
> if (test_and_set_bit(AT_XDMAC_CHAN_IS_CYCLIC, &atchan->status)) {
> 	dev_err(chan2dev(chan), "channel currently used\n");
> 	return NULL;
> }
> 
> I can send v2 if you consider the commit message misleading.

Yes please, that would be better and pls add fixes as suggested by
Ludovic along with his ack

-- 
~Vinod

WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vkoul@kernel.org>
To: Codrin.Ciubotariu@microchip.com
Cc: dmaengine@vger.kernel.org, Ludovic.Desroches@microchip.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] dmaengine: at_xdmac: Fix wrongfull report of a channel as in use
Date: Wed, 23 Jan 2019 17:46:41 +0530	[thread overview]
Message-ID: <20190123121641.GN4635@vkoul-mobl> (raw)
In-Reply-To: <450ee975-a603-cf89-0000-13156c1cb5e8@microchip.com>

On 21-01-19, 14:38, Codrin.Ciubotariu@microchip.com wrote:
> On 20.01.2019 13:04, Vinod Koul wrote:
> > Hi Codrin,
> > 
> > On 17-01-19, 16:10, Codrin.Ciubotariu@microchip.com wrote:
> >> From: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
> >>
> >> atchan->status is used for two things:
> >>   - pass channel interrupts status from interrupt handler to tasklet;
> >>   - channel information like whether it is cyclic or paused;
> >>
> >> Since these operations have nothing in common, this patch adds a
> >> different struct member to keep the interrupts status.
> >>
> >> Fixes a bug in which a channel is wrongfully reported as in use when
> >> trying to obtain a new descriptior for a previously used cyclic channel.
> > 
> > This looks reasonable but am unable to see how the bug is fixed. Perhaps
> > would be great to split the bug part (which can go to fixes) and remove
> > the reuse of variable as a subsequent patch..
> 
> Hi Vinod,
> 
> This patch is the fix, since it moves the operations on atchan->status, 
> in which the interrupt status register is saved, to a different member 
> (irq_status). The AT_XDMAC_CHAN_IS_CYCLIC and AT_XDMAC_CHAN_IS_PAUSED 
> bits have nothing in common with the interrupt status register.
> 
> The bug reproduces when a device_terminate_all() is called, 
> (AT_XDMAC_CHAN_IS_CYCLIC cleared on atchan->status) and then a late End 
> of Block interrupt arrives (AT_XDMAC_CIS_BIS), which sets bit 0 of 
> atchan->status. Bit 0 is also used for AT_XDMAC_CHAN_IS_CYCLIC, so when 
> a new descriptor for a cyclic transfer is created, the driver reports 
> the channel as in use:
> 
> if (test_and_set_bit(AT_XDMAC_CHAN_IS_CYCLIC, &atchan->status)) {
> 	dev_err(chan2dev(chan), "channel currently used\n");
> 	return NULL;
> }
> 
> I can send v2 if you consider the commit message misleading.

Yes please, that would be better and pls add fixes as suggested by
Ludovic along with his ack

-- 
~Vinod

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2019-01-23 12:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23 12:16 Vinod Koul [this message]
2019-01-23 12:16 ` [PATCH] dmaengine: at_xdmac: Fix wrongfull report of a channel as in use Vinod Koul
2019-01-23 12:16 ` Vinod Koul
  -- strict thread matches above, loose matches on Subject: below --
2019-01-22  9:13 Ludovic Desroches
2019-01-22  9:13 ` [PATCH] " Ludovic Desroches
2019-01-22  9:13 ` Ludovic Desroches
2019-01-21 14:38 Codrin Ciubotariu
2019-01-21 14:38 ` [PATCH] " Codrin.Ciubotariu
2019-01-21 14:38 ` Codrin.Ciubotariu
2019-01-20 11:04 Vinod Koul
2019-01-20 11:04 ` [PATCH] " Vinod Koul
2019-01-20 11:04 ` Vinod Koul
2019-01-17 16:10 Codrin Ciubotariu
2019-01-17 16:10 ` [PATCH] " Codrin.Ciubotariu
2019-01-17 16:10 ` Codrin.Ciubotariu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190123121641.GN4635@vkoul-mobl \
    --to=vkoul@kernel.org \
    --cc=Codrin.Ciubotariu@microchip.com \
    --cc=Ludovic.Desroches@microchip.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.