From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: James.Bottomley@HansenPartnership.com
Cc: David Miller <davem@davemloft.net>,
Roland Dreier <rdreier@cisco.com>,
linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
rmk@arm.linux.org.uk
Subject: Re: SCSI breakage on non-cache coherent architectures
Date: Tue, 20 Nov 2007 14:14:57 +1100 [thread overview]
Message-ID: <1195528497.6970.35.camel@pasglop> (raw)
In-Reply-To: <ada8x4ty8e1.fsf@cisco.com>
FYI, Here's what I have for the SCSI change. I haven't updated drivers
to care for the new return code though, help appreciated with that as I
don't know much about these drivers.
Index: linux-work/drivers/scsi/scsi_error.c
===================================================================
--- linux-work.orig/drivers/scsi/scsi_error.c 2007-11-20 13:26:18.000000000 +1100
+++ linux-work/drivers/scsi/scsi_error.c 2007-11-20 13:43:05.000000000 +1100
@@ -602,8 +602,9 @@ static void scsi_abort_eh_cmnd(struct sc
* @cmnd is ignored and this functions sets up a REQUEST_SENSE command
* and cmnd buffers to read @sense_bytes into @scmd->sense_buffer.
**/
-void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
- unsigned char *cmnd, int cmnd_size, unsigned sense_bytes)
+int scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses,
+ unsigned char *cmnd, int cmnd_size, unsigned sense_bytes,
+ gfp_t gfp_mask)
{
struct scsi_device *sdev = scmd->device;
@@ -622,12 +623,20 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd
ses->use_sg = scmd->use_sg;
ses->resid = scmd->resid;
ses->result = scmd->result;
+ sg_init_table(&ses->sense_sgl, 1);
if (sense_bytes) {
+ struct page *pg;
+
+ if (sdev->host->hostt->unchecked_isa_dma)
+ gfp_mask |= __GFP_DMA;
scmd->request_bufflen = min_t(unsigned,
sizeof(scmd->sense_buffer), sense_bytes);
- sg_init_one(&ses->sense_sgl, scmd->sense_buffer,
- scmd->request_bufflen);
+ pg = alloc_page(gfp_mask);
+ if (!pg)
+ return FAILED;
+ memset(page_address(pg), 0, scmd->request_bufflen);
+ sg_set_page(&ses->sense_sgl, pg, scmd->request_bufflen, 0);
scmd->request_buffer = &ses->sense_sgl;
scmd->sc_data_direction = DMA_FROM_DEVICE;
scmd->use_sg = 1;
@@ -658,6 +667,8 @@ void scsi_eh_prep_cmnd(struct scsi_cmnd
* untransferred sense data should be interpreted as being zero.
*/
memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer));
+
+ return SUCCESS;
}
EXPORT_SYMBOL(scsi_eh_prep_cmnd);
@@ -670,9 +681,17 @@ EXPORT_SYMBOL(scsi_eh_prep_cmnd);
**/
void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses)
{
+ struct page *pg;
+
/*
* Restore original data
*/
+ pg = sg_page(&ses->sense_sgl);
+ if (pg) {
+ memcpy(scmd->sense_buffer, page_address(pg),
+ scmd->request_bufflen);
+ __free_page(pg);
+ }
scmd->cmd_len = ses->cmd_len;
memcpy(scmd->cmnd, ses->cmnd, sizeof(scmd->cmnd));
scmd->sc_data_direction = ses->data_direction;
@@ -709,7 +728,10 @@ static int scsi_send_eh_cmnd(struct scsi
struct scsi_eh_save ses;
int rtn;
- scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes);
+ if (scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes,
+ GFP_KERNEL) != SUCCESS)
+ return FAILED;
+
shost->eh_action = &done;
spin_lock_irqsave(shost->host_lock, flags);
Index: linux-work/include/scsi/scsi_eh.h
===================================================================
--- linux-work.orig/include/scsi/scsi_eh.h 2007-11-20 13:36:44.000000000 +1100
+++ linux-work/include/scsi/scsi_eh.h 2007-11-20 13:42:49.000000000 +1100
@@ -81,9 +81,10 @@ struct scsi_eh_save {
struct scatterlist sense_sgl;
};
-extern void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
+extern int scsi_eh_prep_cmnd(struct scsi_cmnd *scmd,
struct scsi_eh_save *ses, unsigned char *cmnd,
- int cmnd_size, unsigned sense_bytes);
+ int cmnd_size, unsigned sense_bytes,
+ gfp_t gfp_mask);
extern void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd,
struct scsi_eh_save *ses);
Index: linux-work/drivers/scsi/NCR5380.c
===================================================================
--- linux-work.orig/drivers/scsi/NCR5380.c 2007-11-20 13:46:41.000000000 +1100
+++ linux-work/drivers/scsi/NCR5380.c 2007-11-20 13:46:47.000000000 +1100
@@ -2283,7 +2283,7 @@ static void NCR5380_information_transfer
}
if ((cmd->cmnd[0] != REQUEST_SENSE) && (status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
- scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
+ scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0, GFP_ATOMIC);
dprintk(NDEBUG_AUTOSENSE, ("scsi%d : performing request sense\n", instance->host_no));
Index: linux-work/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux-work.orig/drivers/scsi/atari_NCR5380.c 2007-11-20 13:46:55.000000000 +1100
+++ linux-work/drivers/scsi/atari_NCR5380.c 2007-11-20 13:47:00.000000000 +1100
@@ -2240,7 +2240,7 @@ static void NCR5380_information_transfer
if ((cmd->cmnd[0] != REQUEST_SENSE) &&
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
- scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
+ scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0, GFP_ATOMIC);
ASEN_PRINTK("scsi%d: performing request sense\n", HOSTNO);
Index: linux-work/drivers/scsi/sun3_NCR5380.c
===================================================================
--- linux-work.orig/drivers/scsi/sun3_NCR5380.c 2007-11-20 13:46:27.000000000 +1100
+++ linux-work/drivers/scsi/sun3_NCR5380.c 2007-11-20 13:46:33.000000000 +1100
@@ -2261,7 +2261,7 @@ static void NCR5380_information_transfer
if ((cmd->cmnd[0] != REQUEST_SENSE) &&
(status_byte(cmd->SCp.Status) == CHECK_CONDITION)) {
- scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0);
+ scsi_eh_prep_cmnd(cmd, &hostdata->ses, NULL, 0, ~0, GFP_ATOMIC);
ASEN_PRINTK("scsi%d: performing request sense\n",
HOSTNO);
/* this is initialized from initialize_SCp
next prev parent reply other threads:[~2007-11-20 3:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-19 5:35 SCSI breakage on non-cache coherent architectures Benjamin Herrenschmidt
2007-11-19 8:38 ` David Miller
2007-11-19 19:51 ` Benjamin Herrenschmidt
2007-11-19 22:31 ` David Miller
2007-11-20 0:34 ` Benjamin Herrenschmidt
2007-11-20 0:46 ` David Miller
2007-11-20 0:55 ` Benjamin Herrenschmidt
2007-11-20 0:57 ` David Miller
2007-11-20 2:10 ` Roland Dreier
2007-11-20 2:35 ` Benjamin Herrenschmidt
2007-11-20 3:14 ` Benjamin Herrenschmidt [this message]
2007-11-20 19:35 ` James Bottomley
2007-11-20 8:29 ` Thomas Bogendoerfer
2007-11-20 14:36 ` James Bottomley
2007-11-20 20:05 ` Roland Dreier
2007-11-20 21:10 ` James Bottomley
2007-11-20 22:39 ` Benjamin Herrenschmidt
2007-11-20 23:09 ` James Bottomley
2007-11-19 12:32 ` Matthew Wilcox
2007-11-19 15:09 ` James Bottomley
2007-11-19 19:54 ` Benjamin Herrenschmidt
2007-11-19 19:55 ` Benjamin Herrenschmidt
2007-11-19 19:53 ` Benjamin Herrenschmidt
2007-11-19 21:43 ` Roland Dreier
2007-11-19 21:55 ` Benjamin Herrenschmidt
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=1195528497.6970.35.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=rdreier@cisco.com \
--cc=rmk@arm.linux.org.uk \
/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.