All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jens Axboe <axboe@suse.de>,
	James Bottomley <James.Bottomley@SteelEye.com>,
	Dave Miller <davem@redhat.com>,
	bzolnier@gmail.com, james.steward@dynamicratings.com,
	jgarzik@pobox.com, mattjreimer@gmail.com,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	rmk@arm.linux.org.uk, lkml <linux-kernel@vger.kernel.org>,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 3/5] libata: add cpu cache flushes after kmapping and modifying a page
Date: Sun, 4 Jun 2006 12:41:20 +0900	[thread overview]
Message-ID: <11493924801664-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <1149392479501-git-send-email-htejun@gmail.com>

Add calls to flush_kernel_dcache_page() after CPU has kmapped and
modified a page.  This fixes PIO cache coherency bugs on architectures
with aliased caches.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

 drivers/scsi/libata-core.c |    5 +++++
 drivers/scsi/libata-scsi.c |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

cc874e5080d87eff23a1576df11ddaaeae9575ec
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index b046ffa..47eb263 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -2821,6 +2821,7 @@ static void ata_sg_clean(struct ata_queu
 			struct scatterlist *psg = &qc->pad_sgent;
 			void *addr = kmap_atomic(psg->page, KM_IRQ0);
 			memcpy(addr + psg->offset, pad_buf, qc->pad_len);
+			flush_kernel_dcache_page(kmap_atomic_to_page(addr));
 			kunmap_atomic(addr, KM_IRQ0);
 		}
 	} else {
@@ -3451,6 +3452,8 @@ static void ata_pio_sector(struct ata_qu
 	do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
 	ata_data_xfer(ap, buf, ATA_SECT_SIZE, do_write);
 
+	if (!do_write)
+		flush_kernel_dcache_page(page);
 	kunmap(page);
 }
 
@@ -3533,6 +3536,8 @@ next_sg:
 	/* do the actual data transfer */
 	ata_data_xfer(ap, buf, count, do_write);
 
+	if (!do_write)
+		flush_kernel_dcache_page(page);
 	kunmap(page);
 
 	if (bytes)
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index a0289ec..b65d7f5 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1500,6 +1500,7 @@ static inline void ata_scsi_rbuf_put(str
 		struct scatterlist *sg;
 
 		sg = (struct scatterlist *) cmd->request_buffer;
+		flush_kernel_dcache_page(kmap_atomic_to_page(buf - sg->offset));
 		kunmap_atomic(buf - sg->offset, KM_USER0);
 	}
 }
-- 
1.3.2



WARNING: multiple messages have this Message-ID (diff)
From: Tejun Heo <htejun@gmail.com>
To: Jens Axboe <axboe@suse.de>,
	James Bottomley <James.Bottomley@SteelEye.com>,
	Dave Miller <davem@redhat.com>,
	bzolnier@gmail.com, james.steward@dynamicratings.com,
	jgarzik@pobox.com, mattjreimer@gmail.com,
	Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	rmk@arm.linux.org.uk, lkml <linux-kernel@vger.kernel.org>,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	htejun@gmail.com
Cc: Tejun Heo <htejun@gmail.com>
Subject: [PATCH 3/5] libata: add cpu cache flushes after kmapping and modifying a page
Date: Sun, 4 Jun 2006 12:41:20 +0900	[thread overview]
Message-ID: <11493924801664-git-send-email-htejun@gmail.com> (raw)
In-Reply-To: <1149392479501-git-send-email-htejun@gmail.com>

Add calls to flush_kernel_dcache_page() after CPU has kmapped and
modified a page.  This fixes PIO cache coherency bugs on architectures
with aliased caches.

Signed-off-by: Tejun Heo <htejun@gmail.com>

---

 drivers/scsi/libata-core.c |    5 +++++
 drivers/scsi/libata-scsi.c |    1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

