linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix Xilinx SystemACE driver to handle empty CF slot
@ 2009-02-28 20:46 Grant Likely
  2009-03-06 16:05 ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2009-02-28 20:46 UTC (permalink / raw)
  To: linux-kernel, linuxppc-dev, John.Linn, sr

From: Grant Likely <grant.likely@secretlab.ca>

The SystemACE driver does not handle an empty CF slot gracefully.  An
empty CF slot ends up hanging the system.  This patch adds a check for
the CF state and stops trying to process requests if the slot is empty.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 drivers/block/xsysace.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)


diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 381d686..ec5b8ca 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -489,6 +489,28 @@ static void ace_fsm_dostate(struct ace_device *ace)
 		ace->fsm_state, ace->id_req_count);
 #endif
 
+	/* Verify that there is actually a CF in the slot.  If not, then
+	 * bail out back to the idle state and wake up all the waiters */
+	status = ace_in32(ace, ACE_STATUS);
+	if ((status & ACE_STATUS_CFDETECT) == 0) {
+		ace->fsm_state = ACE_FSM_STATE_IDLE;
+		ace->media_change = 1;
+		set_capacity(ace->gd, 0);
+		dev_info(ace->dev, "No CF in slot\n");
+ 
+		/* Drop all pending requests */
+		while ((req = elv_next_request(ace->queue)) != NULL)
+			end_request(req, 0);
+
+		/* Drop back to IDLE state and notify waiters */
+		ace->fsm_state = ACE_FSM_STATE_IDLE;
+		ace->id_result = -EIO;
+		while (ace->id_req_count) {
+			complete(&ace->id_completion);
+			ace->id_req_count--;
+		}
+	}
+
 	switch (ace->fsm_state) {
 	case ACE_FSM_STATE_IDLE:
 		/* See if there is anything to do */


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix Xilinx SystemACE driver to handle empty CF slot
  2009-02-28 20:46 [PATCH] Fix Xilinx SystemACE driver to handle empty CF slot Grant Likely
@ 2009-03-06 16:05 ` Grant Likely
  2009-03-06 20:46   ` Jens Axboe
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2009-03-06 16:05 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, linuxppc-dev, John.Linn, sr

Oops, sorry Jens.  I forgot to CC: you on this patch.

g.

On Sat, Feb 28, 2009 at 1:46 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> From: Grant Likely <grant.likely@secretlab.ca>
>
> The SystemACE driver does not handle an empty CF slot gracefully.  An
> empty CF slot ends up hanging the system.  This patch adds a check for
> the CF state and stops trying to process requests if the slot is empty.
>
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
>
>  drivers/block/xsysace.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
>
>
> diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
> index 381d686..ec5b8ca 100644
> --- a/drivers/block/xsysace.c
> +++ b/drivers/block/xsysace.c
> @@ -489,6 +489,28 @@ static void ace_fsm_dostate(struct ace_device *ace)
>                ace->fsm_state, ace->id_req_count);
>  #endif
>
> +       /* Verify that there is actually a CF in the slot.  If not, then
> +        * bail out back to the idle state and wake up all the waiters */
> +       status = ace_in32(ace, ACE_STATUS);
> +       if ((status & ACE_STATUS_CFDETECT) == 0) {
> +               ace->fsm_state = ACE_FSM_STATE_IDLE;
> +               ace->media_change = 1;
> +               set_capacity(ace->gd, 0);
> +               dev_info(ace->dev, "No CF in slot\n");
> +
> +               /* Drop all pending requests */
> +               while ((req = elv_next_request(ace->queue)) != NULL)
> +                       end_request(req, 0);
> +
> +               /* Drop back to IDLE state and notify waiters */
> +               ace->fsm_state = ACE_FSM_STATE_IDLE;
> +               ace->id_result = -EIO;
> +               while (ace->id_req_count) {
> +                       complete(&ace->id_completion);
> +                       ace->id_req_count--;
> +               }
> +       }
> +
>        switch (ace->fsm_state) {
>        case ACE_FSM_STATE_IDLE:
>                /* See if there is anything to do */
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix Xilinx SystemACE driver to handle empty CF slot
  2009-03-06 16:05 ` Grant Likely
@ 2009-03-06 20:46   ` Jens Axboe
  2009-03-06 20:56     ` Grant Likely
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2009-03-06 20:46 UTC (permalink / raw)
  To: Grant Likely; +Cc: linux-kernel, linuxppc-dev, John.Linn, sr

On Fri, Mar 06 2009, Grant Likely wrote:
> Oops, sorry Jens.  I forgot to CC: you on this patch.
> 
> g.
> 
> On Sat, Feb 28, 2009 at 1:46 PM, Grant Likely <grant.likely@secretlab.ca> wrote:
> > From: Grant Likely <grant.likely@secretlab.ca>
> >
> > The SystemACE driver does not handle an empty CF slot gracefully.  An
> > empty CF slot ends up hanging the system.  This patch adds a check for
> > the CF state and stops trying to process requests if the slot is empty.

So with patches like this, it's always nice to know what your target is.
Do you want this in .29, or just queued up for .30? It's not always easy
to judge the urgency of such patches :-)

Also, I note that you are using end_request() throughout the driver. We
really want to get away from that, you should be using blk_end_request()
as that will handle full requests and not just segment-by-segment. No
worries for this patch, but you may want to consider that for a future
patch.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix Xilinx SystemACE driver to handle empty CF slot
  2009-03-06 20:46   ` Jens Axboe
@ 2009-03-06 20:56     ` Grant Likely
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Likely @ 2009-03-06 20:56 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, linuxppc-dev, John.Linn, sr

On Fri, Mar 6, 2009 at 1:46 PM, Jens Axboe <jens.axboe@oracle.com> wrote:
> On Fri, Mar 06 2009, Grant Likely wrote:
>> > The SystemACE driver does not handle an empty CF slot gracefully.  An
>> > empty CF slot ends up hanging the system.  This patch adds a check for
>> > the CF state and stops trying to process requests if the slot is empty.
>
> So with patches like this, it's always nice to know what your target is.
> Do you want this in .29, or just queued up for .30? It's not always easy
> to judge the urgency of such patches :-)

The driver completely falls down and hangs the system if the CF slot
is empty, so I would like to get it into .29.  On the other hand, it
has been a long standing issue, so if merging it will raise any
eyebrows then I'm okay to wait for .30.

> Also, I note that you are using end_request() throughout the driver. We
> really want to get away from that, you should be using blk_end_request()
> as that will handle full requests and not just segment-by-segment. No
> worries for this patch, but you may want to consider that for a future
> patch.

Okay, will do.

Thanks,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-06 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-28 20:46 [PATCH] Fix Xilinx SystemACE driver to handle empty CF slot Grant Likely
2009-03-06 16:05 ` Grant Likely
2009-03-06 20:46   ` Jens Axboe
2009-03-06 20:56     ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).