Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1636062 > unrolled thread
| Started by | Tycho Andersen <tycho@docker.com> |
|---|---|
| First post | 2017-05-05 00:20 +0200 |
| Last post | 2017-05-05 18:20 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v2] ata-sff: always map page before data transfer Tycho Andersen <tycho@docker.com> - 2017-05-05 00:20 +0200
Re: [PATCH v2] ata-sff: always map page before data transfer Christoph Hellwig <hch@infradead.org> - 2017-05-05 08:40 +0200
Re: [PATCH v2] ata-sff: always map page before data transfer Tejun Heo <tj@kernel.org> - 2017-05-05 18:20 +0200
| From | Tycho Andersen <tycho@docker.com> |
|---|---|
| Date | 2017-05-05 00:20 +0200 |
| Subject | [PATCH v2] ata-sff: always map page before data transfer |
| Message-ID | <tDxgl-18B-3@gated-at.bofh.it> |
The XPFO [1] patchset may unmap pages from physmap if they happened to be
destined for userspace. If such a page is unmapped, it needs to be
remapped. Rather than test if a page is in the highmem/xpfo unmapped state,
Christoph suggested [2] that we simply always map the page.
v2: * drop comment about bounce buffer
* don't save IRQs before kmap/unmap
* formatting
Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Tycho Andersen <tycho@docker.com>
CC: Juerg Haefliger <juerg.haefliger@hpe.com>
CC: Tejun Heo <tj@kernel.org>
[1]: https://lkml.org/lkml/2016/11/4/245
[2]: https://lkml.org/lkml/2016/11/4/253
---
v1: https://lkml.org/lkml/2017/5/2/404
---
drivers/ata/libata-sff.c | 44 ++++++++------------------------------------
1 file changed, 8 insertions(+), 36 deletions(-)
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 2bd92dca3e62..01cf07c919bc 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -716,24 +716,10 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
- if (PageHighMem(page)) {
- unsigned long flags;
-
- /* FIXME: use a bounce buffer */
- local_irq_save(flags);
- buf = kmap_atomic(page);
-
- /* do the actual data transfer */
- ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size,
- do_write);
-
- kunmap_atomic(buf);
- local_irq_restore(flags);
- } else {
- buf = page_address(page);
- ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size,
- do_write);
- }
+ /* do the actual data transfer */
+ buf = kmap_atomic(page);
+ ap->ops->sff_data_xfer(qc, buf + offset, qc->sect_size, do_write);
+ kunmap_atomic(buf);
if (!do_write && !PageSlab(page))
flush_dcache_page(page);
@@ -861,24 +847,10 @@ static int __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)
DPRINTK("data %s\n", qc->tf.flags & ATA_TFLAG_WRITE ? "write" : "read");
- if (PageHighMem(page)) {
- unsigned long flags;
-
- /* FIXME: use bounce buffer */
- local_irq_save(flags);
- buf = kmap_atomic(page);
-
- /* do the actual data transfer */
- consumed = ap->ops->sff_data_xfer(qc, buf + offset,
- count, rw);
-
- kunmap_atomic(buf);
- local_irq_restore(flags);
- } else {
- buf = page_address(page);
- consumed = ap->ops->sff_data_xfer(qc, buf + offset,
- count, rw);
- }
+ /* do the actual data transfer */
+ buf = kmap_atomic(page);
+ consumed = ap->ops->sff_data_xfer(qc, buf + offset, count, rw);
+ kunmap_atomic(buf);
bytes -= min(bytes, consumed);
qc->curbytes += count;
--
2.11.0
[toc] | [next] | [standalone]
| From | Christoph Hellwig <hch@infradead.org> |
|---|---|
| Date | 2017-05-05 08:40 +0200 |
| Message-ID | <tDF4d-6re-11@gated-at.bofh.it> |
| In reply to | #1636062 |
Looks good, Reviewed-by: Christoph Hellwig <hch@lst.de>
[toc] | [prev] | [next] | [standalone]
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Date | 2017-05-05 18:20 +0200 |
| Message-ID | <tDO7w-437-11@gated-at.bofh.it> |
| In reply to | #1636062 |
On Thu, May 04, 2017 at 04:15:51PM -0600, Tycho Andersen wrote: > The XPFO [1] patchset may unmap pages from physmap if they happened to be > destined for userspace. If such a page is unmapped, it needs to be > remapped. Rather than test if a page is in the highmem/xpfo unmapped state, > Christoph suggested [2] that we simply always map the page. > > v2: * drop comment about bounce buffer > * don't save IRQs before kmap/unmap > * formatting > > Suggested-by: Christoph Hellwig <hch@infradead.org> > Signed-off-by: Tycho Andersen <tycho@docker.com> > CC: Juerg Haefliger <juerg.haefliger@hpe.com> > CC: Tejun Heo <tj@kernel.org> > > [1]: https://lkml.org/lkml/2016/11/4/245 > [2]: https://lkml.org/lkml/2016/11/4/253 Yeah, it's a nice cleanup. Applied to libata/for-4.13. Thanks. -- tejun
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web