cc874e5080d87eff23a1576df11ddaaeae9575ec
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index b046ffa..47eb263 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -2821,6 +2821,7 @@ static void ata_sg_clean(struct ata_queu
 			struct scatterlist *psg = &qc->pad_sgent;
 			void *addr = kmap_atomic(psg->page, KM_IRQ0);
 			memcpy(addr + psg->offset, pad_buf, qc->pad_len);
+			flush_kernel_dcache_page(kmap_atomic_to_page(addr));
 			kunmap_atomic(addr, KM_IRQ0);
 		}
 	} else {
@@ -3451,6 +3452,8 @@ static void ata_pio_sector(struct ata_qu
 	do_write = (qc->tf.flags & ATA_TFLAG_WRITE);
 	ata_data_xfer(ap, buf, ATA_SECT_SIZE, do_write);
 
+	if (!do_write)
+		flush_kernel_dcache_page(page);
 	kunmap(page);
 }
 
@@ -3533,6 +3536,8 @@ next_sg:
 	/* do the actual data transfer */
 	ata_data_xfer(ap, buf, count, do_write);
 
+	if (!do_write)
+		flush_kernel_dcache_page(page);
 	kunmap(page);
 
 	if (bytes)
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index a0289ec..b65d7f5 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -1500,6 +1500,7 @@ static inline void ata_scsi_rbuf_put(str
 		struct scatterlist *sg;
 
 		sg = (struct scatterlist *) cmd->request_buffer;
+		flush_kernel_dcache_page(kmap_atomic_to_page(buf - sg->offset));
 		kunmap_atomic(buf - sg->offset, KM_USER0);
 	}
 }
-- 
1.3.2



  parent reply	other threads:[~2006-06-04  3:41 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-04  3:41 [PATCHSET] block: fix PIO cache coherency bug, take 2 Tejun Heo
2006-06-04  3:41 ` [PATCH 1/5] arm: implement flush_kernel_dcache_page() Tejun Heo
2006-06-04  3:41   ` Tejun Heo
2006-06-04  3:49   ` [PATCH 1/5] (REPOST) " Tejun Heo
2006-06-04  6:45   ` [PATCH 1/5] " David Miller
2006-06-04  6:53     ` Tejun Heo
2006-06-04  7:04       ` David Miller
2006-06-04  3:41 ` Tejun Heo [this message]
2006-06-04  3:41   ` [PATCH 3/5] libata: add cpu cache flushes after kmapping and modifying a page Tejun Heo
2006-06-04  3:41 ` [PATCH 5/5] md: " Tejun Heo
2006-06-04  3:41   ` Tejun Heo
2006-06-04  3:41 ` [PATCH 4/5] SCSI: " Tejun Heo
2006-06-04  3:41   ` Tejun Heo
2006-06-04  8:20   ` Christoph Hellwig
2006-06-04  9:13     ` Tejun Heo
2006-06-04 20:24       ` Guennadi Liakhovetski
2006-06-04  3:41 ` [PATCH 2/5] ide: " Tejun Heo
2006-06-04  3:41   ` Tejun Heo
2006-06-04  8:17   ` Christoph Hellwig
2006-06-04  9:09     ` Tejun Heo
2006-06-04 20:44 ` [PATCHSET] block: fix PIO cache coherency bug, take 2 Russell King
2006-06-04 22:23   ` Russell King
2006-06-05 14:27     ` James Bottomley
2006-06-05 14:44       ` Russell King
2006-06-05 15:24         ` James Bottomley
2006-06-05 15:34           ` Russell King
2006-06-05 15:47             ` James Bottomley
2006-06-05 15:48               ` Russell King
2006-06-05 16:16                 ` James Bottomley
2006-06-05 16:37                   ` Russell King
2006-06-05 13:43   ` James Bottomley
2006-06-06 11:00     ` Miklos Szeredi

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=11493924801664-git-send-email-htejun@gmail.com \
    --to=htejun@gmail.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=axboe@suse.de \
    --cc=bzolnier@gmail.com \
    --cc=davem@redhat.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=james.steward@dynamicratings.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mattjreimer@gmail.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.