[BUG] 2.6.24-git usb reset problems - Kernel
This is a discussion on [BUG] 2.6.24-git usb reset problems - Kernel ; On Tue, 29 Jan 2008, Jens Axboe wrote:
> On Tue, Jan 29 2008, Jens Axboe wrote:
> > On Tue, Jan 29 2008, James Bottomley wrote:
> > > On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
> ...
-
Re: [BUG] 2.6.24-git usb reset problems
On Tue, 29 Jan 2008, Jens Axboe wrote:
> On Tue, Jan 29 2008, Jens Axboe wrote:
> > On Tue, Jan 29 2008, James Bottomley wrote:
> > > On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
> > > > For some reason, usb_sg_init is boned during auto-sense.
> > >
> > > OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
> > > code ... that was also an update in 2.6.24
> >
> > yeah, already found the bug - it's assuming ->request_buffer holds the
> > sglist, oops. Preparing a fix.
>
> ok here goes, this saves and restores the sg table correctly. it also
> fixes the usb bug for me.
I can confirm this patch fixes the errors I was seeing with current
linux-2.6.git for the USB memory card readers in a Dell TFT connected to a PS3.
> diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> index 547e85a..12770ef 100644
> --- a/drivers/scsi/scsi_error.c
> +++ b/drivers/scsi/scsi_error.c
> @@ -622,13 +622,15 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
> ses->use_sg = scmd->use_sg;
> ses->resid = scmd->resid;
> ses->result = scmd->result;
> + memcpy(&ses->sense_sgl, &scmd->sg_table, sizeof(ses->sense_sgl));
>
> if (sense_bytes) {
> scmd->request_bufflen = min_t(unsigned,
> SCSI_SENSE_BUFFERSIZE, sense_bytes);
> sg_init_one(&ses->sense_sgl, scmd->sense_buffer,
> scmd->request_bufflen);
> - scmd->request_buffer = &ses->sense_sgl;
> + scmd->sg_table.sgl = &ses->sense_sgl;
> + scmd->sg_table.nents = scmd->sg_table.orig_nents = 1;
> scmd->sc_data_direction = DMA_FROM_DEVICE;
> scmd->use_sg = 1;
> memset(scmd->cmnd, 0, sizeof(scmd->cmnd));
> @@ -679,6 +681,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses)
> scmd->request_bufflen = ses->bufflen;
> scmd->request_buffer = ses->buffer;
> scmd->use_sg = ses->use_sg;
> + memcpy(&scmd->sg_table, &ses->sg_table, sizeof(scmd->sg_table));
> scmd->resid = ses->resid;
> scmd->result = ses->result;
> }
> diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
> index d21b891..d43dc83 100644
> --- a/include/scsi/scsi_eh.h
> +++ b/include/scsi/scsi_eh.h
> @@ -75,6 +75,7 @@ struct scsi_eh_save {
>
> void *buffer;
> unsigned bufflen;
> + struct sg_table sg_table;
> unsigned short use_sg;
> int resid;
>
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
Sony Network and Software Technology Center Europe
A division of Sony Service Centre (Europe) N.V.
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium
VAT BE 0413.825.160 · RPR Brussels
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619
-
Re: [BUG] 2.6.24-git usb reset problems
On Wed, Jan 30 2008, Geert Uytterhoeven wrote:
> On Tue, 29 Jan 2008, Jens Axboe wrote:
> > On Tue, Jan 29 2008, Jens Axboe wrote:
> > > On Tue, Jan 29 2008, James Bottomley wrote:
> > > > On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
> > > > > For some reason, usb_sg_init is boned during auto-sense.
> > > >
> > > > OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
> > > > code ... that was also an update in 2.6.24
> > >
> > > yeah, already found the bug - it's assuming ->request_buffer holds the
> > > sglist, oops. Preparing a fix.
> >
> > ok here goes, this saves and restores the sg table correctly. it also
> > fixes the usb bug for me.
>
> I can confirm this patch fixes the errors I was seeing with current
> linux-2.6.git for the USB memory card readers in a Dell TFT connected
> to a PS3.
James, we need a fix for this pushed asap. So either we should merge the
below now, or push the bidi patchset that also fixes this. It all
depends on when you want to merge the bidi patches...
> > diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
> > index 547e85a..12770ef 100644
> > --- a/drivers/scsi/scsi_error.c
> > +++ b/drivers/scsi/scsi_error.c
> > @@ -622,13 +622,15 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
> > ses->use_sg = scmd->use_sg;
> > ses->resid = scmd->resid;
> > ses->result = scmd->result;
> > + memcpy(&ses->sense_sgl, &scmd->sg_table, sizeof(ses->sense_sgl));
> >
> > if (sense_bytes) {
> > scmd->request_bufflen = min_t(unsigned,
> > SCSI_SENSE_BUFFERSIZE, sense_bytes);
> > sg_init_one(&ses->sense_sgl, scmd->sense_buffer,
> > scmd->request_bufflen);
> > - scmd->request_buffer = &ses->sense_sgl;
> > + scmd->sg_table.sgl = &ses->sense_sgl;
> > + scmd->sg_table.nents = scmd->sg_table.orig_nents = 1;
> > scmd->sc_data_direction = DMA_FROM_DEVICE;
> > scmd->use_sg = 1;
> > memset(scmd->cmnd, 0, sizeof(scmd->cmnd));
> > @@ -679,6 +681,7 @@ void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses)
> > scmd->request_bufflen = ses->bufflen;
> > scmd->request_buffer = ses->buffer;
> > scmd->use_sg = ses->use_sg;
> > + memcpy(&scmd->sg_table, &ses->sg_table, sizeof(scmd->sg_table));
> > scmd->resid = ses->resid;
> > scmd->result = ses->result;
> > }
> > diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
> > index d21b891..d43dc83 100644
> > --- a/include/scsi/scsi_eh.h
> > +++ b/include/scsi/scsi_eh.h
> > @@ -75,6 +75,7 @@ struct scsi_eh_save {
> >
> > void *buffer;
> > unsigned bufflen;
> > + struct sg_table sg_table;
> > unsigned short use_sg;
> > int resid;
> >
--
Jens Axboe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
Re: [BUG] 2.6.24-git usb reset problems
On Wed, 2008-01-30 at 11:38 +0100, Jens Axboe wrote:
> On Wed, Jan 30 2008, Geert Uytterhoeven wrote:
> > On Tue, 29 Jan 2008, Jens Axboe wrote:
> > > On Tue, Jan 29 2008, Jens Axboe wrote:
> > > > On Tue, Jan 29 2008, James Bottomley wrote:
> > > > > On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
> > > > > > For some reason, usb_sg_init is boned during auto-sense.
> > > > >
> > > > > OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
> > > > > code ... that was also an update in 2.6.24
> > > >
> > > > yeah, already found the bug - it's assuming ->request_buffer holds the
> > > > sglist, oops. Preparing a fix.
> > >
> > > ok here goes, this saves and restores the sg table correctly. it also
> > > fixes the usb bug for me.
> >
> > I can confirm this patch fixes the errors I was seeing with current
> > linux-2.6.git for the USB memory card readers in a Dell TFT connected
> > to a PS3.
>
> James, we need a fix for this pushed asap. So either we should merge the
> below now, or push the bidi patchset that also fixes this. It all
> depends on when you want to merge the bidi patches...
The SCSI patch set (including the bidirectional pieces) is waiting in
scsi-misc ... just for forms sake, could you confirm that it actually
fixes the problem and I'll push it.
James
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
Re: [BUG] 2.6.24-git usb reset problems
On Wed, Jan 30 2008, James Bottomley wrote:
> On Wed, 2008-01-30 at 11:38 +0100, Jens Axboe wrote:
> > On Wed, Jan 30 2008, Geert Uytterhoeven wrote:
> > > On Tue, 29 Jan 2008, Jens Axboe wrote:
> > > > On Tue, Jan 29 2008, Jens Axboe wrote:
> > > > > On Tue, Jan 29 2008, James Bottomley wrote:
> > > > > > On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
> > > > > > > For some reason, usb_sg_init is boned during auto-sense.
> > > > > >
> > > > > > OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
> > > > > > code ... that was also an update in 2.6.24
> > > > >
> > > > > yeah, already found the bug - it's assuming ->request_buffer holds the
> > > > > sglist, oops. Preparing a fix.
> > > >
> > > > ok here goes, this saves and restores the sg table correctly. it also
> > > > fixes the usb bug for me.
> > >
> > > I can confirm this patch fixes the errors I was seeing with current
> > > linux-2.6.git for the USB memory card readers in a Dell TFT connected
> > > to a PS3.
> >
> > James, we need a fix for this pushed asap. So either we should merge the
> > below now, or push the bidi patchset that also fixes this. It all
> > depends on when you want to merge the bidi patches...
>
> The SCSI patch set (including the bidirectional pieces) is waiting in
> scsi-misc ... just for forms sake, could you confirm that it actually
> fixes the problem and I'll push it.
Certainly, I'll give it a spin tonight.
--
Jens Axboe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
-
Re: [BUG] 2.6.24-git usb reset problems
On Wed, Jan 30 2008, Jens Axboe wrote:
> On Wed, Jan 30 2008, James Bottomley wrote:
> > On Wed, 2008-01-30 at 11:38 +0100, Jens Axboe wrote:
> > > On Wed, Jan 30 2008, Geert Uytterhoeven wrote:
> > > > On Tue, 29 Jan 2008, Jens Axboe wrote:
> > > > > On Tue, Jan 29 2008, Jens Axboe wrote:
> > > > > > On Tue, Jan 29 2008, James Bottomley wrote:
> > > > > > > On Tue, 2008-01-29 at 11:10 -0800, Matthew Dharm wrote:
> > > > > > > > For some reason, usb_sg_init is boned during auto-sense.
> > > > > > >
> > > > > > > OK, that's implicating the scsi_eh_prep_cmnd() in the auto sense
> > > > > > > code ... that was also an update in 2.6.24
> > > > > >
> > > > > > yeah, already found the bug - it's assuming ->request_buffer holds the
> > > > > > sglist, oops. Preparing a fix.
> > > > >
> > > > > ok here goes, this saves and restores the sg table correctly. it also
> > > > > fixes the usb bug for me.
> > > >
> > > > I can confirm this patch fixes the errors I was seeing with current
> > > > linux-2.6.git for the USB memory card readers in a Dell TFT connected
> > > > to a PS3.
> > >
> > > James, we need a fix for this pushed asap. So either we should merge the
> > > below now, or push the bidi patchset that also fixes this. It all
> > > depends on when you want to merge the bidi patches...
> >
> > The SCSI patch set (including the bidirectional pieces) is waiting in
> > scsi-misc ... just for forms sake, could you confirm that it actually
> > fixes the problem and I'll push it.
>
> Certainly, I'll give it a spin tonight.
Confirmed, pulling your scsi-misc branch into current -git makes the
problem go away as well.
--
Jens Axboe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/