From: Jeff Garzik <jeff@garzik.org>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [bug] ata subsystem related crash with latest -git
Date: Thu, 18 Oct 2007 05:32:11 -0400 [thread overview]
Message-ID: <4717281B.6070301@garzik.org> (raw)
In-Reply-To: <20071018091706.GO5063@kernel.dk>
[-- Attachment #1: Type: text/plain, Size: 1705 bytes --]
Jens Axboe wrote:
> The sata_mv construct looks a bit odd. Does this work? That last
The sata_mv construct worked just fine before sg chaining :)
> end_mv_sg test should always be true, just being paranoid...
>
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> index 4df8311..5397eea 100644
> --- a/drivers/ata/sata_mv.c
> +++ b/drivers/ata/sata_mv.c
> @@ -1138,8 +1138,9 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
> {
> struct mv_port_priv *pp = qc->ap->private_data;
> struct scatterlist *sg;
> - struct mv_sg *mv_sg;
> + struct mv_sg *mv_sg, *end_mv_sg;
>
> + end_mv_sg = NULL;
> mv_sg = pp->sg_tbl;
> ata_for_each_sg(sg, qc) {
> dma_addr_t addr = sg_dma_address(sg);
> @@ -1158,14 +1159,12 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
>
> sg_len -= len;
> addr += len;
> -
> - if (!sg_len && ata_sg_is_last(sg, qc))
> - mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
> -
> + end_mv_sg = mv_sg;
> mv_sg++;
> }
> -
> }
> + if (end_mv_sg)
> + end_mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
> }
>
I'm testing a similar patch based on ata_fill_sg()'s method, which
basically does something similar to what you've done here (see
attached). I had noticed that ata_fill_sg() did not call ata_sg_is_last().
If this fixes the problem, I think the best solution would be to delete
ata_sg_is_last(). In the few users that exist, we should be able to
eliminate the test programmatically as you and ata_fill_sg() have done
-- thereby eliminating a branch per loop in a hotpath.
Off to test the attached... if that doesn't work I'll try your version,
though there shouldn't be much difference.
Jeff
[-- Attachment #2: patch.sata_mv-fill-sg --]
[-- Type: text/plain, Size: 2997 bytes --]
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 4df8311..42b5a9e 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -421,7 +421,6 @@ static void mv_error_handler(struct ata_port *ap);
static void mv_post_int_cmd(struct ata_queued_cmd *qc);
static void mv_eh_freeze(struct ata_port *ap);
static void mv_eh_thaw(struct ata_port *ap);
-static int mv_slave_config(struct scsi_device *sdev);
static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio,
@@ -459,7 +458,7 @@ static struct scsi_host_template mv5_sht = {
.use_clustering = 1,
.proc_name = DRV_NAME,
.dma_boundary = MV_DMA_BOUNDARY,
- .slave_configure = mv_slave_config,
+ .slave_configure = ata_scsi_slave_config,
.slave_destroy = ata_scsi_slave_destroy,
.bios_param = ata_std_bios_param,
};
@@ -477,7 +476,7 @@ static struct scsi_host_template mv6_sht = {
.use_clustering = 1,
.proc_name = DRV_NAME,
.dma_boundary = MV_DMA_BOUNDARY,
- .slave_configure = mv_slave_config,
+ .slave_configure = ata_scsi_slave_config,
.slave_destroy = ata_scsi_slave_destroy,
.bios_param = ata_std_bios_param,
};
@@ -756,17 +755,6 @@ static void mv_irq_clear(struct ata_port *ap)
{
}
-static int mv_slave_config(struct scsi_device *sdev)
-{
- int rc = ata_scsi_slave_config(sdev);
- if (rc)
- return rc;
-
- blk_queue_max_phys_segments(sdev->request_queue, MV_MAX_SG_CT / 2);
-
- return 0; /* scsi layer doesn't check return value, sigh */
-}
-
static void mv_set_edma_ptrs(void __iomem *port_mmio,
struct mv_host_priv *hpriv,
struct mv_port_priv *pp)
@@ -1138,34 +1126,35 @@ static void mv_fill_sg(struct ata_queued_cmd *qc)
{
struct mv_port_priv *pp = qc->ap->private_data;
struct scatterlist *sg;
- struct mv_sg *mv_sg;
+ struct mv_sg *mv_sg = pp->sg_tbl;
+ unsigned int idx = 0;
- mv_sg = pp->sg_tbl;
ata_for_each_sg(sg, qc) {
- dma_addr_t addr = sg_dma_address(sg);
- u32 sg_len = sg_dma_len(sg);
+ u64 addr;
+ u32 offset, sg_len, len;
+
+ addr = sg_dma_address(sg);
+ sg_len = sg_dma_len(sg);
while (sg_len) {
- u32 offset = addr & 0xffff;
- u32 len = sg_len;
+ offset = addr & 0xffff;
+ len = sg_len;
if ((offset + sg_len > 0x10000))
len = 0x10000 - offset;
- mv_sg->addr = cpu_to_le32(addr & 0xffffffff);
- mv_sg->addr_hi = cpu_to_le32((addr >> 16) >> 16);
- mv_sg->flags_size = cpu_to_le32(len & 0xffff);
+ mv_sg[idx].addr = cpu_to_le32(addr & 0xffffffff);
+ mv_sg[idx].addr_hi = cpu_to_le32(addr >> 32);
+ mv_sg[idx].flags_size = cpu_to_le32(len & 0xffff);
+ idx++;
sg_len -= len;
addr += len;
-
- if (!sg_len && ata_sg_is_last(sg, qc))
- mv_sg->flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
-
- mv_sg++;
}
-
}
+
+ if (idx)
+ mv_sg[idx - 1].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL);
}
static inline void mv_crqb_pack_cmd(__le16 *cmdw, u8 data, u8 addr, unsigned last)
next prev parent reply other threads:[~2007-10-18 9:32 UTC|newest]
Thread overview: 151+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-17 15:46 [bug] block subsystem related crash with latest -git Ingo Molnar
2007-10-17 15:50 ` Ingo Molnar
2007-10-17 16:32 ` Jens Axboe
2007-10-17 16:50 ` Linus Torvalds
2007-10-17 16:59 ` Jens Axboe
2007-10-17 17:08 ` Jens Axboe
2007-10-17 17:21 ` Jens Axboe
2007-10-17 17:29 ` Jens Axboe
2007-10-17 17:34 ` Ingo Molnar
2007-10-17 17:36 ` Jens Axboe
2007-10-17 17:45 ` [bug] ata " Ingo Molnar
2007-10-17 17:53 ` Jens Axboe
2007-10-17 17:55 ` Jens Axboe
2007-10-17 17:58 ` Ingo Molnar
2007-10-17 18:37 ` Jens Axboe
2007-10-17 19:04 ` Ingo Molnar
2007-10-17 19:08 ` Jens Axboe
2007-10-17 19:14 ` Ingo Molnar
2007-10-17 19:17 ` Ingo Molnar
2007-10-17 19:25 ` Jens Axboe
2007-10-17 19:25 ` Jens Axboe
2007-10-17 19:09 ` Ingo Molnar
2007-10-17 19:28 ` Linus Torvalds
2007-10-17 19:35 ` Jens Axboe
2007-10-17 19:45 ` Linus Torvalds
2007-10-17 19:56 ` Jens Axboe
2007-10-17 20:06 ` Jens Axboe
2007-10-17 20:24 ` Linus Torvalds
2007-10-17 20:31 ` Jens Axboe
2007-10-17 21:11 ` Linus Torvalds
2007-10-17 23:00 ` FUJITA Tomonori
2007-10-18 1:07 ` Linus Torvalds
2007-10-18 1:14 ` Jeff Garzik
2007-10-18 1:19 ` David Miller
2007-10-18 1:36 ` Linus Torvalds
2007-10-18 1:49 ` David Miller
2007-10-18 3:44 ` Mark Lord
2007-10-18 4:01 ` Linus Torvalds
2007-10-18 4:05 ` Mark Lord
2007-10-18 4:14 ` Jeff Garzik
2007-10-18 4:18 ` Mark Lord
2007-10-18 4:31 ` Jeff Garzik
2007-10-18 4:41 ` Mark Lord
2007-10-18 4:53 ` Linus Torvalds
2007-10-18 7:05 ` Jens Axboe
2007-10-18 13:13 ` Mark Lord
2007-10-18 13:23 ` Jens Axboe
2007-10-18 13:32 ` Mark Lord
2007-10-18 13:34 ` Jens Axboe
2007-10-18 13:59 ` Mark Lord
2007-10-18 14:04 ` Jens Axboe
2007-10-18 4:45 ` Linus Torvalds
2007-10-18 4:54 ` Mark Lord
2007-10-18 5:09 ` Mark Lord
2007-10-18 4:20 ` Linus Torvalds
2007-10-18 5:25 ` Mark Lord
2007-10-18 5:34 ` Mark Lord
2007-10-18 5:45 ` Jeff Garzik
2007-10-18 7:09 ` Jens Axboe
2007-10-18 7:30 ` Jeff Garzik
2007-10-18 8:21 ` Jens Axboe
2007-10-18 11:55 ` David Miller
2007-10-18 11:57 ` Jens Axboe
2007-10-18 12:05 ` David Miller
2007-10-18 12:09 ` Jens Axboe
2007-10-18 12:15 ` Jens Axboe
2007-10-18 12:36 ` David Miller
2007-10-18 12:39 ` Jens Axboe
2007-10-18 12:58 ` Benny Halevy
2007-10-18 13:56 ` Jens Axboe
2007-10-18 14:05 ` Jens Axboe
2007-10-18 14:16 ` Benny Halevy
2007-10-18 14:38 ` Jens Axboe
2007-10-18 14:58 ` Olof Johansson
2007-10-18 15:25 ` Jens Axboe
2007-10-18 12:58 ` Jens Axboe
2007-10-18 13:32 ` Jens Axboe
2007-10-18 13:49 ` Benny Halevy
2007-10-18 13:55 ` Jens Axboe
2007-10-18 13:51 ` Mark Lord
2007-10-18 13:58 ` Jens Axboe
2007-10-18 14:03 ` Mark Lord
2007-10-18 14:10 ` Mark Lord
2007-10-18 14:13 ` Mark Lord
2007-10-18 14:14 ` Jens Axboe
2007-10-18 16:55 ` Linus Torvalds
2007-10-18 17:01 ` Jens Axboe
2007-10-18 17:10 ` Jens Axboe
2007-10-18 17:10 ` Arjan van de Ven
2007-10-18 17:14 ` Jens Axboe
2007-10-19 8:59 ` FUJITA Tomonori
2007-10-18 19:20 ` Jeff Garzik
2007-10-17 20:51 ` Ingo Molnar
2007-10-17 19:49 ` Jens Axboe
2007-10-17 20:05 ` Ingo Molnar
2007-10-17 20:10 ` Linus Torvalds
2007-10-18 7:07 ` Ingo Molnar
2007-10-18 7:10 ` Jens Axboe
2007-10-18 8:22 ` Jeff Garzik
2007-10-18 8:32 ` Jens Axboe
2007-10-18 8:38 ` Jeff Garzik
2007-10-18 8:51 ` Jeff Garzik
2007-10-18 9:01 ` Jeff Garzik
[not found] ` <bd58e4af0710180210tcc0d31ep9d05a0f2e9d6df29@mail.gmail.com>
2007-10-18 9:14 ` Jeff Garzik
2007-10-18 9:17 ` Jens Axboe
2007-10-18 9:32 ` Jeff Garzik [this message]
2007-10-18 9:41 ` Jens Axboe
2007-10-18 10:04 ` Jeff Garzik
2007-10-18 10:10 ` Jens Axboe
2007-10-18 10:13 ` Ingo Molnar
2007-10-18 10:16 ` Jens Axboe
2007-10-18 10:17 ` Jens Axboe
2007-10-18 10:49 ` Ingo Molnar
2007-10-18 10:50 ` Jeff Garzik
2007-10-18 10:56 ` Jens Axboe
2007-10-18 10:42 ` [PATCH] " Jeff Garzik
2007-10-18 10:54 ` Ingo Molnar
2007-10-18 11:02 ` Jeff Garzik
2007-10-18 11:40 ` Ingo Molnar
2007-10-18 14:52 ` Olof Johansson
2007-10-20 11:55 ` Torsten Kaiser
2007-10-18 11:03 ` Ingo Molnar
2007-10-18 11:05 ` Jens Axboe
2007-10-17 19:42 ` Linus Torvalds
2007-10-17 19:55 ` Jens Axboe
2007-10-17 18:08 ` Linus Torvalds
2007-10-17 18:13 ` Ingo Molnar
2007-10-17 17:56 ` [bug] block " Linus Torvalds
2007-10-17 18:02 ` Jens Axboe
2007-10-17 18:13 ` Linus Torvalds
2007-10-17 18:20 ` Jens Axboe
2007-10-17 18:58 ` Linus Torvalds
2007-10-17 19:03 ` Jens Axboe
2007-10-17 19:15 ` Linus Torvalds
2007-10-17 18:02 ` Ingo Molnar
2007-10-17 18:14 ` Linus Torvalds
2007-10-17 20:15 ` Luca Tettamanti
2007-10-17 17:30 ` Ingo Molnar
2007-10-17 17:31 ` Jens Axboe
2007-10-17 17:28 ` Ingo Molnar
2007-10-17 17:52 ` Linus Torvalds
2007-10-17 18:00 ` Jens Axboe
2007-10-17 18:18 ` Linus Torvalds
2007-10-17 18:22 ` Jens Axboe
2007-10-18 10:52 ` Benny Halevy
2007-10-18 10:55 ` Jens Axboe
2007-10-18 12:03 ` David Miller
2007-10-18 12:28 ` Jens Axboe
2007-10-17 18:22 ` Linus Torvalds
2007-10-17 18:40 ` Jens Axboe
2007-10-17 17:11 ` Ingo Molnar
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=4717281B.6070301@garzik.org \
--to=jeff@garzik.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox