Re: patch: highmem zero-bounce

Andrea Arcangeli (andrea@suse.de)
Fri, 6 Jul 2001 15:41:38 +0200


On Wed, Jun 27, 2001 at 07:12:29PM +0200, Jens Axboe wrote:
> Humm yes, I agree. I'll redo it tonight and send an updated
> incremental. Hopefully I'll be able to upload a new full version too.

I was going to integrate the avoid-bounce-buffer support but I don't
find anything recent except the bio patch for 2.5 that you uploaded
yesterday:

andrea@athlon:~/mirror/kernel.org/people/axboe > find -mtime -1
./v2.5
./v2.5/bio-14-pre4
andrea@athlon:~/mirror/kernel.org/people/axboe > find -mtime -25
./v2.5
./v2.5/bio-14-pre4
andrea@athlon:~/mirror/kernel.org/people/axboe >

The bio patch would better be 2.5 material, I'd prefer only skipping the
bounce between 1G to 4G in 2.4. Could you make a new patch with only the
bounce skip between 1G and 4G against pre3?

btw, the latest bio patch from yesterday is still broken with respect to
nested irqs:

+static inline void *kmap_atomic(struct page *page, enum km_type type)
+{
+ unsigned long flags;
+ void *vaddr;
+
+ __save_flags(flags);
+ __cli();
+ vaddr = __kmap_atomic(page, type);
+ __restore_flags(flags);
+
+ return vaddr;
+}
[..]
+static inline void kunmap_atomic(void *kvaddr, enum km_type type)
+{
+#if HIGHMEM_DEBUG
+ unsigned long flags;
+
+ __save_flags(flags);
+ __cli();
+ __kunmap_atomic(kvaddr, type);
+ __restore_flags(flags);
#endif
}
[..]
+#define bio_kmap_irq(bio) (kmap_atomic(bio_page((bio)), KM_BIO_IRQ) + bio_offset((bio)))
+#define bio_kunmap_irq(ptr) kunmap_atomic((void *) (((unsigned long) (ptr)) & PAGE_MASK), KM_BIO_IRQ)
[..]
+extern inline void *ide_map_buffer(struct request *rq)
+{
+ return bio_kmap_irq(rq->bio) + ide_rq_offset(rq);
+}
+
+extern inline void ide_unmap_buffer(char *buffer)
+{
+ bio_kunmap_irq(buffer);
+}
[..]
+ char *to = ide_map_buffer(rq);
+ idedisk_output_data (drive, to, SECTOR_WORDS);
+ ide_unmap_buffer(to);
[..]

the __cli() and __restore_flags() are not needed in kmap_atomic, and the
bio_kmap_irq is still broken, the suprious __restore_flags in
kmap_atomic is enabling irq again before you do the PIO, that will
corrupt the pte of the KM_BIO_IRQ if a nested irq runs under us.

In short you don't need to __save_flags(); __cli() for all the KM but
the BIO_IRQ one, and in the BIO_IRQ case you need to __restore_flags not
after setting the pagetable, but after also all the I/O is finished (so
in the kunmap, not in the kmap).

Andrea
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/