From: Borislav Petkov <petkovbb@googlemail.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
linux-kernel@vger.kernel.org
Subject: Re: linux-next-20090225: ide-cd triggers BUG at arch/x86/mm/ioremap.c:80!
Date: Tue, 3 Mar 2009 09:35:06 +0100 [thread overview]
Message-ID: <20090303083506.GA5172@liondog.tnic> (raw)
In-Reply-To: <200903021627.23585.bzolnier@gmail.com>
Hi,
> > @Bart: I'm open for suggestions wrt to a more elegant solution :).
>
> Seems like we should check for blk_fs_request(fs) || rq->data_len
> instead of unconditionally sg mapping all requests in ->do_request.
>
> [ Sigh, I thought it is harmless to always call sg_init_one()...
> probably because it was true back when I added this helper :) ]
how about something like that:
We map to sg once in ide_issue_pc since all drivers call into that.
We have to exclude ide_tape for now since it doesn't do that and uses
its own io buffers-method. Then, we do for both ide-cd and ide-floppy
blk_rq_bytes(rq) in ide_init_sg_cmd() after I've fixed the partial
completions issue later.
Lightly tested with ide-cd for now.
@Tetsuo: please do test, this should fix your OOPS.
Thanks.
--
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index ff6adea..3c7992a 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -625,7 +625,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)
ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
{
- struct ide_atapi_pc *pc;
+ struct ide_atapi_pc *uninitialized_var(pc);
ide_hwif_t *hwif = drive->hwif;
ide_expiry_t *expiry = NULL;
struct request *rq = hwif->rq;
@@ -642,6 +642,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
if (drive->dma)
drive->dma = !ide_dma_prepare(drive, cmd);
+
} else {
pc = drive->pc;
@@ -669,6 +670,17 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive, struct ide_cmd *cmd)
: WAIT_TAPE_CMD;
}
+ if (drive->media != ide_tape &&
+ !drive->dma && (blk_fs_request(rq) || rq->data_len)) {
+ ide_init_sg_cmd(cmd, blk_rq_bytes(rq));
+ ide_map_sg(drive, cmd);
+
+ if (drive->media == ide_floppy) {
+ pc->sg = hwif->sg_table;
+ pc->sg_cnt = cmd->sg_nents;
+ }
+ }
+
ide_init_packet_cmd(cmd, tf_flags, bcount, drive->dma);
(void)do_rw_taskfile(drive, cmd);
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 9e19aec..e7c278c 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -916,10 +916,6 @@ static ide_startstop_t ide_cd_do_request(ide_drive_t *drive, struct request *rq,
cmd.rq = rq;
- ide_init_sg_cmd(&cmd,
- blk_fs_request(rq) ? (rq->nr_sectors << 9) : rq->data_len);
- ide_map_sg(drive, &cmd);
-
return ide_issue_pc(drive, &cmd);
out_end:
nsectors = rq->hard_nr_sectors;
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index b7f0206..9a58db3 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -244,7 +244,6 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
struct request *rq, sector_t block)
{
struct ide_disk_obj *floppy = drive->driver_data;
- ide_hwif_t *hwif = drive->hwif;
struct ide_cmd cmd;
struct ide_atapi_pc *pc;
@@ -292,13 +291,6 @@ static ide_startstop_t ide_floppy_do_request(ide_drive_t *drive,
cmd.tf_flags |= IDE_TFLAG_WRITE;
cmd.rq = rq;
-
- ide_init_sg_cmd(&cmd, rq->nr_sectors << 9);
- ide_map_sg(drive, &cmd);
-
- pc->sg = hwif->sg_table;
- pc->sg_cnt = cmd.sg_nents;
-
pc->rq = rq;
return ide_floppy_issue_pc(drive, &cmd, pc);
next prev parent reply other threads:[~2009-03-03 8:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-26 2:29 Tetsuo Handa
2009-02-26 14:29 ` Bartlomiej Zolnierkiewicz
2009-02-26 15:51 ` Borislav Petkov
2009-03-02 2:15 ` Tetsuo Handa
2009-03-02 13:15 ` Borislav Petkov
2009-03-02 15:27 ` Bartlomiej Zolnierkiewicz
2009-03-03 8:35 ` Borislav Petkov [this message]
2009-03-04 3:33 ` Tetsuo Handa
2009-03-04 7:23 ` Borislav Petkov
2009-03-03 12:31 ` Tetsuo Handa
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=20090303083506.GA5172@liondog.tnic \
--to=petkovbb@googlemail.com \
--cc=bzolnier@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=petkovbb@gmail.com \
/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
all inboxes | Powered by JetHome®